OLD | NEW |
1 # Copyright 2016 the V8 project authors. All rights reserved. | 1 # Copyright 2016 the V8 project authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/sanitizers/sanitizers.gni") | 5 import("//build/config/sanitizers/sanitizers.gni") |
6 | 6 |
7 declare_args() { | 7 declare_args() { |
| 8 # Turns on compiler optimizations in V8 in Debug build. |
| 9 v8_optimized_debug = true |
| 10 |
8 # Enable the snapshot feature, for fast context creation. | 11 # Enable the snapshot feature, for fast context creation. |
9 # http://v8project.blogspot.com/2015/09/custom-startup-snapshots.html | 12 # http://v8project.blogspot.com/2015/09/custom-startup-snapshots.html |
10 v8_use_snapshot = true | 13 v8_use_snapshot = true |
11 | 14 |
12 # Use external files for startup data blobs: | 15 # Use external files for startup data blobs: |
13 # the JS builtins sources and the start snapshot. | 16 # the JS builtins sources and the start snapshot. |
14 v8_use_external_startup_data = !is_ios | 17 v8_use_external_startup_data = !is_ios |
15 | 18 |
16 # V8 generates code for this architecture. If v8_target_arch differs from | 19 # V8 generates code for this architecture. If v8_target_arch differs from |
17 # target_cpu, a simulator will be run. | 20 # target_cpu, a simulator will be run. |
18 v8_target_arch = "" | 21 v8_target_arch = "" |
19 } | 22 } |
20 | 23 |
21 if (v8_target_arch == "") { | 24 if (v8_target_arch == "") { |
22 if (is_msan) { | 25 if (is_msan) { |
23 # Running the V8-generated code on an ARM simulator is a powerful hack that | 26 # Running the V8-generated code on an ARM simulator is a powerful hack that |
24 # allows the tool to see the memory accesses from JITted code. Without this | 27 # allows the tool to see the memory accesses from JITted code. Without this |
25 # flag, JS code causes false positive reports from MSan. | 28 # flag, JS code causes false positive reports from MSan. |
26 v8_target_arch = "arm64" | 29 v8_target_arch = "arm64" |
27 } else { | 30 } else { |
28 v8_target_arch = target_cpu | 31 v8_target_arch = target_cpu |
29 } | 32 } |
30 } | 33 } |
| 34 |
| 35 ############################################################################### |
| 36 # Templates |
| 37 # |
| 38 |
| 39 # Points to // in v8 stand-alone or to //v8/ in chromium. We need absolute |
| 40 # paths for all configs in templates as they are shared in different |
| 41 # subdirectories. |
| 42 path_prefix = get_path_info("../", "abspath") |
| 43 |
| 44 # Common configs to remove or add in all v8 targets. |
| 45 remove_configs = [ "//build/config/compiler:chromium_code" ] |
| 46 add_configs = [ |
| 47 "//build/config/compiler:no_chromium_code", |
| 48 path_prefix + ":features", |
| 49 path_prefix + ":toolchain", |
| 50 ] |
| 51 |
| 52 if (is_debug && !v8_optimized_debug) { |
| 53 remove_configs += [ "//build/config/compiler:default_optimization" ] |
| 54 add_configs += [ "//build/config/compiler:no_optimize" ] |
| 55 } else { |
| 56 remove_configs += [ "//build/config/compiler:default_optimization" ] |
| 57 add_configs += [ "//build/config/compiler:optimize_max" ] |
| 58 } |
| 59 |
| 60 # All templates should be kept in sync. |
| 61 template("v8_source_set") { |
| 62 source_set(target_name) { |
| 63 forward_variables_from(invoker, "*", [ "configs" ]) |
| 64 configs += invoker.configs |
| 65 configs -= remove_configs |
| 66 configs += add_configs |
| 67 } |
| 68 } |
| 69 |
| 70 template("v8_executable") { |
| 71 executable(target_name) { |
| 72 forward_variables_from(invoker, "*", [ "configs" ]) |
| 73 configs += invoker.configs |
| 74 configs -= remove_configs |
| 75 configs += add_configs |
| 76 } |
| 77 } |
| 78 |
| 79 template("v8_component") { |
| 80 component(target_name) { |
| 81 forward_variables_from(invoker, "*", [ "configs" ]) |
| 82 configs += invoker.configs |
| 83 configs -= remove_configs |
| 84 configs += add_configs |
| 85 } |
| 86 } |
OLD | NEW |