0
Files
src/tools/v8_context_snapshot/v8_context_snapshot.gni
Andrew Grieve a5a4a7f84c Reland "Stop shipping v8 context snapshot for arm32"
This reverts commit 75499f2d67.

Reason for reland: added a target_os=="android" check

Original change's description:
> Revert "Stop shipping v8 context snapshot for arm32"
>
> This reverts commit 1a5f87be2f.
>
> Reason for revert: Might have changed use_v8_context_snapshot for
> non-android platforms. Will fix & re-land.
>
> Original change's description:
> > Stop shipping v8 context snapshot for arm32
> >
> > This introduces separate GN variables that are specific to the
> > secondary ABI so that the value of them can be known both to the
> > primary ABI (which needs to know whether or not to include them as
> > assets), as well as the secondary ABI (which needs to know the value
> > to pass to native code).
> >
> > They are:
> > * use_v8_context_snapshot_secondary_abi
> > * include_both_v8_snapshots_secondary_abi
> >
> > Which are compliments of:
> > * use_v8_context_snapshot
> > * include_both_v8_snapshots
> >
> > This also makes v8_context_snapshot_filename a regular variable
> > rather than a GN args, since it seems unlikely that it is useful to
> > allow configuring this via GN args.
> >
> > Bug: 377850453, 40539769
> > Change-Id: I882cb3d7540ea497ea3494a10f378a54d47724d6
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6011925
> > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> > Commit-Queue: Andrew Grieve <agrieve@chromium.org>
> > Reviewed-by: Kentaro Hara <haraken@chromium.org>
> > Cr-Commit-Position: refs/heads/main@{#1382620}
>
> Bug: 377850453, 40539769
> Change-Id: I794a74441450da4e0cd5bd8ce9f71caee8edef0a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6022056
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Owners-Override: Andrew Grieve <agrieve@chromium.org>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Auto-Submit: Andrew Grieve <agrieve@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1382764}

Bug: 377850453, 40539769
Change-Id: Ifc4fbd703abe7c9c51d801099e8c4e81be5e226e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6022321
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1382822}
2024-11-14 06:23:01 +00:00

74 lines
3.0 KiB
Plaintext

# Copyright 2017 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Targets in ths file are to take a V8 context snapshot on build time.
# Created V8 context snapshot is used in
# third_party/blink/renderer/bindings/core/v8/v8_context_snapshot.{cc|h}.
# to speedup creating a V8 context and setting up around it.
import("//build/config/cast.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/v8_target_cpu.gni")
import("//v8/gni/v8.gni")
declare_args() {
# If set, both snapshots are included. At this time, this only applicable to
# android. In other words, it will not work correctly on other platforms.
# Building the context snapshots on android requires building blink multiple
# times. To avoid impacting developer productivity the context snapshot is
# only built for official builds.
include_both_v8_snapshots =
is_official_build && target_os == "android" && target_cpu == "arm64"
if (target_os == "android") {
# Whether to include both snapshots on arm32 when building fat binary.
include_both_v8_snapshots_android_secondary_abi = false
# Whether Android's secondary ABI should use the context snapshot.
use_v8_context_snapshot_android_secondary_abi = false
}
}
declare_args() {
# TODO(crbug.com/40539769): Enable the feature on more environments.
# Disable in mac and win cross builds since building Blink twice is slow.
use_v8_context_snapshot =
include_both_v8_snapshots ||
(!is_chromeos && !is_android && !is_castos && !is_fuchsia &&
!(host_toolchain == default_toolchain && is_msan) &&
!(is_win && host_os != "win") && !(is_mac && host_os != "mac"))
}
# Apply the secondary abi overrides. Must occur outside of declare_args in
# order to take effect when include_both_v8_snapshots / use_v8_context_snapshot
# are set via args.gn.
if (target_os == "android" && v8_current_cpu != v8_target_cpu) {
include_both_v8_snapshots = include_both_v8_snapshots_android_secondary_abi
use_v8_context_snapshot = use_v8_context_snapshot_android_secondary_abi
}
# We use a different filename for arm64 macOS builds so that the arm64 and
# x64 snapshots can live side-by-side in a universal macOS app.
if (is_mac) {
if (v8_target_cpu == "x64") {
v8_context_snapshot_filename = "v8_context_snapshot.x86_64.bin"
} else if (v8_target_cpu == "arm64") {
v8_context_snapshot_filename = "v8_context_snapshot.arm64.bin"
}
} else if (target_os == "android") {
if (v8_current_cpu == "arm" || v8_current_cpu == "x86" ||
v8_current_cpu == "mipsel") {
v8_context_snapshot_filename = "v8_context_snapshot_32.bin"
} else {
v8_context_snapshot_filename = "v8_context_snapshot_64.bin"
}
} else {
v8_context_snapshot_filename = "v8_context_snapshot.bin"
}
# We cannot use V8 context snapshot, if V8 doesn't use snapshot files.
if (use_v8_context_snapshot && !v8_use_external_startup_data) {
use_v8_context_snapshot = false
}