Land v8-side changes to switch to v8_current_cpu in the GN build.

This change makes  the architecture that we target generated
v8 code for a property of the current toolchain, rather than a
global setting that applies to every toolchain.

This will allow us to properly build two snapshots for two different
architectures in a single build, which is needed for android
webview/monochrome builds.

R=brettw@chromium.org, jochen@chromium.org, michaelbai@chromium.org
BUG=625383

Review-Url: https://codereview.chromium.org/2116913002
Cr-Commit-Position: refs/heads/master@{#37805}
This commit is contained in:
dpranke 2016-07-15 15:32:55 -07:00 committed by Commit bot
parent a151ea9e7c
commit 6c3aaae969
6 changed files with 68 additions and 75 deletions

View File

@ -189,7 +189,7 @@ config("toolchain") {
cflags = []
ldflags = []
if (v8_target_cpu == "arm") {
if (v8_current_cpu == "arm") {
defines += [ "V8_TARGET_ARCH_ARM" ]
if (arm_version == 7) {
defines += [ "CAN_USE_ARMV7_INSTRUCTIONS" ]
@ -220,12 +220,12 @@ config("toolchain") {
}
}
}
if (v8_target_cpu == "arm64") {
if (v8_current_cpu == "arm64") {
defines += [ "V8_TARGET_ARCH_ARM64" ]
}
# TODO(jochen): Add support for mips.
if (v8_target_cpu == "mipsel") {
if (v8_current_cpu == "mipsel") {
defines += [ "V8_TARGET_ARCH_MIPS" ]
if (v8_can_use_fpu_instructions) {
defines += [ "CAN_USE_FPU_INSTRUCTIONS" ]
@ -260,7 +260,7 @@ config("toolchain") {
}
# TODO(jochen): Add support for mips64.
if (v8_target_cpu == "mips64el") {
if (v8_current_cpu == "mips64el") {
defines += [ "V8_TARGET_ARCH_MIPS64" ]
if (v8_can_use_fpu_instructions) {
defines += [ "CAN_USE_FPU_INSTRUCTIONS" ]
@ -282,23 +282,23 @@ config("toolchain") {
defines += [ "_MIPS_ARCH_MIPS64R2" ]
}
}
if (v8_target_cpu == "s390" || v8_target_cpu == "s390x") {
if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
defines += [ "V8_TARGET_ARCH_S390" ]
if (v8_target_cpu == "s390x") {
if (v8_current_cpu == "s390x") {
defines += [ "V8_TARGET_ARCH_S390X" ]
}
if (host_cpu == "x64" || host_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_S390_LE_SIM" ]
}
}
if (v8_target_cpu == "x86") {
if (v8_current_cpu == "x86") {
defines += [ "V8_TARGET_ARCH_IA32" ]
if (is_win) {
# Ensure no surprising artifacts from 80bit double math with x86.
cflags += [ "/arch:SSE2" ]
}
}
if (v8_target_cpu == "x64") {
if (v8_current_cpu == "x64") {
defines += [ "V8_TARGET_ARCH_X64" ]
if (is_win) {
# Increase the initial stack size. The default is 1MB, this is 2MB. This
@ -1587,7 +1587,7 @@ v8_source_set("v8_base") {
"src/zone.h",
]
if (v8_target_cpu == "x86") {
if (v8_current_cpu == "x86") {
sources += [
"src/builtins/ia32/builtins-ia32.cc",
"src/compiler/ia32/code-generator-ia32.cc",
@ -1625,7 +1625,7 @@ v8_source_set("v8_base") {
"src/regexp/ia32/regexp-macro-assembler-ia32.cc",
"src/regexp/ia32/regexp-macro-assembler-ia32.h",
]
} else if (v8_target_cpu == "x64") {
} else if (v8_current_cpu == "x64") {
sources += [
"src/builtins/x64/builtins-x64.cc",
"src/compiler/x64/code-generator-x64.cc",
@ -1666,7 +1666,7 @@ v8_source_set("v8_base") {
"src/x64/macro-assembler-x64.cc",
"src/x64/macro-assembler-x64.h",
]
} else if (v8_target_cpu == "arm") {
} else if (v8_current_cpu == "arm") {
sources += [
"src/arm/assembler-arm-inl.h",
"src/arm/assembler-arm.cc",
@ -1712,7 +1712,7 @@ v8_source_set("v8_base") {
"src/regexp/arm/regexp-macro-assembler-arm.cc",
"src/regexp/arm/regexp-macro-assembler-arm.h",
]
} else if (v8_target_cpu == "arm64") {
} else if (v8_current_cpu == "arm64") {
sources += [
"src/arm64/assembler-arm64-inl.h",
"src/arm64/assembler-arm64.cc",
@ -1771,7 +1771,7 @@ v8_source_set("v8_base") {
"src/regexp/arm64/regexp-macro-assembler-arm64.cc",
"src/regexp/arm64/regexp-macro-assembler-arm64.h",
]
} else if (v8_target_cpu == "mipsel") {
} else if (v8_current_cpu == "mipsel") {
sources += [
"src/builtins/mips/builtins-mips.cc",
"src/compiler/mips/code-generator-mips.cc",
@ -1813,7 +1813,7 @@ v8_source_set("v8_base") {
"src/regexp/mips/regexp-macro-assembler-mips.cc",
"src/regexp/mips/regexp-macro-assembler-mips.h",
]
} else if (v8_target_cpu == "mips64el") {
} else if (v8_current_cpu == "mips64el") {
sources += [
"src/builtins/mips64/builtins-mips64.cc",
"src/compiler/mips64/code-generator-mips64.cc",
@ -1855,7 +1855,7 @@ v8_source_set("v8_base") {
"src/regexp/mips64/regexp-macro-assembler-mips64.cc",
"src/regexp/mips64/regexp-macro-assembler-mips64.h",
]
} else if (v8_target_cpu == "s390" || v8_target_cpu == "s390x") {
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += [
"src/builtins/s390/builtins-s390.cc",
"src/compiler/s390/code-generator-s390.cc",

View File

@ -11,12 +11,12 @@ if (is_android) {
import("//build/config/android/config.gni")
}
if (((v8_target_cpu == "x86" ||
v8_target_cpu == "x64" ||
v8_target_cpu=="x87") &&
if (((v8_current_cpu == "x86" ||
v8_current_cpu == "x64" ||
v8_current_cpu=="x87") &&
(is_linux || is_mac)) ||
(v8_target_cpu == "ppc64" && is_linux)) {
v8_enable_gdbjit_default = true
(v8_current_cpu == "ppc64" && is_linux)) {
v8_enable_gdbjit = true
}
v8_imminent_deprecation_warnings_default = true

View File

@ -2,8 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/v8_target_cpu.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/v8_target_cpu.gni")
declare_args() {
# Indicate if valgrind was fetched as a custom deps to make it available on

View File

@ -25,6 +25,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import("//build/config/v8_target_cpu.gni")
declare_args() {
# The snapshot needs to be compiled for the host, but compiled with
# a toolchain that matches the bit-width of the target.
@ -36,41 +38,32 @@ declare_args() {
# configurations v8 runs on.
if (v8_snapshot_toolchain == "") {
if (host_cpu == "x64" && host_os == "linux") {
if (target_cpu == "arm" || target_cpu == "mipsel" || target_cpu == "x86") {
if (target_os == "android" || is_clang) {
v8_snapshot_toolchain = "//build/toolchain/linux:clang_x86"
} else if (target_os == "chromeos") {
# TODO(dpranke): crbug.com/608596: Remove this clause once the
# CrOS ebuilds are setting v8_snapshot_toolchain directly and
# we've cleaned up the sysroot settings in //build.
v8_snapshot_toolchain = "//build/toolchain/linux:clang_x86"
} else {
v8_snapshot_toolchain = "//build/toolchain/linux:x86"
}
} else if (target_cpu == "x64" || target_cpu == "arm64" ||
target_cpu == "mips64el") {
if (target_os == "android" || is_clang) {
v8_snapshot_toolchain = "//build/toolchain/linux:clang_x64"
} else if (target_os == "chromeos") {
# TODO(dpranke): crbug.com/608596: Remove this clause once the
# CrOS ebuilds are setting v8_snapshot_toolchain directly and
# we've cleaned up the sysroot settings in //build.
v8_snapshot_toolchain = "//build/toolchain/linux:clang_x64"
} else {
v8_snapshot_toolchain = "//build/toolchain/linux:x64"
}
if (current_cpu == "arm" || current_cpu == "mipsel" ||
current_cpu == "x86") {
_snapshot_cpu = "x86"
} else {
assert(false, "Need environment for this arch: $target_cpu")
assert(current_cpu == "arm64" || current_cpu == "x64" ||
current_cpu == "mipsel64",
"Need environment for this arch: $current_cpu")
_snapshot_cpu = "x64"
}
} else if (host_os == "mac" && target_os == "win") {
v8_snapshot_toolchain = "//build/toolchain/mac:clang_$target_cpu"
if (v8_current_cpu != _snapshot_cpu) {
_cpus = "${_snapshot_cpu}_v8_${v8_current_cpu}"
} else {
_cpus = _snapshot_cpu
}
if ((host_os == "linux" && current_os == "android") || is_clang) {
v8_snapshot_toolchain = "//build/toolchain/linux:clang_${_cpus}"
} else {
v8_snapshot_toolchain = "//build/toolchain/linux:${_cpus}"
}
} else if (host_os == "mac" && current_os == "win") {
assert(v8_current_cpu == current_cpu,
"v8 target must match the regular target on this platform")
v8_snapshot_toolchain = "//build/toolchain/mac:clang_$current_cpu"
} else {
v8_snapshot_toolchain = default_toolchain
}
}
# TODO(dpranke): snapshot_toolchain is provided for backwards compatibility
# and should be removed once all callers are updated to refer to
# v8_snapshot_toolchain directly.
snapshot_toolchain = v8_snapshot_toolchain

View File

@ -18,27 +18,27 @@ v8_executable("cctest") {
"$target_gen_dir/resources.cc",
] + gypi_values.cctest_sources
if (v8_target_cpu == "arm") {
if (v8_current_cpu == "arm") {
sources += gypi_values.cctest_sources_arm
} else if (v8_target_cpu == "arm64") {
} else if (v8_current_cpu == "arm64") {
sources += gypi_values.cctest_sources_arm64
} else if (v8_target_cpu == "x86") {
} else if (v8_current_cpu == "x86") {
sources += gypi_values.cctest_sources_ia32
} else if (v8_target_cpu == "mips") {
} else if (v8_current_cpu == "mips") {
sources += gypi_values.cctest_sources_mips
} else if (v8_target_cpu == "mipsel") {
} else if (v8_current_cpu == "mipsel") {
sources += gypi_values.cctest_sources_mipsel
} else if (v8_target_cpu == "mips64") {
} else if (v8_current_cpu == "mips64") {
sources += gypi_values.cctest_sources_mips64
} else if (v8_target_cpu == "mips64el") {
} else if (v8_current_cpu == "mips64el") {
sources += gypi_values.cctest_sources_mips64el
} else if (v8_target_cpu == "x64") {
} else if (v8_current_cpu == "x64") {
sources += gypi_values.cctest_sources_x64
} else if (v8_target_cpu == "x87") {
} else if (v8_current_cpu == "x87") {
sources += gypi_values.cctest_sources_x87
} else if (v8_target_cpu == "ppc" || v8_target_cpu == "ppc64") {
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += gypi_values.cctest_sources_ppc
} else if (v8_target_cpu == "s390" || v8_target_cpu == "s390x") {
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += gypi_values.cctest_sources_s390
}
@ -62,9 +62,9 @@ v8_executable("cctest") {
]
# TODO(machenbach): Translate from gyp.
#['v8_target_cpu=="ppc" or v8_target_cpu=="ppc64" \
# or v8_target_cpu=="arm" or v8_target_cpu=="arm64" \
# or v8_target_cpu=="s390" or v8_target_cpu=="s390x"', {
#['v8_current_cpu=="ppc" or v8_current_cpu=="ppc64" \
# or v8_current_cpu=="arm" or v8_current_cpu=="arm64" \
# or v8_current_cpu=="s390" or v8_current_cpu=="s390x"', {
# # disable fmadd/fmsub so that expected results match generated code in
# # RunFloat64MulAndFloat64Add1 and friends.
# 'cflags': ['-ffp-contract=off'],

View File

@ -16,21 +16,21 @@ v8_executable("unittests") {
sources = gypi_values.unittests_sources
if (v8_target_cpu == "arm") {
if (v8_current_cpu == "arm") {
sources += gypi_values.unittests_sources_arm
} else if (v8_target_cpu == "arm64") {
} else if (v8_current_cpu == "arm64") {
sources += gypi_values.unittests_sources_arm64
} else if (v8_target_cpu == "x86") {
} else if (v8_current_cpu == "x86") {
sources += gypi_values.unittests_sources_ia32
} else if (v8_target_cpu == "mips" || v8_target_cpu == "mipsel") {
} else if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel") {
sources += gypi_values.unittests_sources_mips
} else if (v8_target_cpu == "mips64" || v8_target_cpu == "mips64el") {
} else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
sources += gypi_values.unittests_sources_mips64
} else if (v8_target_cpu == "x64") {
} else if (v8_current_cpu == "x64") {
sources += gypi_values.unittests_sources_x64
} else if (v8_target_cpu == "ppc" || v8_target_cpu == "ppc64") {
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += gypi_values.unittests_sources_ppc
} else if (v8_target_cpu == "s390" || v8_target_cpu == "s390x") {
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += gypi_values.unittests_sources_s390
}