Index: build/config/BUILDCONFIG.gn |
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn |
index 4f3a223c32d23ab7b79007add5081deac14bdf7e..54686c28651adb45b12b85325395494c88ebf111 100644 |
--- a/build/config/BUILDCONFIG.gn |
+++ b/build/config/BUILDCONFIG.gn |
@@ -142,9 +142,45 @@ declare_args() { |
# every toolchain can pass through the "global" value via toolchain_args(). |
host_toolchain = "" |
+ # This arg is used when we want to tell the JIT-code-generating v8 code |
+ # that we want to have it generate code for an architecture that is different |
+ # than the architecture that v8 will actually run on, and that we will |
+ # then run the code under an emulator. For example, we might run v8 |
+ # on x86, but generate arm code and run that under emulation. |
+ # |
+ # This arg is defined here rather than in the v8 project because we want |
+ # some of the common architecture-specific args (like arm_float_abi or |
+ # mips_arch_variant) to be set to their defaults either if the current_cpu |
Michael Achenbach
2016/07/07 07:24:22
nit: For consistency, maybe write either "current_
Dirk Pranke
2016/07/07 17:28:12
Will do (using target_cpu).
|
+ # applies *or* if the v8_target_cpu applies. |
+ v8_target_cpu = "" |
+ |
+ # Compile for Memory Sanitizer to find uninitialized reads. |
+ # |
+ # TODO: This is here so that we can set a good default for v8_target_cpu |
+ # when running under the sanitizer, but this is something of a layering |
+ # violation and it would be nice if there was some other way to do this. |
+ is_msan = false |
Dirk Pranke
2016/07/07 02:42:00
I don't like this being here, but the only alterna
Michael Achenbach
2016/07/07 07:24:22
I'd find it ok if developers need to specify v8_ta
Dirk Pranke
2016/07/07 17:28:12
Ah, I thought that x64 v8 msan didn't work at all.
brettw
2016/07/07 17:56:21
I have a negative reaction to this since I spent a
Michael Achenbach
2016/07/08 06:57:11
I'm not totally sure if x64 msan would work well w
|
+ |
# DON'T ADD MORE FLAGS HERE. Read the comment above. |
} |
+if (v8_target_cpu == "") { |
brettw
2016/07/07 17:56:21
I really think we should avoid having V8 stuff in
|
+ if (is_msan) { |
+ # Running the V8-generated code on an ARM simulator is a powerful hack that |
+ # allows the tool to see the memory accesses from JITted code. Without this |
+ # flag, JS code causes false positive reports from MSan. |
+ v8_target_cpu = "arm64" |
+ } else { |
+ v8_target_cpu = target_cpu |
+ } |
+} |
+ |
+declare_args() { |
Michael Achenbach
2016/07/07 07:24:22
Curiosity: Is there a semantic difference in havin
Dirk Pranke
2016/07/07 17:28:12
Generically speaking, yes. See crbug.com/542846. T
|
+ # This argument is declared here so that it can be overridden in |
+ # toolchains. It should never be explicitly set by the user. |
michaelbai
2016/07/07 18:41:26
The v8_current_cpu will show up in the result of "
|
+ v8_current_cpu = v8_target_cpu |
+} |
+ |
assert(!(is_debug && is_official_build), "Can't do official debug builds") |
# ============================================================================== |
@@ -215,10 +251,15 @@ if (target_os == "android") { |
} else if (target_os == "ios") { |
_default_toolchain = "//build/toolchain/mac:ios_clang_$target_cpu" |
} else if (target_os == "linux") { |
+ if (v8_current_cpu != current_cpu) { |
+ _target_cpus = "${target_cpu}_v8_${v8_current_cpu}" |
+ } else { |
+ _target_cpus = target_cpu |
+ } |
if (is_clang) { |
- _default_toolchain = "//build/toolchain/linux:clang_$target_cpu" |
+ _default_toolchain = "//build/toolchain/linux:clang_${_target_cpus}" |
} else { |
- _default_toolchain = "//build/toolchain/linux:$target_cpu" |
+ _default_toolchain = "//build/toolchain/linux:${_target_cpus}" |
} |
} else if (target_os == "mac") { |
assert(host_os == "mac", "Mac cross-compiles are unsupported.") |