diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index 088daeabf9..77f38dd9c6 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -9,9 +9,11 @@ *.pdb *.pyc *.scons* +*.sln *.so *.suo *.user +*.vcproj *.xcodeproj #*# *~ @@ -20,13 +22,16 @@ d8 d8_g shell shell_g +/build/Debug /build/gyp +/build/Release /obj/ /out/ /test/es5conform/data /test/mozilla/data /test/sputnik/sputniktests /test/test262/data +/third_party /tools/oom_dump/oom_dump /tools/oom_dump/oom_dump.o /tools/visual_studio/Debug diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 6e46b3d621..1156d94958 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -24,9 +24,11 @@ Dineel D Sule Erich Ocean Fedor Indutny Filipe David Manana +Haitao Feng Ioseb Dzmanashvili Jan de Mooij Jay Freeman +James Pike Joel Stanley John Jozwiak Jonathan Liu @@ -46,6 +48,7 @@ Rene Rebe Robert Mustacchi Rodolph Perfetta Ryan Dahl +Sandro Santilli Sanjoy Das Subrato K De Tobias Burnus diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index fae15e58ee..7110aa83e3 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,330 @@ +2012-09-11: Version 3.13.7 + + Enable/disable LiveEdit using the (C++) debug API. + + Performance and stability improvements on all platforms. + + +2012-09-06: Version 3.13.6 + + Added validity checking to API functions and calls. + + Disabled accessor inlining (Chromium issue 134609). + + Fixed bug in Math.min/max in optimized code (Chromium issue 145961). + + Directly use %ObjectKeys in json stringify (Chromium issue 2312). + + Fixed VS2005 build (issue 2313). + + Activated fixed ES5 readonly semantics by default. + + Added hardfp flag to the Makefile. + + Performance and stability improvements on all platforms. + + +2012-08-29: Version 3.13.5 + + Release stack trace data after firing Error.stack accessor. + (issue 2308) + + Added a new API V8::SetJitCodeEventHandler to push code name and + location to users such as profilers. + + Allocate block-scoped global bindings to global context. + + Performance and stability improvements on all platforms. + + +2012-08-28: Version 3.13.4 + + Print reason for disabling optimization. Kill --trace-bailout flag. + + Provided option to disable full DEBUG build on Android. + + Introduced global contexts to represent lexical global scope(s). + + Fixed rounding in Uint8ClampedArray setter. (issue 2294) + + Performance and stability improvements on all platforms. + + +2012-08-21: Version 3.13.3 + + Performance and stability improvements on all platforms. + + +2012-08-20: Version 3.13.2 + + Performance and stability improvements on all platforms. + + +2012-08-16: Version 3.13.1 + + Performance and stability improvements on all platforms. + + +2012-08-10: Version 3.13.0 + + Added histograms for total allocated/live heap size, as well as + allocated size and percentage of total for map and cell space. + + Fixed parseInt's octal parsing behavior (ECMA-262 Annex E 15.1.2.2). + (issue 1645) + + Added checks for interceptors to negative lookup code in Crankshaft. + (Chromium issue 140473) + + Made incremental marking clear ICs and type feedback cells. + + Performance and stability improvements on all platforms. + + +2012-08-01: Version 3.12.19 + + Performance and stability improvements on all platforms. + + +2012-07-30: Version 3.12.18 + + Forced using bit-pattern for signed zero double. (issue 2239) + + Made sure double to int conversion is correct. (issue 2260) + + Performance and stability improvements on all platforms. + + +2012-07-27: Version 3.12.17 + + Always set the callee's context when calling a function from optimized + code. + (Chromium issue 138887) + + Fixed building with GCC 3.x + (issue 2016, 2017) + + Improved API calls that return empty handles. + (issue 2245) + + Performance and stability improvements on all platforms. + + +2012-07-25: Version 3.12.16 + + Performance and stability improvements on all platforms. + + +2012-07-24: Version 3.12.15 + + Added PRESERVE_ASCII_NULL option to String::WriteAscii. + (issue 2252) + + Added dependency to HLoadKeyed* instructions to prevent invalid + hoisting. (Chromium issue 137768) + + Enabled building d8 for Android on Mac. + + Interpret negative hexadecimal literals as NaN. + (issue 2240) + + Expose counters in javascript when using --track-gc-object-stats. + + Enabled building and testing V8 on Android IA. + + Added --trace-parse flag to parser. + + Performance and stability improvements on all platforms. + + +2012-07-18: Version 3.12.14 + + Deactivated optimization of packed arrays. + (Chromium issue 137768) + + Fixed broken accessor transition. + (Chromium issue 137689) + + Performance and stability improvements on all platforms. + + +2012-07-17: Version 3.12.13 + + Fixed missing tagging of stack value in finally block. + (Chromium issue 137496) + + Added more support for heap analysis. + + Performance and stability improvements on all platforms. + + +2012-07-16: Version 3.12.12 + + Added an option to the tickprocessor to specify the directory for lib + lookup. + + Fixed ICs for slow objects with native accessor (Chromium issue 137002). + + Fixed transcendental cache on ARM in optimized code (issue 2234). + + New heap inspection tools: counters for object sizes and counts, + histograms for external fragmentation. + + Incorporated constness into inferred interfaces (in preparation for + handling imports) (issue 1569). + + Performance and stability improvements on all platforms. + + +2012-07-12: Version 3.12.11 + + Renamed "mips" arch to "mipsel" in the GYP build. + + Fixed computation of call targets on prototypes in Crankshaft. + (Chromium issue 125148) + + Removed use of __lookupGetter__ when generating stack trace. + (issue 1591) + + Turned on ES 5.2 globals semantics by default. + (issue 1991, Chromium issue 80591) + + Synced preparser and parser wrt syntax error in switch..case. + (issue 2210) + + Fixed reporting of octal literals in strict mode when preparsing. + (issue 2220) + + Fixed inline constructors for Harmony Proxy prototypes. + (issue 2225) + + Performance and stability improvements on all platforms. + + +2012-07-10: Version 3.12.10 + + Re-enabled and fixed issue with array bounds check elimination + (Chromium issue 132114). + + Fixed Debug::Break crash. (Chromium issue 131642) + + Added optimizing compiler support for JavaScript getters. + + Performance and stability improvements on all platforms. + + +2012-07-06: Version 3.12.9 + + Correctly advance the scanner when scanning unicode regexp flag. + (Chromium issue 136084) + + Fixed unhandlified code calling Harmony Proxy traps. + (issue 2219) + + Performance and stability improvements on all platforms. + + +2012-07-05: Version 3.12.8 + + Implemented TypedArray.set and ArrayBuffer.slice in d8. + + Performance and stability improvements on all platforms. + + +2012-07-03: Version 3.12.7 + + Fixed lazy compilation for strict eval scopes. + (Chromium issue 135066) + + Made MACOSX_DEPLOYMENT_TARGET configurable in GYP. + (issue 2151) + + Report "hidden properties" in heap profiler for properties case. + (issue 2212) + + Activated optimization of packed arrays by default. + + Performance and stability improvements on all platforms. + + +2012-06-29: Version 3.12.6 + + Cleaned up hardfp ABI detection for ARM (V8 issue 2140). + + Extended TypedArray support in d8. + + +2012-06-28: Version 3.12.5 + + Fixed lazy parsing heuristics to respect outer scope. + (Chromium issue 135008) + + Allow using test-wrapper-gypbuild.py on Windows when no python + interpreter is registered. + + Performance and stability improvements on all platforms. + + +2012-06-27: Version 3.12.4 + + Removed -fomit-frame-pointer flag from Release builds to make + the stack walkable by TCMalloc (Chromium issue 133723). + + Ported r7868 (constant masking) to x64 (issue 1374). + + Expose more detailed memory statistics (issue 2201). + + Fixed Harmony Maps and WeakMaps for undefined values + (Chromium issue 132744). + + Correctly throw reference error in strict mode with ICs disabled + (issue 2119). + + Performance and stability improvements on all platforms. + + +2012-06-25: Version 3.12.3 + + Reverted r11835 'Unify promotion and allocation limit computation' due + to V8 Splay performance regression on Mac. (Chromium issue 134183) + + Fixed sharing of literal boilerplates for optimized code. (issue 2193) + + Performance and stability improvements on all platforms. + + +2012-06-22: Version 3.12.2 + + Made near-jump check more strict in LoadNamedFieldPolymorphic on + ia32/x64. (Chromium issue 134055) + + Fixed lazy sweeping heuristics to prevent old-space expansion. + (issue 2194) + + Performance and stability improvements on all platforms. + + +2012-06-21: Version 3.12.1 + + Performance and stability improvements on all platforms. + + +2012-06-20: Version 3.12.0 + + Fixed Chromium issues: + 115100, 129628, 131994, 132727, 132741, 132742, 133211 + + Fixed V8 issues: + 915, 1914, 2034, 2087, 2094, 2134, 2156, 2166, 2172, 2177, 2179, 2185 + + Added --extra-code flag to mksnapshot to load JS code into the VM + before creating the snapshot. + + Support 'restart call frame' command in the debugger. + + Performance and stability improvements on all platforms. + + 2012-06-13: Version 3.11.10 Implemented heap profiler memory usage reporting. diff --git a/deps/v8/Makefile b/deps/v8/Makefile index 0d825c0795..8db3193860 100644 --- a/deps/v8/Makefile +++ b/deps/v8/Makefile @@ -34,7 +34,8 @@ TESTJOBS ?= -j16 GYPFLAGS ?= TESTFLAGS ?= ANDROID_NDK_ROOT ?= -ANDROID_TOOL_PREFIX = $(ANDROID_NDK_ROOT)/toolchain/bin/arm-linux-androideabi +ANDROID_TOOLCHAIN ?= +ANDROID_V8 ?= /data/local/v8 # Special build flags. Use them like this: "make library=shared" @@ -61,6 +62,13 @@ endif ifeq ($(snapshot), off) GYPFLAGS += -Dv8_use_snapshot='false' endif +# extrachecks=on/off +ifeq ($(extrachecks), on) + GYPFLAGS += -Dv8_enable_extra_checks=1 +endif +ifeq ($(extrachecks), off) + GYPFLAGS += -Dv8_enable_extra_checks=0 +endif # gdbjit=on ifeq ($(gdbjit), on) GYPFLAGS += -Dv8_enable_gdbjit=1 @@ -95,6 +103,14 @@ endif ifeq ($(strictaliasing), off) GYPFLAGS += -Dv8_no_strict_aliasing=1 endif +# regexp=interpreted +ifeq ($(regexp), interpreted) + GYPFLAGS += -Dv8_interpreted_regexp=1 +endif +# hardfp=on +ifeq ($(hardfp), on) + GYPFLAGS += -Dv8_use_arm_eabi_hardfloat=true +endif # ----------------- available targets: -------------------- # - "dependencies": pulls in external dependencies (currently: GYP) @@ -103,7 +119,7 @@ endif # - every combination ., e.g. "ia32.release" # - "native": current host's architecture, release mode # - any of the above with .check appended, e.g. "ia32.release.check" -# - "android": cross-compile for Android/ARM (release mode) +# - "android": cross-compile for Android/ARM # - default (no target specified): build all DEFAULT_ARCHES and MODES # - "check": build all targets and run all tests # - ".clean" for any in ARCHES @@ -113,9 +129,10 @@ endif # Architectures and modes to be compiled. Consider these to be internal # variables, don't override them (use the targets instead). -ARCHES = ia32 x64 arm mips +ARCHES = ia32 x64 arm mipsel DEFAULT_ARCHES = ia32 x64 arm MODES = release debug +ANDROID_ARCHES = android_ia32 android_arm # List of files that trigger Makefile regeneration: GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ @@ -124,15 +141,19 @@ GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) +ANDROID_BUILDS = $(foreach mode,$(MODES), \ + $(addsuffix .$(mode),$(ANDROID_ARCHES))) # Generates corresponding test targets, e.g. "ia32.release.check". CHECKS = $(addsuffix .check,$(BUILDS)) +ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS)) # File where previously used GYPFLAGS are stored. ENVFILE = $(OUTDIR)/environment .PHONY: all check clean dependencies $(ENVFILE).new native \ $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \ - must-set-ANDROID_NDK_ROOT + $(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \ + must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN # Target definitions. "all" is the default. all: $(MODES) @@ -143,6 +164,10 @@ buildbot: $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \ builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)" +mips mips.release mips.debug: + @echo "V8 does not support big-endian MIPS builds at the moment," \ + "please use little-endian builds (mipsel)." + # Compile targets. MODES and ARCHES are convenience targets. .SECONDEXPANSION: $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES)) @@ -162,17 +187,15 @@ native: $(OUTDIR)/Makefile.native CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ builddir="$(shell pwd)/$(OUTDIR)/$@" -# TODO(jkummerow): add "android.debug" when we need it. -android android.release: $(OUTDIR)/Makefile.android - @$(MAKE) -C "$(OUTDIR)" -f Makefile.android \ - CXX="$(ANDROID_TOOL_PREFIX)-g++" \ - AR="$(ANDROID_TOOL_PREFIX)-ar" \ - RANLIB="$(ANDROID_TOOL_PREFIX)-ranlib" \ - CC="$(ANDROID_TOOL_PREFIX)-gcc" \ - LD="$(ANDROID_TOOL_PREFIX)-ld" \ - LINK="$(ANDROID_TOOL_PREFIX)-g++" \ - BUILDTYPE=Release \ - builddir="$(shell pwd)/$(OUTDIR)/android.release" +$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES)) + +$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \ + must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN Makefile.android + @$(MAKE) -f Makefile.android $@ \ + ARCH="$(basename $@)" \ + MODE="$(subst .,,$(suffix $@))" \ + OUTDIR="$(OUTDIR)" \ + GYPFLAGS="$(GYPFLAGS)" # Test targets. check: all @@ -192,12 +215,25 @@ $(CHECKS): $$(basename $$@) @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ --arch-and-mode=$(basename $@) $(TESTFLAGS) +$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@) + @tools/android-sync.sh $(basename $@) $(OUTDIR) \ + $(shell pwd) $(ANDROID_V8) + +$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync + @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ + --arch-and-mode=$(basename $@) \ + --timeout=600 \ + --special-command="tools/android-run.py @" + +$(addsuffix .check, $(ANDROID_ARCHES)): \ + $(addprefix $$(basename $$@).,$(MODES)).check + native.check: native @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \ --arch-and-mode=. $(TESTFLAGS) # Clean targets. You can clean each architecture individually, or everything. -$(addsuffix .clean,$(ARCHES)) android.clean: +$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)): rm -f $(OUTDIR)/Makefile.$(basename $@) rm -rf $(OUTDIR)/$(basename $@).release rm -rf $(OUTDIR)/$(basename $@).debug @@ -208,11 +244,11 @@ native.clean: rm -rf $(OUTDIR)/native find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete -clean: $(addsuffix .clean,$(ARCHES)) native.clean android.clean +clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean # GYP file generation targets. -MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES)) -$(MAKEFILES): $(GYPFILES) $(ENVFILE) +OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES)) +$(OUT_MAKEFILES): $(GYPFILES) $(ENVFILE) GYP_GENERATORS=make \ build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ -Ibuild/standalone.gypi --depth=. \ @@ -224,18 +260,11 @@ $(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE) build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ -Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS) -$(OUTDIR)/Makefile.android: $(GYPFILES) $(ENVFILE) build/android.gypi \ - must-set-ANDROID_NDK_ROOT - GYP_GENERATORS=make \ - CC="${ANDROID_TOOL_PREFIX}-gcc" \ - CXX="${ANDROID_TOOL_PREFIX}-g++" \ - build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ - -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ - -S.android $(GYPFLAGS) - -must-set-ANDROID_NDK_ROOT: +must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN: ifndef ANDROID_NDK_ROOT - $(error ANDROID_NDK_ROOT is not set) +ifndef ANDROID_TOOLCHAIN + $(error ANDROID_NDK_ROOT or ANDROID_TOOLCHAIN must be set)) +endif endif # Replaces the old with the new environment file if they're different, which diff --git a/deps/v8/Makefile.android b/deps/v8/Makefile.android new file mode 100644 index 0000000000..a8d7fe148e --- /dev/null +++ b/deps/v8/Makefile.android @@ -0,0 +1,92 @@ +# 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. + +# Those definitions should be consistent with the main Makefile +ANDROID_ARCHES = android_ia32 android_arm +MODES = release debug + +# Generates all combinations of ANDROID ARCHES and MODES, +# e.g. "android_ia32.release" or "android_arm.release" +ANDROID_BUILDS = $(foreach mode,$(MODES), \ + $(addsuffix .$(mode),$(ANDROID_ARCHES))) + +HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') +ifeq ($(HOST_OS), linux) + TOOLCHAIN_DIR = linux-x86 +else + ifeq ($(HOST_OS), mac) + TOOLCHAIN_DIR = darwin-x86 + else + $(error Host platform "${HOST_OS}" is not supported) + endif +endif + +ifeq ($(ARCH), android_arm) + DEFINES = target_arch=arm v8_target_arch=arm android_target_arch=arm + DEFINES += arm_neon=0 armv7=1 + TOOLCHAIN_ARCH = arm-linux-androideabi-4.4.3 +else + ifeq ($(ARCH), android_ia32) + DEFINES = target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86 + TOOLCHAIN_ARCH = x86-4.4.3 + else + $(error Target architecture "${ARCH}" is not supported) + endif +endif + +TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt +ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR} +ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) + $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}") +endif + +# For mksnapshot host generation. +DEFINES += host_os=${HOST_OS} + +.SECONDEXPANSION: +$(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@) + @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \ + CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ + AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \ + RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \ + CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \ + LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \ + LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \ + BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ + python -c "print raw_input().capitalize()") \ + builddir="$(shell pwd)/$(OUTDIR)/$@" + +# Android GYP file generation targets. +ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES)) +$(ANDROID_MAKEFILES): + @GYP_GENERATORS=make-android \ + GYP_DEFINES="${DEFINES}" \ + CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \ + CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \ + build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ + -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ + -S.${ARCH} ${GYPFLAGS} diff --git a/deps/v8/build/android.gypi b/deps/v8/build/android.gypi index ffd06484f7..d2d1a35726 100644 --- a/deps/v8/build/android.gypi +++ b/deps/v8/build/android.gypi @@ -33,35 +33,40 @@ 'variables': { # Location of Android NDK. 'variables': { - 'variables': { - 'android_ndk_root%': '&1 | grep -q "^Target: mips-" && echo "yes" || echo "no")', + 'mipscompiler': '&1 | grep -q "^Target: mips" && echo "yes" || echo "no")', }, 'conditions': [ ['mipscompiler=="yes"', { @@ -207,7 +226,7 @@ 'defines': ['_MIPS_ARCH_LOONGSON',], }], ], - }], # v8_target_arch=="mips" + }], # v8_target_arch=="mipsel" ['v8_target_arch=="x64"', { 'defines': [ 'V8_TARGET_ARCH_X64', @@ -220,6 +239,7 @@ 'StackReserveSize': '2097152', }, }, + 'msvs_configuration_platform': 'x64', }], # v8_target_arch=="x64" ['v8_use_liveobjectlist=="true"', { 'defines': [ @@ -239,6 +259,7 @@ 'WIN32', ], 'msvs_configuration_attributes': { + 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', 'CharacterSet': '1', }, @@ -264,7 +285,7 @@ ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ or OS=="netbsd" or OS=="mac" or OS=="android") and \ (v8_target_arch=="arm" or v8_target_arch=="ia32" or \ - v8_target_arch=="mips")', { + v8_target_arch=="mipsel")', { # Check whether the host compiler and target compiler support the # '-m32' option and set it if so. 'target_conditions': [ @@ -323,19 +344,36 @@ }, 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { - 'cflags': [ '-Wno-unused-parameter', + 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ], }], + ['OS=="android"', { + 'variables': { + 'android_full_debug%': 1, + }, + 'conditions': [ + ['android_full_debug==0', { + # Disable full debug if we want a faster v8 in a debug build. + # TODO(2304): pass DISABLE_DEBUG_ASSERT instead of hiding DEBUG. + 'defines!': [ + 'DEBUG', + ], + }], + ], + }], ], }, # Debug 'Release': { 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="android"', { + 'cflags!': [ + '-O2', + '-Os', + ], 'cflags': [ '-fdata-sections', '-ffunction-sections', - '-fomit-frame-pointer', '-O3', ], 'conditions': [ @@ -365,15 +403,17 @@ 'InlineFunctionExpansion': '2', 'EnableIntrinsicFunctions': 'true', 'FavorSizeOrSpeed': '0', - 'OmitFramePointers': 'true', 'StringPooling': 'true', - 'conditions': [ ['OS=="win" and component=="shared_library"', { 'RuntimeLibrary': '2', #/MD }, { 'RuntimeLibrary': '0', #/MT }], + ['v8_target_arch=="x64"', { + # TODO(2207): remove this option once the bug is fixed. + 'WholeProgramOptimization': 'true', + }], ], }, 'VCLinkerTool': { diff --git a/deps/v8/build/standalone.gypi b/deps/v8/build/standalone.gypi index ebdf557230..7145a16e0c 100644 --- a/deps/v8/build/standalone.gypi +++ b/deps/v8/build/standalone.gypi @@ -33,6 +33,7 @@ 'component%': 'static_library', 'visibility%': 'hidden', 'msvs_multi_core_compile%': '1', + 'mac_deployment_target%': '10.5', 'variables': { 'variables': { 'variables': { @@ -45,7 +46,7 @@ # to gyp. 'host_arch%': ' Call(v8::Handle fun, - Handle data = Handle()); + Handle data = Handle()); /** * Returns a mirror object for the given object. @@ -388,6 +388,14 @@ class EXPORT Debug { * to change. */ static Local GetDebugContext(); + + + /** + * Enable/disable LiveEdit functionality for the given Isolate + * (default Isolate if not provided). V8 will abort if LiveEdit is + * unexpectedly used. LiveEdit is enabled by default. + */ + static void SetLiveEditEnabled(bool enable, Isolate* isolate = NULL); }; diff --git a/deps/v8/include/v8-preparser.h b/deps/v8/include/v8-preparser.h index f11d05ef79..389949d200 100644 --- a/deps/v8/include/v8-preparser.h +++ b/deps/v8/include/v8-preparser.h @@ -55,11 +55,12 @@ // Setup for Linux shared library export. There is no need to distinguish // between building or using the V8 shared library, but we should not // export symbols when we are building a static library. -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED) +#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ + (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) #define V8EXPORT __attribute__ ((visibility("default"))) -#else // defined(__GNUC__) && (__GNUC__ >= 4) +#else #define V8EXPORT -#endif // defined(__GNUC__) && (__GNUC__ >= 4) +#endif #endif // _WIN32 diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index cda2463362..c1e9a9e0b8 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -50,11 +50,12 @@ // Setup for Linux shared library export. See v8.h in this directory for // information on how to build/use V8 as shared library. -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED) +#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ + (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) #define V8EXPORT __attribute__ ((visibility("default"))) -#else // defined(__GNUC__) && (__GNUC__ >= 4) +#else #define V8EXPORT -#endif // defined(__GNUC__) && (__GNUC__ >= 4) +#endif #endif // _WIN32 @@ -280,32 +281,12 @@ class V8EXPORT HeapGraphNode { /** Returns node's own size, in bytes. */ int GetSelfSize() const; - /** - * Returns node's retained size, in bytes. That is, self + sizes of - * the objects that are reachable only from this object. In other - * words, the size of memory that will be reclaimed having this node - * collected. - */ - int GetRetainedSize() const; - /** Returns child nodes count of the node. */ int GetChildrenCount() const; /** Retrieves a child by index. */ const HeapGraphEdge* GetChild(int index) const; - /** Returns retainer nodes count of the node. */ - int GetRetainersCount() const; - - /** Returns a retainer by index. */ - const HeapGraphEdge* GetRetainer(int index) const; - - /** - * Returns a dominator node. This is the node that participates in every - * path from the snapshot root to the current node. - */ - const HeapGraphNode* GetDominatorNode() const; - /** * Finds and returns a value from the heap corresponding to this node, * if the value is still reachable. diff --git a/deps/v8/include/v8-testing.h b/deps/v8/include/v8-testing.h index 245f74d878..59eebf9db4 100644 --- a/deps/v8/include/v8-testing.h +++ b/deps/v8/include/v8-testing.h @@ -50,11 +50,12 @@ // Setup for Linux shared library export. See v8.h in this directory for // information on how to build/use V8 as shared library. -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED) +#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ + (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) #define V8EXPORT __attribute__ ((visibility("default"))) -#else // defined(__GNUC__) && (__GNUC__ >= 4) +#else #define V8EXPORT -#endif // defined(__GNUC__) && (__GNUC__ >= 4) +#endif #endif // _WIN32 diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 77ffb385ab..ddde388cd4 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -63,15 +63,16 @@ #else // _WIN32 // Setup for Linux shared library export. -#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(V8_SHARED) +#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ + (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) #ifdef BUILDING_V8_SHARED #define V8EXPORT __attribute__ ((visibility("default"))) #else #define V8EXPORT #endif -#else // defined(__GNUC__) && (__GNUC__ >= 4) +#else #define V8EXPORT -#endif // defined(__GNUC__) && (__GNUC__ >= 4) +#endif #endif // _WIN32 @@ -1064,7 +1065,8 @@ class String : public Primitive { enum WriteOptions { NO_OPTIONS = 0, HINT_MANY_WRITES_EXPECTED = 1, - NO_NULL_TERMINATION = 2 + NO_NULL_TERMINATION = 2, + PRESERVE_ASCII_NULL = 4 }; // 16-bit character codes. @@ -1550,6 +1552,12 @@ class Object : public Value { */ V8EXPORT Local ObjectProtoToString(); + /** + * Returns the function invoked as a constructor for this object. + * May be the null value. + */ + V8EXPORT Local GetConstructor(); + /** * Returns the name of the function invoked as a constructor for this object. */ @@ -2909,15 +2917,84 @@ typedef bool (*EntropySource)(unsigned char* buffer, size_t length); * resolving the location of a return address on the stack. Profilers that * change the return address on the stack can use this to resolve the stack * location to whereever the profiler stashed the original return address. - * When invoked, return_addr_location will point to a location on stack where - * a machine return address resides, this function should return either the - * same pointer, or a pointer to the profiler's copy of the original return - * address. + * + * \param return_addr_location points to a location on stack where a machine + * return address resides. + * \returns either return_addr_location, or else a pointer to the profiler's + * copy of the original return address. + * + * \note the resolver function must not cause garbage collection. */ typedef uintptr_t (*ReturnAddressLocationResolver)( uintptr_t return_addr_location); +/** + * FunctionEntryHook is the type of the profile entry hook called at entry to + * any generated function when function-level profiling is enabled. + * + * \param function the address of the function that's being entered. + * \param return_addr_location points to a location on stack where the machine + * return address resides. This can be used to identify the caller of + * \p function, and/or modified to divert execution when \p function exits. + * + * \note the entry hook must not cause garbage collection. + */ +typedef void (*FunctionEntryHook)(uintptr_t function, + uintptr_t return_addr_location); + + +/** + * A JIT code event is issued each time code is added, moved or removed. + * + * \note removal events are not currently issued. + */ +struct JitCodeEvent { + enum EventType { + CODE_ADDED, + CODE_MOVED, + CODE_REMOVED + }; + + // Type of event. + EventType type; + // Start of the instructions. + void* code_start; + // Size of the instructions. + size_t code_len; + + union { + // Only valid for CODE_ADDED. + struct { + // Name of the object associated with the code, note that the string is + // not zero-terminated. + const char* str; + // Number of chars in str. + size_t len; + } name; + // New location of instructions. Only valid for CODE_MOVED. + void* new_code_start; + }; +}; + +/** + * Option flags passed to the SetJitCodeEventHandler function. + */ +enum JitCodeEventOptions { + kJitCodeEventDefault = 0, + // Generate callbacks for already existent code. + kJitCodeEventEnumExisting = 1 +}; + + +/** + * Callback function passed to SetJitCodeEventHandler. + * + * \param event code add, move or removal event. + */ +typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); + + /** * Interface for iterating though all external resources in the heap. */ @@ -3178,6 +3255,43 @@ class V8EXPORT V8 { static void SetReturnAddressLocationResolver( ReturnAddressLocationResolver return_address_resolver); + /** + * Allows the host application to provide the address of a function that's + * invoked on entry to every V8-generated function. + * Note that \p entry_hook is invoked at the very start of each + * generated function. + * + * \param entry_hook a function that will be invoked on entry to every + * V8-generated function. + * \returns true on success on supported platforms, false on failure. + * \note Setting a new entry hook function when one is already active will + * fail. + */ + static bool SetFunctionEntryHook(FunctionEntryHook entry_hook); + + /** + * Allows the host application to provide the address of a function that is + * notified each time code is added, moved or removed. + * + * \param options options for the JIT code event handler. + * \param event_handler the JIT code event handler, which will be invoked + * each time code is added, moved or removed. + * \note \p event_handler won't get notified of existent code. + * \note since code removal notifications are not currently issued, the + * \p event_handler may get notifications of code that overlaps earlier + * code notifications. This happens when code areas are reused, and the + * earlier overlapping code areas should therefore be discarded. + * \note the events passed to \p event_handler and the strings they point to + * are not guaranteed to live past each call. The \p event_handler must + * copy strings and other parameters it needs to keep around. + * \note the set of events declared in JitCodeEvent::EventType is expected to + * grow over time, and the JitCodeEvent structure is expected to accrue + * new members. The \p event_handler function must ignore event codes + * it does not recognize to maintain future compatibility. + */ + static void SetJitCodeEventHandler(JitCodeEventOptions options, + JitCodeEventHandler event_handler); + /** * Adjusts the amount of registered external memory. Used to give * V8 an indication of the amount of externally allocated memory @@ -3928,7 +4042,7 @@ class Internals { static const int kNullValueRootIndex = 7; static const int kTrueValueRootIndex = 8; static const int kFalseValueRootIndex = 9; - static const int kEmptySymbolRootIndex = 128; + static const int kEmptySymbolRootIndex = 116; static const int kJSObjectType = 0xaa; static const int kFirstNonstringType = 0x80; diff --git a/deps/v8/preparser/preparser-process.cc b/deps/v8/preparser/preparser-process.cc index 368f63f6ce..1bcc804923 100644 --- a/deps/v8/preparser/preparser-process.cc +++ b/deps/v8/preparser/preparser-process.cc @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// 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: @@ -202,7 +202,7 @@ void fail(v8::PreParserData* data, const char* message, ...) { fflush(stderr); if (data != NULL) { // Print preparser data to stdout. - uint32_t size = data->size(); + uint32_t size = static_cast(data->size()); fprintf(stderr, "LOG: data size: %u\n", size); if (!WriteBuffer(stdout, data->data(), size)) { perror("ERROR: Writing data"); @@ -232,7 +232,7 @@ struct ExceptionExpectation { void CheckException(v8::PreParserData* data, ExceptionExpectation* expects) { - PreparseDataInterpreter reader(data->data(), data->size()); + PreparseDataInterpreter reader(data->data(), static_cast(data->size())); if (expects->throws) { if (!reader.throws()) { if (expects->type == NULL) { diff --git a/deps/v8/samples/lineprocessor.cc b/deps/v8/samples/lineprocessor.cc index 7a84a2a0ff..26e787f2b7 100644 --- a/deps/v8/samples/lineprocessor.cc +++ b/deps/v8/samples/lineprocessor.cc @@ -25,19 +25,11 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// This controls whether this sample is compiled with debugger support. -// You may trace its usages in source text to see what parts of program -// are responsible for debugging support. -// Note that V8 itself should be compiled with enabled debugger support -// to have it all working. -#define SUPPORT_DEBUGGING - #include -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT #include -#endif +#endif // ENABLE_DEBUGGER_SUPPORT #include #include @@ -116,7 +108,7 @@ bool RunCppCycle(v8::Handle script, v8::Local context, bool report_exceptions); -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT v8::Persistent debug_message_context; void DispatchDebugMessages() { @@ -135,7 +127,7 @@ void DispatchDebugMessages() { v8::Debug::ProcessDebugMessages(); } -#endif +#endif // ENABLE_DEBUGGER_SUPPORT int RunMain(int argc, char* argv[]) { @@ -146,11 +138,11 @@ int RunMain(int argc, char* argv[]) { v8::Handle script_name(NULL); int script_param_counter = 0; -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT int port_number = -1; bool wait_for_connection = false; bool support_callback = false; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT MainCycleType cycle_type = CycleInCpp; @@ -164,7 +156,7 @@ int RunMain(int argc, char* argv[]) { cycle_type = CycleInCpp; } else if (strcmp(str, "--main-cycle-in-js") == 0) { cycle_type = CycleInJs; -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT } else if (strcmp(str, "--callback") == 0) { support_callback = true; } else if (strcmp(str, "--wait-for-connection") == 0) { @@ -172,7 +164,7 @@ int RunMain(int argc, char* argv[]) { } else if (strcmp(str, "-p") == 0 && i + 1 < argc) { port_number = atoi(argv[i + 1]); // NOLINT i++; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT } else if (strncmp(str, "--", 2) == 0) { printf("Warning: unknown flag %s.\nTry --help for options\n", str); } else if (strcmp(str, "-e") == 0 && i + 1 < argc) { @@ -219,7 +211,7 @@ int RunMain(int argc, char* argv[]) { // Enter the newly created execution environment. v8::Context::Scope context_scope(context); -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT debug_message_context = v8::Persistent::New(context); v8::Locker locker; @@ -231,7 +223,7 @@ int RunMain(int argc, char* argv[]) { if (port_number != -1) { v8::Debug::EnableAgent("lineprocessor", port_number, wait_for_connection); } -#endif +#endif // ENABLE_DEBUGGER_SUPPORT bool report_exceptions = true; @@ -272,9 +264,9 @@ int RunMain(int argc, char* argv[]) { bool RunCppCycle(v8::Handle script, v8::Local context, bool report_exceptions) { -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT v8::Locker lock; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT v8::Handle fun_name = v8::String::New("ProcessLine"); v8::Handle process_val = @@ -347,7 +339,7 @@ v8::Handle ReadFile(const char* name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); @@ -427,9 +419,9 @@ v8::Handle ReadLine() { char* res; { -#ifdef SUPPORT_DEBUGGING +#ifdef ENABLE_DEBUGGER_SUPPORT v8::Unlocker unlocker; -#endif +#endif // ENABLE_DEBUGGER_SUPPORT res = fgets(buffer, kBufferSize, stdin); } if (res == NULL) { diff --git a/deps/v8/samples/process.cc b/deps/v8/samples/process.cc index c0cee4c28e..ae6a5500cd 100644 --- a/deps/v8/samples/process.cc +++ b/deps/v8/samples/process.cc @@ -1,4 +1,4 @@ -// Copyright 2008 the V8 project authors. All rights reserved. +// 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: @@ -351,7 +351,7 @@ Handle JsHttpRequestProcessor::MapGet(Local name, // Otherwise fetch the value and wrap it in a JavaScript string const string& value = (*iter).second; - return String::New(value.c_str(), value.length()); + return String::New(value.c_str(), static_cast(value.length())); } @@ -443,7 +443,7 @@ Handle JsHttpRequestProcessor::GetPath(Local name, const string& path = request->Path(); // Wrap the result in a JavaScript string and return it. - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast(path.length())); } @@ -451,7 +451,7 @@ Handle JsHttpRequestProcessor::GetReferrer(Local name, const AccessorInfo& info) { HttpRequest* request = UnwrapRequest(info.Holder()); const string& path = request->Referrer(); - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast(path.length())); } @@ -459,7 +459,7 @@ Handle JsHttpRequestProcessor::GetHost(Local name, const AccessorInfo& info) { HttpRequest* request = UnwrapRequest(info.Holder()); const string& path = request->Host(); - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast(path.length())); } @@ -467,7 +467,7 @@ Handle JsHttpRequestProcessor::GetUserAgent(Local name, const AccessorInfo& info) { HttpRequest* request = UnwrapRequest(info.Holder()); const string& path = request->UserAgent(); - return String::New(path.c_str(), path.length()); + return String::New(path.c_str(), static_cast(path.length())); } @@ -557,7 +557,7 @@ Handle ReadFile(const string& name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); diff --git a/deps/v8/samples/shell.cc b/deps/v8/samples/shell.cc index db0cc1a930..821ef75a76 100644 --- a/deps/v8/samples/shell.cc +++ b/deps/v8/samples/shell.cc @@ -205,7 +205,7 @@ v8::Handle ReadFile(const char* name) { char* chars = new char[size + 1]; chars[size] = '\0'; for (int i = 0; i < size;) { - int read = fread(&chars[i], 1, size - i, file); + int read = static_cast(fread(&chars[i], 1, size - i, file)); i += read; } fclose(file); diff --git a/deps/v8/src/SConscript b/deps/v8/src/SConscript index 2482b379ac..16bfb55b38 100755 --- a/deps/v8/src/SConscript +++ b/deps/v8/src/SConscript @@ -43,8 +43,8 @@ SOURCES = { assembler.cc ast.cc atomicops_internals_x86_gcc.cc - bignum.cc bignum-dtoa.cc + bignum.cc bootstrapper.cc builtins.cc cached-powers.cc @@ -67,27 +67,30 @@ SOURCES = { disassembler.cc diy-fp.cc dtoa.cc - elements.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 - fast-dtoa.cc - fixed-dtoa.cc handles.cc heap-profiler.cc heap.cc - hydrogen.cc hydrogen-instructions.cc + hydrogen.cc ic.cc incremental-marking.cc - interface.cc inspector.cc + interface.cc interpreter-irregexp.cc isolate.cc jsregexp.cc @@ -99,34 +102,37 @@ SOURCES = { log.cc mark-compact.cc messages.cc - objects.cc objects-printer.cc objects-visiting.cc + objects.cc once.cc + optimizing-compiler-thread.cc parser.cc - preparser.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.cc runtime-profiler.cc + runtime.cc safepoint-table.cc - scanner.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 @@ -137,10 +143,7 @@ SOURCES = { v8utils.cc variables.cc version.cc - store-buffer.cc zone.cc - extensions/gc-extension.cc - extensions/externalize-string-extension.cc """), 'arch:arm': Split(""" arm/builtins-arm.cc diff --git a/deps/v8/src/accessors.cc b/deps/v8/src/accessors.cc index 8aabad0d09..9da6141c5b 100644 --- a/deps/v8/src/accessors.cc +++ b/deps/v8/src/accessors.cc @@ -92,9 +92,9 @@ MaybeObject* Accessors::ArrayGetLength(Object* object, void*) { Object* Accessors::FlattenNumber(Object* value) { if (value->IsNumber() || !value->IsJSValue()) return value; JSValue* wrapper = JSValue::cast(value); - ASSERT(Isolate::Current()->context()->global_context()->number_function()-> + ASSERT(Isolate::Current()->context()->native_context()->number_function()-> has_initial_map()); - Map* number_map = Isolate::Current()->context()->global_context()-> + Map* number_map = Isolate::Current()->context()->native_context()-> number_function()->initial_map(); if (wrapper->map() == number_map) return wrapper->value(); return value; @@ -805,4 +805,69 @@ const AccessorDescriptor Accessors::ObjectPrototype = { 0 }; + +// +// Accessors::MakeModuleExport +// + +static v8::Handle ModuleGetExport( + v8::Local property, + const v8::AccessorInfo& info) { + JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); + Context* context = Context::cast(instance->context()); + ASSERT(context->IsModuleContext()); + int slot = info.Data()->Int32Value(); + Object* value = context->get(slot); + if (value->IsTheHole()) { + Handle name = v8::Utils::OpenHandle(*property); + Isolate* isolate = instance->GetIsolate(); + isolate->ScheduleThrow( + *isolate->factory()->NewReferenceError("not_defined", + HandleVector(&name, 1))); + return v8::Handle(); + } + return v8::Utils::ToLocal(Handle(value)); +} + + +static void ModuleSetExport( + v8::Local property, + v8::Local value, + const v8::AccessorInfo& info) { + JSModule* instance = JSModule::cast(*v8::Utils::OpenHandle(*info.Holder())); + Context* context = Context::cast(instance->context()); + ASSERT(context->IsModuleContext()); + int slot = info.Data()->Int32Value(); + Object* old_value = context->get(slot); + if (old_value->IsTheHole()) { + Handle name = v8::Utils::OpenHandle(*property); + Isolate* isolate = instance->GetIsolate(); + isolate->ScheduleThrow( + *isolate->factory()->NewReferenceError("not_defined", + HandleVector(&name, 1))); + return; + } + context->set(slot, *v8::Utils::OpenHandle(*value)); +} + + +Handle Accessors::MakeModuleExport( + Handle name, + int index, + PropertyAttributes attributes) { + Factory* factory = name->GetIsolate()->factory(); + Handle info = factory->NewAccessorInfo(); + info->set_property_attributes(attributes); + info->set_all_can_read(true); + info->set_all_can_write(true); + info->set_name(*name); + info->set_data(Smi::FromInt(index)); + Handle getter = v8::FromCData(&ModuleGetExport); + Handle setter = v8::FromCData(&ModuleSetExport); + info->set_getter(*getter); + if (!(attributes & ReadOnly)) info->set_setter(*setter); + return info; +} + + } } // namespace v8::internal diff --git a/deps/v8/src/accessors.h b/deps/v8/src/accessors.h index 36b9a9984a..250f742fa0 100644 --- a/deps/v8/src/accessors.h +++ b/deps/v8/src/accessors.h @@ -85,6 +85,10 @@ class Accessors : public AllStatic { void*); static MaybeObject* FunctionGetArguments(Object* object, void*); + // Accessor infos. + static Handle MakeModuleExport( + Handle name, int index, PropertyAttributes attributes); + private: // Accessor functions only used through the descriptor. static MaybeObject* FunctionGetLength(Object* object, void*); diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index 0d88047aa2..dcbc894574 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -33,6 +33,7 @@ #include "../include/v8-profiler.h" #include "../include/v8-testing.h" #include "bootstrapper.h" +#include "code-stubs.h" #include "compiler.h" #include "conversions-inl.h" #include "counters.h" @@ -540,7 +541,9 @@ Extension::Extension(const char* name, source_(source, source_length_), dep_count_(dep_count), deps_(deps), - auto_enable_(false) { } + auto_enable_(false) { + CHECK(source != NULL || source_length_ == 0); +} v8::Handle Undefined() { @@ -767,8 +770,8 @@ void Context::SetData(v8::Handle data) { i::Isolate* isolate = env->GetIsolate(); if (IsDeadCheck(isolate, "v8::Context::SetData()")) return; i::Handle raw_data = Utils::OpenHandle(*data); - ASSERT(env->IsGlobalContext()); - if (env->IsGlobalContext()) { + ASSERT(env->IsNativeContext()); + if (env->IsNativeContext()) { env->set_data(*raw_data); } } @@ -781,8 +784,8 @@ v8::Local Context::GetData() { return v8::Local(); } i::Object* raw_result = NULL; - ASSERT(env->IsGlobalContext()); - if (env->IsGlobalContext()) { + ASSERT(env->IsNativeContext()); + if (env->IsNativeContext()) { raw_result = env->data(); } else { return Local(); @@ -1066,7 +1069,6 @@ static i::Handle MakeAccessorInfo( v8::PropertyAttribute attributes, v8::Handle signature) { i::Handle obj = FACTORY->NewAccessorInfo(); - ASSERT(getter != NULL); SET_FIELD_WRAPPED(obj, set_getter, getter); SET_FIELD_WRAPPED(obj, set_setter, setter); if (data.IsEmpty()) data = v8::Undefined(); @@ -1537,9 +1539,10 @@ Local