Revert "Reland^2 "[build] disable C++ optimization for mksnapshot code.""

This reverts commit 6beea97e09.

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 a6b95a6acf
>
> 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 cee2f772c7
> >
> > 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}
This commit is contained in:
Tobias Tebbi 2019-04-02 14:35:58 +00:00 committed by Commit Bot
parent 4430613313
commit 5f58a82bcf
2 changed files with 23 additions and 39 deletions

View File

@ -701,32 +701,6 @@ config("toolchain") {
}
}
config("default_optimization") {
if (is_debug && !v8_optimized_debug) {
configs = [ "//build/config/compiler:no_optimize" ]
} else {
# 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) {
configs = [ "//build/config/compiler:optimize_speed" ]
} else {
configs = [ "//build/config/compiler:optimize_max" ]
}
}
}
# For code that is only run a few times during the build, C++ optimizations
# are a waste of time.
config("unoptimized_initializer") {
configs = [ ":internal_config" ]
if (using_sanitizer) {
# Some sanitizers rely on optimizations.
configs += [ ":default_optimization" ]
} else {
configs += [ "//build/config/compiler:no_optimize" ]
}
}
# 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") {
@ -1083,8 +1057,7 @@ v8_source_set("torque_generated_initializers") {
]
}
remove_configs = [ v8_path_prefix + ":default_optimization" ]
configs = [ ":unoptimized_initializer" ]
configs = [ ":internal_config" ]
}
action("generate_bytecode_builtins_list") {
@ -1569,8 +1542,7 @@ v8_source_set("v8_initializers") {
sources -= [ "src/builtins/builtins-intl-gen.cc" ]
}
remove_configs = [ v8_path_prefix + ":default_optimization" ]
configs = [ ":unoptimized_initializer" ]
configs = [ ":internal_config" ]
}
v8_source_set("v8_init") {

View File

@ -101,8 +101,20 @@ v8_add_configs = [
v8_path_prefix + ":toolchain",
]
v8_remove_configs += [ "//build/config/compiler:default_optimization" ]
v8_add_configs += [ v8_path_prefix + ":default_optimization" ]
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 += [
@ -144,21 +156,21 @@ template("v8_source_set") {
"configs",
"remove_configs",
])
configs -= v8_remove_configs
configs += v8_add_configs
if (defined(invoker.remove_configs)) {
configs -= invoker.remove_configs
}
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
}
}
template("v8_header_set") {
jumbo_source_set(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
configs += invoker.configs
}
}
@ -170,12 +182,12 @@ template("v8_executable") {
"configs",
"remove_configs",
])
configs -= v8_remove_configs
configs += v8_add_configs
if (defined(invoker.remove_configs)) {
configs -= invoker.remove_configs
}
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
if (is_linux) {
# For enabling ASLR.
ldflags = [ "-pie" ]
@ -198,9 +210,9 @@ template("v8_executable") {
template("v8_component") {
component(target_name) {
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= v8_remove_configs
configs += v8_add_configs
configs += invoker.configs
}
}
@ -208,9 +220,9 @@ template("v8_static_library") {
static_library(target_name) {
complete_static_lib = true
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= v8_remove_configs
configs -= [ "//build/config/compiler:thin_archive" ]
configs += v8_add_configs
configs += invoker.configs
}
}