v8/gni/v8.gni

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

231 lines
7.2 KiB
Plaintext
Raw Normal View History

# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/v8_target_cpu.gni")
import("split_static_library.gni")
declare_args() {
# Set flags for tracking code coverage. Uses gcov with gcc and sanitizer
# coverage with clang.
v8_code_coverage = false
# Includes files needed for correctness fuzzing.
v8_correctness_fuzzer = false
# Adds additional compile target for building multiple architectures at once.
v8_multi_arch_build = false
# Indicate if valgrind was fetched as a custom deps to make it available on
# swarming.
v8_has_valgrind = false
# Indicate if gcmole was fetched as a hook to make it available on swarming.
v8_gcmole = false
# Turns on compiler optimizations in V8 in Debug build.
v8_optimized_debug = true
# Support for backtrace_symbols on linux.
v8_enable_backtrace = ""
# Enables raw heap snapshots containing internals. Used for debugging memory
# on platform and embedder level.
v8_enable_raw_heap_snapshots = false
# Enable several snapshots side-by-side (e.g. default and for trusted code).
v8_use_multi_snapshots = false
# Use external files for startup data blobs:
# the JS builtins sources and the start snapshot.
v8_use_external_startup_data = ""
# Enable ECMAScript Internationalization API. Enabling this feature will
# add a dependency on the ICU library.
v8_enable_i18n_support = true
# Use static libraries instead of source_sets.
v8_static_library = false
# Enable monolithic static library for embedders.
v8_monolithic = false
# Expose symbols for dynamic linking.
v8_expose_symbols = false
[tracing] Add a way to test perfetto traces. Add a new abstract class TraceEventListener which is just an interface for consuming trace events. This separates the V8-specific stuff that an actual perfetto consumer needs to do e.g. handling the has_more flag and signalling back to the controller with a semaphore. This is a change from the previous plan of making the PerfettoConsumer class sub-classable to implement custom consumption of trace events. This will be difficult when the consumer is created outside of the PerfettoTracingController as we can't hook up the consumer_finished_semaphore_ that belongs to the controller. Now the PerfettoTracingController is responsible for the Consumer life- cycle and hides it entirely from callers. We add the AddTraceEventListener() method to allow callers to register a listener either for testing or a JSON listener for real tracing. This lets us write tests that can store all the trace events in memory without first converting them to JSON, letting us write test more easily. There's an example test add to test-tracing - more tests using this style will follow. Cq-Include-Trybots: luci.v8.try:v8_linux64_perfetto_dbg_ng Bug: v8:8339 Change-Id: I2d2b0f408b1c7bed954144163e1968f40d772c1b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1628789 Commit-Queue: Ulan Degenbaev <ulan@chromium.org> Auto-Submit: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#61854}
2019-05-27 12:46:35 +00:00
# Use Perfetto (https://perfetto.dev) as the default TracingController. Not
# currently implemented.
v8_use_perfetto = false
}
if (v8_use_external_startup_data == "") {
# If not specified as a gn arg, use external startup data by default if
Reland "Unconditionally enable snapshot builds and remove 'v8_use_snapshot'" This is a reland of 1c56974f2a7935986762473285369bb45be7917c This is a plain reland of the original CL. The original CL was speculatively reverted, but ended up not being the cause for bot failures. Original change's description: > Unconditionally enable snapshot builds and remove 'v8_use_snapshot' > > This CL removes 'v8_use_snapshot' and the usages of the implied > V8_USE_SNAPSHOT define. One test runner unittest was updated to use the > "asan" variant instead of the now obsolete "no_snap" variant. > > Related chromium CL: https://crrev.com/c/1796325. > > Bug: v8:8531 > Change-Id: I5da7c9f8e9110fe7bc0f4e4f821bcb7f7d98f927 > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1784282 > Commit-Queue: Simon Zünd <szuend@chromium.org> > Reviewed-by: Tamer Tas <tmrts@chromium.org> > Reviewed-by: Michael Achenbach <machenbach@chromium.org> > Reviewed-by: Nico Weber <thakis@chromium.org> > Reviewed-by: Jakob Gruber <jgruber@chromium.org> > Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> > Cr-Commit-Position: refs/heads/master@{#64290} TBR=thakis@chromium.org,machenbach@chromium.org,mstarzinger@chromium.org,jgruber@chromium.org,tmrts@chromium.org,szuend@chromium.org Bug: v8:8531 Change-Id: Id75a802279238138f7aefec62e0b6425a5acc08d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1864649 Reviewed-by: Simon Zünd <szuend@chromium.org> Reviewed-by: Tamer Tas <tmrts@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org> Cr-Commit-Position: refs/heads/master@{#64305}
2019-10-15 06:51:14 +00:00
# we're not on ios.
v8_use_external_startup_data = !is_ios
}
if (v8_use_multi_snapshots) {
# Silently disable multi snapshots if they're incompatible with the current
# build configuration. This allows us to set v8_use_multi_snapshots=true on
# all bots, and e.g. no-snapshot bots will automatically do the right thing.
v8_use_multi_snapshots =
v8_use_external_startup_data && !build_with_chromium
}
if (v8_enable_backtrace == "") {
v8_enable_backtrace = is_debug && !v8_optimized_debug
}
# Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute
# paths for all configs in templates as they are shared in different
# subdirectories.
v8_path_prefix = get_path_info("../", "abspath")
v8_inspector_js_protocol = v8_path_prefix + "/include/js_protocol.pdl"
###############################################################################
# Templates
#
# Common configs to remove or add in all v8 targets.
v8_remove_configs = []
v8_add_configs = [
v8_path_prefix + ":features",
v8_path_prefix + ":toolchain",
]
Revert "Reland^2 "[build] disable C++ optimization for mksnapshot code."" This reverts commit 6beea97e090423aec4f6e5eeb20d4ed84559a79b. Reason for revert: https://crbug.com/942497 Original change's description: > Reland^2 "[build] disable C++ optimization for mksnapshot code." > > This is a reland of a6b95a6acf23516d82fcfeba9e5d0e88dc64288a > > In addition to UBSan, also ASAN needs optimizations. > So this CL doesn't disable optimizations for all sanitizer builds. > > Original change's description: > > Reland "[build] disable C++ optimization for mksnapshot code." > > > > This is a reland of cee2f772c7e5c33967321b190cf568ff15497bc0 > > > > Original change's description: > > > [build] disable C++ optimization for mksnapshot code. > > > > > > By disabling C++ optimizations for code that's only run in mksnapshot, > > > that is, CSA and Torque-generated code, we can save compile time. > > > I observed up to 2x improvements of compile time for some files, > > > while the mksnapshot time did not increase significantly. > > > > > > Bug: v8:7629 > > > Change-Id: I96be2966611b2471b68023e0dd9e351d94f0013c > > > Reviewed-on: https://chromium-review.googlesource.com/c/1460941 > > > Reviewed-by: Yang Guo <yangguo@chromium.org> > > > Reviewed-by: Sigurd Schneider <sigurds@chromium.org> > > > Commit-Queue: Tobias Tebbi <tebbi@chromium.org> > > > Cr-Commit-Position: refs/heads/master@{#59585} > > > > Bug: v8:7629 > > Change-Id: I8330f93173ab3d7b400e15ea4935bbe8256b250f > > Reviewed-on: https://chromium-review.googlesource.com/c/1473292 > > Commit-Queue: Tobias Tebbi <tebbi@chromium.org> > > Commit-Queue: Sigurd Schneider <sigurds@chromium.org> > > Reviewed-by: Sigurd Schneider <sigurds@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#59606} > > Bug: v8:7629 > Change-Id: I42175c472d8e41345573df81645dfe3accc9d8c4 > Reviewed-on: https://chromium-review.googlesource.com/c/1475396 > Reviewed-by: Sigurd Schneider <sigurds@chromium.org> > Commit-Queue: Tobias Tebbi <tebbi@chromium.org> > Cr-Commit-Position: refs/heads/master@{#59632} TBR=yangguo@chromium.org,sigurds@chromium.org,tebbi@chromium.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: v8:7629 chromium:942497 Change-Id: Ie51d7b53440230b41fb763541908cb1162d8850d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1549158 Commit-Queue: Sigurd Schneider <sigurds@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Cr-Commit-Position: refs/heads/master@{#60577}
2019-04-02 14:35:58 +00:00
if (is_debug && !v8_optimized_debug) {
v8_remove_configs += [ "//build/config/compiler:default_optimization" ]
v8_add_configs += [ "//build/config/compiler:no_optimize" ]
} else {
v8_remove_configs += [ "//build/config/compiler:default_optimization" ]
# TODO(crbug.com/621335) Rework this so that we don't have the confusion
# between "optimize_speed" and "optimize_max".
if (((is_posix && !is_android) || is_fuchsia) && !using_sanitizer) {
v8_add_configs += [ "//build/config/compiler:optimize_speed" ]
} else {
v8_add_configs += [ "//build/config/compiler:optimize_max" ]
}
}
if (v8_code_coverage && !is_clang) {
v8_add_configs += [
v8_path_prefix + ":v8_gcov_coverage_cflags",
v8_path_prefix + ":v8_gcov_coverage_ldflags",
]
}
if ((is_posix || is_fuchsia) &&
(v8_enable_backtrace || v8_monolithic || v8_expose_symbols)) {
v8_remove_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
v8_add_configs += [ "//build/config/gcc:symbol_visibility_default" ]
}
# On MIPS gcc_target_rpath and ldso_path might be needed for all builds.
if (target_cpu == "mipsel" || target_cpu == "mips64el" ||
target_cpu == "mips" || target_cpu == "mips64") {
v8_add_configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
}
if (!build_with_chromium && is_clang) {
v8_remove_configs += [ "//build/config/clang:find_bad_constructs" ]
}
# All templates should be kept in sync.
template("v8_source_set") {
if (defined(invoker.split_count) && invoker.split_count > 1 &&
defined(v8_static_library) && v8_static_library && is_win) {
link_target_type = "split_static_library"
} else if (defined(v8_static_library) && v8_static_library) {
link_target_type = "static_library"
} else {
link_target_type = "source_set"
}
target(link_target_type, target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"remove_configs",
])
configs -= v8_remove_configs
configs += v8_add_configs
if (defined(invoker.remove_configs)) {
configs -= invoker.remove_configs
}
configs += invoker.configs
}
}
template("v8_header_set") {
source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs -= v8_remove_configs
configs += v8_add_configs
configs += invoker.configs
}
}
template("v8_executable") {
executable(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"remove_configs",
])
configs -= v8_remove_configs
configs += v8_add_configs
if (defined(invoker.remove_configs)) {
configs -= invoker.remove_configs
}
configs += invoker.configs
if (is_linux) {
# For enabling ASLR.
ldflags = [ "-pie" ]
}
if (defined(testonly) && testonly && v8_code_coverage) {
# Only add code coverage cflags for non-test files for performance
# reasons.
if (is_clang) {
configs -= [ "//build/config/sanitizers:default_sanitizer_flags" ]
configs +=
[ "//build/config/sanitizers:default_sanitizer_flags_but_coverage" ]
} else {
configs -= [ v8_path_prefix + ":v8_gcov_coverage_cflags" ]
}
}
deps += [ v8_path_prefix + ":v8_dump_build_config" ]
}
}
template("v8_component") {
component(target_name) {
forward_variables_from(invoker,
"*",
[
"configs",
"remove_configs",
])
configs -= v8_remove_configs
configs += v8_add_configs
if (defined(invoker.remove_configs)) {
configs -= invoker.remove_configs
}
configs += invoker.configs
}
}
template("v8_static_library") {
static_library(target_name) {
complete_static_lib = true
forward_variables_from(invoker, "*", [ "configs" ])
configs -= v8_remove_configs
configs -= [ "//build/config/compiler:thin_archive" ]
configs += v8_add_configs
configs += invoker.configs
}
}