update other build.gns

This commit is contained in:
Alexander Frick 2023-06-10 16:22:08 -05:00
parent ad0e14b4c2
commit cc65ae0445
11 changed files with 465 additions and 394 deletions

View file

@ -581,11 +581,6 @@ config("compiler") {
}
}
# Rust compiler setup (for either clang or rustc).
if (enable_rust) {
defines += [ "RUST_ENABLED" ]
}
# C11/C++11 compiler flags setup.
# ---------------------------
if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) ||
@ -714,14 +709,10 @@ config("compiler") {
# of "all" which means number of hardware threads) is faster.
ldflags += [ "-Wl,--thinlto-jobs=all" ]
if (is_apple) {
_object_path_suffix = ""
if (is_ios) {
_object_path_suffix = ",persist"
}
ldflags += [
"-Wl,-cache_path_lto," +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"-Wcrl,object_path_lto" + _object_path_suffix,
"-Wcrl,object_path_lto",
]
} else {
ldflags +=
@ -734,9 +725,8 @@ config("compiler") {
# ARM was originally set lower than x86 to keep the size
# bloat of ThinLTO to <10%, but that's potentially no longer true.
# FIXME(inglorion): maybe tune these?
if (target_cpu == "arm" || target_cpu == "arm64") {
import_instr_limit = 30
}
# TODO(b/271459198): Revert limit on amd64 to 30 when fixed.
import_instr_limit = 30
} else if (is_android) {
# TODO(crbug.com/1308318): Investigate if we can get the > 6% perf win
# of import_instr_limit 30 with a binary size hit smaller than ~2 MiB.
@ -899,9 +889,10 @@ config("compiler") {
# to compile dylibs on Android, such as for constructing unit test APKs.
"-Cdefault-linker-libraries",
# Turn warnings into the "deny" lint level, which produce compiler errors.
# The equivalent of -Werror for clang/gcc.
"-Dwarnings",
# Require `unsafe` blocks even in `unsafe` fns. This is intended to become
# an error by default eventually; see
# https://github.com/rust-lang/rust/issues/71668
"-Dunsafe_op_in_unsafe_fn",
# To make Rust .d files compatible with ninja
"-Zdep-info-omit-d-target",
@ -920,12 +911,8 @@ config("compiler") {
if (rust_abi_target != "") {
rustflags += [ "--target=$rust_abi_target" ]
}
if (!use_thin_lto || !use_chromium_rust_toolchain) {
# Don't include bitcode if it won't be used, or can't be used. When
# use_thin_lto is true, we will try to apply LTO to any objects that have
# the appropriate bitcode. But we have to use Chromium's toolchain in order
# to use LTO with rust code. Chromium's rustc will have an LLVM backend that
# matches the C++ clang compiler.
if (!use_thin_lto) {
# Don't include bitcode if it won't be used.
rustflags += [ "-Cembed-bitcode=no" ]
}
if (is_official_build) {
@ -1341,7 +1328,7 @@ config("compiler_codegen") {
configs += [ "//build/config/nacl:compiler_codegen" ]
}
if (current_cpu == "arm64" && !is_win) {
if (current_cpu == "arm64" && !is_win && is_clang) {
# Disable outlining everywhere on arm64 except Win. For more information see
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
# TODO(crbug.com/1411363): Enable this on Windows if possible.
@ -1770,6 +1757,15 @@ config("chromium_code") {
cflags += [ "-Wextra" ]
}
if (treat_warnings_as_errors) {
# Turn rustc warnings into the "deny" lint level, which produce compiler
# errors. The equivalent of -Werror for clang/gcc.
#
# Note we apply the actual lint flags in config("compiler"). All warnings
# are suppressed in third-party crates.
rustflags = [ "-Dwarnings" ]
}
# In Chromium code, we define __STDC_foo_MACROS in order to get the
# C99 macros on Mac and Linux.
defines = [
@ -1809,8 +1805,8 @@ config("chromium_code") {
]
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_libfuzzer) {
# use_fuzzing_engine_with_lpm: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_fuzzing_engine_with_lpm) {
cflags += [ "-Wunreachable-code-aggressive" ]
}
@ -2395,10 +2391,12 @@ if (is_clang && is_a_target_toolchain) {
if (is_android || is_castos) {
_clang_sample_profile = "//chrome/android/profiles/afdo.prof"
} else {
assert(chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm",
"Only atom, bigcore and arm are valid Chrome OS profiles.")
assert(
chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm" ||
chromeos_afdo_platform == "arm-exp",
"Only 'atom', 'bigcore', 'arm' and 'arm-exp' are valid ChromeOS profiles.")
_clang_sample_profile =
"//chromeos/profiles/${chromeos_afdo_platform}.afdo.prof"
}
@ -2752,9 +2750,12 @@ if (is_chromeos_ash && is_chromeos_device) {
if (is_android || (is_chromeos_ash && is_chromeos_device)) {
# Use orderfile for linking Chrome on Android and Chrome OS.
# This config enables using an orderfile for linking in LLD.
# TODO: Consider using call graph sort instead, at least on Android.
config("chrome_orderfile_config") {
if (chrome_orderfile_path != "" && !enable_call_graph_profile_sort) {
# Don't try to use an orderfile with call graph sorting, except on Android,
# where we care about memory used by code, so we still want to mandate
# ordering.
if (chrome_orderfile_path != "" &&
(is_android || !enable_call_graph_profile_sort)) {
assert(use_lld)
_rebased_orderfile = rebase_path(chrome_orderfile_path, root_build_dir)
ldflags = [

View file

@ -300,10 +300,7 @@ config("runtime_library") {
}
}
# Chromium supports running on Windows 7, but if these constants are set to
# Windows 7, then newer APIs aren't made available by the Windows SDK.
# So we set this to Windows 10 and then are careful to check at runtime
# to only call newer APIs when they're available.
# Chromium only supports Windowes 10+.
# Some third-party libraries assume that these defines set what version of
# Windows is available at runtime. Targets using these libraries need to
# manually override this config for their compiles.

View file

@ -581,11 +581,6 @@ config("compiler") {
}
}
# Rust compiler setup (for either clang or rustc).
if (enable_rust) {
defines += [ "RUST_ENABLED" ]
}
# C11/C++11 compiler flags setup.
# ---------------------------
if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) ||
@ -714,14 +709,10 @@ config("compiler") {
# of "all" which means number of hardware threads) is faster.
ldflags += [ "-Wl,--thinlto-jobs=all" ]
if (is_apple) {
_object_path_suffix = ""
if (is_ios) {
_object_path_suffix = ",persist"
}
ldflags += [
"-Wl,-cache_path_lto," +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"-Wcrl,object_path_lto" + _object_path_suffix,
"-Wcrl,object_path_lto",
]
} else {
ldflags +=
@ -734,9 +725,8 @@ config("compiler") {
# ARM was originally set lower than x86 to keep the size
# bloat of ThinLTO to <10%, but that's potentially no longer true.
# FIXME(inglorion): maybe tune these?
if (target_cpu == "arm" || target_cpu == "arm64") {
import_instr_limit = 30
}
# TODO(b/271459198): Revert limit on amd64 to 30 when fixed.
import_instr_limit = 30
} else if (is_android) {
# TODO(crbug.com/1308318): Investigate if we can get the > 6% perf win
# of import_instr_limit 30 with a binary size hit smaller than ~2 MiB.
@ -890,9 +880,10 @@ config("compiler") {
# to compile dylibs on Android, such as for constructing unit test APKs.
"-Cdefault-linker-libraries",
# Turn warnings into the "deny" lint level, which produce compiler errors.
# The equivalent of -Werror for clang/gcc.
"-Dwarnings",
# Require `unsafe` blocks even in `unsafe` fns. This is intended to become
# an error by default eventually; see
# https://github.com/rust-lang/rust/issues/71668
"-Dunsafe_op_in_unsafe_fn",
# To make Rust .d files compatible with ninja
"-Zdep-info-omit-d-target",
@ -911,12 +902,8 @@ config("compiler") {
if (rust_abi_target != "") {
rustflags += [ "--target=$rust_abi_target" ]
}
if (!use_thin_lto || !use_chromium_rust_toolchain) {
# Don't include bitcode if it won't be used, or can't be used. When
# use_thin_lto is true, we will try to apply LTO to any objects that have
# the appropriate bitcode. But we have to use Chromium's toolchain in order
# to use LTO with rust code. Chromium's rustc will have an LLVM backend that
# matches the C++ clang compiler.
if (!use_thin_lto) {
# Don't include bitcode if it won't be used.
rustflags += [ "-Cembed-bitcode=no" ]
}
if (is_official_build) {
@ -1314,7 +1301,7 @@ config("compiler_codegen") {
configs += [ "//build/config/nacl:compiler_codegen" ]
}
if (current_cpu == "arm64" && !is_win) {
if (current_cpu == "arm64" && !is_win && is_clang) {
# Disable outlining everywhere on arm64 except Win. For more information see
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
# TODO(crbug.com/1411363): Enable this on Windows if possible.
@ -1743,6 +1730,15 @@ config("chromium_code") {
cflags += [ "-Wextra" ]
}
if (treat_warnings_as_errors) {
# Turn rustc warnings into the "deny" lint level, which produce compiler
# errors. The equivalent of -Werror for clang/gcc.
#
# Note we apply the actual lint flags in config("compiler"). All warnings
# are suppressed in third-party crates.
rustflags = [ "-Dwarnings" ]
}
# In Chromium code, we define __STDC_foo_MACROS in order to get the
# C99 macros on Mac and Linux.
defines = [
@ -1782,8 +1778,8 @@ config("chromium_code") {
]
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_libfuzzer) {
# use_fuzzing_engine_with_lpm: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_fuzzing_engine_with_lpm) {
cflags += [ "-Wunreachable-code-aggressive" ]
}
@ -2333,10 +2329,12 @@ if (is_clang && is_a_target_toolchain) {
if (is_android || is_castos) {
_clang_sample_profile = "//chrome/android/profiles/afdo.prof"
} else {
assert(chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm",
"Only atom, bigcore and arm are valid Chrome OS profiles.")
assert(
chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm" ||
chromeos_afdo_platform == "arm-exp",
"Only 'atom', 'bigcore', 'arm' and 'arm-exp' are valid ChromeOS profiles.")
_clang_sample_profile =
"//chromeos/profiles/${chromeos_afdo_platform}.afdo.prof"
}
@ -2690,9 +2688,12 @@ if (is_chromeos_ash && is_chromeos_device) {
if (is_android || (is_chromeos_ash && is_chromeos_device)) {
# Use orderfile for linking Chrome on Android and Chrome OS.
# This config enables using an orderfile for linking in LLD.
# TODO: Consider using call graph sort instead, at least on Android.
config("chrome_orderfile_config") {
if (chrome_orderfile_path != "" && !enable_call_graph_profile_sort) {
# Don't try to use an orderfile with call graph sorting, except on Android,
# where we care about memory used by code, so we still want to mandate
# ordering.
if (chrome_orderfile_path != "" &&
(is_android || !enable_call_graph_profile_sort)) {
assert(use_lld)
_rebased_orderfile = rebase_path(chrome_orderfile_path, root_build_dir)
ldflags = [

View file

@ -581,11 +581,6 @@ config("compiler") {
}
}
# Rust compiler setup (for either clang or rustc).
if (enable_rust) {
defines += [ "RUST_ENABLED" ]
}
# C11/C++11 compiler flags setup.
# ---------------------------
if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) ||
@ -714,14 +709,10 @@ config("compiler") {
# of "all" which means number of hardware threads) is faster.
ldflags += [ "-Wl,--thinlto-jobs=all" ]
if (is_apple) {
_object_path_suffix = ""
if (is_ios) {
_object_path_suffix = ",persist"
}
ldflags += [
"-Wl,-cache_path_lto," +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"-Wcrl,object_path_lto" + _object_path_suffix,
"-Wcrl,object_path_lto",
]
} else {
ldflags +=
@ -734,9 +725,8 @@ config("compiler") {
# ARM was originally set lower than x86 to keep the size
# bloat of ThinLTO to <10%, but that's potentially no longer true.
# FIXME(inglorion): maybe tune these?
if (target_cpu == "arm" || target_cpu == "arm64") {
import_instr_limit = 30
}
# TODO(b/271459198): Revert limit on amd64 to 30 when fixed.
import_instr_limit = 30
} else if (is_android) {
# TODO(crbug.com/1308318): Investigate if we can get the > 6% perf win
# of import_instr_limit 30 with a binary size hit smaller than ~2 MiB.
@ -890,9 +880,10 @@ config("compiler") {
# to compile dylibs on Android, such as for constructing unit test APKs.
"-Cdefault-linker-libraries",
# Turn warnings into the "deny" lint level, which produce compiler errors.
# The equivalent of -Werror for clang/gcc.
"-Dwarnings",
# Require `unsafe` blocks even in `unsafe` fns. This is intended to become
# an error by default eventually; see
# https://github.com/rust-lang/rust/issues/71668
"-Dunsafe_op_in_unsafe_fn",
# To make Rust .d files compatible with ninja
"-Zdep-info-omit-d-target",
@ -911,12 +902,8 @@ config("compiler") {
if (rust_abi_target != "") {
rustflags += [ "--target=$rust_abi_target" ]
}
if (!use_thin_lto || !use_chromium_rust_toolchain) {
# Don't include bitcode if it won't be used, or can't be used. When
# use_thin_lto is true, we will try to apply LTO to any objects that have
# the appropriate bitcode. But we have to use Chromium's toolchain in order
# to use LTO with rust code. Chromium's rustc will have an LLVM backend that
# matches the C++ clang compiler.
if (!use_thin_lto) {
# Don't include bitcode if it won't be used.
rustflags += [ "-Cembed-bitcode=no" ]
}
if (is_official_build) {
@ -1333,7 +1320,7 @@ config("compiler_codegen") {
configs += [ "//build/config/nacl:compiler_codegen" ]
}
if (current_cpu == "arm64" && !is_win) {
if (current_cpu == "arm64" && !is_win && is_clang) {
# Disable outlining everywhere on arm64 except Win. For more information see
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
# TODO(crbug.com/1411363): Enable this on Windows if possible.
@ -1762,6 +1749,15 @@ config("chromium_code") {
cflags += [ "-Wextra" ]
}
if (treat_warnings_as_errors) {
# Turn rustc warnings into the "deny" lint level, which produce compiler
# errors. The equivalent of -Werror for clang/gcc.
#
# Note we apply the actual lint flags in config("compiler"). All warnings
# are suppressed in third-party crates.
rustflags = [ "-Dwarnings" ]
}
# In Chromium code, we define __STDC_foo_MACROS in order to get the
# C99 macros on Mac and Linux.
defines = [
@ -1801,8 +1797,8 @@ config("chromium_code") {
]
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_libfuzzer) {
# use_fuzzing_engine_with_lpm: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_fuzzing_engine_with_lpm) {
cflags += [ "-Wunreachable-code-aggressive" ]
}
@ -2065,7 +2061,6 @@ if (is_win) {
common_optimize_on_cflags += [
"-Xclang", "-freroll-loops",
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-adce-remove-loops",
@ -2073,28 +2068,23 @@ if (is_win) {
"-mllvm", "-enable-cse-in-legalizer",
"-mllvm", "-scalar-evolution-use-expensive-range-sharpening",
"-mllvm", "-loop-rotate-multi",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
"-mllvm", "-enable-interleaved-mem-accesses",
"-mllvm", "-enable-masked-interleaved-mem-accesses",
"-mllvm", "-enable-gvn-hoist",
"-mllvm", "-enable-dfa-jump-thread",
"/O2",
"/clang:-O3",
"/clang:-mavx",
"/clang:-maes",
"/clang:-mpclmul",
"/clang:-mavx",
"/clang:-mavx2",
"-Xclang", "-O3",
]
common_optimize_on_ldflags += [
"-mllvm:-extra-vectorizer-passes",
"-mllvm:-enable-cond-stores-vec",
"-mllvm:-slp-vectorize-hor-store",
"-mllvm:-adce-remove-loops",
@ -2102,17 +2092,14 @@ if (is_win) {
"-mllvm:-enable-cse-in-legalizer",
"-mllvm:-scalar-evolution-use-expensive-range-sharpening",
"-mllvm:-loop-rotate-multi",
"-mllvm:-enable-loopinterchange",
"-mllvm:-enable-loop-distribute",
"-mllvm:-enable-unroll-and-jam",
"-mllvm:-enable-loop-flatten",
"-mllvm:-interleave-small-loop-scalar-reduction",
"-mllvm:-unroll-runtime",
"-mllvm:-unroll-runtime-multi-exit",
"-mllvm:-aggressive-ext-opt",
"-mllvm:-enable-interleaved-mem-accesses",
"-mllvm:-enable-masked-interleaved-mem-accesses",
"-mllvm:-enable-gvn-hoist",
"-mllvm:-enable-dfa-jump-thread",
]
if (use_polly == true) {
@ -2142,7 +2129,6 @@ if (is_win) {
common_optimize_on_cflags += [
"-freroll-loops",
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-adce-remove-loops",
@ -2150,23 +2136,19 @@ if (is_win) {
"-mllvm", "-enable-cse-in-legalizer",
"-mllvm", "-scalar-evolution-use-expensive-range-sharpening",
"-mllvm", "-loop-rotate-multi",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
"-mllvm", "-enable-interleaved-mem-accesses",
"-mllvm", "-enable-masked-interleaved-mem-accesses",
"-mllvm", "-enable-gvn-hoist",
"-mllvm", "-enable-dfa-jump-thread",
"-O3",
]
common_optimize_on_ldflags += [
"-freroll-loops",
"-Wl,-mllvm,-extra-vectorizer-passes",
"-Wl,-mllvm,-enable-cond-stores-vec",
"-Wl,-mllvm,-slp-vectorize-hor-store",
"-Wl,-mllvm,-adce-remove-loops",
@ -2174,17 +2156,14 @@ if (is_win) {
"-Wl,-mllvm,-enable-cse-in-legalizer",
"-Wl,-mllvm,-scalar-evolution-use-expensive-range-sharpening",
"-Wl,-mllvm,-loop-rotate-multi",
"-Wl,-mllvm,-enable-loopinterchange",
"-Wl,-mllvm,-enable-loop-distribute",
"-Wl,-mllvm,-enable-unroll-and-jam",
"-Wl,-mllvm,-enable-loop-flatten",
"-Wl,-mllvm,-interleave-small-loop-scalar-reduction",
"-Wl,-mllvm,-unroll-runtime",
"-Wl,-mllvm,-unroll-runtime-multi-exit",
"-Wl,-mllvm,-aggressive-ext-opt",
"-Wl,-mllvm,-enable-interleaved-mem-accesses",
"-Wl,-mllvm,-enable-masked-interleaved-mem-accesses",
"-Wl,-mllvm,-enable-gvn-hoist",
"-Wl,-mllvm,-enable-dfa-jump-thread",
"-Wl,-O3",
]
@ -2472,10 +2451,12 @@ if (is_clang && is_a_target_toolchain) {
if (is_android || is_castos) {
_clang_sample_profile = "//chrome/android/profiles/afdo.prof"
} else {
assert(chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm",
"Only atom, bigcore and arm are valid Chrome OS profiles.")
assert(
chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm" ||
chromeos_afdo_platform == "arm-exp",
"Only 'atom', 'bigcore', 'arm' and 'arm-exp' are valid ChromeOS profiles.")
_clang_sample_profile =
"//chromeos/profiles/${chromeos_afdo_platform}.afdo.prof"
}
@ -2829,9 +2810,12 @@ if (is_chromeos_ash && is_chromeos_device) {
if (is_android || (is_chromeos_ash && is_chromeos_device)) {
# Use orderfile for linking Chrome on Android and Chrome OS.
# This config enables using an orderfile for linking in LLD.
# TODO: Consider using call graph sort instead, at least on Android.
config("chrome_orderfile_config") {
if (chrome_orderfile_path != "" && !enable_call_graph_profile_sort) {
# Don't try to use an orderfile with call graph sorting, except on Android,
# where we care about memory used by code, so we still want to mandate
# ordering.
if (chrome_orderfile_path != "" &&
(is_android || !enable_call_graph_profile_sort)) {
assert(use_lld)
_rebased_orderfile = rebase_path(chrome_orderfile_path, root_build_dir)
ldflags = [

View file

@ -307,10 +307,7 @@ config("runtime_library") {
}
}
# Chromium supports running on Windows 7, but if these constants are set to
# Windows 7, then newer APIs aren't made available by the Windows SDK.
# So we set this to Windows 10 and then are careful to check at runtime
# to only call newer APIs when they're available.
# Chromium only supports Windowes 10+.
# Some third-party libraries assume that these defines set what version of
# Windows is available at runtime. Targets using these libraries need to
# manually override this config for their compiles.

View file

@ -4,9 +4,11 @@
import("//build/config/android/config.gni")
import("//build/config/arm.gni")
import("//build/config/coverage/coverage.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/mips.gni")
import("//build/config/riscv.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build_overrides/build.gni")
@ -123,6 +125,10 @@ declare_args() {
# Use pre-generated static root pointer values from static-roots.h.
v8_enable_static_roots = ""
# Mode used by gen-static-roots.py to have a heap layout which is identical
# to when v8_enable_static_roots is enabled.
v8_enable_static_root_generation = false
# Enable code-generation-time checking of types in the CodeStubAssembler.
v8_enable_verify_csa = false
@ -271,6 +277,9 @@ declare_args() {
# Use switch-based dispatch if this is false
v8_enable_regexp_interpreter_threaded_dispatch = true
# Check mksnapshot determinism by running it multiple times.
v8_verify_deterministic_mksnapshot = false
# Enable additional targets necessary for verification of torque
# file generation
v8_verify_torque_generation_invariance = false
@ -375,6 +384,14 @@ declare_args() {
# Make ValueDeserializer crash if the data to deserialize is invalid.
v8_value_deserializer_hard_fail = false
# Enable jitless mode, including compile-time optimizations. Note that even
# when this is set to 'false', one can run V8 in jitless mode at runtime by
# passing the `--jitless` flag; but then you miss out on compile-time
# optimizations.
# iOS (non-simulator) does not have executable pages for 3rd party
# applications yet so disable jit.
v8_jitless = v8_enable_lite_mode || target_is_ios_device
}
# Derived defaults.
@ -465,31 +482,10 @@ if (v8_enable_maglev == "") {
assert(v8_enable_turbofan || !v8_enable_maglev,
"Maglev is not available when Turbofan is disabled.")
if (v8_builtins_profiling_log_file == "default") {
v8_builtins_profiling_log_file = ""
assert(!v8_jitless ||
(!v8_enable_maglev && !v8_enable_turbofan && !v8_enable_webassembly),
"Maglev, Turbofan and Wasm are not available in jitless mode")
# Don't use existing profile when
# * generating a new one (i.e. v8_enable_builtins_profiling),
# * is_debug or dcheck_always_on because they add more checks to the
# builtins control flow which we don't want to generate,
# * v8_enable_webassembly because it changes the set of opcodes which affects
# graphs hashes,
# * !is_clang because it might affect argument evaluation order, which
# makes node IDs not predictable for subgraphs like Op1(Op2(), Op3()) and
# as a result different graph hash.
if (!v8_enable_builtins_profiling && is_clang && !is_debug &&
!dcheck_always_on && v8_enable_webassembly) {
if ((v8_current_cpu == "x64" || v8_current_cpu == "arm64") &&
v8_enable_pointer_compression && v8_enable_external_code_space) {
# Note, currently x64 profile can be applied to arm64 but not the other
# way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/x64.profile"
} else if (v8_current_cpu == "x86" || v8_current_cpu == "arm") {
# Note, x86 profile can be applied to arm but not the other way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/x86.profile"
}
}
}
if (v8_enable_single_generation == "") {
v8_enable_single_generation = v8_disable_write_barriers
}
@ -565,6 +561,40 @@ assert(!v8_enable_static_roots ||
v8_enable_i18n_support),
"Trying to enable static roots in a configuration that is not supported")
assert(
!(v8_enable_static_roots && v8_enable_static_root_generation),
"Static root values must be generated in a build that does not rely on static roots itself")
if (v8_builtins_profiling_log_file == "default") {
v8_builtins_profiling_log_file = ""
# Don't use existing profile when
# * v8_enable_builtins_optimization is disabled,
# * generating a new one (i.e. v8_enable_builtins_profiling),
# * is_debug or dcheck_always_on because they add more checks to the
# builtins control flow which we don't want to generate,
# * !v8_enable_sandbox because it affects the way how external pointer values
# are accessed,
# * v8_enable_webassembly because it changes the set of opcodes which affects
# graphs hashes,
# * !is_clang because it might affect argument evaluation order, which
# makes node IDs not predictable for subgraphs like Op1(Op2(), Op3()) and
# as a result different graph hash.
if (v8_enable_builtins_optimization && !v8_enable_builtins_profiling &&
is_clang && !is_debug && !dcheck_always_on && v8_enable_webassembly) {
if ((v8_current_cpu == "x64" || v8_current_cpu == "arm64") &&
v8_enable_pointer_compression && v8_enable_external_code_space &&
v8_enable_sandbox) {
# Note, currently x64 profile can be applied to arm64 but not the other
# way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/profiles/x64.profile"
} else if (v8_current_cpu == "x86" || v8_current_cpu == "arm") {
# Note, x86 profile can be applied to arm but not the other way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/profiles/x86.profile"
}
}
}
if (v8_enable_webassembly && !target_is_simulator && v8_current_cpu == "x64") {
v8_enable_wasm_simd256_revec = true
}
@ -626,12 +656,6 @@ assert(!cppgc_enable_young_generation || cppgc_enable_caged_heap,
assert(!cppgc_enable_pointer_compression || cppgc_enable_caged_heap,
"Pointer compression in CppGC requires caged heap")
assert(
!v8_enable_conservative_stack_scanning ||
v8_enable_inner_pointer_resolution_osb ||
v8_enable_inner_pointer_resolution_mb,
"Conservative stack scanning requires inner pointer resolution (OSB or MB)")
if (v8_enable_single_generation == true) {
assert(
v8_enable_unconditional_write_barriers || v8_disable_write_barriers,
@ -995,12 +1019,6 @@ config("features") {
if (v8_enable_single_generation) {
defines += [ "V8_ENABLE_SINGLE_GENERATION" ]
}
if (v8_enable_inner_pointer_resolution_osb) {
defines += [ "V8_ENABLE_INNER_POINTER_RESOLUTION_OSB" ]
}
if (v8_enable_inner_pointer_resolution_mb) {
defines += [ "V8_ENABLE_INNER_POINTER_RESOLUTION_MB" ]
}
if (v8_disable_write_barriers) {
defines += [ "V8_DISABLE_WRITE_BARRIERS" ]
}
@ -1061,6 +1079,9 @@ config("features") {
if (v8_enable_turbofan) {
defines += [ "V8_ENABLE_TURBOFAN" ]
}
if (v8_jitless) {
defines += [ "V8_JITLESS" ]
}
if (v8_enable_swiss_name_dictionary) {
defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ]
}
@ -1106,6 +1127,9 @@ config("features") {
if (v8_enable_static_roots) {
defines += [ "V8_STATIC_ROOTS" ]
}
if (v8_enable_static_root_generation) {
defines += [ "V8_STATIC_ROOT_GENERATION" ]
}
if (v8_use_zlib) {
defines += [ "V8_USE_ZLIB" ]
}
@ -1252,8 +1276,9 @@ config("toolchain") {
if (!is_clang) {
cflags += [ "-ffp-contract=off" ]
}
if (target_is_simulator) {
if (riscv_use_rvv || target_is_simulator) {
defines += [ "CAN_USE_RVV_INSTRUCTIONS" ]
defines += [ "RVV_VLEN=${riscv_rvv_vlen}" ]
}
}
@ -1580,23 +1605,6 @@ config("always_turbofanimize") {
}
}
# Configs for code coverage with gcov. Separate configs for cflags and ldflags
# to selectively influde cflags in non-test targets only.
config("v8_gcov_coverage_cflags") {
cflags = [
"-fprofile-arcs",
"-ftest-coverage",
# We already block on gcc warnings on other bots. Let's not block here to
# always generate coverage reports.
"-Wno-error",
]
}
config("v8_gcov_coverage_ldflags") {
ldflags = [ "-fprofile-arcs" ]
}
###############################################################################
# Actions
#
@ -1630,12 +1638,8 @@ template("asm_to_inline_asm") {
if (v8_postmortem_support) {
action("postmortem-metadata") {
# Only targets in this file and the top-level visibility target can
# depend on this.
visibility = [
":*",
"//:gn_visibility",
]
# Only targets in this file can depend on this.
visibility = [ ":*" ]
script = "tools/gen-postmortem-metadata.py"
@ -1772,6 +1776,7 @@ torque_files = [
"src/builtins/internal-coverage.tq",
"src/builtins/internal.tq",
"src/builtins/iterator.tq",
"src/builtins/iterator-from.tq",
"src/builtins/iterator-helpers.tq",
"src/builtins/math.tq",
"src/builtins/number.tq",
@ -2069,7 +2074,7 @@ if (v8_verify_torque_generation_invariance) {
group("v8_maybe_icu") {
if (v8_enable_i18n_support) {
public_deps = [ "//third_party/icu" ]
public_deps = [ v8_icu_path ]
}
}
@ -2317,10 +2322,44 @@ if (emit_builtins_as_inline_asm) {
}
}
if (v8_verify_deterministic_mksnapshot) {
runs = [
"run_0",
"run_1",
"run_2",
"run_3",
"run_4",
"run_5",
"run_6",
]
foreach(i, runs) {
run_mksnapshot(i) {
args = []
embedded_variant = "Default"
}
}
action("verify_deterministic_mksnapshot") {
deps = []
foreach(i, runs) {
deps += [ ":run_mksnapshot_$i" ]
}
report_file = "$target_gen_dir/mksnapshot_comparison.txt"
script = "tools/snapshot/compare_mksnapshot_output.py"
args = [
rebase_path("$report_file", root_build_dir),
rebase_path("$target_gen_dir", root_build_dir),
rebase_path("$root_out_dir", root_build_dir),
"7", # Length of the 'runs' list.
]
outputs = [ report_file ]
}
}
action("v8_dump_build_config") {
script = "tools/testrunner/utils/dump_build_config.py"
outputs = [ "$root_out_dir/v8_build_config.json" ]
is_gcov_coverage = v8_code_coverage && !is_clang
is_DEBUG_defined = v8_enable_debugging_features || dcheck_always_on
is_full_debug = v8_enable_debugging_features && !v8_optimized_debug
args = [
@ -2331,11 +2370,11 @@ action("v8_dump_build_config") {
"is_asan=$is_asan",
"is_cfi=$is_cfi",
"is_clang=$is_clang",
"is_clang_coverage=$use_clang_coverage",
"is_component_build=$is_component_build",
"is_debug=$v8_enable_debugging_features",
"is_DEBUG_defined=$is_DEBUG_defined",
"is_full_debug=$is_full_debug",
"is_gcov_coverage=$is_gcov_coverage",
"is_msan=$is_msan",
"is_tsan=$is_tsan",
"is_ubsan_vptr=$is_ubsan_vptr",
@ -2371,6 +2410,7 @@ action("v8_dump_build_config") {
"v8_enable_verify_heap=$v8_enable_verify_heap",
"v8_enable_verify_predictable=$v8_enable_verify_predictable",
"v8_enable_webassembly=$v8_enable_webassembly",
"v8_jitless=$v8_jitless",
"v8_target_cpu=\"$v8_target_cpu\"",
]
@ -2387,7 +2427,10 @@ action("v8_dump_build_config") {
#
v8_source_set("v8_snapshot") {
visibility = [ ":*" ] # Targets in this file can depend on this.
# Let external targets depend on v8_snapshot.
if (v8_use_external_startup_data) {
visibility = [ ":*" ] # Targets in this file can depend on this.
}
deps = [
":v8_internal_headers",
@ -2421,9 +2464,6 @@ v8_source_set("v8_snapshot") {
sources += [ "src/snapshot/snapshot-external.cc" ]
} else {
# Also top-level visibility targets can depend on this.
visibility += [ "//:gn_visibility" ]
public_deps += [ ":v8_maybe_icu" ]
sources += [ "$target_gen_dir/snapshot.cc" ]
@ -2988,6 +3028,7 @@ v8_header_set("v8_internal_headers") {
"src/compiler/osr.h",
"src/compiler/per-isolate-compiler-cache.h",
"src/compiler/persistent-map.h",
"src/compiler/phase.h",
"src/compiler/pipeline-statistics.h",
"src/compiler/pipeline.h",
"src/compiler/processed-feedback.h",
@ -3005,11 +3046,16 @@ v8_header_set("v8_internal_headers") {
"src/compiler/simplified-operator.h",
"src/compiler/state-values-utils.h",
"src/compiler/store-store-elimination.h",
"src/compiler/string-builder-optimizer.h",
"src/compiler/turbofan.h",
"src/compiler/turboshaft/assembler.h",
"src/compiler/turboshaft/assert-types-reducer.h",
"src/compiler/turboshaft/branch-elimination-reducer.h",
"src/compiler/turboshaft/build-graph-phase.h",
"src/compiler/turboshaft/builtin-call-descriptors.h",
"src/compiler/turboshaft/dead-code-elimination-phase.h",
"src/compiler/turboshaft/dead-code-elimination-reducer.h",
"src/compiler/turboshaft/decompression-optimization-phase.h",
"src/compiler/turboshaft/decompression-optimization.h",
"src/compiler/turboshaft/define-assembler-macros.inc",
"src/compiler/turboshaft/deopt-data.h",
@ -3019,24 +3065,34 @@ v8_header_set("v8_internal_headers") {
"src/compiler/turboshaft/graph.h",
"src/compiler/turboshaft/index.h",
"src/compiler/turboshaft/late-escape-analysis-reducer.h",
"src/compiler/turboshaft/late-optimization-phase.h",
"src/compiler/turboshaft/layered-hash-map.h",
"src/compiler/turboshaft/machine-lowering-phase.h",
"src/compiler/turboshaft/machine-lowering-reducer.h",
"src/compiler/turboshaft/machine-optimization-reducer.h",
"src/compiler/turboshaft/memory-optimization.h",
"src/compiler/turboshaft/memory-optimization-reducer.h",
"src/compiler/turboshaft/operation-matching.h",
"src/compiler/turboshaft/operations.h",
"src/compiler/turboshaft/optimization-phase.h",
"src/compiler/turboshaft/optimize-phase.h",
"src/compiler/turboshaft/phase.h",
"src/compiler/turboshaft/recreate-schedule-phase.h",
"src/compiler/turboshaft/recreate-schedule.h",
"src/compiler/turboshaft/reducer-traits.h",
"src/compiler/turboshaft/representations.h",
"src/compiler/turboshaft/runtime-call-descriptors.h",
"src/compiler/turboshaft/select-lowering-reducer.h",
"src/compiler/turboshaft/sidetable.h",
"src/compiler/turboshaft/simplify-tf-loops.h",
"src/compiler/turboshaft/snapshot-table.h",
"src/compiler/turboshaft/tag-untag-lowering-phase.h",
"src/compiler/turboshaft/tag-untag-lowering-reducer.h",
"src/compiler/turboshaft/tracing.h",
"src/compiler/turboshaft/type-assertions-phase.h",
"src/compiler/turboshaft/type-inference-analysis.h",
"src/compiler/turboshaft/type-inference-reducer.h",
"src/compiler/turboshaft/type-parser.h",
"src/compiler/turboshaft/typed-optimizations-phase.h",
"src/compiler/turboshaft/typed-optimizations-reducer.h",
"src/compiler/turboshaft/typer.h",
"src/compiler/turboshaft/types.h",
@ -3216,8 +3272,10 @@ v8_header_set("v8_internal_headers") {
"src/heap/memory-measurement-inl.h",
"src/heap/memory-measurement.h",
"src/heap/memory-reducer.h",
"src/heap/minor-gc-job.h",
"src/heap/new-spaces-inl.h",
"src/heap/new-spaces.h",
"src/heap/object-lock.h",
"src/heap/object-stats.h",
"src/heap/objects-visiting-inl.h",
"src/heap/objects-visiting.h",
@ -3234,14 +3292,11 @@ v8_header_set("v8_internal_headers") {
"src/heap/remembered-set-inl.h",
"src/heap/remembered-set.h",
"src/heap/safepoint.h",
"src/heap/scavenge-job.h",
"src/heap/scavenger-inl.h",
"src/heap/scavenger.h",
"src/heap/slot-set.h",
"src/heap/spaces-inl.h",
"src/heap/spaces.h",
"src/heap/stress-marking-observer.h",
"src/heap/stress-scavenge-observer.h",
"src/heap/sweeper.h",
"src/heap/traced-handles-marking-visitor.h",
"src/heap/weak-object-worklists.h",
@ -3724,6 +3779,7 @@ v8_header_set("v8_internal_headers") {
"src/compiler/wasm-gc-lowering.h",
"src/compiler/wasm-gc-operator-reducer.h",
"src/compiler/wasm-graph-assembler.h",
"src/compiler/wasm-inlining-into-js.h",
"src/compiler/wasm-inlining.h",
"src/compiler/wasm-load-elimination.h",
"src/compiler/wasm-loop-peeling.h",
@ -3791,6 +3847,7 @@ v8_header_set("v8_internal_headers") {
"src/wasm/wasm-subtyping.h",
"src/wasm/wasm-tier.h",
"src/wasm/wasm-value.h",
"src/wasm/well-known-imports.h",
]
}
@ -3834,8 +3891,6 @@ v8_header_set("v8_internal_headers") {
"src/objects/js-segment-iterator.h",
"src/objects/js-segmenter-inl.h",
"src/objects/js-segmenter.h",
"src/objects/js-segments-inl.h",
"src/objects/js-segments.h",
]
}
@ -3847,13 +3902,6 @@ v8_header_set("v8_internal_headers") {
sources += [ "src/heap/conservative-stack-visitor.h" ]
}
if (v8_enable_inner_pointer_resolution_osb) {
sources += [
"src/heap/object-start-bitmap-inl.h",
"src/heap/object-start-bitmap.h",
]
}
if (v8_enable_wasm_gdb_remote_debugging) {
sources += [
"src/debug/wasm/gdb-server/gdb-remote-util.h",
@ -4084,12 +4132,10 @@ v8_header_set("v8_internal_headers") {
"src/baseline/riscv/baseline-assembler-riscv-inl.h",
"src/baseline/riscv/baseline-compiler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv.h",
"src/codegen/riscv/base-assembler-riscv.h",
"src/codegen/riscv/base-constants-riscv.h",
"src/codegen/riscv/base-riscv-i.h",
"src/codegen/riscv/base-riscv-i.h",
"src/codegen/riscv/constant-riscv-a.h",
"src/codegen/riscv/constant-riscv-c.h",
"src/codegen/riscv/constant-riscv-d.h",
@ -4102,7 +4148,7 @@ v8_header_set("v8_internal_headers") {
"src/codegen/riscv/extension-riscv-a.h",
"src/codegen/riscv/extension-riscv-c.h",
"src/codegen/riscv/extension-riscv-d.h",
"src/codegen/riscv/extension-riscv-d.h",
"src/codegen/riscv/extension-riscv-f.h",
"src/codegen/riscv/extension-riscv-inl.h",
"src/codegen/riscv/extension-riscv-m.h",
"src/codegen/riscv/extension-riscv-v.h",
@ -4123,8 +4169,8 @@ v8_header_set("v8_internal_headers") {
### gcmole(riscv32) ###
"src/baseline/riscv/baseline-assembler-riscv-inl.h",
"src/baseline/riscv/baseline-compiler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv.h",
"src/codegen/riscv/assembler-riscv32-inl.h",
"src/codegen/riscv/base-assembler-riscv.h",
"src/codegen/riscv/base-constants-riscv.h",
"src/codegen/riscv/base-riscv-i.h",
@ -4282,6 +4328,7 @@ v8_compiler_sources = [
"src/compiler/simplified-operator.cc",
"src/compiler/state-values-utils.cc",
"src/compiler/store-store-elimination.cc",
"src/compiler/string-builder-optimizer.cc",
"src/compiler/turbofan-enabled.cc",
"src/compiler/type-cache.cc",
"src/compiler/type-narrowing-reducer.cc",
@ -4387,6 +4434,7 @@ if (v8_enable_webassembly) {
"src/compiler/wasm-gc-lowering.cc",
"src/compiler/wasm-gc-operator-reducer.cc",
"src/compiler/wasm-graph-assembler.cc",
"src/compiler/wasm-inlining-into-js.cc",
"src/compiler/wasm-inlining.cc",
"src/compiler/wasm-load-elimination.cc",
"src/compiler/wasm-loop-peeling.cc",
@ -4471,18 +4519,29 @@ v8_source_set("v8_turboshaft") {
sources = [
"src/compiler/turboshaft/assembler.cc",
"src/compiler/turboshaft/build-graph-phase.cc",
"src/compiler/turboshaft/dead-code-elimination-phase.cc",
"src/compiler/turboshaft/decompression-optimization-phase.cc",
"src/compiler/turboshaft/decompression-optimization.cc",
"src/compiler/turboshaft/graph-builder.cc",
"src/compiler/turboshaft/graph-visualizer.cc",
"src/compiler/turboshaft/graph.cc",
"src/compiler/turboshaft/late-escape-analysis-reducer.cc",
"src/compiler/turboshaft/memory-optimization.cc",
"src/compiler/turboshaft/late-optimization-phase.cc",
"src/compiler/turboshaft/machine-lowering-phase.cc",
"src/compiler/turboshaft/memory-optimization-reducer.cc",
"src/compiler/turboshaft/operations.cc",
"src/compiler/turboshaft/optimization-phase.cc",
"src/compiler/turboshaft/optimize-phase.cc",
"src/compiler/turboshaft/phase.cc",
"src/compiler/turboshaft/recreate-schedule-phase.cc",
"src/compiler/turboshaft/recreate-schedule.cc",
"src/compiler/turboshaft/representations.cc",
"src/compiler/turboshaft/simplify-tf-loops.cc",
"src/compiler/turboshaft/tag-untag-lowering-phase.cc",
"src/compiler/turboshaft/type-assertions-phase.cc",
"src/compiler/turboshaft/type-parser.cc",
"src/compiler/turboshaft/typed-optimizations-phase.cc",
"src/compiler/turboshaft/typer.cc",
"src/compiler/turboshaft/types.cc",
"src/compiler/turboshaft/utils.cc",
@ -4732,6 +4791,7 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/memory-chunk.cc",
"src/heap/memory-measurement.cc",
"src/heap/memory-reducer.cc",
"src/heap/minor-gc-job.cc",
"src/heap/new-spaces.cc",
"src/heap/object-stats.cc",
"src/heap/objects-visiting.cc",
@ -4740,11 +4800,9 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/read-only-heap.cc",
"src/heap/read-only-spaces.cc",
"src/heap/safepoint.cc",
"src/heap/scavenge-job.cc",
"src/heap/scavenger.cc",
"src/heap/slot-set.cc",
"src/heap/spaces.cc",
"src/heap/stress-marking-observer.cc",
"src/heap/stress-scavenge-observer.cc",
"src/heap/sweeper.cc",
"src/heap/traced-handles-marking-visitor.cc",
@ -5075,6 +5133,7 @@ v8_source_set("v8_base_without_compiler") {
"src/wasm/wasm-result.cc",
"src/wasm/wasm-serialization.cc",
"src/wasm/wasm-subtyping.cc",
"src/wasm/well-known-imports.cc",
]
}
@ -5377,7 +5436,7 @@ v8_source_set("v8_base_without_compiler") {
deps += [ ":run_gen-regexp-special-case" ]
sources += [ "$target_gen_dir/src/regexp/special-case.cc" ]
if (is_win) {
deps += [ "//third_party/icu:icudata" ]
deps += [ "$v8_icu_path:icudata" ]
}
} else {
sources -= [
@ -5403,8 +5462,8 @@ v8_source_set("v8_base_without_compiler") {
if (v8_use_zlib) {
deps += [
"//third_party/zlib",
"//third_party/zlib/google:compression_utils_portable",
"$v8_zlib_path",
"$v8_zlib_path/google:compression_utils_portable",
]
}
@ -5468,7 +5527,6 @@ v8_source_set("torque_base") {
"src/torque/cfg.h",
"src/torque/class-debug-reader-generator.cc",
"src/torque/constants.h",
"src/torque/contextual.h",
"src/torque/cpp-builder.cc",
"src/torque/cpp-builder.h",
"src/torque/csa-generator.cc",
@ -5598,6 +5656,7 @@ v8_component("v8_libbase") {
"src/base/build_config.h",
"src/base/compiler-specific.h",
"src/base/container-utils.h",
"src/base/contextual.h",
"src/base/cpu.cc",
"src/base/cpu.h",
"src/base/debug/stack_trace.cc",
@ -5655,6 +5714,7 @@ v8_component("v8_libbase") {
"src/base/platform/memory.h",
"src/base/platform/mutex.cc",
"src/base/platform/mutex.h",
"src/base/platform/platform.cc",
"src/base/platform/platform.h",
"src/base/platform/semaphore.cc",
"src/base/platform/semaphore.h",
@ -5788,6 +5848,7 @@ v8_component("v8_libbase") {
sources += [
"src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-darwin.cc",
"src/base/platform/platform-ios.cc",
]
} else if (is_win) {
# TODO(infra): Add support for cygwin.
@ -6285,11 +6346,12 @@ if (v8_check_header_includes) {
#
if (v8_monolithic) {
# A component build is not monolithic.
assert(!is_component_build)
assert(!is_component_build,
"Set `is_component_build = false` for v8_monolithic.")
# Using external startup data would produce separate files.
assert(!v8_use_external_startup_data)
assert(!v8_use_external_startup_data,
"Set `v8_use_external_startup_data = false` for v8_monolithic.")
v8_static_library("v8_monolith") {
deps = [
":v8",
@ -6476,7 +6538,7 @@ if (v8_enable_i18n_support) {
":v8_libbase",
":v8_shared_internal_headers",
"//build/win:default_exe_manifest",
"//third_party/icu",
v8_icu_path,
]
configs = [ ":internal_config" ]

View file

@ -2062,7 +2062,6 @@ if (is_win) {
common_optimize_on_cflags += [
"-Xclang", "-freroll-loops",
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-adce-remove-loops",
@ -2070,25 +2069,23 @@ if (is_win) {
"-mllvm", "-enable-cse-in-legalizer",
"-mllvm", "-scalar-evolution-use-expensive-range-sharpening",
"-mllvm", "-loop-rotate-multi",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
"-mllvm", "-enable-interleaved-mem-accesses",
"-mllvm", "-enable-masked-interleaved-mem-accesses",
"-mllvm", "-enable-gvn-hoist",
"-mllvm", "-enable-dfa-jump-thread",
"/O2",
"/clang:-O3",
"/clang:-msse2",
"/clang:-mavx",
"/clang:-maes",
"/clang:-mpclmul",
"-Xclang", "-O3",
]
common_optimize_on_ldflags += [
"-mllvm:-extra-vectorizer-passes",
"-mllvm:-enable-cond-stores-vec",
"-mllvm:-slp-vectorize-hor-store",
"-mllvm:-adce-remove-loops",
@ -2096,17 +2093,14 @@ if (is_win) {
"-mllvm:-enable-cse-in-legalizer",
"-mllvm:-scalar-evolution-use-expensive-range-sharpening",
"-mllvm:-loop-rotate-multi",
"-mllvm:-enable-loopinterchange",
"-mllvm:-enable-loop-distribute",
"-mllvm:-enable-unroll-and-jam",
"-mllvm:-enable-loop-flatten",
"-mllvm:-interleave-small-loop-scalar-reduction",
"-mllvm:-unroll-runtime",
"-mllvm:-unroll-runtime-multi-exit",
"-mllvm:-aggressive-ext-opt",
"-mllvm:-enable-interleaved-mem-accesses",
"-mllvm:-enable-masked-interleaved-mem-accesses",
"-mllvm:-enable-gvn-hoist",
"-mllvm:-enable-dfa-jump-thread",
]
if (use_polly == true) {
@ -2136,7 +2130,6 @@ if (is_win) {
common_optimize_on_cflags += [
"-freroll-loops",
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-adce-remove-loops",
@ -2144,23 +2137,19 @@ if (is_win) {
"-mllvm", "-enable-cse-in-legalizer",
"-mllvm", "-scalar-evolution-use-expensive-range-sharpening",
"-mllvm", "-loop-rotate-multi",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
"-mllvm", "-enable-interleaved-mem-accesses",
"-mllvm", "-enable-masked-interleaved-mem-accesses",
"-mllvm", "-enable-gvn-hoist",
"-mllvm", "-enable-dfa-jump-thread",
"-O3",
]
common_optimize_on_ldflags += [
"-freroll-loops",
"-Wl,-mllvm,-extra-vectorizer-passes",
"-Wl,-mllvm,-enable-cond-stores-vec",
"-Wl,-mllvm,-slp-vectorize-hor-store",
"-Wl,-mllvm,-adce-remove-loops",
@ -2168,17 +2157,14 @@ if (is_win) {
"-Wl,-mllvm,-enable-cse-in-legalizer",
"-Wl,-mllvm,-scalar-evolution-use-expensive-range-sharpening",
"-Wl,-mllvm,-loop-rotate-multi",
"-Wl,-mllvm,-enable-loopinterchange",
"-Wl,-mllvm,-enable-loop-distribute",
"-Wl,-mllvm,-enable-unroll-and-jam",
"-Wl,-mllvm,-enable-loop-flatten",
"-Wl,-mllvm,-interleave-small-loop-scalar-reduction",
"-Wl,-mllvm,-unroll-runtime",
"-Wl,-mllvm,-unroll-runtime-multi-exit",
"-Wl,-mllvm,-aggressive-ext-opt",
"-Wl,-mllvm,-enable-interleaved-mem-accesses",
"-Wl,-mllvm,-enable-masked-interleaved-mem-accesses",
"-Wl,-mllvm,-enable-gvn-hoist",
"-Wl,-mllvm,-enable-dfa-jump-thread",
"-Wl,-O3",
]

View file

@ -296,10 +296,7 @@ config("runtime_library") {
}
}
# Chromium supports running on Windows 7, but if these constants are set to
# Windows 7, then newer APIs aren't made available by the Windows SDK.
# So we set this to Windows 10 and then are careful to check at runtime
# to only call newer APIs when they're available.
# Chromium only supports Windowes 10+.
# Some third-party libraries assume that these defines set what version of
# Windows is available at runtime. Targets using these libraries need to
# manually override this config for their compiles.

View file

@ -581,11 +581,6 @@ config("compiler") {
}
}
# Rust compiler setup (for either clang or rustc).
if (enable_rust) {
defines += [ "RUST_ENABLED" ]
}
# C11/C++11 compiler flags setup.
# ---------------------------
if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) ||
@ -714,14 +709,10 @@ config("compiler") {
# of "all" which means number of hardware threads) is faster.
ldflags += [ "-Wl,--thinlto-jobs=all" ]
if (is_apple) {
_object_path_suffix = ""
if (is_ios) {
_object_path_suffix = ",persist"
}
ldflags += [
"-Wl,-cache_path_lto," +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"-Wcrl,object_path_lto" + _object_path_suffix,
"-Wcrl,object_path_lto",
]
} else {
ldflags +=
@ -734,9 +725,8 @@ config("compiler") {
# ARM was originally set lower than x86 to keep the size
# bloat of ThinLTO to <10%, but that's potentially no longer true.
# FIXME(inglorion): maybe tune these?
if (target_cpu == "arm" || target_cpu == "arm64") {
import_instr_limit = 30
}
# TODO(b/271459198): Revert limit on amd64 to 30 when fixed.
import_instr_limit = 30
} else if (is_android) {
# TODO(crbug.com/1308318): Investigate if we can get the > 6% perf win
# of import_instr_limit 30 with a binary size hit smaller than ~2 MiB.
@ -890,9 +880,10 @@ config("compiler") {
# to compile dylibs on Android, such as for constructing unit test APKs.
"-Cdefault-linker-libraries",
# Turn warnings into the "deny" lint level, which produce compiler errors.
# The equivalent of -Werror for clang/gcc.
"-Dwarnings",
# Require `unsafe` blocks even in `unsafe` fns. This is intended to become
# an error by default eventually; see
# https://github.com/rust-lang/rust/issues/71668
"-Dunsafe_op_in_unsafe_fn",
# To make Rust .d files compatible with ninja
"-Zdep-info-omit-d-target",
@ -911,12 +902,8 @@ config("compiler") {
if (rust_abi_target != "") {
rustflags += [ "--target=$rust_abi_target" ]
}
if (!use_thin_lto || !use_chromium_rust_toolchain) {
# Don't include bitcode if it won't be used, or can't be used. When
# use_thin_lto is true, we will try to apply LTO to any objects that have
# the appropriate bitcode. But we have to use Chromium's toolchain in order
# to use LTO with rust code. Chromium's rustc will have an LLVM backend that
# matches the C++ clang compiler.
if (!use_thin_lto) {
# Don't include bitcode if it won't be used.
rustflags += [ "-Cembed-bitcode=no" ]
}
if (is_official_build) {
@ -1330,7 +1317,7 @@ config("compiler_codegen") {
configs += [ "//build/config/nacl:compiler_codegen" ]
}
if (current_cpu == "arm64" && !is_win) {
if (current_cpu == "arm64" && !is_win && is_clang) {
# Disable outlining everywhere on arm64 except Win. For more information see
# crbug.com/931297 for Android and crbug.com/1410297 for iOS.
# TODO(crbug.com/1411363): Enable this on Windows if possible.
@ -1759,6 +1746,15 @@ config("chromium_code") {
cflags += [ "-Wextra" ]
}
if (treat_warnings_as_errors) {
# Turn rustc warnings into the "deny" lint level, which produce compiler
# errors. The equivalent of -Werror for clang/gcc.
#
# Note we apply the actual lint flags in config("compiler"). All warnings
# are suppressed in third-party crates.
rustflags = [ "-Dwarnings" ]
}
# In Chromium code, we define __STDC_foo_MACROS in order to get the
# C99 macros on Mac and Linux.
defines = [
@ -1798,8 +1794,8 @@ config("chromium_code") {
]
# TODO(thakis): Enable this more often, https://crbug.com/346399
# use_libfuzzer: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_libfuzzer) {
# use_fuzzing_engine_with_lpm: https://crbug.com/1063180
if ((!is_nacl || is_nacl_saigo) && !use_fuzzing_engine_with_lpm) {
cflags += [ "-Wunreachable-code-aggressive" ]
}
@ -2062,7 +2058,6 @@ if (is_win) {
common_optimize_on_cflags += [
"-Xclang", "-freroll-loops",
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-adce-remove-loops",
@ -2070,25 +2065,23 @@ if (is_win) {
"-mllvm", "-enable-cse-in-legalizer",
"-mllvm", "-scalar-evolution-use-expensive-range-sharpening",
"-mllvm", "-loop-rotate-multi",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
"-mllvm", "-enable-interleaved-mem-accesses",
"-mllvm", "-enable-masked-interleaved-mem-accesses",
"-mllvm", "-enable-gvn-hoist",
"-mllvm", "-enable-dfa-jump-thread",
"/O2",
"/clang:-O3",
"/clang:-msse3",
"/clang:-mavx",
"/clang:-maes",
"/clang:-mpclmul",
"-Xclang", "-O3",
]
common_optimize_on_ldflags += [
"-mllvm:-extra-vectorizer-passes",
"-mllvm:-enable-cond-stores-vec",
"-mllvm:-slp-vectorize-hor-store",
"-mllvm:-adce-remove-loops",
@ -2096,17 +2089,14 @@ if (is_win) {
"-mllvm:-enable-cse-in-legalizer",
"-mllvm:-scalar-evolution-use-expensive-range-sharpening",
"-mllvm:-loop-rotate-multi",
"-mllvm:-enable-loopinterchange",
"-mllvm:-enable-loop-distribute",
"-mllvm:-enable-unroll-and-jam",
"-mllvm:-enable-loop-flatten",
"-mllvm:-interleave-small-loop-scalar-reduction",
"-mllvm:-unroll-runtime",
"-mllvm:-unroll-runtime-multi-exit",
"-mllvm:-aggressive-ext-opt",
"-mllvm:-enable-interleaved-mem-accesses",
"-mllvm:-enable-masked-interleaved-mem-accesses",
"-mllvm:-enable-gvn-hoist",
"-mllvm:-enable-dfa-jump-thread",
]
if (use_polly == true) {
@ -2136,7 +2126,6 @@ if (is_win) {
common_optimize_on_cflags += [
"-freroll-loops",
"-mllvm", "-extra-vectorizer-passes",
"-mllvm", "-enable-cond-stores-vec",
"-mllvm", "-slp-vectorize-hor-store",
"-mllvm", "-adce-remove-loops",
@ -2144,23 +2133,19 @@ if (is_win) {
"-mllvm", "-enable-cse-in-legalizer",
"-mllvm", "-scalar-evolution-use-expensive-range-sharpening",
"-mllvm", "-loop-rotate-multi",
"-mllvm", "-enable-loopinterchange",
"-mllvm", "-enable-loop-distribute",
"-mllvm", "-enable-unroll-and-jam",
"-mllvm", "-enable-loop-flatten",
"-mllvm", "-interleave-small-loop-scalar-reduction",
"-mllvm", "-unroll-runtime",
"-mllvm", "-unroll-runtime-multi-exit",
"-mllvm", "-aggressive-ext-opt",
"-mllvm", "-enable-interleaved-mem-accesses",
"-mllvm", "-enable-masked-interleaved-mem-accesses",
"-mllvm", "-enable-gvn-hoist",
"-mllvm", "-enable-dfa-jump-thread",
"-O3",
]
common_optimize_on_ldflags += [
"-freroll-loops",
"-Wl,-mllvm,-extra-vectorizer-passes",
"-Wl,-mllvm,-enable-cond-stores-vec",
"-Wl,-mllvm,-slp-vectorize-hor-store",
"-Wl,-mllvm,-adce-remove-loops",
@ -2168,17 +2153,14 @@ if (is_win) {
"-Wl,-mllvm,-enable-cse-in-legalizer",
"-Wl,-mllvm,-scalar-evolution-use-expensive-range-sharpening",
"-Wl,-mllvm,-loop-rotate-multi",
"-Wl,-mllvm,-enable-loopinterchange",
"-Wl,-mllvm,-enable-loop-distribute",
"-Wl,-mllvm,-enable-unroll-and-jam",
"-Wl,-mllvm,-enable-loop-flatten",
"-Wl,-mllvm,-interleave-small-loop-scalar-reduction",
"-Wl,-mllvm,-unroll-runtime",
"-Wl,-mllvm,-unroll-runtime-multi-exit",
"-Wl,-mllvm,-aggressive-ext-opt",
"-Wl,-mllvm,-enable-interleaved-mem-accesses",
"-Wl,-mllvm,-enable-masked-interleaved-mem-accesses",
"-Wl,-mllvm,-enable-gvn-hoist",
"-Wl,-mllvm,-enable-dfa-jump-thread",
"-Wl,-O3",
]
@ -2466,10 +2448,12 @@ if (is_clang && is_a_target_toolchain) {
if (is_android || is_castos) {
_clang_sample_profile = "//chrome/android/profiles/afdo.prof"
} else {
assert(chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm",
"Only atom, bigcore and arm are valid Chrome OS profiles.")
assert(
chromeos_afdo_platform == "atom" ||
chromeos_afdo_platform == "bigcore" ||
chromeos_afdo_platform == "arm" ||
chromeos_afdo_platform == "arm-exp",
"Only 'atom', 'bigcore', 'arm' and 'arm-exp' are valid ChromeOS profiles.")
_clang_sample_profile =
"//chromeos/profiles/${chromeos_afdo_platform}.afdo.prof"
}
@ -2823,9 +2807,12 @@ if (is_chromeos_ash && is_chromeos_device) {
if (is_android || (is_chromeos_ash && is_chromeos_device)) {
# Use orderfile for linking Chrome on Android and Chrome OS.
# This config enables using an orderfile for linking in LLD.
# TODO: Consider using call graph sort instead, at least on Android.
config("chrome_orderfile_config") {
if (chrome_orderfile_path != "" && !enable_call_graph_profile_sort) {
# Don't try to use an orderfile with call graph sorting, except on Android,
# where we care about memory used by code, so we still want to mandate
# ordering.
if (chrome_orderfile_path != "" &&
(is_android || !enable_call_graph_profile_sort)) {
assert(use_lld)
_rebased_orderfile = rebase_path(chrome_orderfile_path, root_build_dir)
ldflags = [

View file

@ -297,10 +297,7 @@ config("runtime_library") {
}
}
# Chromium supports running on Windows 7, but if these constants are set to
# Windows 7, then newer APIs aren't made available by the Windows SDK.
# So we set this to Windows 10 and then are careful to check at runtime
# to only call newer APIs when they're available.
# Chromium only supports Windowes 10+.
# Some third-party libraries assume that these defines set what version of
# Windows is available at runtime. Targets using these libraries need to
# manually override this config for their compiles.

View file

@ -4,9 +4,11 @@
import("//build/config/android/config.gni")
import("//build/config/arm.gni")
import("//build/config/coverage/coverage.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/host_byteorder.gni")
import("//build/config/mips.gni")
import("//build/config/riscv.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build_overrides/build.gni")
@ -123,6 +125,10 @@ declare_args() {
# Use pre-generated static root pointer values from static-roots.h.
v8_enable_static_roots = ""
# Mode used by gen-static-roots.py to have a heap layout which is identical
# to when v8_enable_static_roots is enabled.
v8_enable_static_root_generation = false
# Enable code-generation-time checking of types in the CodeStubAssembler.
v8_enable_verify_csa = false
@ -271,6 +277,9 @@ declare_args() {
# Use switch-based dispatch if this is false
v8_enable_regexp_interpreter_threaded_dispatch = true
# Check mksnapshot determinism by running it multiple times.
v8_verify_deterministic_mksnapshot = false
# Enable additional targets necessary for verification of torque
# file generation
v8_verify_torque_generation_invariance = false
@ -375,6 +384,14 @@ declare_args() {
# Make ValueDeserializer crash if the data to deserialize is invalid.
v8_value_deserializer_hard_fail = false
# Enable jitless mode, including compile-time optimizations. Note that even
# when this is set to 'false', one can run V8 in jitless mode at runtime by
# passing the `--jitless` flag; but then you miss out on compile-time
# optimizations.
# iOS (non-simulator) does not have executable pages for 3rd party
# applications yet so disable jit.
v8_jitless = v8_enable_lite_mode || target_is_ios_device
}
# Derived defaults.
@ -465,31 +482,10 @@ if (v8_enable_maglev == "") {
assert(v8_enable_turbofan || !v8_enable_maglev,
"Maglev is not available when Turbofan is disabled.")
if (v8_builtins_profiling_log_file == "default") {
v8_builtins_profiling_log_file = ""
assert(!v8_jitless ||
(!v8_enable_maglev && !v8_enable_turbofan && !v8_enable_webassembly),
"Maglev, Turbofan and Wasm are not available in jitless mode")
# Don't use existing profile when
# * generating a new one (i.e. v8_enable_builtins_profiling),
# * is_debug or dcheck_always_on because they add more checks to the
# builtins control flow which we don't want to generate,
# * v8_enable_webassembly because it changes the set of opcodes which affects
# graphs hashes,
# * !is_clang because it might affect argument evaluation order, which
# makes node IDs not predictable for subgraphs like Op1(Op2(), Op3()) and
# as a result different graph hash.
if (!v8_enable_builtins_profiling && is_clang && !is_debug &&
!dcheck_always_on && v8_enable_webassembly) {
if ((v8_current_cpu == "x64" || v8_current_cpu == "arm64") &&
v8_enable_pointer_compression && v8_enable_external_code_space) {
# Note, currently x64 profile can be applied to arm64 but not the other
# way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/x64.profile"
} else if (v8_current_cpu == "x86" || v8_current_cpu == "arm") {
# Note, x86 profile can be applied to arm but not the other way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/x86.profile"
}
}
}
if (v8_enable_single_generation == "") {
v8_enable_single_generation = v8_disable_write_barriers
}
@ -565,6 +561,40 @@ assert(!v8_enable_static_roots ||
v8_enable_i18n_support),
"Trying to enable static roots in a configuration that is not supported")
assert(
!(v8_enable_static_roots && v8_enable_static_root_generation),
"Static root values must be generated in a build that does not rely on static roots itself")
if (v8_builtins_profiling_log_file == "default") {
v8_builtins_profiling_log_file = ""
# Don't use existing profile when
# * v8_enable_builtins_optimization is disabled,
# * generating a new one (i.e. v8_enable_builtins_profiling),
# * is_debug or dcheck_always_on because they add more checks to the
# builtins control flow which we don't want to generate,
# * !v8_enable_sandbox because it affects the way how external pointer values
# are accessed,
# * v8_enable_webassembly because it changes the set of opcodes which affects
# graphs hashes,
# * !is_clang because it might affect argument evaluation order, which
# makes node IDs not predictable for subgraphs like Op1(Op2(), Op3()) and
# as a result different graph hash.
if (v8_enable_builtins_optimization && !v8_enable_builtins_profiling &&
is_clang && !is_debug && !dcheck_always_on && v8_enable_webassembly) {
if ((v8_current_cpu == "x64" || v8_current_cpu == "arm64") &&
v8_enable_pointer_compression && v8_enable_external_code_space &&
v8_enable_sandbox) {
# Note, currently x64 profile can be applied to arm64 but not the other
# way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/profiles/x64.profile"
} else if (v8_current_cpu == "x86" || v8_current_cpu == "arm") {
# Note, x86 profile can be applied to arm but not the other way round.
v8_builtins_profiling_log_file = "tools/builtins-pgo/profiles/x86.profile"
}
}
}
if (v8_enable_webassembly && !target_is_simulator && v8_current_cpu == "x64") {
v8_enable_wasm_simd256_revec = true
}
@ -626,12 +656,6 @@ assert(!cppgc_enable_young_generation || cppgc_enable_caged_heap,
assert(!cppgc_enable_pointer_compression || cppgc_enable_caged_heap,
"Pointer compression in CppGC requires caged heap")
assert(
!v8_enable_conservative_stack_scanning ||
v8_enable_inner_pointer_resolution_osb ||
v8_enable_inner_pointer_resolution_mb,
"Conservative stack scanning requires inner pointer resolution (OSB or MB)")
if (v8_enable_single_generation == true) {
assert(
v8_enable_unconditional_write_barriers || v8_disable_write_barriers,
@ -995,12 +1019,6 @@ config("features") {
if (v8_enable_single_generation) {
defines += [ "V8_ENABLE_SINGLE_GENERATION" ]
}
if (v8_enable_inner_pointer_resolution_osb) {
defines += [ "V8_ENABLE_INNER_POINTER_RESOLUTION_OSB" ]
}
if (v8_enable_inner_pointer_resolution_mb) {
defines += [ "V8_ENABLE_INNER_POINTER_RESOLUTION_MB" ]
}
if (v8_disable_write_barriers) {
defines += [ "V8_DISABLE_WRITE_BARRIERS" ]
}
@ -1061,6 +1079,9 @@ config("features") {
if (v8_enable_turbofan) {
defines += [ "V8_ENABLE_TURBOFAN" ]
}
if (v8_jitless) {
defines += [ "V8_JITLESS" ]
}
if (v8_enable_swiss_name_dictionary) {
defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ]
}
@ -1106,6 +1127,9 @@ config("features") {
if (v8_enable_static_roots) {
defines += [ "V8_STATIC_ROOTS" ]
}
if (v8_enable_static_root_generation) {
defines += [ "V8_STATIC_ROOT_GENERATION" ]
}
if (v8_use_zlib) {
defines += [ "V8_USE_ZLIB" ]
}
@ -1252,8 +1276,9 @@ config("toolchain") {
if (!is_clang) {
cflags += [ "-ffp-contract=off" ]
}
if (target_is_simulator) {
if (riscv_use_rvv || target_is_simulator) {
defines += [ "CAN_USE_RVV_INSTRUCTIONS" ]
defines += [ "RVV_VLEN=${riscv_rvv_vlen}" ]
}
}
@ -1580,23 +1605,6 @@ config("always_turbofanimize") {
}
}
# Configs for code coverage with gcov. Separate configs for cflags and ldflags
# to selectively influde cflags in non-test targets only.
config("v8_gcov_coverage_cflags") {
cflags = [
"-fprofile-arcs",
"-ftest-coverage",
# We already block on gcc warnings on other bots. Let's not block here to
# always generate coverage reports.
"-Wno-error",
]
}
config("v8_gcov_coverage_ldflags") {
ldflags = [ "-fprofile-arcs" ]
}
###############################################################################
# Actions
#
@ -1630,12 +1638,8 @@ template("asm_to_inline_asm") {
if (v8_postmortem_support) {
action("postmortem-metadata") {
# Only targets in this file and the top-level visibility target can
# depend on this.
visibility = [
":*",
"//:gn_visibility",
]
# Only targets in this file can depend on this.
visibility = [ ":*" ]
script = "tools/gen-postmortem-metadata.py"
@ -1772,6 +1776,7 @@ torque_files = [
"src/builtins/internal-coverage.tq",
"src/builtins/internal.tq",
"src/builtins/iterator.tq",
"src/builtins/iterator-from.tq",
"src/builtins/iterator-helpers.tq",
"src/builtins/math.tq",
"src/builtins/number.tq",
@ -2069,7 +2074,7 @@ if (v8_verify_torque_generation_invariance) {
group("v8_maybe_icu") {
if (v8_enable_i18n_support) {
public_deps = [ "//third_party/icu" ]
public_deps = [ v8_icu_path ]
}
}
@ -2317,10 +2322,44 @@ if (emit_builtins_as_inline_asm) {
}
}
if (v8_verify_deterministic_mksnapshot) {
runs = [
"run_0",
"run_1",
"run_2",
"run_3",
"run_4",
"run_5",
"run_6",
]
foreach(i, runs) {
run_mksnapshot(i) {
args = []
embedded_variant = "Default"
}
}
action("verify_deterministic_mksnapshot") {
deps = []
foreach(i, runs) {
deps += [ ":run_mksnapshot_$i" ]
}
report_file = "$target_gen_dir/mksnapshot_comparison.txt"
script = "tools/snapshot/compare_mksnapshot_output.py"
args = [
rebase_path("$report_file", root_build_dir),
rebase_path("$target_gen_dir", root_build_dir),
rebase_path("$root_out_dir", root_build_dir),
"7", # Length of the 'runs' list.
]
outputs = [ report_file ]
}
}
action("v8_dump_build_config") {
script = "tools/testrunner/utils/dump_build_config.py"
outputs = [ "$root_out_dir/v8_build_config.json" ]
is_gcov_coverage = v8_code_coverage && !is_clang
is_DEBUG_defined = v8_enable_debugging_features || dcheck_always_on
is_full_debug = v8_enable_debugging_features && !v8_optimized_debug
args = [
@ -2331,11 +2370,11 @@ action("v8_dump_build_config") {
"is_asan=$is_asan",
"is_cfi=$is_cfi",
"is_clang=$is_clang",
"is_clang_coverage=$use_clang_coverage",
"is_component_build=$is_component_build",
"is_debug=$v8_enable_debugging_features",
"is_DEBUG_defined=$is_DEBUG_defined",
"is_full_debug=$is_full_debug",
"is_gcov_coverage=$is_gcov_coverage",
"is_msan=$is_msan",
"is_tsan=$is_tsan",
"is_ubsan_vptr=$is_ubsan_vptr",
@ -2371,6 +2410,7 @@ action("v8_dump_build_config") {
"v8_enable_verify_heap=$v8_enable_verify_heap",
"v8_enable_verify_predictable=$v8_enable_verify_predictable",
"v8_enable_webassembly=$v8_enable_webassembly",
"v8_jitless=$v8_jitless",
"v8_target_cpu=\"$v8_target_cpu\"",
]
@ -2387,7 +2427,10 @@ action("v8_dump_build_config") {
#
v8_source_set("v8_snapshot") {
visibility = [ ":*" ] # Targets in this file can depend on this.
# Let external targets depend on v8_snapshot.
if (v8_use_external_startup_data) {
visibility = [ ":*" ] # Targets in this file can depend on this.
}
deps = [
":v8_internal_headers",
@ -2421,9 +2464,6 @@ v8_source_set("v8_snapshot") {
sources += [ "src/snapshot/snapshot-external.cc" ]
} else {
# Also top-level visibility targets can depend on this.
visibility += [ "//:gn_visibility" ]
public_deps += [ ":v8_maybe_icu" ]
sources += [ "$target_gen_dir/snapshot.cc" ]
@ -2988,6 +3028,7 @@ v8_header_set("v8_internal_headers") {
"src/compiler/osr.h",
"src/compiler/per-isolate-compiler-cache.h",
"src/compiler/persistent-map.h",
"src/compiler/phase.h",
"src/compiler/pipeline-statistics.h",
"src/compiler/pipeline.h",
"src/compiler/processed-feedback.h",
@ -3005,11 +3046,16 @@ v8_header_set("v8_internal_headers") {
"src/compiler/simplified-operator.h",
"src/compiler/state-values-utils.h",
"src/compiler/store-store-elimination.h",
"src/compiler/string-builder-optimizer.h",
"src/compiler/turbofan.h",
"src/compiler/turboshaft/assembler.h",
"src/compiler/turboshaft/assert-types-reducer.h",
"src/compiler/turboshaft/branch-elimination-reducer.h",
"src/compiler/turboshaft/build-graph-phase.h",
"src/compiler/turboshaft/builtin-call-descriptors.h",
"src/compiler/turboshaft/dead-code-elimination-phase.h",
"src/compiler/turboshaft/dead-code-elimination-reducer.h",
"src/compiler/turboshaft/decompression-optimization-phase.h",
"src/compiler/turboshaft/decompression-optimization.h",
"src/compiler/turboshaft/define-assembler-macros.inc",
"src/compiler/turboshaft/deopt-data.h",
@ -3019,24 +3065,34 @@ v8_header_set("v8_internal_headers") {
"src/compiler/turboshaft/graph.h",
"src/compiler/turboshaft/index.h",
"src/compiler/turboshaft/late-escape-analysis-reducer.h",
"src/compiler/turboshaft/late-optimization-phase.h",
"src/compiler/turboshaft/layered-hash-map.h",
"src/compiler/turboshaft/machine-lowering-phase.h",
"src/compiler/turboshaft/machine-lowering-reducer.h",
"src/compiler/turboshaft/machine-optimization-reducer.h",
"src/compiler/turboshaft/memory-optimization.h",
"src/compiler/turboshaft/memory-optimization-reducer.h",
"src/compiler/turboshaft/operation-matching.h",
"src/compiler/turboshaft/operations.h",
"src/compiler/turboshaft/optimization-phase.h",
"src/compiler/turboshaft/optimize-phase.h",
"src/compiler/turboshaft/phase.h",
"src/compiler/turboshaft/recreate-schedule-phase.h",
"src/compiler/turboshaft/recreate-schedule.h",
"src/compiler/turboshaft/reducer-traits.h",
"src/compiler/turboshaft/representations.h",
"src/compiler/turboshaft/runtime-call-descriptors.h",
"src/compiler/turboshaft/select-lowering-reducer.h",
"src/compiler/turboshaft/sidetable.h",
"src/compiler/turboshaft/simplify-tf-loops.h",
"src/compiler/turboshaft/snapshot-table.h",
"src/compiler/turboshaft/tag-untag-lowering-phase.h",
"src/compiler/turboshaft/tag-untag-lowering-reducer.h",
"src/compiler/turboshaft/tracing.h",
"src/compiler/turboshaft/type-assertions-phase.h",
"src/compiler/turboshaft/type-inference-analysis.h",
"src/compiler/turboshaft/type-inference-reducer.h",
"src/compiler/turboshaft/type-parser.h",
"src/compiler/turboshaft/typed-optimizations-phase.h",
"src/compiler/turboshaft/typed-optimizations-reducer.h",
"src/compiler/turboshaft/typer.h",
"src/compiler/turboshaft/types.h",
@ -3216,8 +3272,10 @@ v8_header_set("v8_internal_headers") {
"src/heap/memory-measurement-inl.h",
"src/heap/memory-measurement.h",
"src/heap/memory-reducer.h",
"src/heap/minor-gc-job.h",
"src/heap/new-spaces-inl.h",
"src/heap/new-spaces.h",
"src/heap/object-lock.h",
"src/heap/object-stats.h",
"src/heap/objects-visiting-inl.h",
"src/heap/objects-visiting.h",
@ -3234,14 +3292,11 @@ v8_header_set("v8_internal_headers") {
"src/heap/remembered-set-inl.h",
"src/heap/remembered-set.h",
"src/heap/safepoint.h",
"src/heap/scavenge-job.h",
"src/heap/scavenger-inl.h",
"src/heap/scavenger.h",
"src/heap/slot-set.h",
"src/heap/spaces-inl.h",
"src/heap/spaces.h",
"src/heap/stress-marking-observer.h",
"src/heap/stress-scavenge-observer.h",
"src/heap/sweeper.h",
"src/heap/traced-handles-marking-visitor.h",
"src/heap/weak-object-worklists.h",
@ -3724,6 +3779,7 @@ v8_header_set("v8_internal_headers") {
"src/compiler/wasm-gc-lowering.h",
"src/compiler/wasm-gc-operator-reducer.h",
"src/compiler/wasm-graph-assembler.h",
"src/compiler/wasm-inlining-into-js.h",
"src/compiler/wasm-inlining.h",
"src/compiler/wasm-load-elimination.h",
"src/compiler/wasm-loop-peeling.h",
@ -3791,6 +3847,7 @@ v8_header_set("v8_internal_headers") {
"src/wasm/wasm-subtyping.h",
"src/wasm/wasm-tier.h",
"src/wasm/wasm-value.h",
"src/wasm/well-known-imports.h",
]
}
@ -3834,8 +3891,6 @@ v8_header_set("v8_internal_headers") {
"src/objects/js-segment-iterator.h",
"src/objects/js-segmenter-inl.h",
"src/objects/js-segmenter.h",
"src/objects/js-segments-inl.h",
"src/objects/js-segments.h",
]
}
@ -3847,13 +3902,6 @@ v8_header_set("v8_internal_headers") {
sources += [ "src/heap/conservative-stack-visitor.h" ]
}
if (v8_enable_inner_pointer_resolution_osb) {
sources += [
"src/heap/object-start-bitmap-inl.h",
"src/heap/object-start-bitmap.h",
]
}
if (v8_enable_wasm_gdb_remote_debugging) {
sources += [
"src/debug/wasm/gdb-server/gdb-remote-util.h",
@ -4084,12 +4132,10 @@ v8_header_set("v8_internal_headers") {
"src/baseline/riscv/baseline-assembler-riscv-inl.h",
"src/baseline/riscv/baseline-compiler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv.h",
"src/codegen/riscv/base-assembler-riscv.h",
"src/codegen/riscv/base-constants-riscv.h",
"src/codegen/riscv/base-riscv-i.h",
"src/codegen/riscv/base-riscv-i.h",
"src/codegen/riscv/constant-riscv-a.h",
"src/codegen/riscv/constant-riscv-c.h",
"src/codegen/riscv/constant-riscv-d.h",
@ -4102,7 +4148,7 @@ v8_header_set("v8_internal_headers") {
"src/codegen/riscv/extension-riscv-a.h",
"src/codegen/riscv/extension-riscv-c.h",
"src/codegen/riscv/extension-riscv-d.h",
"src/codegen/riscv/extension-riscv-d.h",
"src/codegen/riscv/extension-riscv-f.h",
"src/codegen/riscv/extension-riscv-inl.h",
"src/codegen/riscv/extension-riscv-m.h",
"src/codegen/riscv/extension-riscv-v.h",
@ -4123,8 +4169,8 @@ v8_header_set("v8_internal_headers") {
### gcmole(riscv32) ###
"src/baseline/riscv/baseline-assembler-riscv-inl.h",
"src/baseline/riscv/baseline-compiler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv-inl.h",
"src/codegen/riscv/assembler-riscv.h",
"src/codegen/riscv/assembler-riscv32-inl.h",
"src/codegen/riscv/base-assembler-riscv.h",
"src/codegen/riscv/base-constants-riscv.h",
"src/codegen/riscv/base-riscv-i.h",
@ -4282,6 +4328,7 @@ v8_compiler_sources = [
"src/compiler/simplified-operator.cc",
"src/compiler/state-values-utils.cc",
"src/compiler/store-store-elimination.cc",
"src/compiler/string-builder-optimizer.cc",
"src/compiler/turbofan-enabled.cc",
"src/compiler/type-cache.cc",
"src/compiler/type-narrowing-reducer.cc",
@ -4387,6 +4434,7 @@ if (v8_enable_webassembly) {
"src/compiler/wasm-gc-lowering.cc",
"src/compiler/wasm-gc-operator-reducer.cc",
"src/compiler/wasm-graph-assembler.cc",
"src/compiler/wasm-inlining-into-js.cc",
"src/compiler/wasm-inlining.cc",
"src/compiler/wasm-load-elimination.cc",
"src/compiler/wasm-loop-peeling.cc",
@ -4471,18 +4519,29 @@ v8_source_set("v8_turboshaft") {
sources = [
"src/compiler/turboshaft/assembler.cc",
"src/compiler/turboshaft/build-graph-phase.cc",
"src/compiler/turboshaft/dead-code-elimination-phase.cc",
"src/compiler/turboshaft/decompression-optimization-phase.cc",
"src/compiler/turboshaft/decompression-optimization.cc",
"src/compiler/turboshaft/graph-builder.cc",
"src/compiler/turboshaft/graph-visualizer.cc",
"src/compiler/turboshaft/graph.cc",
"src/compiler/turboshaft/late-escape-analysis-reducer.cc",
"src/compiler/turboshaft/memory-optimization.cc",
"src/compiler/turboshaft/late-optimization-phase.cc",
"src/compiler/turboshaft/machine-lowering-phase.cc",
"src/compiler/turboshaft/memory-optimization-reducer.cc",
"src/compiler/turboshaft/operations.cc",
"src/compiler/turboshaft/optimization-phase.cc",
"src/compiler/turboshaft/optimize-phase.cc",
"src/compiler/turboshaft/phase.cc",
"src/compiler/turboshaft/recreate-schedule-phase.cc",
"src/compiler/turboshaft/recreate-schedule.cc",
"src/compiler/turboshaft/representations.cc",
"src/compiler/turboshaft/simplify-tf-loops.cc",
"src/compiler/turboshaft/tag-untag-lowering-phase.cc",
"src/compiler/turboshaft/type-assertions-phase.cc",
"src/compiler/turboshaft/type-parser.cc",
"src/compiler/turboshaft/typed-optimizations-phase.cc",
"src/compiler/turboshaft/typer.cc",
"src/compiler/turboshaft/types.cc",
"src/compiler/turboshaft/utils.cc",
@ -4732,6 +4791,7 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/memory-chunk.cc",
"src/heap/memory-measurement.cc",
"src/heap/memory-reducer.cc",
"src/heap/minor-gc-job.cc",
"src/heap/new-spaces.cc",
"src/heap/object-stats.cc",
"src/heap/objects-visiting.cc",
@ -4740,11 +4800,9 @@ v8_source_set("v8_base_without_compiler") {
"src/heap/read-only-heap.cc",
"src/heap/read-only-spaces.cc",
"src/heap/safepoint.cc",
"src/heap/scavenge-job.cc",
"src/heap/scavenger.cc",
"src/heap/slot-set.cc",
"src/heap/spaces.cc",
"src/heap/stress-marking-observer.cc",
"src/heap/stress-scavenge-observer.cc",
"src/heap/sweeper.cc",
"src/heap/traced-handles-marking-visitor.cc",
@ -5075,6 +5133,7 @@ v8_source_set("v8_base_without_compiler") {
"src/wasm/wasm-result.cc",
"src/wasm/wasm-serialization.cc",
"src/wasm/wasm-subtyping.cc",
"src/wasm/well-known-imports.cc",
]
}
@ -5377,7 +5436,7 @@ v8_source_set("v8_base_without_compiler") {
deps += [ ":run_gen-regexp-special-case" ]
sources += [ "$target_gen_dir/src/regexp/special-case.cc" ]
if (is_win) {
deps += [ "//third_party/icu:icudata" ]
deps += [ "$v8_icu_path:icudata" ]
}
} else {
sources -= [
@ -5403,8 +5462,8 @@ v8_source_set("v8_base_without_compiler") {
if (v8_use_zlib) {
deps += [
"//third_party/zlib",
"//third_party/zlib/google:compression_utils_portable",
"$v8_zlib_path",
"$v8_zlib_path/google:compression_utils_portable",
]
}
@ -5468,7 +5527,6 @@ v8_source_set("torque_base") {
"src/torque/cfg.h",
"src/torque/class-debug-reader-generator.cc",
"src/torque/constants.h",
"src/torque/contextual.h",
"src/torque/cpp-builder.cc",
"src/torque/cpp-builder.h",
"src/torque/csa-generator.cc",
@ -5598,6 +5656,7 @@ v8_component("v8_libbase") {
"src/base/build_config.h",
"src/base/compiler-specific.h",
"src/base/container-utils.h",
"src/base/contextual.h",
"src/base/cpu.cc",
"src/base/cpu.h",
"src/base/debug/stack_trace.cc",
@ -5655,6 +5714,7 @@ v8_component("v8_libbase") {
"src/base/platform/memory.h",
"src/base/platform/mutex.cc",
"src/base/platform/mutex.h",
"src/base/platform/platform.cc",
"src/base/platform/platform.h",
"src/base/platform/semaphore.cc",
"src/base/platform/semaphore.h",
@ -5788,6 +5848,7 @@ v8_component("v8_libbase") {
sources += [
"src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-darwin.cc",
"src/base/platform/platform-ios.cc",
]
} else if (is_win) {
# TODO(infra): Add support for cygwin.
@ -6285,11 +6346,12 @@ if (v8_check_header_includes) {
#
if (v8_monolithic) {
# A component build is not monolithic.
assert(!is_component_build)
assert(!is_component_build,
"Set `is_component_build = false` for v8_monolithic.")
# Using external startup data would produce separate files.
assert(!v8_use_external_startup_data)
assert(!v8_use_external_startup_data,
"Set `v8_use_external_startup_data = false` for v8_monolithic.")
v8_static_library("v8_monolith") {
deps = [
":v8",
@ -6476,7 +6538,7 @@ if (v8_enable_i18n_support) {
":v8_libbase",
":v8_shared_internal_headers",
"//build/win:default_exe_manifest",
"//third_party/icu",
v8_icu_path,
]
configs = [ ":internal_config" ]