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}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
42ab4a6ecd
commit
1a5f87be2f
android_webview/expectations
chrome/android/expectations
monochrome_64_32_public_bundle.arm64.libs_and_assets.expectedtrichrome_library_32_64_apk.arm64.libs_and_assets.expectedtrichrome_library_32_apk.arm64.libs_and_assets.expected
gin
tools/v8_context_snapshot
@ -84,4 +84,3 @@ apk_path=assets/stored-locales/zh-CN.pak+com.android.webview+, compress=False, a
|
||||
apk_path=assets/stored-locales/zh-HK.pak+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/stored-locales/zh-TW.pak+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/stored-locales/zu.pak+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/v8_context_snapshot_32.bin+com.android.webview+, compress=False, alignment=4
|
||||
|
@ -170,7 +170,6 @@ apk_path=assets/stored-locales/zh-CN.pak, compress=False, alignment=4
|
||||
apk_path=assets/stored-locales/zh-HK.pak, compress=False, alignment=4
|
||||
apk_path=assets/stored-locales/zh-TW.pak, compress=False, alignment=4
|
||||
apk_path=assets/stored-locales/zu.pak, compress=False, alignment=4
|
||||
apk_path=assets/v8_context_snapshot_32.bin, compress=False, alignment=4
|
||||
apk_path=assets/v8_context_snapshot_64.bin, compress=False, alignment=4
|
||||
apk_path=assets/webapk8.dex, compress=True, alignment=0
|
||||
apk_path=assets/webapk_dex_version.txt, compress=True, alignment=0
|
||||
|
@ -3,4 +3,3 @@ apk_path=lib/armeabi-v7a/libcrashpad_handler_trampoline.so, compress=False, alig
|
||||
apk_path=lib/armeabi-v7a/libmonochrome.so, compress=False, alignment=4096
|
||||
apk_path=assets/icudtl.dat+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/snapshot_blob_32.bin+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/v8_context_snapshot_32.bin+com.android.webview+, compress=False, alignment=4
|
||||
|
@ -3,4 +3,3 @@ apk_path=lib/armeabi-v7a/libcrashpad_handler_trampoline.so, compress=False, alig
|
||||
apk_path=lib/armeabi-v7a/libmonochrome.so, compress=False, alignment=4096
|
||||
apk_path=assets/icudtl.dat+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/snapshot_blob_32.bin+com.android.webview+, compress=False, alignment=4
|
||||
apk_path=assets/v8_context_snapshot_32.bin+com.android.webview+, compress=False, alignment=4
|
||||
|
@ -164,13 +164,14 @@ if (is_android && enable_java_templates &&
|
||||
disable_compression = true
|
||||
sources = []
|
||||
deps = []
|
||||
if (use_v8_context_snapshot) {
|
||||
if (use_v8_context_snapshot_secondary_abi) {
|
||||
sources += [ "$root_out_dir/v8_context_snapshot_32.bin" ]
|
||||
deps += [
|
||||
"//tools/v8_context_snapshot($android_secondary_abi_toolchain)",
|
||||
]
|
||||
}
|
||||
if (!use_v8_context_snapshot || include_both_v8_snapshots) {
|
||||
if (!use_v8_context_snapshot_secondary_abi ||
|
||||
include_both_v8_snapshots_secondary_abi) {
|
||||
_secondary_abi_out_dir =
|
||||
get_label_info("//v8($android_secondary_abi_toolchain)",
|
||||
"root_out_dir")
|
||||
|
@ -13,46 +13,60 @@ 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" && v8_target_cpu == "arm64"
|
||||
# Whether to include both snapshots on arm32 when building fat binary.
|
||||
include_both_v8_snapshots_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 &&
|
||||
# Android may build for both 64 bit and 32bit. When this happens, the
|
||||
# v8_target_cpu will not equal the target_cpu (for example,
|
||||
# v8_target_cpu == "arm" but target_os == "arm64").
|
||||
(v8_target_cpu == target_cpu || target_os == "android") &&
|
||||
!(host_toolchain == default_toolchain && is_msan) &&
|
||||
!(is_win && host_os != "win") && !(is_mac && host_os != "mac"))
|
||||
|
||||
# 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"
|
||||
}
|
||||
# Android may build for both 64 bit and 32bit.
|
||||
if (v8_current_cpu != v8_target_cpu) {
|
||||
# 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 = include_both_v8_snapshots_secondary_abi
|
||||
} else {
|
||||
v8_context_snapshot_filename = "v8_context_snapshot.bin"
|
||||
include_both_v8_snapshots =
|
||||
is_official_build && target_os == "android" && target_cpu == "arm64"
|
||||
}
|
||||
|
||||
# Whether Android's secondary ABI should use the context snapshot.
|
||||
use_v8_context_snapshot_secondary_abi =
|
||||
include_both_v8_snapshots_secondary_abi
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
if (v8_current_cpu != v8_target_cpu) {
|
||||
# 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 = use_v8_context_snapshot_secondary_abi
|
||||
} else {
|
||||
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"))
|
||||
}
|
||||
}
|
||||
|
||||
# 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.
|
||||
|
Reference in New Issue
Block a user