diff options
Diffstat (limited to 'deps/v8/build')
-rw-r--r-- | deps/v8/build/all.gyp | 2 | ||||
-rw-r--r-- | deps/v8/build/android.gypi | 37 | ||||
-rw-r--r-- | deps/v8/build/detect_v8_host_arch.py | 69 | ||||
-rw-r--r-- | deps/v8/build/features.gypi | 20 | ||||
-rwxr-xr-x | deps/v8/build/get_landmines.py | 26 | ||||
-rwxr-xr-x | deps/v8/build/gyp_v8 | 9 | ||||
-rw-r--r-- | deps/v8/build/landmine_utils.py | 114 | ||||
-rwxr-xr-x | deps/v8/build/landmines.py | 139 | ||||
-rw-r--r-- | deps/v8/build/standalone.gypi | 54 | ||||
-rw-r--r-- | deps/v8/build/toolchain.gypi | 380 |
10 files changed, 641 insertions, 209 deletions
diff --git a/deps/v8/build/all.gyp b/deps/v8/build/all.gyp index 3860379ea..5e410a3d0 100644 --- a/deps/v8/build/all.gyp +++ b/deps/v8/build/all.gyp @@ -10,7 +10,9 @@ 'dependencies': [ '../samples/samples.gyp:*', '../src/d8.gyp:d8', + '../test/base-unittests/base-unittests.gyp:*', '../test/cctest/cctest.gyp:*', + '../test/compiler-unittests/compiler-unittests.gyp:*', ], 'conditions': [ ['component!="shared_library"', { diff --git a/deps/v8/build/android.gypi b/deps/v8/build/android.gypi index 73ac93a43..46ece0852 100644 --- a/deps/v8/build/android.gypi +++ b/deps/v8/build/android.gypi @@ -35,9 +35,6 @@ 'variables': { 'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)', 'android_toolchain%': '<!(/bin/echo -n $ANDROID_TOOLCHAIN)', - # This is set when building the Android WebView inside the Android build - # system, using the 'android' gyp backend. - 'android_webview_build%': 0, }, 'conditions': [ ['android_ndk_root==""', { @@ -64,9 +61,6 @@ # link the NDK one? 'use_system_stlport%': '<(android_webview_build)', 'android_stlport_library': 'stlport_static', - # Copy it out one scope. - 'android_webview_build%': '<(android_webview_build)', - 'OS': 'android', }, # variables 'target_defaults': { 'defines': [ @@ -81,7 +75,12 @@ }, # Release }, # configurations 'cflags': [ '-Wno-abi', '-Wall', '-W', '-Wno-unused-parameter', - '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', ], + '-Wnon-virtual-dtor', '-fno-rtti', '-fno-exceptions', + # Note: Using -std=c++0x will define __STRICT_ANSI__, which in + # turn will leave out some template stuff for 'long long'. What + # we want is -std=c++11, but this is not supported by GCC 4.6 or + # Xcode 4.2 + '-std=gnu++0x' ], 'target_conditions': [ ['_toolset=="target"', { 'cflags!': [ @@ -179,7 +178,7 @@ '-L<(android_stlport_libs)/mips', ], }], - ['target_arch=="ia32"', { + ['target_arch=="ia32" or target_arch=="x87"', { 'ldflags': [ '-L<(android_stlport_libs)/x86', ], @@ -196,7 +195,7 @@ }], ], }], - ['target_arch=="ia32"', { + ['target_arch=="ia32" or target_arch=="x87"', { # The x86 toolchain currently has problems with stack-protector. 'cflags!': [ '-fstack-protector', @@ -215,6 +214,15 @@ '-fno-stack-protector', ], }], + ['target_arch=="arm64" or target_arch=="x64"', { + # TODO(ulan): Enable PIE for other architectures (crbug.com/373219). + 'cflags': [ + '-fPIE', + ], + 'ldflags': [ + '-pie', + ], + }], ], 'target_conditions': [ ['_type=="executable"', { @@ -257,15 +265,8 @@ }], # _toolset=="target" # Settings for building host targets using the system toolchain. ['_toolset=="host"', { - 'conditions': [ - ['target_arch=="x64"', { - 'cflags': [ '-m64', '-pthread' ], - 'ldflags': [ '-m64', '-pthread' ], - }, { - 'cflags': [ '-m32', '-pthread' ], - 'ldflags': [ '-m32', '-pthread' ], - }], - ], + 'cflags': [ '-pthread' ], + 'ldflags': [ '-pthread' ], 'ldflags!': [ '-Wl,-z,noexecstack', '-Wl,--gc-sections', diff --git a/deps/v8/build/detect_v8_host_arch.py b/deps/v8/build/detect_v8_host_arch.py new file mode 100644 index 000000000..3460a9a40 --- /dev/null +++ b/deps/v8/build/detect_v8_host_arch.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# Copyright 2014 the V8 project authors. All rights reserved. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Outputs host CPU architecture in format recognized by gyp.""" + +import platform +import re +import sys + + +def main(): + print DoMain([]) + return 0 + +def DoMain(_): + """Hook to be called from gyp without starting a separate python + interpreter.""" + host_arch = platform.machine() + + # Convert machine type to format recognized by gyp. + if re.match(r'i.86', host_arch) or host_arch == 'i86pc': + host_arch = 'ia32' + elif host_arch in ['x86_64', 'amd64']: + host_arch = 'x64' + elif host_arch.startswith('arm'): + host_arch = 'arm' + elif host_arch == 'aarch64': + host_arch = 'arm64' + elif host_arch == 'mips64': + host_arch = 'mips64el' + elif host_arch.startswith('mips'): + host_arch = 'mipsel' + + # platform.machine is based on running kernel. It's possible to use 64-bit + # kernel with 32-bit userland, e.g. to give linker slightly more memory. + # Distinguish between different userland bitness by querying + # the python binary. + if host_arch == 'x64' and platform.architecture()[0] == '32bit': + host_arch = 'ia32' + + return host_arch + +if __name__ == '__main__': + sys.exit(main()) diff --git a/deps/v8/build/features.gypi b/deps/v8/build/features.gypi index e8f5b2f08..7ce66e4c9 100644 --- a/deps/v8/build/features.gypi +++ b/deps/v8/build/features.gypi @@ -41,6 +41,8 @@ 'v8_use_snapshot%': 'true', + 'v8_enable_verify_predictable%': 0, + # With post mortem support enabled, metadata is embedded into libv8 that # describes various parameters of the VM for use by debuggers. See # tools/gen-postmortem-metadata.py for details. @@ -57,8 +59,9 @@ # Enable compiler warnings when using V8_DEPRECATED apis. 'v8_deprecation_warnings%': 0, - # Use the v8 provided v8::Platform implementation. - 'v8_use_default_platform%': 1, + # Use external files for startup data blobs: + # the JS builtins sources and the start snapshot. + 'v8_use_external_startup_data%': 0, }, 'target_defaults': { 'conditions': [ @@ -74,6 +77,9 @@ ['v8_enable_verify_heap==1', { 'defines': ['VERIFY_HEAP',], }], + ['v8_enable_verify_predictable==1', { + 'defines': ['VERIFY_PREDICTABLE',], + }], ['v8_interpreted_regexp==1', { 'defines': ['V8_INTERPRETED_REGEXP',], }], @@ -83,13 +89,11 @@ ['v8_enable_i18n_support==1', { 'defines': ['V8_I18N_SUPPORT',], }], - ['v8_use_default_platform==1', { - 'defines': ['V8_USE_DEFAULT_PLATFORM',], - }], ['v8_compress_startup_data=="bz2"', { - 'defines': [ - 'COMPRESS_STARTUP_DATA_BZ2', - ], + 'defines': ['COMPRESS_STARTUP_DATA_BZ2',], + }], + ['v8_use_external_startup_data==1', { + 'defines': ['V8_USE_EXTERNAL_STARTUP_DATA',], }], ], # conditions 'configurations': { diff --git a/deps/v8/build/get_landmines.py b/deps/v8/build/get_landmines.py new file mode 100755 index 000000000..c6ff8165f --- /dev/null +++ b/deps/v8/build/get_landmines.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# Copyright 2014 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. + +""" +This file emits the list of reasons why a particular build needs to be clobbered +(or a list of 'landmines'). +""" + +import sys + + +def main(): + """ + ALL LANDMINES ARE EMITTED FROM HERE. + """ + print 'Need to clobber after ICU52 roll.' + print 'Landmines test.' + print 'Activating MSVS 2013.' + print 'Revert activation of MSVS 2013.' + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/deps/v8/build/gyp_v8 b/deps/v8/build/gyp_v8 index bc733dfca..14467ecca 100755 --- a/deps/v8/build/gyp_v8 +++ b/deps/v8/build/gyp_v8 @@ -34,6 +34,7 @@ import glob import os import platform import shlex +import subprocess import sys script_dir = os.path.dirname(os.path.realpath(__file__)) @@ -107,6 +108,14 @@ def additional_include_files(args=[]): def run_gyp(args): rc = gyp.main(args) + + # Check for landmines (reasons to clobber the build). This must be run here, + # rather than a separate runhooks step so that any environment modifications + # from above are picked up. + print 'Running build/landmines.py...' + subprocess.check_call( + [sys.executable, os.path.join(script_dir, 'landmines.py')]) + if rc != 0: print 'Error running GYP' sys.exit(rc) diff --git a/deps/v8/build/landmine_utils.py b/deps/v8/build/landmine_utils.py new file mode 100644 index 000000000..e8b7c98d5 --- /dev/null +++ b/deps/v8/build/landmine_utils.py @@ -0,0 +1,114 @@ +# Copyright 2014 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 functools +import logging +import os +import shlex +import sys + + +def memoize(default=None): + """This decorator caches the return value of a parameterless pure function""" + def memoizer(func): + val = [] + @functools.wraps(func) + def inner(): + if not val: + ret = func() + val.append(ret if ret is not None else default) + if logging.getLogger().isEnabledFor(logging.INFO): + print '%s -> %r' % (func.__name__, val[0]) + return val[0] + return inner + return memoizer + + +@memoize() +def IsWindows(): + return sys.platform in ['win32', 'cygwin'] + + +@memoize() +def IsLinux(): + return sys.platform.startswith(('linux', 'freebsd')) + + +@memoize() +def IsMac(): + return sys.platform == 'darwin' + + +@memoize() +def gyp_defines(): + """Parses and returns GYP_DEFINES env var as a dictionary.""" + return dict(arg.split('=', 1) + for arg in shlex.split(os.environ.get('GYP_DEFINES', ''))) + +@memoize() +def gyp_msvs_version(): + return os.environ.get('GYP_MSVS_VERSION', '') + +@memoize() +def distributor(): + """ + Returns a string which is the distributed build engine in use (if any). + Possible values: 'goma', 'ib', '' + """ + if 'goma' in gyp_defines(): + return 'goma' + elif IsWindows(): + if 'CHROME_HEADLESS' in os.environ: + return 'ib' # use (win and !goma and headless) as approximation of ib + + +@memoize() +def platform(): + """ + Returns a string representing the platform this build is targetted for. + Possible values: 'win', 'mac', 'linux', 'ios', 'android' + """ + if 'OS' in gyp_defines(): + if 'android' in gyp_defines()['OS']: + return 'android' + else: + return gyp_defines()['OS'] + elif IsWindows(): + return 'win' + elif IsLinux(): + return 'linux' + else: + return 'mac' + + +@memoize() +def builder(): + """ + Returns a string representing the build engine (not compiler) to use. + Possible values: 'make', 'ninja', 'xcode', 'msvs', 'scons' + """ + if 'GYP_GENERATORS' in os.environ: + # for simplicity, only support the first explicit generator + generator = os.environ['GYP_GENERATORS'].split(',')[0] + if generator.endswith('-android'): + return generator.split('-')[0] + elif generator.endswith('-ninja'): + return 'ninja' + else: + return generator + else: + if platform() == 'android': + # Good enough for now? Do any android bots use make? + return 'make' + elif platform() == 'ios': + return 'xcode' + elif IsWindows(): + return 'msvs' + elif IsLinux(): + return 'make' + elif IsMac(): + return 'xcode' + else: + assert False, 'Don\'t know what builder we\'re using!' diff --git a/deps/v8/build/landmines.py b/deps/v8/build/landmines.py new file mode 100755 index 000000000..bd1fb28f7 --- /dev/null +++ b/deps/v8/build/landmines.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# Copyright 2014 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. + +""" +This script runs every build as a hook. If it detects that the build should +be clobbered, it will touch the file <build_dir>/.landmine_triggered. The +various build scripts will then check for the presence of this file and clobber +accordingly. The script will also emit the reasons for the clobber to stdout. + +A landmine is tripped when a builder checks out a different revision, and the +diff between the new landmines and the old ones is non-null. At this point, the +build is clobbered. +""" + +import difflib +import logging +import optparse +import os +import sys +import subprocess +import time + +import landmine_utils + + +SRC_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + + +def get_target_build_dir(build_tool, target): + """ + Returns output directory absolute path dependent on build and targets. + Examples: + r'c:\b\build\slave\win\build\src\out\Release' + '/mnt/data/b/build/slave/linux/build/src/out/Debug' + '/b/build/slave/ios_rel_device/build/src/xcodebuild/Release-iphoneos' + + Keep this function in sync with tools/build/scripts/slave/compile.py + """ + ret = None + if build_tool == 'xcode': + ret = os.path.join(SRC_DIR, 'xcodebuild', target) + elif build_tool in ['make', 'ninja', 'ninja-ios']: # TODO: Remove ninja-ios. + ret = os.path.join(SRC_DIR, 'out', target) + elif build_tool in ['msvs', 'vs', 'ib']: + ret = os.path.join(SRC_DIR, 'build', target) + else: + raise NotImplementedError('Unexpected GYP_GENERATORS (%s)' % build_tool) + return os.path.abspath(ret) + + +def set_up_landmines(target, new_landmines): + """Does the work of setting, planting, and triggering landmines.""" + out_dir = get_target_build_dir(landmine_utils.builder(), target) + + landmines_path = os.path.join(out_dir, '.landmines') + if not os.path.exists(out_dir): + return + + if not os.path.exists(landmines_path): + print "Landmines tracker didn't exists." + + # FIXME(machenbach): Clobber deletes the .landmines tracker. Difficult + # to know if we are right after a clobber or if it is first-time landmines + # deployment. Also, a landmine-triggered clobber right after a clobber is + # not possible. Different clobber methods for msvs, xcode and make all + # have different blacklists of files that are not deleted. + if os.path.exists(landmines_path): + triggered = os.path.join(out_dir, '.landmines_triggered') + with open(landmines_path, 'r') as f: + old_landmines = f.readlines() + if old_landmines != new_landmines: + old_date = time.ctime(os.stat(landmines_path).st_ctime) + diff = difflib.unified_diff(old_landmines, new_landmines, + fromfile='old_landmines', tofile='new_landmines', + fromfiledate=old_date, tofiledate=time.ctime(), n=0) + + with open(triggered, 'w') as f: + f.writelines(diff) + print "Setting landmine: %s" % triggered + elif os.path.exists(triggered): + # Remove false triggered landmines. + os.remove(triggered) + print "Removing landmine: %s" % triggered + with open(landmines_path, 'w') as f: + f.writelines(new_landmines) + + +def process_options(): + """Returns a list of landmine emitting scripts.""" + parser = optparse.OptionParser() + parser.add_option( + '-s', '--landmine-scripts', action='append', + default=[os.path.join(SRC_DIR, 'build', 'get_landmines.py')], + help='Path to the script which emits landmines to stdout. The target ' + 'is passed to this script via option -t. Note that an extra ' + 'script can be specified via an env var EXTRA_LANDMINES_SCRIPT.') + parser.add_option('-v', '--verbose', action='store_true', + default=('LANDMINES_VERBOSE' in os.environ), + help=('Emit some extra debugging information (default off). This option ' + 'is also enabled by the presence of a LANDMINES_VERBOSE environment ' + 'variable.')) + + options, args = parser.parse_args() + + if args: + parser.error('Unknown arguments %s' % args) + + logging.basicConfig( + level=logging.DEBUG if options.verbose else logging.ERROR) + + extra_script = os.environ.get('EXTRA_LANDMINES_SCRIPT') + if extra_script: + return options.landmine_scripts + [extra_script] + else: + return options.landmine_scripts + + +def main(): + landmine_scripts = process_options() + + if landmine_utils.builder() in ('dump_dependency_json', 'eclipse'): + return 0 + + landmines = [] + for s in landmine_scripts: + proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) + output, _ = proc.communicate() + landmines.extend([('%s\n' % l.strip()) for l in output.splitlines()]) + + for target in ('Debug', 'Release'): + set_up_landmines(target, landmines) + + return 0 + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/deps/v8/build/standalone.gypi b/deps/v8/build/standalone.gypi index befa73851..2ed19f65e 100644 --- a/deps/v8/build/standalone.gypi +++ b/deps/v8/build/standalone.gypi @@ -33,8 +33,8 @@ 'includes': ['toolchain.gypi'], 'variables': { 'component%': 'static_library', - 'clang%': 0, 'asan%': 0, + 'tsan%': 0, 'visibility%': 'hidden', 'v8_enable_backtrace%': 0, 'v8_enable_i18n_support%': 1, @@ -51,13 +51,7 @@ # Anything else gets passed through, which probably won't work # very well; such hosts should pass an explicit target_arch # to gyp. - 'host_arch%': - '<!(uname -m | sed -e "s/i.86/ia32/;\ - s/x86_64/x64/;\ - s/amd64/x64/;\ - s/arm.*/arm/;\ - s/aarch64/arm64/;\ - s/mips.*/mipsel/")', + 'host_arch%': '<!pymod_do_main(detect_v8_host_arch)', }, { # OS!="linux" and OS!="freebsd" and OS!="openbsd" and # OS!="netbsd" and OS!="mac" @@ -104,6 +98,7 @@ ['(v8_target_arch=="arm" and host_arch!="arm") or \ (v8_target_arch=="arm64" and host_arch!="arm64") or \ (v8_target_arch=="mipsel" and host_arch!="mipsel") or \ + (v8_target_arch=="mips64el" and host_arch!="mips64el") or \ (v8_target_arch=="x64" and host_arch!="x64") or \ (OS=="android" or OS=="qnx")', { 'want_separate_host_toolset': 1, @@ -115,16 +110,20 @@ }, { 'os_posix%': 1, }], - ['(v8_target_arch=="ia32" or v8_target_arch=="x64") and \ + ['(v8_target_arch=="ia32" or v8_target_arch=="x64" or v8_target_arch=="x87") and \ (OS=="linux" or OS=="mac")', { 'v8_enable_gdbjit%': 1, }, { 'v8_enable_gdbjit%': 0, }], + ['OS=="mac"', { + 'clang%': 1, + }, { + 'clang%': 0, + }], ], # Default ARM variable settings. 'arm_version%': 'default', - 'arm_neon%': 0, 'arm_fpu%': 'vfpv3', 'arm_float_abi%': 'default', 'arm_thumb': 'default', @@ -192,17 +191,36 @@ ], }, }], + ['tsan==1', { + 'target_defaults': { + 'cflags+': [ + '-fno-omit-frame-pointer', + '-gline-tables-only', + '-fsanitize=thread', + '-fPIC', + '-Wno-c++11-extensions', + ], + 'cflags!': [ + '-fomit-frame-pointer', + ], + 'ldflags': [ + '-fsanitize=thread', + '-pie', + ], + 'defines': [ + 'THREAD_SANITIZER', + ], + }, + }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ or OS=="netbsd"', { 'target_defaults': { 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', - '-pthread', '-fno-exceptions', '-pedantic' ], - 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti' ], + '-Wno-long-long', '-pthread', '-fno-exceptions', + '-pedantic' ], + 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ], 'ldflags': [ '-pthread', ], 'conditions': [ - [ 'OS=="linux"', { - 'cflags': [ '-ansi' ], - }], [ 'visibility=="hidden" and v8_enable_backtrace==0', { 'cflags': [ '-fvisibility=hidden' ], }], @@ -218,7 +236,7 @@ 'target_defaults': { 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', '-fno-exceptions' ], - 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti' ], + 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ], 'conditions': [ [ 'visibility=="hidden"', { 'cflags': [ '-fvisibility=hidden' ], @@ -316,7 +334,7 @@ 'target_defaults': { 'xcode_settings': { 'ALWAYS_SEARCH_USER_PATHS': 'NO', - 'GCC_C_LANGUAGE_STANDARD': 'ansi', # -ansi + 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic # (Equivalent to -fPIC) @@ -352,7 +370,7 @@ ['clang==1', { 'xcode_settings': { 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', - 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++11', # -std=gnu++11 + 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x }, }], ], diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi index a9958ce8d..1d47360d2 100644 --- a/deps/v8/build/toolchain.gypi +++ b/deps/v8/build/toolchain.gypi @@ -31,7 +31,7 @@ 'variables': { 'msvs_use_common_release': 0, 'gcc_version%': 'unknown', - 'CXX%': '${CXX:-$(which g++)}', # Used to assemble a shell command. + 'clang%': 0, 'v8_target_arch%': '<(target_arch)', # Native Client builds currently use the V8 ARM JIT and # arm/simulator-arm.cc to defer the significant effort required @@ -47,7 +47,7 @@ # these registers in the snapshot and use CPU feature probing when running # on the target. 'v8_can_use_vfp32dregs%': 'false', - 'arm_test%': 'off', + 'arm_test_noprobe%': 'off', # Similar to vfp but on MIPS. 'v8_can_use_fpu_instructions%': 'true', @@ -56,7 +56,7 @@ 'v8_use_mips_abi_hardfloat%': 'true', # Default arch variant for MIPS. - 'mips_arch_variant%': 'mips32r2', + 'mips_arch_variant%': 'r2', 'v8_enable_backtrace%': 0, @@ -82,35 +82,85 @@ # Allow to suppress the array bounds warning (default is no suppression). 'wno_array_bounds%': '', + + 'variables': { + # This is set when building the Android WebView inside the Android build + # system, using the 'android' gyp backend. + 'android_webview_build%': 0, + }, + # Copy it out one scope. + 'android_webview_build%': '<(android_webview_build)', }, + 'conditions': [ + ['host_arch=="ia32" or host_arch=="x64" or clang==1', { + 'variables': { + 'host_cxx_is_biarch%': 1, + }, + }, { + 'variables': { + 'host_cxx_is_biarch%': 0, + }, + }], + ['target_arch=="ia32" or target_arch=="x64" or target_arch=="x87" or \ + clang==1', { + 'variables': { + 'target_cxx_is_biarch%': 1, + }, + }, { + 'variables': { + 'target_cxx_is_biarch%': 0, + }, + }], + ], 'target_defaults': { 'conditions': [ ['v8_target_arch=="arm"', { 'defines': [ 'V8_TARGET_ARCH_ARM', ], + 'conditions': [ + [ 'arm_version==7 or arm_version=="default"', { + 'defines': [ + 'CAN_USE_ARMV7_INSTRUCTIONS', + ], + }], + [ 'arm_fpu=="vfpv3-d16" or arm_fpu=="default"', { + 'defines': [ + 'CAN_USE_VFP3_INSTRUCTIONS', + ], + }], + [ 'arm_fpu=="vfpv3"', { + 'defines': [ + 'CAN_USE_VFP3_INSTRUCTIONS', + 'CAN_USE_VFP32DREGS', + ], + }], + [ 'arm_fpu=="neon"', { + 'defines': [ + 'CAN_USE_VFP3_INSTRUCTIONS', + 'CAN_USE_VFP32DREGS', + 'CAN_USE_NEON', + ], + }], + [ 'arm_test_noprobe=="on"', { + 'defines': [ + 'ARM_TEST_NO_FEATURE_PROBE', + ], + }], + ], 'target_conditions': [ ['_toolset=="host"', { - 'variables': { - 'armcompiler': '<!($(echo ${CXX_host:-$(which g++)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")', - }, 'conditions': [ - ['armcompiler=="yes"', { + ['v8_target_arch==host_arch and android_webview_build==0', { + # Host built with an Arm CXX compiler. 'conditions': [ [ 'arm_version==7', { 'cflags': ['-march=armv7-a',], }], [ 'arm_version==7 or arm_version=="default"', { 'conditions': [ - [ 'arm_neon==1', { - 'cflags': ['-mfpu=neon',], - }, - { - 'conditions': [ - [ 'arm_fpu!="default"', { - 'cflags': ['-mfpu=<(arm_fpu)',], - }], - ], + [ 'arm_fpu!="default"', { + 'cflags': ['-mfpu=<(arm_fpu)',], }], ], }], @@ -123,44 +173,11 @@ [ 'arm_thumb==0', { 'cflags': ['-marm',], }], - [ 'arm_test=="on"', { - 'defines': [ - 'ARM_TEST', - ], - }], ], }, { - # armcompiler=="no" + # 'v8_target_arch!=host_arch' + # Host not built with an Arm CXX compiler (simulator build). 'conditions': [ - [ 'arm_version==7 or arm_version=="default"', { - 'defines': [ - 'CAN_USE_ARMV7_INSTRUCTIONS=1', - ], - 'conditions': [ - [ 'arm_fpu=="default"', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - ], - }], - [ 'arm_fpu=="vfpv3-d16"', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - ], - }], - [ 'arm_fpu=="vfpv3"', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - 'CAN_USE_VFP32DREGS', - ], - }], - [ 'arm_fpu=="neon" or arm_neon==1', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - 'CAN_USE_VFP32DREGS', - ], - }], - ], - }], [ 'arm_float_abi=="hard"', { 'defines': [ 'USE_EABI_HARDFLOAT=1', @@ -172,33 +189,21 @@ ], }], ], - 'defines': [ - 'ARM_TEST', - ], }], ], }], # _toolset=="host" ['_toolset=="target"', { - 'variables': { - 'armcompiler': '<!($(echo ${CXX_target:-<(CXX)}) -v 2>&1 | grep -q "^Target: arm" && echo "yes" || echo "no")', - }, 'conditions': [ - ['armcompiler=="yes"', { + ['v8_target_arch==target_arch and android_webview_build==0', { + # Target built with an Arm CXX compiler. 'conditions': [ [ 'arm_version==7', { 'cflags': ['-march=armv7-a',], }], [ 'arm_version==7 or arm_version=="default"', { 'conditions': [ - [ 'arm_neon==1', { - 'cflags': ['-mfpu=neon',], - }, - { - 'conditions': [ - [ 'arm_fpu!="default"', { - 'cflags': ['-mfpu=<(arm_fpu)',], - }], - ], + [ 'arm_fpu!="default"', { + 'cflags': ['-mfpu=<(arm_fpu)',], }], ], }], @@ -211,44 +216,11 @@ [ 'arm_thumb==0', { 'cflags': ['-marm',], }], - [ 'arm_test=="on"', { - 'defines': [ - 'ARM_TEST', - ], - }], ], }, { - # armcompiler=="no" + # 'v8_target_arch!=target_arch' + # Target not built with an Arm CXX compiler (simulator build). 'conditions': [ - [ 'arm_version==7 or arm_version=="default"', { - 'defines': [ - 'CAN_USE_ARMV7_INSTRUCTIONS=1', - ], - 'conditions': [ - [ 'arm_fpu=="default"', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - ], - }], - [ 'arm_fpu=="vfpv3-d16"', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - ], - }], - [ 'arm_fpu=="vfpv3"', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - 'CAN_USE_VFP32DREGS', - ], - }], - [ 'arm_fpu=="neon" or arm_neon==1', { - 'defines': [ - 'CAN_USE_VFP3_INSTRUCTIONS', - 'CAN_USE_VFP32DREGS', - ], - }], - ], - }], [ 'arm_float_abi=="hard"', { 'defines': [ 'USE_EABI_HARDFLOAT=1', @@ -260,9 +232,6 @@ ], }], ], - 'defines': [ - 'ARM_TEST', - ], }], ], }], # _toolset=="target" @@ -278,15 +247,19 @@ 'V8_TARGET_ARCH_IA32', ], }], # v8_target_arch=="ia32" + ['v8_target_arch=="x87"', { + 'defines': [ + 'V8_TARGET_ARCH_X87', + ], + 'cflags': ['-march=i586'], + }], # v8_target_arch=="x87" ['v8_target_arch=="mips"', { 'defines': [ 'V8_TARGET_ARCH_MIPS', ], - 'variables': { - 'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")', - }, 'conditions': [ - ['mipscompiler=="yes"', { + ['v8_target_arch==target_arch and android_webview_build==0', { + # Target built with a Mips CXX compiler. 'target_conditions': [ ['_toolset=="target"', { 'cflags': ['-EB'], @@ -299,10 +272,10 @@ 'cflags': ['-msoft-float'], 'ldflags': ['-msoft-float'], }], - ['mips_arch_variant=="mips32r2"', { + ['mips_arch_variant=="r2"', { 'cflags': ['-mips32r2', '-Wa,-mips32r2'], }], - ['mips_arch_variant=="mips32r1"', { + ['mips_arch_variant=="r1"', { 'cflags': ['-mips32', '-Wa,-mips32'], }], ], @@ -324,7 +297,7 @@ '__mips_soft_float=1' ], }], - ['mips_arch_variant=="mips32r2"', { + ['mips_arch_variant=="r2"', { 'defines': ['_MIPS_ARCH_MIPS32R2',], }], ], @@ -333,11 +306,9 @@ 'defines': [ 'V8_TARGET_ARCH_MIPS', ], - 'variables': { - 'mipscompiler': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: mips" && echo "yes" || echo "no")', - }, 'conditions': [ - ['mipscompiler=="yes"', { + ['v8_target_arch==target_arch and android_webview_build==0', { + # Target built with a Mips CXX compiler. 'target_conditions': [ ['_toolset=="target"', { 'cflags': ['-EL'], @@ -350,10 +321,10 @@ 'cflags': ['-msoft-float'], 'ldflags': ['-msoft-float'], }], - ['mips_arch_variant=="mips32r2"', { + ['mips_arch_variant=="r2"', { 'cflags': ['-mips32r2', '-Wa,-mips32r2'], }], - ['mips_arch_variant=="mips32r1"', { + ['mips_arch_variant=="r1"', { 'cflags': ['-mips32', '-Wa,-mips32'], }], ['mips_arch_variant=="loongson"', { @@ -378,7 +349,7 @@ '__mips_soft_float=1' ], }], - ['mips_arch_variant=="mips32r2"', { + ['mips_arch_variant=="r2"', { 'defines': ['_MIPS_ARCH_MIPS32R2',], }], ['mips_arch_variant=="loongson"', { @@ -386,6 +357,68 @@ }], ], }], # v8_target_arch=="mipsel" + ['v8_target_arch=="mips64el"', { + 'defines': [ + 'V8_TARGET_ARCH_MIPS64', + ], + 'conditions': [ + ['v8_target_arch==target_arch and android_webview_build==0', { + # Target built with a Mips CXX compiler. + 'target_conditions': [ + ['_toolset=="target"', { + 'cflags': ['-EL'], + 'ldflags': ['-EL'], + 'conditions': [ + [ 'v8_use_mips_abi_hardfloat=="true"', { + 'cflags': ['-mhard-float'], + 'ldflags': ['-mhard-float'], + }, { + 'cflags': ['-msoft-float'], + 'ldflags': ['-msoft-float'], + }], + ['mips_arch_variant=="r6"', { + 'cflags': ['-mips64r6', '-mabi=64', '-Wa,-mips64r6'], + 'ldflags': [ + '-mips64r6', '-mabi=64', + '-Wl,--dynamic-linker=$(LDSO_PATH)', + '-Wl,--rpath=$(LD_R_PATH)', + ], + }], + ['mips_arch_variant=="r2"', { + 'cflags': ['-mips64r2', '-mabi=64', '-Wa,-mips64r2'], + 'ldflags': [ + '-mips64r2', '-mabi=64', + '-Wl,--dynamic-linker=$(LDSO_PATH)', + '-Wl,--rpath=$(LD_R_PATH)', + ], + }], + ], + }], + ], + }], + [ 'v8_can_use_fpu_instructions=="true"', { + 'defines': [ + 'CAN_USE_FPU_INSTRUCTIONS', + ], + }], + [ 'v8_use_mips_abi_hardfloat=="true"', { + 'defines': [ + '__mips_hard_float=1', + 'CAN_USE_FPU_INSTRUCTIONS', + ], + }, { + 'defines': [ + '__mips_soft_float=1' + ], + }], + ['mips_arch_variant=="r6"', { + 'defines': ['_MIPS_ARCH_MIPS64R6',], + }], + ['mips_arch_variant=="r2"', { + 'defines': ['_MIPS_ARCH_MIPS64R2',], + }], + ], + }], # v8_target_arch=="mips64el" ['v8_target_arch=="x64"', { 'defines': [ 'V8_TARGET_ARCH_X64', @@ -400,16 +433,42 @@ }, 'msvs_configuration_platform': 'x64', }], # v8_target_arch=="x64" + ['v8_target_arch=="x32"', { + 'defines': [ + # x32 port shares the source code with x64 port. + 'V8_TARGET_ARCH_X64', + 'V8_TARGET_ARCH_32_BIT', + ], + 'cflags': [ + '-mx32', + # Inhibit warning if long long type is used. + '-Wno-long-long', + ], + 'ldflags': [ + '-mx32', + ], + }], # v8_target_arch=="x32" ['OS=="win"', { 'defines': [ 'WIN32', ], + # 4351: VS 2005 and later are warning us that they've fixed a bug + # present in VS 2003 and earlier. + 'msvs_disabled_warnings': [4351], 'msvs_configuration_attributes': { 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', 'CharacterSet': '1', }, }], + ['OS=="win" and v8_target_arch=="ia32"', { + 'msvs_settings': { + 'VCCLCompilerTool': { + # Ensure no surprising artifacts from 80bit double math with x86. + 'AdditionalOptions': ['/arch:SSE2'], + }, + }, + }], ['OS=="win" and v8_enable_prof==1', { 'msvs_settings': { 'VCLinkerTool': { @@ -417,44 +476,28 @@ }, }, }], - ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ - or OS=="netbsd" or OS=="qnx"', { - 'conditions': [ - [ 'v8_no_strict_aliasing==1', { - 'cflags': [ '-fno-strict-aliasing' ], - }], - ], # conditions - }], - ['OS=="solaris"', { - 'defines': [ '__C99FEATURES__=1' ], # isinf() etc. - }], - ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ + ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \ (v8_target_arch=="arm" or v8_target_arch=="ia32" or \ - v8_target_arch=="mips" or v8_target_arch=="mipsel")', { - # Check whether the host compiler and target compiler support the - # '-m32' option and set it if so. + v8_target_arch=="x87" or v8_target_arch=="mips" or \ + v8_target_arch=="mipsel")', { 'target_conditions': [ ['_toolset=="host"', { - 'variables': { - 'm32flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)', - }, - 'cflags': [ '<(m32flag)' ], - 'ldflags': [ '<(m32flag)' ], + 'conditions': [ + ['host_cxx_is_biarch==1', { + 'cflags': [ '-m32' ], + 'ldflags': [ '-m32' ] + }], + ], 'xcode_settings': { 'ARCHS': [ 'i386' ], }, }], ['_toolset=="target"', { - 'variables': { - 'm32flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m32 -E - > /dev/null 2>&1 < /dev/null) && echo "-m32" || true)', - 'clang%': 0, - }, 'conditions': [ - ['((OS!="android" and OS!="qnx") or clang==1) and \ - nacl_target_arch!="nacl_x64"', { - 'cflags': [ '<(m32flag)' ], - 'ldflags': [ '<(m32flag)' ], + ['target_cxx_is_biarch==1 and nacl_target_arch!="nacl_x64"', { + 'cflags': [ '-m32' ], + 'ldflags': [ '-m32' ], }], ], 'xcode_settings': { @@ -465,28 +508,35 @@ }], ['(OS=="linux" or OS=="android") and \ (v8_target_arch=="x64" or v8_target_arch=="arm64")', { - # Check whether the host compiler and target compiler support the - # '-m64' option and set it if so. 'target_conditions': [ ['_toolset=="host"', { - 'variables': { - 'm64flag': '<!(($(echo ${CXX_host:-$(which g++)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)', - }, - 'cflags': [ '<(m64flag)' ], - 'ldflags': [ '<(m64flag)' ], - }], - ['_toolset=="target"', { - 'variables': { - 'm64flag': '<!(($(echo ${CXX_target:-<(CXX)}) -m64 -E - > /dev/null 2>&1 < /dev/null) && echo "-m64" || true)', - }, 'conditions': [ - ['((OS!="android" and OS!="qnx") or clang==1)', { - 'cflags': [ '<(m64flag)' ], - 'ldflags': [ '<(m64flag)' ], + ['host_cxx_is_biarch==1', { + 'cflags': [ '-m64' ], + 'ldflags': [ '-m64' ] }], - ], - }] - ], + ], + }], + ['_toolset=="target"', { + 'conditions': [ + ['target_cxx_is_biarch==1', { + 'cflags': [ '-m64' ], + 'ldflags': [ '-m64' ], + }], + ] + }], + ], + }], + ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ + or OS=="netbsd" or OS=="qnx"', { + 'conditions': [ + [ 'v8_no_strict_aliasing==1', { + 'cflags': [ '-fno-strict-aliasing' ], + }], + ], # conditions + }], + ['OS=="solaris"', { + 'defines': [ '__C99FEATURES__=1' ], # isinf() etc. }], ['OS=="freebsd" or OS=="openbsd"', { 'cflags': [ '-I/usr/local/include' ], |