From 50624a50ee484b8a53cd4f1155e4e53f19c803be Mon Sep 17 00:00:00 2001 From: isaacs Date: Fri, 19 Apr 2013 10:50:44 -0700 Subject: V8: Upgrade to 3.18.1 --- deps/v8/.gitignore | 2 - deps/v8/ChangeLog | 9 + deps/v8/SConstruct | 1612 -------------------- deps/v8/build/common.gypi | 9 + deps/v8/preparser/SConscript | 38 - deps/v8/samples/SConscript | 38 - deps/v8/src/SConscript | 413 ----- deps/v8/src/api.cc | 3 + deps/v8/src/arguments.h | 21 +- deps/v8/src/arm/assembler-arm-inl.h | 25 +- deps/v8/src/arm/assembler-arm.cc | 4 - deps/v8/src/arm/assembler-arm.h | 26 - deps/v8/src/arm/code-stubs-arm.cc | 7 +- deps/v8/src/arm/code-stubs-arm.h | 2 +- deps/v8/src/arm/constants-arm.h | 37 +- deps/v8/src/arm/cpu-arm.cc | 2 +- deps/v8/src/arm/debug-arm.cc | 20 - deps/v8/src/arm/full-codegen-arm.cc | 12 - deps/v8/src/arm/lithium-arm.cc | 10 +- deps/v8/src/arm/lithium-codegen-arm.cc | 71 +- deps/v8/src/arm/lithium-codegen-arm.h | 4 +- deps/v8/src/arm/macro-assembler-arm.cc | 88 -- deps/v8/src/arm/macro-assembler-arm.h | 9 - deps/v8/src/arm/simulator-arm.cc | 134 +- deps/v8/src/arm/simulator-arm.h | 6 +- deps/v8/src/atomicops_internals_x86_gcc.h | 2 +- deps/v8/src/builtins-decls.h | 40 - deps/v8/src/builtins.cc | 34 +- deps/v8/src/builtins.h | 2 + deps/v8/src/code-stubs-hydrogen.cc | 23 +- deps/v8/src/code-stubs.cc | 6 +- deps/v8/src/code-stubs.h | 30 +- deps/v8/src/codegen.cc | 9 +- deps/v8/src/compiler.cc | 10 +- deps/v8/src/compiler.h | 2 +- deps/v8/src/deoptimizer.cc | 5 +- deps/v8/src/disassembler.cc | 3 +- deps/v8/src/factory.cc | 11 +- deps/v8/src/factory.h | 4 +- deps/v8/src/generator.js | 20 + deps/v8/src/heap-inl.h | 7 + deps/v8/src/heap.cc | 5 +- deps/v8/src/heap.h | 6 +- deps/v8/src/hydrogen-instructions.cc | 45 +- deps/v8/src/hydrogen-instructions.h | 9 +- deps/v8/src/hydrogen.cc | 453 ++++-- deps/v8/src/hydrogen.h | 185 ++- deps/v8/src/ia32/code-stubs-ia32.cc | 1 - deps/v8/src/ia32/code-stubs-ia32.h | 2 +- deps/v8/src/ia32/full-codegen-ia32.cc | 12 - deps/v8/src/ia32/lithium-codegen-ia32.cc | 20 +- deps/v8/src/ia32/lithium-codegen-ia32.h | 5 +- deps/v8/src/ia32/lithium-ia32.cc | 12 +- deps/v8/src/ic.cc | 4 +- deps/v8/src/lithium.cc | 6 +- deps/v8/src/lithium.h | 2 +- deps/v8/src/log.cc | 1 - deps/v8/src/macros.py | 1 + deps/v8/src/mips/code-stubs-mips.cc | 1 - deps/v8/src/mips/code-stubs-mips.h | 2 +- deps/v8/src/mips/full-codegen-mips.cc | 13 - deps/v8/src/mips/lithium-codegen-mips.cc | 12 +- deps/v8/src/mips/lithium-codegen-mips.h | 7 +- deps/v8/src/objects-inl.h | 23 +- deps/v8/src/objects-printer.cc | 2 + deps/v8/src/objects.cc | 3 +- deps/v8/src/objects.h | 23 +- deps/v8/src/parser.cc | 15 +- deps/v8/src/platform-freebsd.cc | 2 - deps/v8/src/platform-linux.cc | 2 - deps/v8/src/platform-posix.cc | 17 +- deps/v8/src/runtime-profiler.cc | 3 +- deps/v8/src/runtime.cc | 38 +- deps/v8/src/runtime.h | 13 + deps/v8/src/safepoint-table.cc | 3 +- deps/v8/src/spaces.cc | 1 - deps/v8/src/version.cc | 2 +- deps/v8/src/x64/code-stubs-x64.cc | 49 +- deps/v8/src/x64/code-stubs-x64.h | 2 +- deps/v8/src/x64/frames-x64.h | 7 +- deps/v8/src/x64/full-codegen-x64.cc | 12 - deps/v8/src/x64/lithium-codegen-x64.cc | 19 +- deps/v8/src/x64/lithium-codegen-x64.h | 3 +- deps/v8/src/x64/lithium-x64.cc | 12 +- deps/v8/test/benchmarks/testcfg.py | 105 -- deps/v8/test/cctest/SConscript | 152 -- deps/v8/test/cctest/cctest.gyp | 4 +- deps/v8/test/cctest/testcfg.py | 97 -- deps/v8/test/es5conform/README | 14 - deps/v8/test/es5conform/es5conform.status | 316 ---- deps/v8/test/es5conform/harness-adapt.js | 74 - deps/v8/test/es5conform/testcfg.py | 114 -- deps/v8/test/message/testcfg.py | 115 +- deps/v8/test/mjsunit/harmony/generators-objects.js | 27 +- deps/v8/test/mjsunit/harmony/typedarrays.js | 2 + .../regress/regress-grow-store-smi-check.js | 53 + deps/v8/test/mjsunit/string-fromcharcode.js | 21 + deps/v8/test/mjsunit/testcfg.py | 133 +- deps/v8/test/mozilla/testcfg.py | 97 +- deps/v8/test/preparser/testcfg.py | 144 +- deps/v8/test/sputnik/README | 6 - deps/v8/test/sputnik/sputnik.status | 231 --- deps/v8/test/sputnik/testcfg.py | 118 -- deps/v8/test/test262/testcfg.py | 112 -- deps/v8/tools/test-wrapper-gypbuild.py | 270 ---- deps/v8/tools/test.py | 1559 ------------------- 106 files changed, 1079 insertions(+), 6550 deletions(-) delete mode 100644 deps/v8/SConstruct delete mode 100644 deps/v8/preparser/SConscript delete mode 100644 deps/v8/samples/SConscript delete mode 100755 deps/v8/src/SConscript delete mode 100644 deps/v8/src/builtins-decls.h delete mode 100644 deps/v8/test/benchmarks/testcfg.py delete mode 100644 deps/v8/test/cctest/SConscript delete mode 100644 deps/v8/test/es5conform/README delete mode 100644 deps/v8/test/es5conform/es5conform.status delete mode 100644 deps/v8/test/es5conform/harness-adapt.js delete mode 100644 deps/v8/test/es5conform/testcfg.py create mode 100644 deps/v8/test/mjsunit/regress/regress-grow-store-smi-check.js delete mode 100644 deps/v8/test/sputnik/README delete mode 100644 deps/v8/test/sputnik/sputnik.status delete mode 100644 deps/v8/test/sputnik/testcfg.py delete mode 100755 deps/v8/tools/test-wrapper-gypbuild.py delete mode 100755 deps/v8/tools/test.py (limited to 'deps') diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index fe8425f021..10121a1132 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -29,7 +29,6 @@ shell_g /obj /out /test/cctest/cctest.status2 -/test/es5conform/data /test/message/message.status2 /test/mjsunit/mjsunit.status2 /test/mozilla/CHECKED_OUT_VERSION @@ -37,7 +36,6 @@ shell_g /test/mozilla/downloaded_* /test/mozilla/mozilla.status2 /test/preparser/preparser.status2 -/test/sputnik/sputniktests /test/test262/data /test/test262/test262-* /test/test262/test262.status2 diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index 70aa73a43b..5f64a3e923 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,12 @@ +2013-04-18: Version 3.18.1 + + Removed SCons related files and deprecated test suite configurations. + + Improved handling of unary plus (issue 2527). + + Performance and stability improvements on all platforms. + + 2013-04-17: Version 3.18.0 Enabled pretenuring of fast literals in high promotion mode. diff --git a/deps/v8/SConstruct b/deps/v8/SConstruct deleted file mode 100644 index 21d1902733..0000000000 --- a/deps/v8/SConstruct +++ /dev/null @@ -1,1612 +0,0 @@ -# Copyright 2012 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. - -import platform -import re -import subprocess -import sys -import os -from os.path import join, dirname, abspath -from types import DictType, StringTypes -root_dir = dirname(File('SConstruct').rfile().abspath) -src_dir = join(root_dir, 'src') -sys.path.insert(0, join(root_dir, 'tools')) -import js2c, utils - -# ARM_TARGET_LIB is the path to the dynamic library to use on the target -# machine if cross-compiling to an arm machine. You will also need to set -# the additional cross-compiling environment variables to the cross compiler. -ARM_TARGET_LIB = os.environ.get('ARM_TARGET_LIB') -if ARM_TARGET_LIB: - ARM_LINK_FLAGS = ['-Wl,-rpath=' + ARM_TARGET_LIB + '/lib:' + - ARM_TARGET_LIB + '/usr/lib', - '-Wl,--dynamic-linker=' + ARM_TARGET_LIB + - '/lib/ld-linux.so.3'] -else: - ARM_LINK_FLAGS = [] - -GCC_EXTRA_CCFLAGS = [] -GCC_DTOA_EXTRA_CCFLAGS = [] - -LIBRARY_FLAGS = { - 'all': { - 'CPPPATH': [src_dir], - 'regexp:interpreted': { - 'CPPDEFINES': ['V8_INTERPRETED_REGEXP'] - }, - 'mode:debug': { - 'CPPDEFINES': ['V8_ENABLE_CHECKS', 'OBJECT_PRINT', 'VERIFY_HEAP'] - }, - 'objectprint:on': { - 'CPPDEFINES': ['OBJECT_PRINT'], - }, - 'debuggersupport:on': { - 'CPPDEFINES': ['ENABLE_DEBUGGER_SUPPORT'], - }, - 'fasttls:off': { - 'CPPDEFINES': ['V8_NO_FAST_TLS'], - }, - }, - 'gcc': { - 'all': { - 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], - 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], - }, - 'visibility:hidden': { - # Use visibility=default to disable this. - 'CXXFLAGS': ['-fvisibility=hidden'] - }, - 'strictaliasing:off': { - 'CCFLAGS': ['-fno-strict-aliasing'] - }, - 'mode:debug': { - 'CCFLAGS': ['-g', '-O0'], - 'CPPDEFINES': ['ENABLE_DISASSEMBLER', 'DEBUG'], - }, - 'mode:release': { - 'CCFLAGS': ['-O3', '-fomit-frame-pointer', '-fdata-sections', - '-ffunction-sections'], - }, - 'os:linux': { - 'CCFLAGS': ['-ansi'] + GCC_EXTRA_CCFLAGS, - 'library:shared': { - 'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'], - 'LIBS': ['pthread'] - } - }, - 'os:macos': { - 'CCFLAGS': ['-ansi', '-mmacosx-version-min=10.4'], - 'library:shared': { - 'CPPDEFINES': ['V8_SHARED', 'BUILDING_V8_SHARED'], - } - }, - 'os:freebsd': { - 'CPPPATH' : [src_dir, '/usr/local/include'], - 'LIBPATH' : ['/usr/local/lib'], - 'CCFLAGS': ['-ansi'], - 'LIBS': ['execinfo'] - }, - 'os:openbsd': { - 'CPPPATH' : [src_dir, '/usr/local/include'], - 'LIBPATH' : ['/usr/local/lib'], - 'CCFLAGS': ['-ansi'], - }, - 'os:solaris': { - # On Solaris, to get isinf, INFINITY, fpclassify and other macros one - # needs to define __C99FEATURES__. - 'CPPDEFINES': ['__C99FEATURES__'], - 'CPPPATH' : [src_dir, '/usr/local/include'], - 'LIBPATH' : ['/usr/local/lib'], - 'CCFLAGS': ['-ansi'], - }, - 'os:netbsd': { - 'CPPPATH' : [src_dir, '/usr/pkg/include'], - 'LIBPATH' : ['/usr/pkg/lib'], - }, - 'os:win32': { - 'CCFLAGS': ['-DWIN32'], - 'CXXFLAGS': ['-DWIN32'], - }, - 'arch:ia32': { - 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'], - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'] - }, - 'arch:arm': { - 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], - 'unalignedaccesses:on' : { - 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=1'] - }, - 'unalignedaccesses:off' : { - 'CPPDEFINES' : ['CAN_USE_UNALIGNED_ACCESSES=0'] - }, - 'armeabi:soft' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=soft'], - } - }, - 'armeabi:softfp' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], - 'vfp3:on': { - 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] - }, - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=softfp'], - } - }, - 'armeabi:hard' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'], - 'vfp3:on': { - 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] - }, - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=hard'], - } - } - }, - 'simulator:arm': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'], - }, - 'arch:mips': { - 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], - 'mips_arch_variant:mips32r2': { - 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] - }, - 'mips_arch_variant:loongson': { - 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] - }, - 'simulator:none': { - 'CCFLAGS': ['-EL'], - 'LINKFLAGS': ['-EL'], - 'mips_arch_variant:mips32r2': { - 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] - }, - 'mips_arch_variant:mips32r1': { - 'CCFLAGS': ['-mips32', '-Wa,-mips32'] - }, - 'mips_arch_variant:loongson': { - 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] - }, - 'library:static': { - 'LINKFLAGS': ['-static', '-static-libgcc'] - }, - 'mipsabi:softfloat': { - 'CCFLAGS': ['-msoft-float'], - 'LINKFLAGS': ['-msoft-float'] - }, - 'mipsabi:hardfloat': { - 'CCFLAGS': ['-mhard-float'], - 'LINKFLAGS': ['-mhard-float'] - } - } - }, - 'simulator:mips': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'], - 'mipsabi:softfloat': { - 'CPPDEFINES': ['__mips_soft_float=1'], - 'fpu:on': { - 'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS'] - } - }, - 'mipsabi:hardfloat': { - 'CPPDEFINES': ['__mips_hard_float=1', 'CAN_USE_FPU_INSTRUCTIONS'], - } - }, - 'arch:x64': { - 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], - 'CCFLAGS': ['-m64'], - 'LINKFLAGS': ['-m64'], - }, - 'gdbjit:on': { - 'CPPDEFINES': ['ENABLE_GDB_JIT_INTERFACE'] - }, - 'compress_startup_data:bz2': { - 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'] - } - }, - 'msvc': { - 'all': { - 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], - 'CXXFLAGS': ['/GR-', '/Gy'], - 'CPPDEFINES': ['WIN32'], - 'LINKFLAGS': ['/INCREMENTAL:NO', '/NXCOMPAT', '/IGNORE:4221'], - 'CCPDBFLAGS': ['/Zi'] - }, - 'verbose:off': { - 'DIALECTFLAGS': ['/nologo'], - 'ARFLAGS': ['/NOLOGO'] - }, - 'arch:ia32': { - 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', '_USE_32BIT_TIME_T'], - 'LINKFLAGS': ['/MACHINE:X86'], - 'ARFLAGS': ['/MACHINE:X86'] - }, - 'arch:x64': { - 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], - 'LINKFLAGS': ['/MACHINE:X64'], - 'ARFLAGS': ['/MACHINE:X64'] - }, - 'mode:debug': { - 'CCFLAGS': ['/Od', '/Gm'], - 'CPPDEFINES': ['_DEBUG', 'ENABLE_DISASSEMBLER', 'DEBUG'], - 'LINKFLAGS': ['/DEBUG'], - 'msvcrt:static': { - 'CCFLAGS': ['/MTd'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MDd'] - } - }, - 'mode:release': { - 'CCFLAGS': ['/O2'], - 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], - 'msvcrt:static': { - 'CCFLAGS': ['/MT'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MD'] - }, - 'msvcltcg:on': { - 'CCFLAGS': ['/GL'], - 'ARFLAGS': ['/LTCG'], - 'pgo:off': { - 'LINKFLAGS': ['/LTCG'], - }, - 'pgo:instrument': { - 'LINKFLAGS': ['/LTCG:PGI'] - }, - 'pgo:optimize': { - 'LINKFLAGS': ['/LTCG:PGO'] - } - } - } - } -} - - -V8_EXTRA_FLAGS = { - 'gcc': { - 'all': { - 'WARNINGFLAGS': ['-Wall', - '-Werror', - '-W', - '-Wno-unused-parameter', - '-Woverloaded-virtual', - '-Wnon-virtual-dtor'] - }, - 'os:win32': { - 'WARNINGFLAGS': ['-pedantic', - '-Wno-long-long', - '-Wno-pedantic-ms-format'], - 'library:shared': { - 'LIBS': ['winmm', 'ws2_32'] - } - }, - 'os:linux': { - 'WARNINGFLAGS': ['-pedantic'], - 'library:shared': { - 'soname:on': { - 'LINKFLAGS': ['-Wl,-soname,${SONAME}'] - } - } - }, - 'os:macos': { - 'WARNINGFLAGS': ['-pedantic'] - }, - 'arch:arm': { - # This is to silence warnings about ABI changes that some versions of the - # CodeSourcery G++ tool chain produce for each occurrence of varargs. - 'WARNINGFLAGS': ['-Wno-abi'] - }, - 'disassembler:on': { - 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] - } - }, - 'msvc': { - 'all': { - 'WARNINGFLAGS': ['/W3', '/WX', '/wd4351', '/wd4355', '/wd4800'] - }, - 'library:shared': { - 'CPPDEFINES': ['BUILDING_V8_SHARED'], - 'LIBS': ['winmm', 'ws2_32'] - }, - 'arch:arm': { - 'CPPDEFINES': ['V8_TARGET_ARCH_ARM'], - # /wd4996 is to silence the warning about sscanf - # used by the arm simulator. - 'WARNINGFLAGS': ['/wd4996'] - }, - 'arch:mips': { - 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], - 'mips_arch_variant:mips32r2': { - 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] - }, - }, - 'disassembler:on': { - 'CPPDEFINES': ['ENABLE_DISASSEMBLER'] - } - } -} - - -MKSNAPSHOT_EXTRA_FLAGS = { - 'gcc': { - 'os:linux': { - 'LIBS': ['pthread'], - }, - 'os:macos': { - 'LIBS': ['pthread'], - }, - 'os:freebsd': { - 'LIBS': ['execinfo', 'pthread'] - }, - 'os:solaris': { - 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], - 'LINKFLAGS': ['-mt'] - }, - 'os:openbsd': { - 'LIBS': ['execinfo', 'pthread'] - }, - 'os:win32': { - 'LIBS': ['winmm', 'ws2_32'], - }, - 'os:netbsd': { - 'LIBS': ['execinfo', 'pthread'] - }, - 'compress_startup_data:bz2': { - 'os:linux': { - 'LIBS': ['bz2'] - } - }, - }, - 'msvc': { - 'all': { - 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], - 'LIBS': ['winmm', 'ws2_32'] - } - } -} - - -DTOA_EXTRA_FLAGS = { - 'gcc': { - 'all': { - 'WARNINGFLAGS': ['-Werror', '-Wno-uninitialized'], - 'CCFLAGS': GCC_DTOA_EXTRA_CCFLAGS - } - }, - 'msvc': { - 'all': { - 'WARNINGFLAGS': ['/WX', '/wd4018', '/wd4244'] - } - } -} - - -CCTEST_EXTRA_FLAGS = { - 'all': { - 'CPPPATH': [src_dir], - 'library:shared': { - 'CPPDEFINES': ['USING_V8_SHARED'] - }, - }, - 'gcc': { - 'all': { - 'LIBPATH': [abspath('.')], - 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], - 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], - 'LINKFLAGS': ['$CCFLAGS'], - }, - 'os:linux': { - 'LIBS': ['pthread'], - 'CCFLAGS': ['-Wno-unused-but-set-variable'], - }, - 'os:macos': { - 'LIBS': ['pthread'], - }, - 'os:freebsd': { - 'LIBS': ['execinfo', 'pthread'] - }, - 'os:solaris': { - 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], - 'LINKFLAGS': ['-mt'] - }, - 'os:openbsd': { - 'LIBS': ['execinfo', 'pthread'] - }, - 'os:win32': { - 'LIBS': ['winmm', 'ws2_32'] - }, - 'os:netbsd': { - 'LIBS': ['execinfo', 'pthread'] - }, - 'arch:arm': { - 'LINKFLAGS': ARM_LINK_FLAGS - }, - }, - 'msvc': { - 'all': { - 'CPPDEFINES': ['_HAS_EXCEPTIONS=0'], - 'LIBS': ['winmm', 'ws2_32'] - }, - 'arch:ia32': { - 'CPPDEFINES': ['V8_TARGET_ARCH_IA32'] - }, - 'arch:x64': { - 'CPPDEFINES': ['V8_TARGET_ARCH_X64'], - 'LINKFLAGS': ['/STACK:2097152'] - }, - } -} - - -SAMPLE_FLAGS = { - 'all': { - 'CPPPATH': [join(root_dir, 'include')], - 'library:shared': { - 'CPPDEFINES': ['USING_V8_SHARED'] - }, - }, - 'gcc': { - 'all': { - 'LIBPATH': ['.'], - 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], - 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], - 'LINKFLAGS': ['$CCFLAGS'], - }, - 'os:linux': { - 'LIBS': ['pthread'], - }, - 'os:macos': { - 'LIBS': ['pthread'], - }, - 'os:freebsd': { - 'LIBPATH' : ['/usr/local/lib'], - 'LIBS': ['execinfo', 'pthread'] - }, - 'os:solaris': { - # On Solaris, to get isinf, INFINITY, fpclassify and other macros one - # needs to define __C99FEATURES__. - 'CPPDEFINES': ['__C99FEATURES__'], - 'LIBPATH' : ['/usr/local/lib'], - 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], - 'LINKFLAGS': ['-mt'] - }, - 'os:openbsd': { - 'LIBPATH' : ['/usr/local/lib'], - 'LIBS': ['execinfo', 'pthread'] - }, - 'os:win32': { - 'LIBS': ['winmm', 'ws2_32'] - }, - 'os:netbsd': { - 'LIBPATH' : ['/usr/pkg/lib'], - 'LIBS': ['execinfo', 'pthread'] - }, - 'arch:arm': { - 'LINKFLAGS': ARM_LINK_FLAGS, - 'armeabi:soft' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=soft'], - } - }, - 'armeabi:softfp' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=softfp'], - } - }, - 'armeabi:hard' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=1'], - 'vfp3:on': { - 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] - }, - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=hard'], - } - } - }, - 'arch:ia32': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'] - }, - 'arch:x64': { - 'CCFLAGS': ['-m64'], - 'LINKFLAGS': ['-m64'] - }, - 'arch:mips': { - 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], - 'mips_arch_variant:mips32r2': { - 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] - }, - 'mips_arch_variant:loongson': { - 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] - }, - 'simulator:none': { - 'CCFLAGS': ['-EL'], - 'LINKFLAGS': ['-EL'], - 'mips_arch_variant:mips32r2': { - 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] - }, - 'mips_arch_variant:mips32r1': { - 'CCFLAGS': ['-mips32', '-Wa,-mips32'] - }, - 'mips_arch_variant:loongson': { - 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] - }, - 'library:static': { - 'LINKFLAGS': ['-static', '-static-libgcc'] - }, - 'mipsabi:softfloat': { - 'CCFLAGS': ['-msoft-float'], - 'LINKFLAGS': ['-msoft-float'] - }, - 'mipsabi:hardfloat': { - 'CCFLAGS': ['-mhard-float'], - 'LINKFLAGS': ['-mhard-float'], - 'fpu:on': { - 'CPPDEFINES' : ['CAN_USE_FPU_INSTRUCTIONS'] - } - } - } - }, - 'simulator:arm': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'] - }, - 'simulator:mips': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'] - }, - 'mode:release': { - 'CCFLAGS': ['-O2'] - }, - 'mode:debug': { - 'CCFLAGS': ['-g', '-O0'], - 'CPPDEFINES': ['DEBUG'] - }, - 'compress_startup_data:bz2': { - 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], - 'os:linux': { - 'LIBS': ['bz2'] - } - }, - }, - 'msvc': { - 'all': { - 'LIBS': ['winmm', 'ws2_32'] - }, - 'verbose:off': { - 'CCFLAGS': ['/nologo'], - 'LINKFLAGS': ['/NOLOGO'] - }, - 'verbose:on': { - 'LINKFLAGS': ['/VERBOSE'] - }, - 'prof:on': { - 'LINKFLAGS': ['/MAP'] - }, - 'mode:release': { - 'CCFLAGS': ['/O2'], - 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], - 'msvcrt:static': { - 'CCFLAGS': ['/MT'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MD'] - }, - 'msvcltcg:on': { - 'CCFLAGS': ['/GL'], - 'pgo:off': { - 'LINKFLAGS': ['/LTCG'], - }, - }, - 'pgo:instrument': { - 'LINKFLAGS': ['/LTCG:PGI'] - }, - 'pgo:optimize': { - 'LINKFLAGS': ['/LTCG:PGO'] - } - }, - 'arch:ia32': { - 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], - 'LINKFLAGS': ['/MACHINE:X86'] - }, - 'arch:x64': { - 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], - 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] - }, - 'mode:debug': { - 'CCFLAGS': ['/Od'], - 'LINKFLAGS': ['/DEBUG'], - 'CPPDEFINES': ['DEBUG'], - 'msvcrt:static': { - 'CCFLAGS': ['/MTd'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MDd'] - } - } - } -} - - -PREPARSER_FLAGS = { - 'all': { - 'CPPPATH': [join(root_dir, 'include'), src_dir], - 'library:shared': { - 'CPPDEFINES': ['USING_V8_SHARED'] - }, - }, - 'gcc': { - 'all': { - 'LIBPATH': ['.'], - 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], - 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], - 'LINKFLAGS': ['$CCFLAGS'], - }, - 'os:win32': { - 'LIBS': ['winmm', 'ws2_32'] - }, - 'arch:arm': { - 'LINKFLAGS': ARM_LINK_FLAGS, - 'armeabi:soft' : { - 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=soft'], - } - }, - 'armeabi:softfp' : { - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=softfp'], - } - }, - 'armeabi:hard' : { - 'simulator:none': { - 'CCFLAGS': ['-mfloat-abi=hard'], - } - } - }, - 'arch:ia32': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'] - }, - 'arch:x64': { - 'CCFLAGS': ['-m64'], - 'LINKFLAGS': ['-m64'] - }, - 'arch:mips': { - 'CPPDEFINES': ['V8_TARGET_ARCH_MIPS'], - 'mips_arch_variant:mips32r2': { - 'CPPDEFINES': ['_MIPS_ARCH_MIPS32R2'] - }, - 'mips_arch_variant:loongson': { - 'CPPDEFINES': ['_MIPS_ARCH_LOONGSON'] - }, - 'simulator:none': { - 'CCFLAGS': ['-EL'], - 'LINKFLAGS': ['-EL'], - 'mips_arch_variant:mips32r2': { - 'CCFLAGS': ['-mips32r2', '-Wa,-mips32r2'] - }, - 'mips_arch_variant:mips32r1': { - 'CCFLAGS': ['-mips32', '-Wa,-mips32'] - }, - 'mips_arch_variant:loongson': { - 'CCFLAGS': ['-march=mips3', '-Wa,-march=mips3'] - }, - 'library:static': { - 'LINKFLAGS': ['-static', '-static-libgcc'] - }, - 'mipsabi:softfloat': { - 'CCFLAGS': ['-msoft-float'], - 'LINKFLAGS': ['-msoft-float'] - }, - 'mipsabi:hardfloat': { - 'CCFLAGS': ['-mhard-float'], - 'LINKFLAGS': ['-mhard-float'] - } - } - }, - 'simulator:arm': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'] - }, - 'simulator:mips': { - 'CCFLAGS': ['-m32'], - 'LINKFLAGS': ['-m32'], - 'mipsabi:softfloat': { - 'CPPDEFINES': ['__mips_soft_float=1'], - }, - 'mipsabi:hardfloat': { - 'CPPDEFINES': ['__mips_hard_float=1'], - } - }, - 'mode:release': { - 'CCFLAGS': ['-O2'] - }, - 'mode:debug': { - 'CCFLAGS': ['-g', '-O0'], - 'CPPDEFINES': ['DEBUG'] - }, - 'os:freebsd': { - 'LIBPATH' : ['/usr/local/lib'], - }, - }, - 'msvc': { - 'all': { - 'LIBS': ['winmm', 'ws2_32'] - }, - 'verbose:off': { - 'CCFLAGS': ['/nologo'], - 'LINKFLAGS': ['/NOLOGO'] - }, - 'verbose:on': { - 'LINKFLAGS': ['/VERBOSE'] - }, - 'prof:on': { - 'LINKFLAGS': ['/MAP'] - }, - 'mode:release': { - 'CCFLAGS': ['/O2'], - 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], - 'msvcrt:static': { - 'CCFLAGS': ['/MT'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MD'] - }, - 'msvcltcg:on': { - 'CCFLAGS': ['/GL'], - 'pgo:off': { - 'LINKFLAGS': ['/LTCG'], - }, - }, - 'pgo:instrument': { - 'LINKFLAGS': ['/LTCG:PGI'] - }, - 'pgo:optimize': { - 'LINKFLAGS': ['/LTCG:PGO'] - } - }, - 'arch:ia32': { - 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], - 'LINKFLAGS': ['/MACHINE:X86'] - }, - 'arch:x64': { - 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], - 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] - }, - 'mode:debug': { - 'CCFLAGS': ['/Od'], - 'LINKFLAGS': ['/DEBUG'], - 'CPPDEFINES': ['DEBUG'], - 'msvcrt:static': { - 'CCFLAGS': ['/MTd'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MDd'] - } - } - } -} - - -D8_FLAGS = { - 'all': { - 'library:shared': { - 'CPPDEFINES': ['V8_SHARED'], - 'LIBS': ['v8'], - 'LIBPATH': ['.'] - }, - }, - 'gcc': { - 'all': { - 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], - 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], - 'LINKFLAGS': ['$CCFLAGS'], - }, - 'console:readline': { - 'LIBS': ['readline'] - }, - 'os:linux': { - 'LIBS': ['pthread'], - }, - 'os:macos': { - 'LIBS': ['pthread'], - }, - 'os:freebsd': { - 'LIBS': ['pthread'], - }, - 'os:solaris': { - 'LIBS': ['m', 'pthread', 'socket', 'nsl', 'rt'], - 'LINKFLAGS': ['-mt'] - }, - 'os:openbsd': { - 'LIBS': ['pthread'], - }, - 'os:win32': { - 'LIBS': ['winmm', 'ws2_32'], - }, - 'os:netbsd': { - 'LIBS': ['pthread'], - }, - 'arch:arm': { - 'LINKFLAGS': ARM_LINK_FLAGS - }, - 'compress_startup_data:bz2': { - 'CPPDEFINES': ['COMPRESS_STARTUP_DATA_BZ2'], - 'os:linux': { - 'LIBS': ['bz2'] - } - } - }, - 'msvc': { - 'all': { - 'LIBS': ['winmm', 'ws2_32'] - }, - 'verbose:off': { - 'CCFLAGS': ['/nologo'], - 'LINKFLAGS': ['/NOLOGO'] - }, - 'verbose:on': { - 'LINKFLAGS': ['/VERBOSE'] - }, - 'prof:on': { - 'LINKFLAGS': ['/MAP'] - }, - 'mode:release': { - 'CCFLAGS': ['/O2'], - 'LINKFLAGS': ['/OPT:REF', '/OPT:ICF'], - 'msvcrt:static': { - 'CCFLAGS': ['/MT'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MD'] - }, - 'msvcltcg:on': { - 'CCFLAGS': ['/GL'], - 'pgo:off': { - 'LINKFLAGS': ['/LTCG'], - }, - }, - 'pgo:instrument': { - 'LINKFLAGS': ['/LTCG:PGI'] - }, - 'pgo:optimize': { - 'LINKFLAGS': ['/LTCG:PGO'] - } - }, - 'arch:ia32': { - 'CPPDEFINES': ['V8_TARGET_ARCH_IA32', 'WIN32'], - 'LINKFLAGS': ['/MACHINE:X86'] - }, - 'arch:x64': { - 'CPPDEFINES': ['V8_TARGET_ARCH_X64', 'WIN32'], - 'LINKFLAGS': ['/MACHINE:X64', '/STACK:2097152'] - }, - 'mode:debug': { - 'CCFLAGS': ['/Od'], - 'LINKFLAGS': ['/DEBUG'], - 'CPPDEFINES': ['DEBUG'], - 'msvcrt:static': { - 'CCFLAGS': ['/MTd'] - }, - 'msvcrt:shared': { - 'CCFLAGS': ['/MDd'] - } - } - } -} - - -SUFFIXES = { - 'release': '', - 'debug': '_g' -} - - -def Abort(message): - print message - sys.exit(1) - - -def GuessOS(env): - return utils.GuessOS() - - -def GuessArch(env): - return utils.GuessArchitecture() - - -def GuessToolchain(env): - tools = env['TOOLS'] - if 'gcc' in tools: - return 'gcc' - elif 'msvc' in tools: - return 'msvc' - else: - return None - - -def GuessVisibility(env): - os = env['os'] - toolchain = env['toolchain']; - if (os == 'win32' or os == 'cygwin') and toolchain == 'gcc': - # MinGW / Cygwin can't do it. - return 'default' - elif os == 'solaris': - return 'default' - else: - return 'hidden' - - -def GuessStrictAliasing(env): - # There seems to be a problem with gcc 4.5.x. - # See http://code.google.com/p/v8/issues/detail?id=884 - # It can be worked around by disabling strict aliasing. - toolchain = env['toolchain']; - if toolchain == 'gcc': - env = Environment(tools=['gcc']) - # The gcc version should be available in env['CCVERSION'], - # but when scons detects msvc this value is not set. - version = subprocess.Popen([env['CC'], '-dumpversion'], - stdout=subprocess.PIPE).communicate()[0] - if version.find('4.5') == 0: - return 'off' - return 'default' - - -PLATFORM_OPTIONS = { - 'arch': { - 'values': ['arm', 'ia32', 'x64', 'mips'], - 'guess': GuessArch, - 'help': 'the architecture to build for' - }, - 'os': { - 'values': ['freebsd', 'linux', 'macos', 'win32', 'openbsd', 'solaris', 'cygwin', 'netbsd'], - 'guess': GuessOS, - 'help': 'the os to build for' - }, - 'toolchain': { - 'values': ['gcc', 'msvc'], - 'guess': GuessToolchain, - 'help': 'the toolchain to use' - } -} - -SIMPLE_OPTIONS = { - 'regexp': { - 'values': ['native', 'interpreted'], - 'default': 'native', - 'help': 'Whether to use native or interpreted regexp implementation' - }, - 'snapshot': { - 'values': ['on', 'off', 'nobuild'], - 'default': 'off', - 'help': 'build using snapshots for faster start-up' - }, - 'prof': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'enable profiling of build target' - }, - 'gdbjit': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'enable GDB JIT interface' - }, - 'library': { - 'values': ['static', 'shared'], - 'default': 'static', - 'help': 'the type of library to produce' - }, - 'objectprint': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'enable object printing' - }, - 'profilingsupport': { - 'values': ['on', 'off'], - 'default': 'on', - 'help': 'enable profiling of JavaScript code' - }, - 'debuggersupport': { - 'values': ['on', 'off'], - 'default': 'on', - 'help': 'enable debugging of JavaScript code' - }, - 'soname': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'turn on setting soname for Linux shared library' - }, - 'msvcrt': { - 'values': ['static', 'shared'], - 'default': 'static', - 'help': 'the type of Microsoft Visual C++ runtime library to use' - }, - 'msvcltcg': { - 'values': ['on', 'off'], - 'default': 'on', - 'help': 'use Microsoft Visual C++ link-time code generation' - }, - 'simulator': { - 'values': ['arm', 'mips', 'none'], - 'default': 'none', - 'help': 'build with simulator' - }, - 'unalignedaccesses': { - 'values': ['default', 'on', 'off'], - 'default': 'default', - 'help': 'set whether the ARM target supports unaligned accesses' - }, - 'disassembler': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'enable the disassembler to inspect generated code' - }, - 'fasttls': { - 'values': ['on', 'off'], - 'default': 'on', - 'help': 'enable fast thread local storage support ' - '(if available on the current architecture/platform)' - }, - 'sourcesignatures': { - 'values': ['MD5', 'timestamp'], - 'default': 'MD5', - 'help': 'set how the build system detects file changes' - }, - 'console': { - 'values': ['dumb', 'readline'], - 'default': 'dumb', - 'help': 'the console to use for the d8 shell' - }, - 'verbose': { - 'values': ['on', 'off'], - 'default': 'off', - 'help': 'more output from compiler and linker' - }, - 'visibility': { - 'values': ['default', 'hidden'], - 'guess': GuessVisibility, - 'help': 'shared library symbol visibility' - }, - 'strictaliasing': { - 'values': ['default', 'off'], - 'guess': GuessStrictAliasing, - 'help': 'assume strict aliasing while optimizing' - }, - 'pgo': { - 'values': ['off', 'instrument', 'optimize'], - 'default': 'off', - 'help': 'select profile guided optimization variant', - }, - 'armeabi': { - 'values': ['hard', 'softfp', 'soft'], - 'default': 'softfp', - 'help': 'generate calling conventiont according to selected ARM EABI variant' - }, - 'mipsabi': { - 'values': ['hardfloat', 'softfloat', 'none'], - 'default': 'hardfloat', - 'help': 'generate calling conventiont according to selected mips ABI' - }, - 'mips_arch_variant': { - 'values': ['mips32r2', 'mips32r1', 'loongson'], - 'default': 'mips32r2', - 'help': 'mips variant' - }, - 'compress_startup_data': { - 'values': ['off', 'bz2'], - 'default': 'off', - 'help': 'compress startup data (snapshot) [Linux only]' - }, - 'vfp3': { - 'values': ['on', 'off'], - 'default': 'on', - 'help': 'use vfp3 instructions when building the snapshot [Arm only]' - }, - 'fpu': { - 'values': ['on', 'off'], - 'default': 'on', - 'help': 'use fpu instructions when building the snapshot [MIPS only]' - }, - 'I_know_I_should_build_with_GYP': { - 'values': ['yes', 'no'], - 'default': 'no', - 'help': 'grace period: temporarily override SCons deprecation' - } - -} - -ALL_OPTIONS = dict(PLATFORM_OPTIONS, **SIMPLE_OPTIONS) - - -def AddOptions(options, result): - guess_env = Environment(options=result) - for (name, option) in options.iteritems(): - if 'guess' in option: - # Option has a guess function - guess = option.get('guess') - default = guess(guess_env) - else: - # Option has a fixed default - default = option.get('default') - help = '%s (%s)' % (option.get('help'), ", ".join(option['values'])) - result.Add(name, help, default) - - -def GetOptions(): - result = Options() - result.Add('mode', 'compilation mode (debug, release)', 'release') - result.Add('sample', 'build sample (shell, process, lineprocessor)', '') - result.Add('cache', 'directory to use for scons build cache', '') - result.Add('env', 'override environment settings (NAME0:value0,NAME1:value1,...)', '') - result.Add('importenv', 'import environment settings (NAME0,NAME1,...)', '') - AddOptions(PLATFORM_OPTIONS, result) - AddOptions(SIMPLE_OPTIONS, result) - return result - - -def GetTools(opts): - env = Environment(options=opts) - os = env['os'] - toolchain = env['toolchain'] - if os == 'win32' and toolchain == 'gcc': - return ['mingw'] - elif os == 'win32' and toolchain == 'msvc': - return ['msvc', 'mslink', 'mslib', 'msvs'] - else: - return ['default'] - - -def GetVersionComponents(): - MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") - MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") - BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") - PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") - - patterns = [MAJOR_VERSION_PATTERN, - MINOR_VERSION_PATTERN, - BUILD_NUMBER_PATTERN, - PATCH_LEVEL_PATTERN] - - source = open(join(root_dir, 'src', 'version.cc')).read() - version_components = [] - for pattern in patterns: - match = pattern.search(source) - if match: - version_components.append(match.group(1).strip()) - else: - version_components.append('0') - - return version_components - - -def GetVersion(): - version_components = GetVersionComponents() - - if version_components[len(version_components) - 1] == '0': - version_components.pop() - return '.'.join(version_components) - - -def GetSpecificSONAME(): - SONAME_PATTERN = re.compile(r"#define\s+SONAME\s+\"(.*)\"") - - source = open(join(root_dir, 'src', 'version.cc')).read() - match = SONAME_PATTERN.search(source) - - if match: - return match.group(1).strip() - else: - return '' - - -def SplitList(str): - return [ s for s in str.split(",") if len(s) > 0 ] - - -def IsLegal(env, option, values): - str = env[option] - for s in SplitList(str): - if not s in values: - Abort("Illegal value for option %s '%s'." % (option, s)) - return False - return True - - -def WarnAboutDeprecation(): - print """ - ##################################################################### - # # - # LAST WARNING: Building V8 with SCons is deprecated. # - # # - # This only works because you have overridden the kill switch. # - # # - # MIGRATE TO THE GYP-BASED BUILD NOW! # - # # - # Instructions: http://code.google.com/p/v8/wiki/BuildingWithGYP. # - # # - ##################################################################### - """ - - -def VerifyOptions(env): - if env['I_know_I_should_build_with_GYP'] != 'yes': - Abort("Building V8 with SCons is no longer supported. Please use GYP " - "instead; you can find instructions are at " - "http://code.google.com/p/v8/wiki/BuildingWithGYP.\n\n" - "Quitting.\n\n" - "For a limited grace period, you can specify " - "\"I_know_I_should_build_with_GYP=yes\" to override.") - else: - WarnAboutDeprecation() - import atexit - atexit.register(WarnAboutDeprecation) - - if not IsLegal(env, 'mode', ['debug', 'release']): - return False - if not IsLegal(env, 'sample', ["shell", "process", "lineprocessor"]): - return False - if not IsLegal(env, 'regexp', ["native", "interpreted"]): - return False - if env['os'] == 'win32' and env['library'] == 'shared' and env['prof'] == 'on': - Abort("Profiling on windows only supported for static library.") - if env['gdbjit'] == 'on' and ((env['os'] != 'linux' and env['os'] != 'macos') or (env['arch'] != 'ia32' and env['arch'] != 'x64' and env['arch'] != 'arm')): - Abort("GDBJIT interface is supported only for Intel-compatible (ia32 or x64) Linux/OSX target.") - if env['os'] == 'win32' and env['soname'] == 'on': - Abort("Shared Object soname not applicable for Windows.") - if env['soname'] == 'on' and env['library'] == 'static': - Abort("Shared Object soname not applicable for static library.") - if env['os'] != 'win32' and env['pgo'] != 'off': - Abort("Profile guided optimization only supported on Windows.") - if env['cache'] and not os.path.isdir(env['cache']): - Abort("The specified cache directory does not exist.") - if not (env['arch'] == 'arm' or env['simulator'] == 'arm') and ('unalignedaccesses' in ARGUMENTS): - print env['arch'] - print env['simulator'] - Abort("Option unalignedaccesses only supported for the ARM architecture.") - if env['os'] != 'linux' and env['compress_startup_data'] != 'off': - Abort("Startup data compression is only available on Linux") - for (name, option) in ALL_OPTIONS.iteritems(): - if (not name in env): - message = ("A value for option %s must be specified (%s)." % - (name, ", ".join(option['values']))) - Abort(message) - if not env[name] in option['values']: - message = ("Unknown %s value '%s'. Possible values are (%s)." % - (name, env[name], ", ".join(option['values']))) - Abort(message) - - -class BuildContext(object): - - def __init__(self, options, env_overrides, samples): - self.library_targets = [] - self.mksnapshot_targets = [] - self.cctest_targets = [] - self.sample_targets = [] - self.d8_targets = [] - self.options = options - self.env_overrides = env_overrides - self.samples = samples - self.preparser_targets = [] - self.use_snapshot = (options['snapshot'] != 'off') - self.build_snapshot = (options['snapshot'] == 'on') - self.flags = None - - def AddRelevantFlags(self, initial, flags): - result = initial.copy() - toolchain = self.options['toolchain'] - if toolchain in flags: - self.AppendFlags(result, flags[toolchain].get('all')) - for option in sorted(self.options.keys()): - value = self.options[option] - self.AppendFlags(result, flags[toolchain].get(option + ':' + value)) - self.AppendFlags(result, flags.get('all')) - return result - - def AddRelevantSubFlags(self, options, flags): - self.AppendFlags(options, flags.get('all')) - for option in sorted(self.options.keys()): - value = self.options[option] - self.AppendFlags(options, flags.get(option + ':' + value)) - - def GetRelevantSources(self, source): - result = [] - result += source.get('all', []) - for (name, value) in self.options.iteritems(): - source_value = source.get(name + ':' + value, []) - if type(source_value) == dict: - result += self.GetRelevantSources(source_value) - else: - result += source_value - return sorted(result) - - def AppendFlags(self, options, added): - if not added: - return - for (key, value) in added.iteritems(): - if key.find(':') != -1: - self.AddRelevantSubFlags(options, { key: value }) - else: - if not key in options: - options[key] = value - else: - prefix = options[key] - if isinstance(prefix, StringTypes): prefix = prefix.split() - options[key] = prefix + value - - def ConfigureObject(self, env, input, **kw): - if (kw.has_key('CPPPATH') and env.has_key('CPPPATH')): - kw['CPPPATH'] += env['CPPPATH'] - if self.options['library'] == 'static': - return env.StaticObject(input, **kw) - else: - return env.SharedObject(input, **kw) - - def ApplyEnvOverrides(self, env): - if not self.env_overrides: - return - if type(env['ENV']) == DictType: - env['ENV'].update(**self.env_overrides) - else: - env['ENV'] = self.env_overrides - - -def PostprocessOptions(options, os): - # Adjust architecture if the simulator option has been set - if (options['simulator'] != 'none') and (options['arch'] != options['simulator']): - if 'arch' in ARGUMENTS: - # Print a warning if arch has explicitly been set - print "Warning: forcing architecture to match simulator (%s)" % options['simulator'] - options['arch'] = options['simulator'] - if (options['prof'] != 'off') and (options['profilingsupport'] == 'off'): - # Print a warning if profiling is enabled without profiling support - print "Warning: forcing profilingsupport on when prof is on" - options['profilingsupport'] = 'on' - if os == 'win32' and options['pgo'] != 'off' and options['msvcltcg'] == 'off': - if 'msvcltcg' in ARGUMENTS: - print "Warning: forcing msvcltcg on as it is required for pgo (%s)" % options['pgo'] - options['msvcltcg'] = 'on' - if (options['mipsabi'] != 'none') and (options['arch'] != 'mips') and (options['simulator'] != 'mips'): - options['mipsabi'] = 'none' - - -def ParseEnvOverrides(arg, imports): - # The environment overrides are in the format NAME0:value0,NAME1:value1,... - # The environment imports are in the format NAME0,NAME1,... - overrides = {} - for var in imports.split(','): - if var in os.environ: - overrides[var] = os.environ[var] - for override in arg.split(','): - pos = override.find(':') - if pos == -1: - continue - overrides[override[:pos].strip()] = override[pos+1:].strip() - return overrides - - -def BuildSpecific(env, mode, env_overrides, tools): - options = {'mode': mode} - for option in ALL_OPTIONS: - options[option] = env[option] - PostprocessOptions(options, env['os']) - - context = BuildContext(options, env_overrides, samples=SplitList(env['sample'])) - - # Remove variables which can't be imported from the user's external - # environment into a construction environment. - user_environ = os.environ.copy() - try: - del user_environ['ENV'] - except KeyError: - pass - - library_flags = context.AddRelevantFlags(user_environ, LIBRARY_FLAGS) - v8_flags = context.AddRelevantFlags(library_flags, V8_EXTRA_FLAGS) - mksnapshot_flags = context.AddRelevantFlags(library_flags, MKSNAPSHOT_EXTRA_FLAGS) - dtoa_flags = context.AddRelevantFlags(library_flags, DTOA_EXTRA_FLAGS) - cctest_flags = context.AddRelevantFlags(v8_flags, CCTEST_EXTRA_FLAGS) - sample_flags = context.AddRelevantFlags(user_environ, SAMPLE_FLAGS) - preparser_flags = context.AddRelevantFlags(user_environ, PREPARSER_FLAGS) - d8_flags = context.AddRelevantFlags(library_flags, D8_FLAGS) - - context.flags = { - 'v8': v8_flags, - 'mksnapshot': mksnapshot_flags, - 'dtoa': dtoa_flags, - 'cctest': cctest_flags, - 'sample': sample_flags, - 'd8': d8_flags, - 'preparser': preparser_flags - } - - # Generate library base name. - target_id = mode - suffix = SUFFIXES[target_id] - library_name = 'v8' + suffix - preparser_library_name = 'v8preparser' + suffix - version = GetVersion() - if context.options['soname'] == 'on': - # When building shared object with SONAME version the library name. - library_name += '-' + version - - # Generate library SONAME if required by the build. - if context.options['soname'] == 'on': - soname = GetSpecificSONAME() - if soname == '': - soname = 'lib' + library_name + '.so' - env['SONAME'] = soname - - # Build the object files by invoking SCons recursively. - d8_env = Environment(tools=tools) - d8_env.Replace(**context.flags['d8']) - (object_files, shell_files, mksnapshot, preparser_files) = env.SConscript( - join('src', 'SConscript'), - build_dir=join('obj', target_id), - exports='context tools d8_env', - duplicate=False - ) - - context.mksnapshot_targets.append(mksnapshot) - - # Link the object files into a library. - env.Replace(**context.flags['v8']) - - context.ApplyEnvOverrides(env) - if context.options['library'] == 'static': - library = env.StaticLibrary(library_name, object_files) - preparser_library = env.StaticLibrary(preparser_library_name, - preparser_files) - else: - # There seems to be a glitch in the way scons decides where to put - # PDB files when compiling using MSVC so we specify it manually. - # This should not affect any other platforms. - pdb_name = library_name + '.dll.pdb' - library = env.SharedLibrary(library_name, object_files, PDB=pdb_name) - preparser_pdb_name = preparser_library_name + '.dll.pdb'; - preparser_soname = 'lib' + preparser_library_name + '.so'; - preparser_library = env.SharedLibrary(preparser_library_name, - preparser_files, - PDB=preparser_pdb_name, - SONAME=preparser_soname) - context.library_targets.append(library) - context.library_targets.append(preparser_library) - - context.ApplyEnvOverrides(d8_env) - if context.options['library'] == 'static': - shell = d8_env.Program('d8' + suffix, object_files + shell_files) - else: - shell = d8_env.Program('d8' + suffix, shell_files) - d8_env.Depends(shell, library) - context.d8_targets.append(shell) - - for sample in context.samples: - sample_env = Environment(tools=tools) - sample_env.Replace(**context.flags['sample']) - sample_env.Prepend(LIBS=[library_name]) - context.ApplyEnvOverrides(sample_env) - sample_object = sample_env.SConscript( - join('samples', 'SConscript'), - build_dir=join('obj', 'sample', sample, target_id), - exports='sample context tools', - duplicate=False - ) - sample_name = sample + suffix - sample_program = sample_env.Program(sample_name, sample_object) - sample_env.Depends(sample_program, library) - context.sample_targets.append(sample_program) - - cctest_env = env.Copy() - cctest_env.Prepend(LIBS=[library_name]) - cctest_program = cctest_env.SConscript( - join('test', 'cctest', 'SConscript'), - build_dir=join('obj', 'test', target_id), - exports='context object_files tools', - duplicate=False - ) - context.cctest_targets.append(cctest_program) - - preparser_env = env.Copy() - preparser_env.Replace(**context.flags['preparser']) - preparser_env.Prepend(LIBS=[preparser_library_name]) - context.ApplyEnvOverrides(preparser_env) - preparser_object = preparser_env.SConscript( - join('preparser', 'SConscript'), - build_dir=join('obj', 'preparser', target_id), - exports='context tools', - duplicate=False - ) - preparser_name = join('obj', 'preparser', target_id, 'preparser') - preparser_program = preparser_env.Program(preparser_name, preparser_object); - preparser_env.Depends(preparser_program, preparser_library) - context.preparser_targets.append(preparser_program) - - return context - - -def Build(): - opts = GetOptions() - tools = GetTools(opts) - env = Environment(options=opts, tools=tools) - - Help(opts.GenerateHelpText(env)) - VerifyOptions(env) - env_overrides = ParseEnvOverrides(env['env'], env['importenv']) - - SourceSignatures(env['sourcesignatures']) - - libraries = [] - mksnapshots = [] - cctests = [] - samples = [] - preparsers = [] - d8s = [] - modes = SplitList(env['mode']) - for mode in modes: - context = BuildSpecific(env.Copy(), mode, env_overrides, tools) - libraries += context.library_targets - mksnapshots += context.mksnapshot_targets - cctests += context.cctest_targets - samples += context.sample_targets - preparsers += context.preparser_targets - d8s += context.d8_targets - - env.Alias('library', libraries) - env.Alias('mksnapshot', mksnapshots) - env.Alias('cctests', cctests) - env.Alias('sample', samples) - env.Alias('d8', d8s) - env.Alias('preparser', preparsers) - - if env['sample']: - env.Default('sample') - else: - env.Default('library') - - if env['cache']: - CacheDir(env['cache']) - -# We disable deprecation warnings because we need to be able to use -# env.Copy without getting warnings for compatibility with older -# version of scons. Also, there's a bug in some revisions that -# doesn't allow this flag to be set, so we swallow any exceptions. -# Lovely. -try: - SetOption('warn', 'no-deprecated') -except: - pass - -Build() diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi index 8028b3eecb..0b1f397268 100644 --- a/deps/v8/build/common.gypi +++ b/deps/v8/build/common.gypi @@ -454,6 +454,15 @@ }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="android"', { + 'cflags!': [ + '-O2', + '-Os', + ], + 'cflags': [ + '-fdata-sections', + '-ffunction-sections', + '-O3', + ], 'conditions': [ [ 'gcc_version==44 and clang==0', { 'cflags': [ diff --git a/deps/v8/preparser/SConscript b/deps/v8/preparser/SConscript deleted file mode 100644 index 10b3953193..0000000000 --- a/deps/v8/preparser/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2011 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. - -from os.path import join -Import('context tools') - -def ConfigureObjectFiles(): - env = Environment(tools=tools) - env.Replace(**context.flags['preparser']) - context.ApplyEnvOverrides(env) - return env.Object('preparser-process.cc') - -preparser_object = ConfigureObjectFiles() -Return('preparser_object') diff --git a/deps/v8/samples/SConscript b/deps/v8/samples/SConscript deleted file mode 100644 index 84c48c9047..0000000000 --- a/deps/v8/samples/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2008 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. - -from os.path import join -Import('sample context tools') - -def ConfigureObjectFiles(): - env = Environment(tools=tools) - env.Replace(**context.flags['sample']) - context.ApplyEnvOverrides(env) - return env.Object(sample + '.cc') - -sample_object = ConfigureObjectFiles() -Return('sample_object') diff --git a/deps/v8/src/SConscript b/deps/v8/src/SConscript deleted file mode 100755 index 772ac4eb2c..0000000000 --- a/deps/v8/src/SConscript +++ /dev/null @@ -1,413 +0,0 @@ -# Copyright 2012 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. - -import sys -from os.path import join, dirname, abspath -root_dir = dirname(File('SConstruct').rfile().abspath) -sys.path.append(join(root_dir, 'tools')) -import js2c -Import('context') -Import('tools') -Import('d8_env') - - -SOURCES = { - 'all': Split(""" - accessors.cc - allocation.cc - api.cc - assembler.cc - ast.cc - atomicops_internals_x86_gcc.cc - bignum-dtoa.cc - bignum.cc - bootstrapper.cc - builtins.cc - cached-powers.cc - checks.cc - circular-queue.cc - code-stubs.cc - codegen.cc - compilation-cache.cc - compiler.cc - contexts.cc - conversions.cc - counters.cc - cpu-profiler.cc - data-flow.cc - date.cc - dateparser.cc - debug-agent.cc - debug.cc - deoptimizer.cc - disassembler.cc - diy-fp.cc - dtoa.cc - elements-kind.cc - elements.cc - execution.cc - extensions/externalize-string-extension.cc - extensions/gc-extension.cc - extensions/statistics-extension.cc - factory.cc - fast-dtoa.cc - fixed-dtoa.cc - flags.cc - frames.cc - full-codegen.cc - func-name-inferrer.cc - gdb-jit.cc - global-handles.cc - handles.cc - heap-profiler.cc - heap-snapshot-generator.cc - heap.cc - hydrogen-instructions.cc - hydrogen.cc - ic.cc - incremental-marking.cc - interface.cc - interpreter-irregexp.cc - isolate.cc - jsregexp.cc - lithium-allocator.cc - lithium.cc - liveedit.cc - log-utils.cc - log.cc - mark-compact.cc - messages.cc - objects-printer.cc - objects-visiting.cc - objects.cc - once.cc - optimizing-compiler-thread.cc - parser.cc - preparse-data.cc - preparser.cc - profile-generator.cc - property.cc - regexp-macro-assembler-irregexp.cc - regexp-macro-assembler.cc - regexp-stack.cc - rewriter.cc - runtime-profiler.cc - runtime.cc - safepoint-table.cc - scanner-character-streams.cc - scanner.cc - scopeinfo.cc - scopes.cc - serialize.cc - snapshot-common.cc - spaces.cc - store-buffer.cc - string-search.cc - string-stream.cc - strtod.cc - stub-cache.cc - token.cc - transitions.cc - type-info.cc - unicode.cc - utils.cc - v8-counters.cc - v8.cc - v8conversions.cc - v8threads.cc - v8utils.cc - variables.cc - version.cc - zone.cc - """), - 'arch:arm': Split(""" - arm/builtins-arm.cc - arm/code-stubs-arm.cc - arm/codegen-arm.cc - arm/constants-arm.cc - arm/cpu-arm.cc - arm/debug-arm.cc - arm/deoptimizer-arm.cc - arm/disasm-arm.cc - arm/frames-arm.cc - arm/full-codegen-arm.cc - arm/ic-arm.cc - arm/lithium-arm.cc - arm/lithium-codegen-arm.cc - arm/lithium-gap-resolver-arm.cc - arm/macro-assembler-arm.cc - arm/regexp-macro-assembler-arm.cc - arm/stub-cache-arm.cc - arm/assembler-arm.cc - """), - 'arch:mips': Split(""" - mips/assembler-mips.cc - mips/builtins-mips.cc - mips/code-stubs-mips.cc - mips/codegen-mips.cc - mips/constants-mips.cc - mips/cpu-mips.cc - mips/debug-mips.cc - mips/deoptimizer-mips.cc - mips/disasm-mips.cc - mips/frames-mips.cc - mips/full-codegen-mips.cc - mips/ic-mips.cc - mips/lithium-codegen-mips.cc - mips/lithium-gap-resolver-mips.cc - mips/lithium-mips.cc - mips/macro-assembler-mips.cc - mips/regexp-macro-assembler-mips.cc - mips/stub-cache-mips.cc - """), - 'arch:ia32': Split(""" - ia32/assembler-ia32.cc - ia32/builtins-ia32.cc - ia32/code-stubs-ia32.cc - ia32/codegen-ia32.cc - ia32/cpu-ia32.cc - ia32/debug-ia32.cc - ia32/deoptimizer-ia32.cc - ia32/disasm-ia32.cc - ia32/frames-ia32.cc - ia32/full-codegen-ia32.cc - ia32/ic-ia32.cc - ia32/lithium-codegen-ia32.cc - ia32/lithium-gap-resolver-ia32.cc - ia32/lithium-ia32.cc - ia32/macro-assembler-ia32.cc - ia32/regexp-macro-assembler-ia32.cc - ia32/stub-cache-ia32.cc - """), - 'arch:x64': Split(""" - x64/assembler-x64.cc - x64/builtins-x64.cc - x64/code-stubs-x64.cc - x64/codegen-x64.cc - x64/cpu-x64.cc - x64/debug-x64.cc - x64/deoptimizer-x64.cc - x64/disasm-x64.cc - x64/frames-x64.cc - x64/full-codegen-x64.cc - x64/ic-x64.cc - x64/lithium-codegen-x64.cc - x64/lithium-gap-resolver-x64.cc - x64/lithium-x64.cc - x64/macro-assembler-x64.cc - x64/regexp-macro-assembler-x64.cc - x64/stub-cache-x64.cc - """), - 'simulator:arm': ['arm/simulator-arm.cc'], - 'simulator:mips': ['mips/simulator-mips.cc'], - 'os:freebsd': ['platform-freebsd.cc', 'platform-posix.cc'], - 'os:openbsd': ['platform-openbsd.cc', 'platform-posix.cc'], - 'os:linux': ['platform-linux.cc', 'platform-posix.cc'], - 'os:android': ['platform-linux.cc', 'platform-posix.cc'], - 'os:macos': ['platform-macos.cc', 'platform-posix.cc'], - 'os:solaris': ['platform-solaris.cc', 'platform-posix.cc'], - 'os:cygwin': ['platform-cygwin.cc', 'platform-posix.cc'], - 'os:nullos': ['platform-nullos.cc'], - 'os:win32': ['platform-win32.cc', 'win32-math.cc'], - 'mode:release': [], - 'mode:debug': [ - 'objects-debug.cc', 'prettyprinter.cc', 'regexp-macro-assembler-tracer.cc' - ] -} - - -PREPARSER_SOURCES = { - 'all': Split(""" - allocation.cc - bignum.cc - bignum-dtoa.cc - cached-powers.cc - conversions.cc - diy-fp.cc - dtoa.cc - fast-dtoa.cc - fixed-dtoa.cc - preparse-data.cc - preparser.cc - preparser-api.cc - scanner.cc - strtod.cc - token.cc - unicode.cc - utils.cc - """), - 'os:win32': ['win32-math.cc'] -} - - -D8_LIGHT_FILES = { - 'all': [ - 'd8.cc' - ] -} - - -D8_FULL_FILES = { - 'all': [ - 'd8.cc', 'd8-debug.cc' - ], - 'os:linux': [ - 'd8-posix.cc' - ], - 'os:macos': [ - 'd8-posix.cc' - ], - 'os:android': [ - 'd8-posix.cc' - ], - 'os:freebsd': [ - 'd8-posix.cc' - ], - 'os:openbsd': [ - 'd8-posix.cc' - ], - 'os:solaris': [ - 'd8-posix.cc' - ], - 'os:cygwin': [ - 'd8-posix.cc' - ], - 'os:win32': [ - 'd8-windows.cc' - ], - 'os:nullos': [ - 'd8-windows.cc' # Empty implementation at the moment. - ], - 'console:readline': [ - 'd8-readline.cc' - ] -} - - -LIBRARY_FILES = ''' -runtime.js -v8natives.js -array.js -string.js -uri.js -math.js -messages.js -apinatives.js -date.js -regexp.js -json.js -liveedit-debugger.js -mirror-debugger.js -debug-debugger.js -'''.split() - - -EXPERIMENTAL_LIBRARY_FILES = ''' -symbol.js -proxy.js -collection.js -'''.split() - - -def Abort(message): - print message - sys.exit(1) - - -def ConfigureObjectFiles(): - env = Environment(tools=tools) - env.Replace(**context.flags['v8']) - context.ApplyEnvOverrides(env) - env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C) - env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE" --log-snapshot-positions') - - def BuildJS2CEnv(type): - js2c_env = { 'TYPE': type, 'COMPRESSION': 'off' } - if 'COMPRESS_STARTUP_DATA_BZ2' in env['CPPDEFINES']: - js2c_env['COMPRESSION'] = 'bz2' - return js2c_env - - # Build the standard platform-independent source files. - source_files = context.GetRelevantSources(SOURCES) - d8_js = env.JS2C('d8-js.cc', 'd8.js', **{'TYPE': 'D8', 'COMPRESSION': 'off'}) - d8_js_obj = context.ConfigureObject(env, d8_js, CPPPATH=['.']) - if context.options['library'] == 'shared': - d8_files = context.GetRelevantSources(D8_LIGHT_FILES) - d8_objs = [] - else: - d8_files = context.GetRelevantSources(D8_FULL_FILES) - d8_objs = [d8_js_obj] - d8_objs.append(context.ConfigureObject(d8_env, [d8_files])) - - # Combine the JavaScript library files into a single C++ file and - # compile it. - library_files = [s for s in LIBRARY_FILES] - library_files.append('macros.py') - libraries_src = env.JS2C( - ['libraries.cc'], library_files, **BuildJS2CEnv('CORE')) - libraries_obj = context.ConfigureObject(env, libraries_src, CPPPATH=['.']) - - # Combine the experimental JavaScript library files into a C++ file - # and compile it. - experimental_library_files = [ s for s in EXPERIMENTAL_LIBRARY_FILES ] - experimental_library_files.append('macros.py') - experimental_libraries_src = env.JS2C(['experimental-libraries.cc'], - experimental_library_files, - **BuildJS2CEnv('EXPERIMENTAL')) - experimental_libraries_obj = context.ConfigureObject(env, experimental_libraries_src, CPPPATH=['.']) - - source_objs = context.ConfigureObject(env, source_files) - non_snapshot_files = [source_objs] - - preparser_source_files = context.GetRelevantSources(PREPARSER_SOURCES) - preparser_objs = context.ConfigureObject(env, preparser_source_files) - - # Create snapshot if necessary. For cross compilation you should either - # do without snapshots and take the performance hit or you should build a - # host VM with the simulator=arm and snapshot=on options and then take the - # resulting snapshot.cc file from obj/release and put it in the src - # directory. Then rebuild the VM with the cross compiler and specify - # snapshot=nobuild on the scons command line. - empty_snapshot_obj = context.ConfigureObject(env, 'snapshot-empty.cc') - mksnapshot_env = env.Copy() - mksnapshot_env.Replace(**context.flags['mksnapshot']) - mksnapshot_src = 'mksnapshot.cc' - mksnapshot = mksnapshot_env.Program('mksnapshot', [mksnapshot_src, libraries_obj, experimental_libraries_obj, non_snapshot_files, empty_snapshot_obj], PDB='mksnapshot.exe.pdb') - if context.use_snapshot: - if context.build_snapshot: - snapshot_cc = env.Snapshot('snapshot.cc', mksnapshot, LOGFILE=File('snapshot.log').abspath) - else: - snapshot_cc = 'snapshot.cc' - snapshot_obj = context.ConfigureObject(env, snapshot_cc, CPPPATH=['.']) - else: - snapshot_obj = empty_snapshot_obj - library_objs = [non_snapshot_files, libraries_obj, experimental_libraries_obj, snapshot_obj] - return (library_objs, d8_objs, [mksnapshot], preparser_objs) - - -(library_objs, d8_objs, mksnapshot, preparser_objs) = ConfigureObjectFiles() -Return('library_objs d8_objs mksnapshot preparser_objs') diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index dddcd7dcf5..15831ec6a8 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -623,6 +623,9 @@ i::Object** V8::GlobalizeReference(i::Isolate* isolate, i::Object** obj) { if (IsDeadCheck(isolate, "V8::Persistent::New")) return NULL; LOG_API(isolate, "Persistent::New"); i::Handle result = isolate->global_handles()->Create(*obj); +#ifdef DEBUG + (*obj)->Verify(); +#endif // DEBUG return result.location(); } diff --git a/deps/v8/src/arguments.h b/deps/v8/src/arguments.h index 1423d5642b..f8fb00c575 100644 --- a/deps/v8/src/arguments.h +++ b/deps/v8/src/arguments.h @@ -115,18 +115,15 @@ class CustomArguments : public Relocatable { #define DECLARE_RUNTIME_FUNCTION(Type, Name) \ -Type Name(int args_length, Object** args_object, Isolate* isolate) - -#define RUNTIME_FUNCTION(Type, Name) \ -static Type __RT_impl_##Name(Arguments args, Isolate* isolate); \ -Type Name(int args_length, Object** args_object, Isolate* isolate) { \ - Arguments args(args_length, args_object); \ - return __RT_impl_##Name(args, isolate); \ -} \ -static Type __RT_impl_##Name(Arguments args, Isolate* isolate) - -#define RUNTIME_ARGUMENTS(isolate, args) \ - args.length(), args.arguments(), isolate +Type Name(Arguments args, Isolate* isolate) + + +#define RUNTIME_FUNCTION(Type, Name) \ +Type Name(Arguments args, Isolate* isolate) + + +#define RUNTIME_ARGUMENTS(isolate, args) args, isolate + } } // namespace v8::internal diff --git a/deps/v8/src/arm/assembler-arm-inl.h b/deps/v8/src/arm/assembler-arm-inl.h index 0f9630b341..1e0d5c1f7d 100644 --- a/deps/v8/src/arm/assembler-arm-inl.h +++ b/deps/v8/src/arm/assembler-arm-inl.h @@ -266,19 +266,11 @@ Object** RelocInfo::call_object_address() { bool RelocInfo::IsPatchedReturnSequence() { Instr current_instr = Assembler::instr_at(pc_); Instr next_instr = Assembler::instr_at(pc_ + Assembler::kInstrSize); -#ifdef USE_BLX // A patched return sequence is: // ldr ip, [pc, #0] // blx ip return ((current_instr & kLdrPCMask) == kLdrPCPattern) && ((next_instr & kBlxRegMask) == kBlxRegPattern); -#else - // A patched return sequence is: - // mov lr, pc - // ldr pc, [pc, #-4] - return (current_instr == kMovLrPc) - && ((next_instr & kLdrPCMask) == kLdrPCPattern); -#endif } @@ -408,14 +400,11 @@ Address Assembler::target_pointer_address_at(Address pc) { instr = Memory::int32_at(target_pc); } -#ifdef USE_BLX - // If we have a blx instruction, the instruction before it is - // what needs to be patched. + // With a blx instruction, the instruction before is what needs to be patched. if ((instr & kBlxRegMask) == kBlxRegPattern) { target_pc -= kInstrSize; instr = Memory::int32_at(target_pc); } -#endif ASSERT(IsLdrPcImmediateOffset(instr)); int offset = instr & 0xfff; // offset_12 is unsigned @@ -442,7 +431,6 @@ Address Assembler::target_pointer_at(Address pc) { Address Assembler::target_address_from_return_address(Address pc) { // Returns the address of the call target from the return address that will // be returned to after a call. -#ifdef USE_BLX // Call sequence on V7 or later is : // movw ip, #... @ call address low 16 // movt ip, #... @ call address high 16 @@ -461,18 +449,10 @@ Address Assembler::target_address_from_return_address(Address pc) { ASSERT(IsMovW(Memory::int32_at(candidate)) && IsMovT(Memory::int32_at(candidate + kInstrSize))); return candidate; -#else - // Call sequence is: - // mov lr, pc - // ldr pc, [pc, #...] @ call address - // @ return address - return pc - kInstrSize; -#endif } Address Assembler::return_address_from_call_start(Address pc) { -#ifdef USE_BLX if (IsLdrPcImmediateOffset(Memory::int32_at(pc))) { return pc + kInstrSize * 2; } else { @@ -480,9 +460,6 @@ Address Assembler::return_address_from_call_start(Address pc) { ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); return pc + kInstrSize * 3; } -#else - return pc + kInstrSize; -#endif } diff --git a/deps/v8/src/arm/assembler-arm.cc b/deps/v8/src/arm/assembler-arm.cc index bc21b64017..b473c6b52b 100644 --- a/deps/v8/src/arm/assembler-arm.cc +++ b/deps/v8/src/arm/assembler-arm.cc @@ -1683,7 +1683,6 @@ void Assembler::stop(const char* msg, Condition cond, int32_t code) { emit(reinterpret_cast(msg)); } #else // def __arm__ -#ifdef CAN_USE_ARMV5_INSTRUCTIONS if (cond != al) { Label skip; b(&skip, NegateCondition(cond)); @@ -1692,9 +1691,6 @@ void Assembler::stop(const char* msg, Condition cond, int32_t code) { } else { bkpt(0); } -#else // ndef CAN_USE_ARMV5_INSTRUCTIONS - svc(0x9f0001, cond); -#endif // ndef CAN_USE_ARMV5_INSTRUCTIONS #endif // def __arm__ } diff --git a/deps/v8/src/arm/assembler-arm.h b/deps/v8/src/arm/assembler-arm.h index 0aecbcdd61..0fd5186734 100644 --- a/deps/v8/src/arm/assembler-arm.h +++ b/deps/v8/src/arm/assembler-arm.h @@ -663,37 +663,19 @@ class Assembler : public AssemblerBase { // Distance between start of patched return sequence and the emitted address // to jump to. -#ifdef USE_BLX // Patched return sequence is: // ldr ip, [pc, #0] @ emited address and start // blx ip static const int kPatchReturnSequenceAddressOffset = 0 * kInstrSize; -#else - // Patched return sequence is: - // mov lr, pc @ start of sequence - // ldr pc, [pc, #-4] @ emited address - static const int kPatchReturnSequenceAddressOffset = kInstrSize; -#endif // Distance between start of patched debug break slot and the emitted address // to jump to. -#ifdef USE_BLX // Patched debug break slot code is: // ldr ip, [pc, #0] @ emited address and start // blx ip static const int kPatchDebugBreakSlotAddressOffset = 0 * kInstrSize; -#else - // Patched debug break slot code is: - // mov lr, pc @ start of sequence - // ldr pc, [pc, #-4] @ emited address - static const int kPatchDebugBreakSlotAddressOffset = kInstrSize; -#endif -#ifdef USE_BLX static const int kPatchDebugBreakSlotReturnOffset = 2 * kInstrSize; -#else - static const int kPatchDebugBreakSlotReturnOffset = kInstrSize; -#endif // Difference between address of current opcode and value read from pc // register. @@ -1130,16 +1112,8 @@ class Assembler : public AssemblerBase { static bool use_immediate_embedded_pointer_loads( const Assembler* assembler) { -#ifdef USE_BLX return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && (assembler == NULL || !assembler->predictable_code_size()); -#else - // If not using BLX, all loads from the constant pool cannot be immediate, - // because the ldr pc, [pc + #xxxx] used for calls must be a single - // instruction and cannot be easily distinguished out of context from - // other loads that could use movw/movt. - return false; -#endif } // Check the code size generated from label to here. diff --git a/deps/v8/src/arm/code-stubs-arm.cc b/deps/v8/src/arm/code-stubs-arm.cc index 1db415292a..ef2dbb3892 100644 --- a/deps/v8/src/arm/code-stubs-arm.cc +++ b/deps/v8/src/arm/code-stubs-arm.cc @@ -30,7 +30,6 @@ #if defined(V8_TARGET_ARCH_ARM) #include "bootstrapper.h" -#include "builtins-decls.h" #include "code-stubs.h" #include "regexp-macro-assembler.h" #include "stub-cache.h" @@ -482,9 +481,7 @@ void ConvertToDoubleStub::Generate(MacroAssembler* masm) { __ Ret(); __ bind(¬_special); - // Count leading zeros. Uses mantissa for a scratch register on pre-ARM5. - // Gets the wrong answer for 0, but we already checked for that case above. - __ CountLeadingZeros(zeros_, source_, mantissa); + __ clz(zeros_, source_); // Compute exponent and or it into the exponent register. // We use mantissa as a scratch register here. Use a fudge factor to // divide the constant 31 + HeapNumber::kExponentBias, 0x41d, into two parts @@ -2032,7 +2029,7 @@ void BinaryOpStub_GenerateSmiSmiOperation(MacroAssembler* masm, } // Perform division by shifting. - __ CountLeadingZeros(scratch1, scratch1, scratch2); + __ clz(scratch1, scratch1); __ rsb(scratch1, scratch1, Operand(31)); __ mov(right, Operand(left, LSR, scratch1)); __ Ret(); diff --git a/deps/v8/src/arm/code-stubs-arm.h b/deps/v8/src/arm/code-stubs-arm.h index 741ff9ca83..75cbf6582c 100644 --- a/deps/v8/src/arm/code-stubs-arm.h +++ b/deps/v8/src/arm/code-stubs-arm.h @@ -130,7 +130,7 @@ class UnaryOpStub: public PlatformCodeStub { void GenerateGenericStubBitNot(MacroAssembler* masm); void GenerateGenericCodeFallback(MacroAssembler* masm); - virtual int GetCodeKind() { return Code::UNARY_OP_IC; } + virtual Code::Kind GetCodeKind() const { return Code::UNARY_OP_IC; } virtual InlineCacheState GetICState() { return UnaryOpIC::ToState(operand_type_); diff --git a/deps/v8/src/arm/constants-arm.h b/deps/v8/src/arm/constants-arm.h index 747dc5627a..e21055fee4 100644 --- a/deps/v8/src/arm/constants-arm.h +++ b/deps/v8/src/arm/constants-arm.h @@ -33,13 +33,6 @@ #error ARM EABI support is required. #endif -// This means that interwork-compatible jump instructions are generated. We -// want to generate them on the simulator too so it makes snapshots that can -// be used on real hardware. -#if defined(__THUMB_INTERWORK__) || !defined(__arm__) -# define USE_THUMB_INTERWORK 1 -#endif - #if defined(__ARM_ARCH_7A__) || \ defined(__ARM_ARCH_7R__) || \ defined(__ARM_ARCH_7__) @@ -49,39 +42,11 @@ #endif #endif -#if defined(__ARM_ARCH_6__) || \ - defined(__ARM_ARCH_6J__) || \ - defined(__ARM_ARCH_6K__) || \ - defined(__ARM_ARCH_6Z__) || \ - defined(__ARM_ARCH_6ZK__) || \ - defined(__ARM_ARCH_6T2__) || \ - defined(CAN_USE_ARMV7_INSTRUCTIONS) -# define CAN_USE_ARMV6_INSTRUCTIONS 1 -#endif - -#if defined(__ARM_ARCH_5__) || \ - defined(__ARM_ARCH_5T__) || \ - defined(__ARM_ARCH_5TE__) || \ - defined(__ARM_ARCH_5TEJ__) || \ - defined(CAN_USE_ARMV6_INSTRUCTIONS) -# define CAN_USE_ARMV5_INSTRUCTIONS 1 -# define CAN_USE_THUMB_INSTRUCTIONS 1 -#endif - -// Simulator should support ARM5 instructions and unaligned access by default. +// Simulator should support unaligned access by default. #if !defined(__arm__) -# define CAN_USE_ARMV5_INSTRUCTIONS 1 -# define CAN_USE_THUMB_INSTRUCTIONS 1 - # ifndef CAN_USE_UNALIGNED_ACCESSES # define CAN_USE_UNALIGNED_ACCESSES 1 # endif - -#endif - -// Using blx may yield better code, so use it when required or when available -#if defined(USE_THUMB_INTERWORK) || defined(CAN_USE_ARMV5_INSTRUCTIONS) -#define USE_BLX 1 #endif namespace v8 { diff --git a/deps/v8/src/arm/cpu-arm.cc b/deps/v8/src/arm/cpu-arm.cc index 7b08ed8c2f..101cd9f143 100644 --- a/deps/v8/src/arm/cpu-arm.cc +++ b/deps/v8/src/arm/cpu-arm.cc @@ -108,7 +108,7 @@ void CPU::FlushICache(void* start, size_t size) { void CPU::DebugBreak() { -#if !defined (__arm__) || !defined(CAN_USE_ARMV5_INSTRUCTIONS) +#if !defined (__arm__) UNIMPLEMENTED(); // when building ARM emulator target #else asm volatile("bkpt 0"); diff --git a/deps/v8/src/arm/debug-arm.cc b/deps/v8/src/arm/debug-arm.cc index e9a65b2b0f..848fae20d5 100644 --- a/deps/v8/src/arm/debug-arm.cc +++ b/deps/v8/src/arm/debug-arm.cc @@ -48,23 +48,13 @@ void BreakLocationIterator::SetDebugBreakAtReturn() { // add sp, sp, #4 // bx lr // to a call to the debug break return code. - // #ifdef USE_BLX // ldr ip, [pc, #0] // blx ip - // #else - // mov lr, pc - // ldr pc, [pc, #-4] - // #endif // // bktp 0 CodePatcher patcher(rinfo()->pc(), Assembler::kJSReturnSequenceInstructions); -#ifdef USE_BLX patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); patcher.masm()->blx(v8::internal::ip); -#else - patcher.masm()->mov(v8::internal::lr, v8::internal::pc); - patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); -#endif patcher.Emit(Isolate::Current()->debug()->debug_break_return()->entry()); patcher.masm()->bkpt(0); } @@ -99,22 +89,12 @@ void BreakLocationIterator::SetDebugBreakAtSlot() { // mov r2, r2 // mov r2, r2 // to a call to the debug break slot code. - // #ifdef USE_BLX // ldr ip, [pc, #0] // blx ip - // #else - // mov lr, pc - // ldr pc, [pc, #-4] - // #endif // CodePatcher patcher(rinfo()->pc(), Assembler::kDebugBreakSlotInstructions); -#ifdef USE_BLX patcher.masm()->ldr(v8::internal::ip, MemOperand(v8::internal::pc, 0)); patcher.masm()->blx(v8::internal::ip); -#else - patcher.masm()->mov(v8::internal::lr, v8::internal::pc); - patcher.masm()->ldr(v8::internal::pc, MemOperand(v8::internal::pc, -4)); -#endif patcher.Emit(Isolate::Current()->debug()->debug_break_slot()->entry()); } diff --git a/deps/v8/src/arm/full-codegen-arm.cc b/deps/v8/src/arm/full-codegen-arm.cc index ba0f141289..6a33234031 100644 --- a/deps/v8/src/arm/full-codegen-arm.cc +++ b/deps/v8/src/arm/full-codegen-arm.cc @@ -3976,18 +3976,6 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { break; } - case Token::ADD: { - Comment cmt(masm_, "[ UnaryOperation (ADD)"); - VisitForAccumulatorValue(expr->expression()); - Label no_conversion; - __ JumpIfSmi(result_register(), &no_conversion); - ToNumberStub convert_stub; - __ CallStub(&convert_stub); - __ bind(&no_conversion); - context()->Plug(result_register()); - break; - } - case Token::SUB: EmitUnaryOperation(expr, "[ UnaryOperation (SUB)"); break; diff --git a/deps/v8/src/arm/lithium-arm.cc b/deps/v8/src/arm/lithium-arm.cc index f6029b5143..64083e8597 100644 --- a/deps/v8/src/arm/lithium-arm.cc +++ b/deps/v8/src/arm/lithium-arm.cc @@ -823,11 +823,15 @@ void LChunkBuilder::DoBasicBlock(HBasicBlock* block, HBasicBlock* next_block) { HEnvironment* last_environment = pred->last_environment(); for (int i = 0; i < block->phis()->length(); ++i) { HPhi* phi = block->phis()->at(i); - last_environment->SetValueAt(phi->merged_index(), phi); + if (phi->merged_index() < last_environment->length()) { + last_environment->SetValueAt(phi->merged_index(), phi); + } } for (int i = 0; i < block->deleted_phis()->length(); ++i) { - last_environment->SetValueAt(block->deleted_phis()->at(i), - graph_->GetConstantUndefined()); + if (block->deleted_phis()->at(i) < last_environment->length()) { + last_environment->SetValueAt(block->deleted_phis()->at(i), + graph_->GetConstantUndefined()); + } } block->UpdateEnvironment(last_environment); // Pick up the outgoing argument count of one of the predecessors. diff --git a/deps/v8/src/arm/lithium-codegen-arm.cc b/deps/v8/src/arm/lithium-codegen-arm.cc index a19015d807..d2f44b05c0 100644 --- a/deps/v8/src/arm/lithium-codegen-arm.cc +++ b/deps/v8/src/arm/lithium-codegen-arm.cc @@ -304,7 +304,7 @@ bool LCodeGen::GenerateDeferredCode() { LDeferredCode* code = deferred_[i]; __ bind(code->entry()); if (NeedsDeferredFrame()) { - Comment(";;; Deferred build frame", + Comment(";;; Deferred build frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(!frame_is_built_); @@ -320,7 +320,7 @@ bool LCodeGen::GenerateDeferredCode() { code->instr()->Mnemonic()); code->Generate(); if (NeedsDeferredFrame()) { - Comment(";;; Deferred destroy frame", + Comment(";;; Deferred destroy frame @%d: %s.", code->instruction_index(), code->instr()->Mnemonic()); ASSERT(frame_is_built_); @@ -1043,11 +1043,9 @@ void LCodeGen::RecordPosition(int position) { void LCodeGen::DoLabel(LLabel* label) { - if (label->is_loop_header()) { - Comment(";;; B%d - LOOP entry", label->block_id()); - } else { - Comment(";;; B%d", label->block_id()); - } + Comment(";;; -------------------- B%d%s --------------------", + label->block_id(), + label->is_loop_header() ? " (loop header)" : ""); __ bind(label->label()); current_block_ = label->block_id(); DoGap(label); @@ -2055,33 +2053,38 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) { LOperand* left = instr->left(); LOperand* right = instr->right(); HMathMinMax::Operation operation = instr->hydrogen()->operation(); - Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; if (instr->hydrogen()->representation().IsInteger32()) { + Condition condition = (operation == HMathMinMax::kMathMin) ? le : ge; Register left_reg = ToRegister(left); Operand right_op = (right->IsRegister() || right->IsConstantOperand()) ? ToOperand(right) : Operand(EmitLoadRegister(right, ip)); Register result_reg = ToRegister(instr->result()); __ cmp(left_reg, right_op); - if (!result_reg.is(left_reg)) { - __ mov(result_reg, left_reg, LeaveCC, condition); - } + __ Move(result_reg, left_reg, condition); __ mov(result_reg, right_op, LeaveCC, NegateCondition(condition)); } else { ASSERT(instr->hydrogen()->representation().IsDouble()); DwVfpRegister left_reg = ToDoubleRegister(left); DwVfpRegister right_reg = ToDoubleRegister(right); DwVfpRegister result_reg = ToDoubleRegister(instr->result()); - Label check_nan_left, check_zero, return_left, return_right, done; + Label result_is_nan, return_left, return_right, check_zero, done; __ VFPCompareAndSetFlags(left_reg, right_reg); - __ b(vs, &check_nan_left); - __ b(eq, &check_zero); - __ b(condition, &return_left); - __ b(al, &return_right); - - __ bind(&check_zero); + if (operation == HMathMinMax::kMathMin) { + __ b(mi, &return_left); + __ b(gt, &return_right); + } else { + __ b(mi, &return_right); + __ b(gt, &return_left); + } + __ b(vs, &result_is_nan); + // Left equals right => check for -0. __ VFPCompareAndSetFlags(left_reg, 0.0); - __ b(ne, &return_left); // left == right != 0. + if (left_reg.is(result_reg) || right_reg.is(result_reg)) { + __ b(ne, &done); // left == right != 0. + } else { + __ b(ne, &return_left); // left == right != 0. + } // At this point, both left and right are either 0 or -0. if (operation == HMathMinMax::kMathMin) { // We could use a single 'vorr' instruction here if we had NEON support. @@ -2093,21 +2096,21 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) { // the decision for vadd is easy because vand is a NEON instruction. __ vadd(result_reg, left_reg, right_reg); } - __ b(al, &done); + __ b(&done); + + __ bind(&result_is_nan); + __ vadd(result_reg, left_reg, right_reg); + __ b(&done); - __ bind(&check_nan_left); - __ VFPCompareAndSetFlags(left_reg, left_reg); - __ b(vs, &return_left); // left == NaN. __ bind(&return_right); - if (!right_reg.is(result_reg)) { - __ vmov(result_reg, right_reg); + __ Move(result_reg, right_reg); + if (!left_reg.is(result_reg)) { + __ b(&done); } - __ b(al, &done); __ bind(&return_left); - if (!left_reg.is(result_reg)) { - __ vmov(result_reg, left_reg); - } + __ Move(result_reg, left_reg); + __ bind(&done); } } @@ -2205,12 +2208,10 @@ void LCodeGen::DoBranch(LBranch* instr) { EmitBranch(true_block, false_block, ne); } else if (r.IsDouble()) { DwVfpRegister reg = ToDoubleRegister(instr->value()); - Register scratch = scratch0(); - // Test the double value. Zero and NaN are false. - __ VFPCompareAndLoadFlags(reg, 0.0, scratch); - __ tst(scratch, Operand(kVFPZConditionFlagBit | kVFPVConditionFlagBit)); - EmitBranch(true_block, false_block, eq); + __ VFPCompareAndSetFlags(reg, 0.0); + __ cmp(r0, r0, vs); // If NaN, set the Z flag. + EmitBranch(true_block, false_block, ne); } else { ASSERT(r.IsTagged()); Register reg = ToRegister(instr->value()); @@ -2302,7 +2303,7 @@ void LCodeGen::DoBranch(LBranch* instr) { __ b(ne, ¬_heap_number); __ vldr(dbl_scratch, FieldMemOperand(reg, HeapNumber::kValueOffset)); __ VFPCompareAndSetFlags(dbl_scratch, 0.0); - __ b(vs, false_label); // NaN -> false. + __ cmp(r0, r0, vs); // NaN -> false. __ b(eq, false_label); // +0, -0 -> false. __ b(true_label); __ bind(¬_heap_number); diff --git a/deps/v8/src/arm/lithium-codegen-arm.h b/deps/v8/src/arm/lithium-codegen-arm.h index 3e24dae54c..c55558cff5 100644 --- a/deps/v8/src/arm/lithium-codegen-arm.h +++ b/deps/v8/src/arm/lithium-codegen-arm.h @@ -29,10 +29,12 @@ #define V8_ARM_LITHIUM_CODEGEN_ARM_H_ #include "arm/lithium-arm.h" + #include "arm/lithium-gap-resolver-arm.h" #include "deoptimizer.h" #include "safepoint-table.h" #include "scopes.h" +#include "v8utils.h" namespace v8 { namespace internal { @@ -211,7 +213,7 @@ class LCodeGen BASE_EMBEDDED { int GetStackSlotCount() const { return chunk()->spill_slot_count(); } void Abort(const char* reason); - void Comment(const char* format, ...); + void FPRINTF_CHECKING Comment(const char* format, ...); void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); } diff --git a/deps/v8/src/arm/macro-assembler-arm.cc b/deps/v8/src/arm/macro-assembler-arm.cc index 7df0c0a1ff..616d02d867 100644 --- a/deps/v8/src/arm/macro-assembler-arm.cc +++ b/deps/v8/src/arm/macro-assembler-arm.cc @@ -51,44 +51,15 @@ MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) } -// We always generate arm code, never thumb code, even if V8 is compiled to -// thumb, so we require inter-working support -#if defined(__thumb__) && !defined(USE_THUMB_INTERWORK) -#error "flag -mthumb-interwork missing" -#endif - - -// We do not support thumb inter-working with an arm architecture not supporting -// the blx instruction (below v5t). If you know what CPU you are compiling for -// you can use -march=armv7 or similar. -#if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS) -# error "For thumb inter-working we require an architecture which supports blx" -#endif - - -// Using bx does not yield better code, so use it only when required -#if defined(USE_THUMB_INTERWORK) -#define USE_BX 1 -#endif - - void MacroAssembler::Jump(Register target, Condition cond) { -#if USE_BX bx(target, cond); -#else - mov(pc, Operand(target), LeaveCC, cond); -#endif } void MacroAssembler::Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond) { -#if USE_BX mov(ip, Operand(target, rmode)); bx(ip, cond); -#else - mov(pc, Operand(target, rmode), LeaveCC, cond); -#endif } @@ -108,11 +79,7 @@ void MacroAssembler::Jump(Handle code, RelocInfo::Mode rmode, int MacroAssembler::CallSize(Register target, Condition cond) { -#ifdef USE_BLX return kInstrSize; -#else - return 2 * kInstrSize; -#endif } @@ -121,13 +88,7 @@ void MacroAssembler::Call(Register target, Condition cond) { BlockConstPoolScope block_const_pool(this); Label start; bind(&start); -#ifdef USE_BLX blx(target, cond); -#else - // set lr for return at current pc + 8 - mov(lr, Operand(pc), LeaveCC, cond); - mov(pc, Operand(target), LeaveCC, cond); -#endif ASSERT_EQ(CallSize(target, cond), SizeOfCodeGeneratedSince(&start)); } @@ -170,7 +131,6 @@ void MacroAssembler::Call(Address target, set_predictable_code_size(true); } -#ifdef USE_BLX // Call sequence on V7 or later may be : // movw ip, #... @ call address low 16 // movt ip, #... @ call address high 16 @@ -191,12 +151,6 @@ void MacroAssembler::Call(Address target, mov(ip, Operand(reinterpret_cast(target), rmode)); blx(ip, cond); -#else - // Set lr for return at current pc + 8. - mov(lr, Operand(pc), LeaveCC, cond); - // Emit a ldr pc, [pc + offset of target in constant pool]. - mov(pc, Operand(reinterpret_cast(target), rmode), LeaveCC, cond); -#endif ASSERT_EQ(CallSize(target, rmode, cond), SizeOfCodeGeneratedSince(&start)); if (mode == NEVER_INLINE_TARGET_ADDRESS) { set_predictable_code_size(old_predictable_code_size); @@ -230,11 +184,7 @@ void MacroAssembler::Call(Handle code, void MacroAssembler::Ret(Condition cond) { -#if USE_BX bx(lr, cond); -#else - mov(pc, Operand(lr), LeaveCC, cond); -#endif } @@ -3226,44 +3176,6 @@ void MacroAssembler::InitializeFieldsWithFiller(Register start_offset, } -void MacroAssembler::CountLeadingZeros(Register zeros, // Answer. - Register source, // Input. - Register scratch) { - ASSERT(!zeros.is(source) || !source.is(scratch)); - ASSERT(!zeros.is(scratch)); - ASSERT(!scratch.is(ip)); - ASSERT(!source.is(ip)); - ASSERT(!zeros.is(ip)); -#ifdef CAN_USE_ARMV5_INSTRUCTIONS - clz(zeros, source); // This instruction is only supported after ARM5. -#else - // Order of the next two lines is important: zeros register - // can be the same as source register. - Move(scratch, source); - mov(zeros, Operand::Zero()); - // Top 16. - tst(scratch, Operand(0xffff0000)); - add(zeros, zeros, Operand(16), LeaveCC, eq); - mov(scratch, Operand(scratch, LSL, 16), LeaveCC, eq); - // Top 8. - tst(scratch, Operand(0xff000000)); - add(zeros, zeros, Operand(8), LeaveCC, eq); - mov(scratch, Operand(scratch, LSL, 8), LeaveCC, eq); - // Top 4. - tst(scratch, Operand(0xf0000000)); - add(zeros, zeros, Operand(4), LeaveCC, eq); - mov(scratch, Operand(scratch, LSL, 4), LeaveCC, eq); - // Top 2. - tst(scratch, Operand(0xc0000000)); - add(zeros, zeros, Operand(2), LeaveCC, eq); - mov(scratch, Operand(scratch, LSL, 2), LeaveCC, eq); - // Top bit. - tst(scratch, Operand(0x80000000u)); - add(zeros, zeros, Operand(1), LeaveCC, eq); -#endif -} - - void MacroAssembler::CheckFor32DRegs(Register scratch) { mov(scratch, Operand(ExternalReference::cpu_features())); ldr(scratch, MemOperand(scratch)); diff --git a/deps/v8/src/arm/macro-assembler-arm.h b/deps/v8/src/arm/macro-assembler-arm.h index 86ae8f22d9..f9f672bac6 100644 --- a/deps/v8/src/arm/macro-assembler-arm.h +++ b/deps/v8/src/arm/macro-assembler-arm.h @@ -993,15 +993,6 @@ class MacroAssembler: public Assembler { Register input_high, Register input_low); - // Count leading zeros in a 32 bit word. On ARM5 and later it uses the clz - // instruction. On pre-ARM5 hardware this routine gives the wrong answer - // for 0 (31 instead of 32). Source and scratch can be the same in which case - // the source is clobbered. Source and zeros can also be the same in which - // case scratch should be a different register. - void CountLeadingZeros(Register zeros, - Register source, - Register scratch); - // Check whether d16-d31 are available on the CPU. The result is given by the // Z condition flag: Z==0 if d16-d31 available, Z==1 otherwise. void CheckFor32DRegs(Register scratch); diff --git a/deps/v8/src/arm/simulator-arm.cc b/deps/v8/src/arm/simulator-arm.cc index ad4d77df28..ea79310447 100644 --- a/deps/v8/src/arm/simulator-arm.cc +++ b/deps/v8/src/arm/simulator-arm.cc @@ -975,14 +975,12 @@ ReturnType Simulator::GetFromVFPRegister(int reg_index) { } -// Runtime FP routines take up to two double arguments and zero -// or one integer arguments. All are constructed here, +// For use in calls that take two double values, constructed either // from r0-r3 or d0 and d1. -void Simulator::GetFpArgs(double* x, double* y, int32_t* z) { +void Simulator::GetFpArgs(double* x, double* y) { if (use_eabi_hardfloat()) { *x = vfp_registers_[0]; *y = vfp_registers_[1]; - *z = registers_[1]; } else { // We use a char buffer to get around the strict-aliasing rules which // otherwise allow the compiler to optimize away the copy. @@ -993,9 +991,41 @@ void Simulator::GetFpArgs(double* x, double* y, int32_t* z) { // Registers 2 and 3 -> y. OS::MemCopy(buffer, registers_ + 2, sizeof(*y)); OS::MemCopy(y, buffer, sizeof(*y)); - // Register 2 -> z. - OS::MemCopy(buffer, registers_ + 2, sizeof(*z)); - OS::MemCopy(z, buffer, sizeof(*z)); + } +} + +// For use in calls that take one double value, constructed either +// from r0 and r1 or d0. +void Simulator::GetFpArgs(double* x) { + if (use_eabi_hardfloat()) { + *x = vfp_registers_[0]; + } else { + // We use a char buffer to get around the strict-aliasing rules which + // otherwise allow the compiler to optimize away the copy. + char buffer[sizeof(*x)]; + // Registers 0 and 1 -> x. + OS::MemCopy(buffer, registers_, sizeof(*x)); + OS::MemCopy(x, buffer, sizeof(*x)); + } +} + + +// For use in calls that take one double value constructed either +// from r0 and r1 or d0 and one integer value. +void Simulator::GetFpArgs(double* x, int32_t* y) { + if (use_eabi_hardfloat()) { + *x = vfp_registers_[0]; + *y = registers_[1]; + } else { + // We use a char buffer to get around the strict-aliasing rules which + // otherwise allow the compiler to optimize away the copy. + char buffer[sizeof(*x)]; + // Registers 0 and 1 -> x. + OS::MemCopy(buffer, registers_, sizeof(*x)); + OS::MemCopy(x, buffer, sizeof(*x)); + // Register 2 -> y. + OS::MemCopy(buffer, registers_ + 2, sizeof(*y)); + OS::MemCopy(y, buffer, sizeof(*y)); } } @@ -1618,12 +1648,10 @@ typedef int64_t (*SimulatorRuntimeCall)(int32_t arg0, int32_t arg3, int32_t arg4, int32_t arg5); - -// These prototypes handle the four types of FP calls. -typedef int64_t (*SimulatorRuntimeCompareCall)(double darg0, double darg1); -typedef double (*SimulatorRuntimeFPFPCall)(double darg0, double darg1); -typedef double (*SimulatorRuntimeFPCall)(double darg0); -typedef double (*SimulatorRuntimeFPIntCall)(double darg0, int32_t arg0); +typedef double (*SimulatorRuntimeFPCall)(int32_t arg0, + int32_t arg1, + int32_t arg2, + int32_t arg3); // This signature supports direct call in to API function native callback // (refer to InvocationCallback in v8.h). @@ -1689,27 +1717,27 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { intptr_t external = reinterpret_cast(redirection->external_function()); if (fp_call) { - double dval0, dval1; // one or two double parameters - int32_t ival; // zero or one integer parameters - int64_t iresult = 0; // integer return value - double dresult = 0; // double return value - GetFpArgs(&dval0, &dval1, &ival); if (::v8::internal::FLAG_trace_sim || !stack_aligned) { - SimulatorRuntimeCall generic_target = - reinterpret_cast(external); + SimulatorRuntimeFPCall target = + reinterpret_cast(external); + double dval0, dval1; + int32_t ival; switch (redirection->type()) { case ExternalReference::BUILTIN_FP_FP_CALL: case ExternalReference::BUILTIN_COMPARE_CALL: + GetFpArgs(&dval0, &dval1); PrintF("Call to host function at %p with args %f, %f", - FUNCTION_ADDR(generic_target), dval0, dval1); + FUNCTION_ADDR(target), dval0, dval1); break; case ExternalReference::BUILTIN_FP_CALL: + GetFpArgs(&dval0); PrintF("Call to host function at %p with arg %f", - FUNCTION_ADDR(generic_target), dval0); + FUNCTION_ADDR(target), dval0); break; case ExternalReference::BUILTIN_FP_INT_CALL: + GetFpArgs(&dval0, &ival); PrintF("Call to host function at %p with args %f, %d", - FUNCTION_ADDR(generic_target), dval0, ival); + FUNCTION_ADDR(target), dval0, ival); break; default: UNREACHABLE(); @@ -1721,54 +1749,22 @@ void Simulator::SoftwareInterrupt(Instruction* instr) { PrintF("\n"); } CHECK(stack_aligned); - switch (redirection->type()) { - case ExternalReference::BUILTIN_COMPARE_CALL: { - SimulatorRuntimeCompareCall target = - reinterpret_cast(external); - iresult = target(dval0, dval1); - set_register(r0, static_cast(iresult)); - set_register(r1, static_cast(iresult >> 32)); - break; - } - case ExternalReference::BUILTIN_FP_FP_CALL: { - SimulatorRuntimeFPFPCall target = - reinterpret_cast(external); - dresult = target(dval0, dval1); - SetFpResult(dresult); - break; - } - case ExternalReference::BUILTIN_FP_CALL: { + if (redirection->type() != ExternalReference::BUILTIN_COMPARE_CALL) { SimulatorRuntimeFPCall target = - reinterpret_cast(external); - dresult = target(dval0); - SetFpResult(dresult); - break; - } - case ExternalReference::BUILTIN_FP_INT_CALL: { - SimulatorRuntimeFPIntCall target = - reinterpret_cast(external); - dresult = target(dval0, ival); - SetFpResult(dresult); - break; - } - default: - UNREACHABLE(); - break; - } - if (::v8::internal::FLAG_trace_sim || !stack_aligned) { - switch (redirection->type()) { - case ExternalReference::BUILTIN_COMPARE_CALL: - PrintF("Returned %08x\n", static_cast(iresult)); - break; - case ExternalReference::BUILTIN_FP_FP_CALL: - case ExternalReference::BUILTIN_FP_CALL: - case ExternalReference::BUILTIN_FP_INT_CALL: - PrintF("Returned %f\n", dresult); - break; - default: - UNREACHABLE(); - break; + reinterpret_cast(external); + double result = target(arg0, arg1, arg2, arg3); + SetFpResult(result); + } else { + SimulatorRuntimeCall target = + reinterpret_cast(external); + int64_t result = target(arg0, arg1, arg2, arg3, arg4, arg5); + int32_t lo_res = static_cast(result); + int32_t hi_res = static_cast(result >> 32); + if (::v8::internal::FLAG_trace_sim) { + PrintF("Returned %08x\n", lo_res); } + set_register(r0, lo_res); + set_register(r1, hi_res); } } else if (redirection->type() == ExternalReference::DIRECT_API_CALL) { SimulatorRuntimeDirectApiCall target = diff --git a/deps/v8/src/arm/simulator-arm.h b/deps/v8/src/arm/simulator-arm.h index 45ae999b57..674ff42d63 100644 --- a/deps/v8/src/arm/simulator-arm.h +++ b/deps/v8/src/arm/simulator-arm.h @@ -348,8 +348,10 @@ class Simulator { void* external_function, v8::internal::ExternalReference::Type type); - // Handle arguments and return value for runtime FP functions. - void GetFpArgs(double* x, double* y, int32_t* z); + // For use in calls that take double value arguments. + void GetFpArgs(double* x, double* y); + void GetFpArgs(double* x); + void GetFpArgs(double* x, int32_t* y); void SetFpResult(const double& result); void TrashCallerSaveRegisters(); diff --git a/deps/v8/src/atomicops_internals_x86_gcc.h b/deps/v8/src/atomicops_internals_x86_gcc.h index e58d598fbd..6e55b50182 100644 --- a/deps/v8/src/atomicops_internals_x86_gcc.h +++ b/deps/v8/src/atomicops_internals_x86_gcc.h @@ -168,7 +168,7 @@ inline Atomic32 Release_Load(volatile const Atomic32* ptr) { return *ptr; } -#if defined(__x86_64__) && defined(V8_HOST_ARCH_64_BIT) +#if defined(__x86_64__) // 64-bit low-level operations on 64-bit platform. diff --git a/deps/v8/src/builtins-decls.h b/deps/v8/src/builtins-decls.h deleted file mode 100644 index beb5dd1e80..0000000000 --- a/deps/v8/src/builtins-decls.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 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. - -#ifndef V8_BUILTINS_DECLS_H_ -#define V8_BUILTINS_DECLS_H_ - -#include "arguments.h" - -namespace v8 { -namespace internal { - -DECLARE_RUNTIME_FUNCTION(MaybeObject*, ArrayConstructor_StubFailure); - -} } // namespace v8::internal - -#endif // V8_BUILTINS_DECLS_H_ diff --git a/deps/v8/src/builtins.cc b/deps/v8/src/builtins.cc index 56c0501e57..30edf579e6 100644 --- a/deps/v8/src/builtins.cc +++ b/deps/v8/src/builtins.cc @@ -125,31 +125,23 @@ BUILTIN_LIST_C(DEF_ARG_TYPE) #ifdef DEBUG -#define BUILTIN(name) \ - MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ - name##ArgumentsType args, Isolate* isolate); \ - MUST_USE_RESULT static MaybeObject* Builtin_##name( \ - int args_length, Object** args_object, Isolate* isolate) { \ - name##ArgumentsType args(args_length, args_object); \ - ASSERT(isolate == Isolate::Current()); \ - args.Verify(); \ - return Builtin_Impl_##name(args, isolate); \ - } \ - MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ +#define BUILTIN(name) \ + MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ + name##ArgumentsType args, Isolate* isolate); \ + MUST_USE_RESULT static MaybeObject* Builtin_##name( \ + name##ArgumentsType args, Isolate* isolate) { \ + ASSERT(isolate == Isolate::Current()); \ + args.Verify(); \ + return Builtin_Impl_##name(args, isolate); \ + } \ + MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ name##ArgumentsType args, Isolate* isolate) #else // For release mode. -#define BUILTIN(name) \ - static MaybeObject* Builtin_impl##name( \ - name##ArgumentsType args, Isolate* isolate); \ - static MaybeObject* Builtin_##name( \ - int args_length, Object** args_object, Isolate* isolate) { \ - name##ArgumentsType args(args_length, args_object); \ - return Builtin_impl##name(args, isolate); \ - } \ - static MaybeObject* Builtin_impl##name( \ - name##ArgumentsType args, Isolate* isolate) +#define BUILTIN(name) \ + static MaybeObject* Builtin_##name(name##ArgumentsType args, Isolate* isolate) + #endif diff --git a/deps/v8/src/builtins.h b/deps/v8/src/builtins.h index ee607ad304..12ed56af79 100644 --- a/deps/v8/src/builtins.h +++ b/deps/v8/src/builtins.h @@ -274,6 +274,8 @@ enum BuiltinExtraArguments { V(APPLY_PREPARE, 1) \ V(APPLY_OVERFLOW, 1) +MaybeObject* ArrayConstructor_StubFailure(Arguments args, Isolate* isolate); + class BuiltinFunctionTable; class ObjectVisitor; diff --git a/deps/v8/src/code-stubs-hydrogen.cc b/deps/v8/src/code-stubs-hydrogen.cc index 02c0091889..60ddf9b462 100644 --- a/deps/v8/src/code-stubs-hydrogen.cc +++ b/deps/v8/src/code-stubs-hydrogen.cc @@ -106,8 +106,7 @@ bool CodeStubGraphBuilderBase::BuildGraph() { Zone* zone = this->zone(); int param_count = descriptor_->register_param_count_; HEnvironment* start_environment = graph()->start_environment(); - HBasicBlock* next_block = - CreateBasicBlock(start_environment, BailoutId::StubEntry()); + HBasicBlock* next_block = CreateBasicBlock(start_environment); current_block()->Goto(next_block); next_block->SetJoinId(BailoutId::StubEntry()); set_current_block(next_block); @@ -186,7 +185,7 @@ template static Handle DoGenerateCode(Stub* stub) { CodeStubGraphBuilder builder(stub); LChunk* chunk = OptimizeGraph(builder.CreateGraph()); - return chunk->Codegen(Code::COMPILED_STUB); + return chunk->Codegen(); } @@ -212,23 +211,24 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { AddInstruction(new(zone) HLoadElements(boilerplate, NULL)); IfBuilder if_fixed_cow(this); - if_fixed_cow.BeginIfMapEquals(elements, factory->fixed_cow_array_map()); + if_fixed_cow.IfCompareMap(elements, factory->fixed_cow_array_map()); + if_fixed_cow.Then(); environment()->Push(BuildCloneShallowArray(context(), boilerplate, alloc_site_mode, FAST_ELEMENTS, 0/*copy-on-write*/)); - if_fixed_cow.BeginElse(); + if_fixed_cow.Else(); IfBuilder if_fixed(this); - if_fixed.BeginIfMapEquals(elements, factory->fixed_array_map()); + if_fixed.IfCompareMap(elements, factory->fixed_array_map()); + if_fixed.Then(); environment()->Push(BuildCloneShallowArray(context(), boilerplate, alloc_site_mode, FAST_ELEMENTS, length)); - if_fixed.BeginElse(); - + if_fixed.Else(); environment()->Push(BuildCloneShallowArray(context(), boilerplate, alloc_site_mode, @@ -250,7 +250,7 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { Handle FastCloneShallowArrayStub::GenerateCode() { CodeStubGraphBuilder builder(this); LChunk* chunk = OptimizeGraph(builder.CreateGraph()); - return chunk->Codegen(Code::COMPILED_STUB); + return chunk->Codegen(); } @@ -359,11 +359,12 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { IfBuilder if_builder(this); - if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); + if_builder.IfCompare(array_length, graph()->GetConstant0(), Token::EQ); + if_builder.Then(); // Nothing to do, just change the map. - if_builder.BeginElse(); + if_builder.Else(); HInstruction* elements = AddInstruction(new(zone) HLoadElements(js_array, js_array)); diff --git a/deps/v8/src/code-stubs.cc b/deps/v8/src/code-stubs.cc index ad418d69cd..497dde54e7 100644 --- a/deps/v8/src/code-stubs.cc +++ b/deps/v8/src/code-stubs.cc @@ -67,7 +67,7 @@ void CodeStub::RecordCodeGeneration(Code* code, Isolate* isolate) { } -int CodeStub::GetCodeKind() { +Code::Kind CodeStub::GetCodeKind() const { return Code::STUB; } @@ -98,7 +98,7 @@ Handle PlatformCodeStub::GenerateCode() { // Copy the generated code into a heap object. Code::Flags flags = Code::ComputeFlags( - static_cast(GetCodeKind()), + GetCodeKind(), GetICState(), GetExtraICState(), GetStubType(), @@ -308,7 +308,7 @@ void ICCompareStub::AddToSpecialCache(Handle new_object) { bool ICCompareStub::FindCodeInSpecialCache(Code** code_out, Isolate* isolate) { Factory* factory = isolate->factory(); Code::Flags flags = Code::ComputeFlags( - static_cast(GetCodeKind()), + GetCodeKind(), UNINITIALIZED); ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT); Handle probe( diff --git a/deps/v8/src/code-stubs.h b/deps/v8/src/code-stubs.h index 60c4fb9bd5..56b595583d 100644 --- a/deps/v8/src/code-stubs.h +++ b/deps/v8/src/code-stubs.h @@ -176,19 +176,19 @@ class CodeStub BASE_EMBEDDED { virtual Major MajorKey() = 0; virtual int MinorKey() = 0; - protected: - static bool CanUseFPRegisters(); - - // Generates the assembler code for the stub. - virtual Handle GenerateCode() = 0; - - // BinaryOpStub needs to override this. virtual InlineCacheState GetICState() { return UNINITIALIZED; } virtual Code::ExtraICState GetExtraICState() { return Code::kNoExtraICState; } + + protected: + static bool CanUseFPRegisters(); + + // Generates the assembler code for the stub. + virtual Handle GenerateCode() = 0; + virtual Code::StubType GetStubType() { return Code::NORMAL; } @@ -210,7 +210,7 @@ class CodeStub BASE_EMBEDDED { virtual void Activate(Code* code) { } // BinaryOpStub needs to override this. - virtual int GetCodeKind(); + virtual Code::Kind GetCodeKind() const; // Add the code to a specialized cache, specific to an individual // stub type. Please note, this method must add the code object to a @@ -249,7 +249,7 @@ class PlatformCodeStub : public CodeStub { // Retrieve the code for the stub. Generate the code if needed. virtual Handle GenerateCode(); - virtual int GetCodeKind() { return Code::STUB; } + virtual Code::Kind GetCodeKind() const { return Code::STUB; } virtual int GetStubFlags() { return -1; } protected: @@ -286,7 +286,7 @@ class HydrogenCodeStub : public CodeStub { // Retrieve the code for the stub. Generate the code if needed. virtual Handle GenerateCode() = 0; - virtual int GetCodeKind() { return Code::COMPILED_STUB; } + virtual Code::Kind GetCodeKind() const { return Code::STUB; } CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) { return isolate->code_stub_interface_descriptor(MajorKey()); @@ -606,7 +606,7 @@ class MathPowStub: public PlatformCodeStub { class ICStub: public PlatformCodeStub { public: explicit ICStub(Code::Kind kind) : kind_(kind) { } - virtual int GetCodeKind() { return kind_; } + virtual Code::Kind GetCodeKind() const { return kind_; } virtual InlineCacheState GetICState() { return MONOMORPHIC; } bool Describes(Code* code) { @@ -692,7 +692,7 @@ class StoreArrayLengthStub: public StoreICStub { class HandlerStub: public ICStub { public: explicit HandlerStub(Code::Kind kind) : ICStub(kind) { } - virtual int GetCodeKind() { return Code::STUB; } + virtual Code::Kind GetCodeKind() const { return Code::STUB; } virtual int GetStubFlags() { return kind(); } }; @@ -830,7 +830,7 @@ class BinaryOpStub: public PlatformCodeStub { // Entirely platform-specific methods are defined as static helper // functions in the /code-stubs-.cc files. - virtual int GetCodeKind() { return Code::BINARY_OP_IC; } + virtual Code::Kind GetCodeKind() const { return Code::BINARY_OP_IC; } virtual InlineCacheState GetICState() { return BinaryOpIC::ToState(Max(left_type_, right_type_)); @@ -884,7 +884,7 @@ class ICCompareStub: public PlatformCodeStub { virtual CodeStub::Major MajorKey() { return CompareIC; } virtual int MinorKey(); - virtual int GetCodeKind() { return Code::COMPARE_IC; } + virtual Code::Kind GetCodeKind() const { return Code::COMPARE_IC; } void GenerateSmis(MacroAssembler* masm); void GenerateNumbers(MacroAssembler* masm); @@ -1548,7 +1548,7 @@ class ToBooleanStub: public PlatformCodeStub { : tos_(tos), types_(types) { } void Generate(MacroAssembler* masm); - virtual int GetCodeKind() { return Code::TO_BOOLEAN_IC; } + virtual Code::Kind GetCodeKind() const { return Code::TO_BOOLEAN_IC; } virtual void PrintName(StringStream* stream); virtual bool SometimesSetsUpAFrame() { return false; } diff --git a/deps/v8/src/codegen.cc b/deps/v8/src/codegen.cc index 90ab2b5a20..ff4003c1ef 100644 --- a/deps/v8/src/codegen.cc +++ b/deps/v8/src/codegen.cc @@ -106,10 +106,13 @@ Handle CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, // Allocate and install the code. CodeDesc desc; + bool is_crankshafted = + Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION || + info->IsStub(); masm->GetCode(&desc); Handle code = - isolate->factory()->NewCode(desc, flags, masm->CodeObject()); - + isolate->factory()->NewCode(desc, flags, masm->CodeObject(), + false, is_crankshafted); if (!code.is_null()) { isolate->counters()->total_compiled_code_size()->Increment( code->instruction_size()); @@ -129,7 +132,7 @@ void CodeGenerator::PrintCode(Handle code, CompilationInfo* info) { if (print_code) { // Print the source code if available. FunctionLiteral* function = info->function(); - if (code->kind() != Code::COMPILED_STUB) { + if (code->kind() == Code::OPTIMIZED_FUNCTION) { Handle