Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Version 3.18.0

Enabled pretenuring of fast literals in high promotion mode.

Removed preparser library; link preparser executable against full V8.

Fixed set-up of intrinsic's 'constructor' properties. (Chromium issue 229445)

ES6 symbols: extended V8 API to support symbols (issue 2158).

Removed ARM support for VFP2.

Made __proto__ a real JavaScript accessor property. (issue 1949 and issue 2606)

Performance and stability improvements on all platforms.

git-svn-id: https://v8.googlecode.com/svn/trunk@14304 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
  • Loading branch information...
commit fac83d83e78443423336046452762a8200181de0 1 parent d5303eb
mstarzinger@chromium.org authored
Showing with 8,098 additions and 9,211 deletions.
  1. +19 −0 ChangeLog
  2. +111 −19 Makefile
  3. +96 −0 Makefile.nacl
  4. +1 −1  PRESUBMIT.py
  5. +92 −47 build/common.gypi
  6. +3 −1 build/standalone.gypi
  7. +2 −0  include/v8-preparser.h
  8. +26 −23 include/v8-profiler.h
  9. +107 −11 include/v8.h
  10. +4 −2 preparser/preparser-process.cc
  11. +15 −2 preparser/preparser.gyp
  12. +0 −58 src/accessors.cc
  13. +1 −6 src/accessors.h
  14. +3 −3 src/allocation.cc
  15. +192 −36 src/api.cc
  16. +4 −0 src/api.h
  17. +12 −9 src/arguments.h
  18. +3 −15 src/arm/assembler-arm-inl.h
  19. +117 −85 src/arm/assembler-arm.cc
  20. +8 −11 src/arm/assembler-arm.h
  21. +306 −806 src/arm/code-stubs-arm.cc
  22. +2 −4 src/arm/code-stubs-arm.h
  23. +4 −22 src/arm/codegen-arm.cc
  24. +1 −1  src/arm/constants-arm.cc
  25. +12 −7 src/arm/constants-arm.h
  26. +107 −97 src/arm/deoptimizer-arm.cc
  27. +3 −2 src/arm/disasm-arm.cc
  28. +0 −12 src/arm/frames-arm.h
  29. +33 −45 src/arm/full-codegen-arm.cc
  30. +93 −64 src/arm/lithium-arm.cc
  31. +130 −18 src/arm/lithium-arm.h
  32. +73 −478 src/arm/lithium-codegen-arm.cc
  33. +2 −12 src/arm/lithium-codegen-arm.h
  34. +2 −9 src/arm/lithium-gap-resolver-arm.cc
  35. +61 −174 src/arm/macro-assembler-arm.cc
  36. +27 −16 src/arm/macro-assembler-arm.h
  37. +117 −94 src/arm/simulator-arm.cc
  38. +4 −4 src/arm/simulator-arm.h
  39. +220 −391 src/arm/stub-cache-arm.cc
  40. +8 −5 src/array.js
  41. +16 −4 src/assembler.cc
  42. +4 −0 src/assembler.h
  43. +5 −1 src/ast.cc
  44. +14 −5 src/ast.h
  45. +4 −3 src/atomicops_internals_x86_gcc.cc
  46. +1 −1  src/atomicops_internals_x86_gcc.h
  47. +8 −1 src/bignum.cc
  48. +82 −38 src/bootstrapper.cc
  49. +40 −0 src/builtins-decls.h
  50. +24 −16 src/builtins.cc
  51. +0 −2  src/builtins.h
  52. +67 −5 src/code-stubs-hydrogen.cc
  53. +4 −2 src/code-stubs.cc
  54. +47 −9 src/code-stubs.h
  55. +63 −34 src/collection.js
  56. +16 −15 src/compiler.cc
  57. +18 −0 src/contexts.h
  58. +1 −1  src/conversions-inl.h
  59. +2 −2 src/cpu-profiler.cc
  60. +1 −0  src/cpu-profiler.h
  61. +12 −0 src/d8.cc
  62. +7 −0 src/d8.gyp
  63. +8 −11 src/date.js
  64. +9 −7 src/debug.cc
  65. +81 −35 src/deoptimizer.cc
  66. +30 −17 src/deoptimizer.h
  67. +5 −6 src/disassembler.cc
  68. +2 −2 src/elements.cc
  69. +21 −3 src/execution.cc
  70. +4 −1 src/execution.h
  71. +10 −10 src/factory.cc
  72. +24 −11 src/flag-definitions.h
  73. +19 −10 src/flags.cc
  74. +12 −1 src/frames.h
  75. +20 −14 src/full-codegen.cc
  76. +12 −7 src/full-codegen.h
  77. +20 −19 src/gdb-jit.cc
  78. +74 −0 src/generator.js
  79. +6 −1 src/global-handles.h
  80. +12 −0 src/globals.h
  81. +0 −1  src/handles-inl.h
  82. +26 −1 src/handles.cc
  83. +8 −4 src/handles.h
  84. +16 −6 src/heap-inl.h
  85. +1 −1  src/heap-snapshot-generator.cc
  86. +77 −47 src/heap.cc
  87. +22 −38 src/heap.h
  88. +68 −29 src/hydrogen-instructions.cc
  89. +164 −125 src/hydrogen-instructions.h
  90. +510 −103 src/hydrogen.cc
  91. +69 −3 src/hydrogen.h
  92. +3 −3 src/ia32/assembler-ia32.cc
  93. +7 −0 src/ia32/assembler-ia32.h
  94. +0 −35 src/ia32/builtins-ia32.cc
  95. +22 −169 src/ia32/code-stubs-ia32.cc
  96. +418 −161 src/ia32/codegen-ia32.cc
  97. +2 −0  src/ia32/cpu-ia32.cc
  98. +67 −47 src/ia32/deoptimizer-ia32.cc
  99. +0 −12 src/ia32/frames-ia32.h
  100. +21 −13 src/ia32/full-codegen-ia32.cc
  101. +609 −352 src/ia32/lithium-codegen-ia32.cc
  102. +23 −13 src/ia32/lithium-codegen-ia32.h
  103. +51 −21 src/ia32/lithium-gap-resolver-ia32.cc
  104. +187 −111 src/ia32/lithium-ia32.cc
  105. +171 −39 src/ia32/lithium-ia32.h
  106. +40 −22 src/ia32/macro-assembler-ia32.cc
  107. +4 −1 src/ia32/macro-assembler-ia32.h
  108. +139 −76 src/ia32/stub-cache-ia32.cc
  109. +6 −8 src/ic.cc
  110. +46 −25 src/isolate.cc
  111. +5 −19 src/isolate.h
  112. +113 −23 src/json-parser.h
  113. +16 −2 src/json.js
  114. +2 −1  src/jsregexp.cc
  115. +2 −1  src/list-inl.h
  116. +24 −4 src/lithium-allocator.cc
  117. +12 −1 src/lithium-allocator.h
  118. +7 −7 src/liveedit.cc
  119. +3 −2 src/log-utils.cc
  120. +10 −137 src/log.cc
  121. +2 −48 src/log.h
  122. +18 −7 src/macro-assembler.h
  123. +4 −6 src/mark-compact.cc
  124. +10 −3 src/math.js
  125. +4 −0 src/messages.js
  126. +0 −12 src/mips/assembler-mips-inl.h
  127. +24 −40 src/mips/assembler-mips.cc
  128. +0 −5 src/mips/assembler-mips.h
  129. +330 −963 src/mips/code-stubs-mips.cc
  130. +2 −25 src/mips/code-stubs-mips.h
  131. +6 −26 src/mips/codegen-mips.cc
  132. +3 −2 src/mips/constants-mips.h
  133. +82 −77 src/mips/deoptimizer-mips.cc
  134. +2 −2 src/mips/disasm-mips.cc
  135. +0 −12 src/mips/frames-mips.h
  136. +28 −47 src/mips/full-codegen-mips.cc
  137. +59 −437 src/mips/lithium-codegen-mips.cc
  138. +2 −12 src/mips/lithium-codegen-mips.h
  139. +0 −7 src/mips/lithium-gap-resolver-mips.cc
  140. +95 −67 src/mips/lithium-mips.cc
  141. +125 −17 src/mips/lithium-mips.h
  142. +12 −80 src/mips/macro-assembler-mips.cc
  143. +77 −77 src/mips/simulator-mips.cc
  144. +2 −4 src/mips/simulator-mips.h
  145. +225 −431 src/mips/stub-cache-mips.cc
  146. +39 −0 src/objects-debug.cc
  147. +88 −25 src/objects-inl.h
  148. +20 −0 src/objects-printer.cc
  149. +2 −0  src/objects-visiting.cc
  150. +42 −81 src/objects.cc
  151. +96 −18 src/objects.h
  152. +104 −100 src/parser.cc
  153. +57 −26 src/parser.h
  154. +122 −187 src/platform-cygwin.cc
  155. +7 −206 src/platform-freebsd.cc
  156. +18 −347 src/platform-linux.cc
  157. +25 −192 src/platform-macos.cc
  158. +41 −1 src/platform-nullos.cc
  159. +7 −221 src/platform-openbsd.cc
  160. +22 −9 src/platform-posix.cc
  161. +6 −200 src/platform-solaris.cc
  162. +33 −195 src/platform-win32.cc
  163. +84 −155 src/platform.h
  164. +2 −2 src/preparse-data.cc
  165. +6 −24 src/preparser-api.cc
  166. +1 −1  src/preparser.cc
  167. +31 −40 src/preparser.h
  168. +1 −1  src/prettyprinter.cc
  169. +1 −9 src/profile-generator.cc
  170. +24 −10 src/proxy.js
  171. +2 −2 src/regexp-macro-assembler-irregexp.cc
  172. +7 −8 src/regexp-stack.cc
  173. +6 −2 src/regexp.js
  174. +11 −76 src/runtime-profiler.cc
  175. +0 −60 src/runtime-profiler.h
  176. +266 −58 src/runtime.cc
  177. +18 −1 src/runtime.h
Sorry, we could not display the entire diff because it was too big.
View
19 ChangeLog
@@ -1,3 +1,22 @@
+2013-04-17: Version 3.18.0
+
+ Enabled pretenuring of fast literals in high promotion mode.
+
+ Removed preparser library; link preparser executable against full V8.
+
+ Fixed set-up of intrinsic's 'constructor' properties.
+ (Chromium issue 229445)
+
+ ES6 symbols: extended V8 API to support symbols (issue 2158).
+
+ Removed ARM support for VFP2.
+
+ Made __proto__ a real JavaScript accessor property.
+ (issue 1949 and issue 2606)
+
+ Performance and stability improvements on all platforms.
+
+
2013-04-04: Version 3.17.16
Stack trace API: poison stack frames below the first strict mode frame.
View
130 Makefile
@@ -36,6 +36,7 @@ TESTFLAGS ?=
ANDROID_NDK_ROOT ?=
ANDROID_TOOLCHAIN ?=
ANDROID_V8 ?= /data/local/v8
+NACL_SDK_ROOT ?=
# Special build flags. Use them like this: "make library=shared"
@@ -83,22 +84,18 @@ endif
ifeq ($(gdbjit), on)
GYPFLAGS += -Dv8_enable_gdbjit=1
endif
-# vfp2=off
-ifeq ($(vfp2), off)
- GYPFLAGS += -Dv8_can_use_vfp2_instructions=false
-else
- GYPFLAGS += -Dv8_can_use_vfp2_instructions=true -Darm_fpu=vfpv2
-endif
-# vfp3=off
-ifeq ($(vfp3), off)
- GYPFLAGS += -Dv8_can_use_vfp3_instructions=false
-else
- GYPFLAGS += -Dv8_can_use_vfp3_instructions=true -Darm_fpu=vfpv3
+# vtunejit=on
+ifeq ($(vtunejit), on)
+ GYPFLAGS += -Dv8_enable_vtunejit=1
endif
# debuggersupport=off
ifeq ($(debuggersupport), off)
GYPFLAGS += -Dv8_enable_debugger_support=0
endif
+# unalignedaccess=on
+ifeq ($(unalignedaccess), on)
+ GYPFLAGS += -Dv8_can_use_unaligned_accesses=true
+endif
# soname_version=1.2.3
ifdef soname_version
GYPFLAGS += -Dsoname_version=$(soname_version)
@@ -119,13 +116,66 @@ endif
ifeq ($(regexp), interpreted)
GYPFLAGS += -Dv8_interpreted_regexp=1
endif
-# hardfp=on
-ifeq ($(hardfp), on)
- GYPFLAGS += -Dv8_use_arm_eabi_hardfloat=true
-endif
-# armv7=false
+# arm specific flags.
+# armv7=false/true
ifeq ($(armv7), false)
GYPFLAGS += -Darmv7=0
+else
+ifeq ($(armv7), true)
+ GYPFLAGS += -Darmv7=1
+endif
+endif
+# vfp2=off. Deprecated, use armfpu=
+# vfp3=off. Deprecated, use armfpu=
+ifeq ($(vfp3), off)
+ GYPFLAGS += -Darm_fpu=vfp
+endif
+# hardfp=on/off. Deprecated, use armfloatabi
+ifeq ($(hardfp),on)
+ GYPFLAGS += -Darm_float_abi=hard
+else
+ifeq ($(hardfp),off)
+ GYPFLAGS += -Darm_float_abi=softfp
+endif
+endif
+# armneon=on/off
+ifeq ($(armneon), on)
+ GYPFLAGS += -Darm_neon=1
+endif
+# fpu: armfpu=xxx
+# xxx: vfp, vfpv3-d16, vfpv3, neon.
+ifeq ($(armfpu),)
+ifneq ($(vfp3), off)
+ GYPFLAGS += -Darm_fpu=default
+endif
+else
+ GYPFLAGS += -Darm_fpu=$(armfpu)
+endif
+# float abi: armfloatabi=softfp/hard
+ifeq ($(armfloatabi),)
+ifeq ($(hardfp),)
+ GYPFLAGS += -Darm_float_abi=default
+endif
+else
+ GYPFLAGS += -Darm_float_abi=$(armfloatabi)
+endif
+# armthumb=on/off
+ifeq ($(armthumb), off)
+ GYPFLAGS += -Darm_thumb=0
+else
+ifeq ($(armthumb), on)
+ GYPFLAGS += -Darm_thumb=1
+endif
+endif
+# armtest=on
+# With this flag set, by default v8 will only use features implied
+# by the compiler (no probe). This is done by modifying the default
+# values of enable_armv7, enable_vfp2, enable_vfp3 and enable_32dregs.
+# Modifying these flags when launching v8 will enable the probing for
+# the specified values.
+# When using the simulator, this flag is implied.
+ifeq ($(armtest), on)
+ GYPFLAGS += -Darm_test=on
endif
# ----------------- available targets: --------------------
@@ -136,6 +186,7 @@ endif
# - "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
+# - "nacl" : cross-compile for Native Client (ia32 and x64)
# - default (no target specified): build all DEFAULT_ARCHES and MODES
# - "check": build all targets and run all tests
# - "<arch>.clean" for any <arch> in ARCHES
@@ -149,19 +200,27 @@ ARCHES = ia32 x64 arm mipsel
DEFAULT_ARCHES = ia32 x64 arm
MODES = release debug
ANDROID_ARCHES = android_ia32 android_arm android_mipsel
+NACL_ARCHES = nacl_ia32 nacl_x64
# List of files that trigger Makefile regeneration:
GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \
preparser/preparser.gyp samples/samples.gyp src/d8.gyp \
test/cctest/cctest.gyp tools/gyp/v8.gyp
+# If vtunejit=on, the v8vtune.gyp will be appended.
+ifeq ($(vtunejit), on)
+ GYPFILES += src/third_party/vtune/v8vtune.gyp
+endif
# 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)))
+NACL_BUILDS = $(foreach mode,$(MODES), \
+ $(addsuffix .$(mode),$(NACL_ARCHES)))
# Generates corresponding test targets, e.g. "ia32.release.check".
CHECKS = $(addsuffix .check,$(BUILDS))
ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
+NACL_CHECKS = $(addsuffix .check,$(NACL_BUILDS))
# File where previously used GYPFLAGS are stored.
ENVFILE = $(OUTDIR)/environment
@@ -169,7 +228,9 @@ ENVFILE = $(OUTDIR)/environment
$(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
$(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
$(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
- must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN
+ must-set-ANDROID_NDK_ROOT_OR_TOOLCHAIN \
+ $(NACL_ARCHES) $(NACL_BUILDS) $(NACL_CHECKS) \
+ must-set-NACL_SDK_ROOT
# Target definitions. "all" is the default.
all: $(MODES)
@@ -213,6 +274,16 @@ $(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
OUTDIR="$(OUTDIR)" \
GYPFLAGS="$(GYPFLAGS)"
+$(NACL_ARCHES): $(addprefix $$@.,$(MODES))
+
+$(NACL_BUILDS): $(GYPFILES) $(ENVFILE) \
+ Makefile.nacl must-set-NACL_SDK_ROOT
+ @$(MAKE) -f Makefile.nacl $@ \
+ ARCH="$(basename $@)" \
+ MODE="$(subst .,,$(suffix $@))" \
+ OUTDIR="$(OUTDIR)" \
+ GYPFLAGS="$(GYPFLAGS)"
+
# Test targets.
check: all
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
@@ -244,12 +315,21 @@ $(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
$(addsuffix .check, $(ANDROID_ARCHES)): \
$(addprefix $$(basename $$@).,$(MODES)).check
+$(addsuffix .check, $(NACL_BUILDS)): $$(basename $$@)
+ @tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR) \
+ --arch-and-mode=$(basename $@) \
+ --timeout=600 --nopresubmit \
+ --command-prefix="tools/nacl-run.py"
+
+$(addsuffix .check, $(NACL_ARCHES)): \
+ $(addprefix $$(basename $$@).,$(MODES)).check
+
native.check: native
@tools/run-tests.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
--arch-and-mode=. $(TESTFLAGS)
# Clean targets. You can clean each architecture individually, or everything.
-$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)):
+$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)):
rm -f $(OUTDIR)/Makefile.$(basename $@)
rm -rf $(OUTDIR)/$(basename $@).release
rm -rf $(OUTDIR)/$(basename $@).debug
@@ -260,7 +340,7 @@ native.clean:
rm -rf $(OUTDIR)/native
find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete
-clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean
+clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES) $(NACL_ARCHES)) native.clean
# GYP file generation targets.
OUT_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES))
@@ -283,6 +363,18 @@ ifndef ANDROID_TOOLCHAIN
endif
endif
+# Note that NACL_SDK_ROOT must be set to point to an appropriate
+# Native Client SDK before using this makefile. You can download
+# an SDK here:
+# https://developers.google.com/native-client/sdk/download
+# The path indicated by NACL_SDK_ROOT will typically end with
+# a folder for a pepper version such as "pepper_25" that should
+# have "tools" and "toolchain" subdirectories.
+must-set-NACL_SDK_ROOT:
+ifndef NACL_SDK_ROOT
+ $(error NACL_SDK_ROOT must be set)
+endif
+
# Replaces the old with the new environment file if they're different, which
# will trigger GYP to regenerate Makefiles.
$(ENVFILE): $(ENVFILE).new
View
96 Makefile.nacl
@@ -0,0 +1,96 @@
+#
+# 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.
+
+# Those definitions should be consistent with the main Makefile
+NACL_ARCHES = nacl_ia32 nacl_x64
+MODES = release debug
+
+# Generates all combinations of NACL ARCHES and MODES,
+# e.g. "nacl_ia32.release" or "nacl_x64.release"
+NACL_BUILDS = $(foreach mode,$(MODES), \
+ $(addsuffix .$(mode),$(NACL_ARCHES)))
+
+HOST_OS = $(shell uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
+ifeq ($(HOST_OS), linux)
+ TOOLCHAIN_DIR = linux_x86_glibc
+else
+ ifeq ($(HOST_OS), mac)
+ TOOLCHAIN_DIR = mac_x86_glibc
+ else
+ $(error Host platform "${HOST_OS}" is not supported)
+ endif
+endif
+
+TOOLCHAIN_PATH = ${NACL_SDK_ROOT}/toolchain
+NACL_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR}
+
+ifeq ($(ARCH), nacl_ia32)
+ GYPENV = nacl_target_arch=nacl_ia32 v8_target_arch=arm v8_host_arch=ia32
+ TOOLCHAIN_ARCH = x86-4.4
+ NACL_CC = "$(NACL_TOOLCHAIN)/bin/i686-nacl-gcc"
+ NACL_CXX = "$(NACL_TOOLCHAIN)/bin/i686-nacl-g++"
+ NACL_LINK = "$(NACL_TOOLCHAIN)/bin/i686-nacl-g++"
+else
+ ifeq ($(ARCH), nacl_x64)
+ GYPENV = nacl_target_arch=nacl_x64 v8_target_arch=arm v8_host_arch=ia32
+ TOOLCHAIN_ARCH = x86-4.4
+ NACL_CC = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-gcc"
+ NACL_CXX = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-g++"
+ NACL_LINK = "$(NACL_TOOLCHAIN)/bin/x86_64-nacl-g++"
+ else
+ $(error Target architecture "${ARCH}" is not supported)
+ endif
+endif
+
+ifeq ($(wildcard $(NACL_TOOLCHAIN)),)
+ $(error Cannot find Native Client toolchain in "${NACL_TOOLCHAIN}")
+endif
+
+# For mksnapshot host generation.
+GYPENV += host_os=${HOST_OS}
+
+NACL_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(NACL_ARCHES))
+.SECONDEXPANSION:
+# For some reason the $$(basename $$@) expansion didn't work here...
+$(NACL_BUILDS): $(NACL_MAKEFILES)
+ @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \
+ CXX=${NACL_CXX} \
+ LINK=${NACL_LINK} \
+ BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
+ python -c "print raw_input().capitalize()") \
+ builddir="$(shell pwd)/$(OUTDIR)/$@"
+
+# NACL GYP file generation targets.
+$(NACL_MAKEFILES):
+ @GYP_GENERATORS=make \
+ GYP_DEFINES="${GYPENV}" \
+ CC=${NACL_CC} \
+ CXX=${NACL_CXX} \
+ build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
+ -Ibuild/standalone.gypi --depth=. \
+ -S.$(subst .,,$(suffix $@)) $(GYPFLAGS)
View
2  PRESUBMIT.py
@@ -53,6 +53,7 @@ def _CommonChecks(input_api, output_api):
results = []
results.extend(input_api.canned_checks.CheckOwners(
input_api, output_api, source_file_filter=None))
+ results.extend(_V8PresubmitChecks(input_api, output_api))
return results
@@ -67,5 +68,4 @@ def CheckChangeOnCommit(input_api, output_api):
results.extend(_CommonChecks(input_api, output_api))
results.extend(input_api.canned_checks.CheckChangeHasDescription(
input_api, output_api))
- results.extend(_V8PresubmitChecks(input_api, output_api))
return results
View
139 build/common.gypi
@@ -35,6 +35,13 @@
'CXX%': '${CXX:-$(which g++)}', # Used to assemble a shell command.
'v8_compress_startup_data%': 'off',
'v8_target_arch%': '<(target_arch)',
+ # Native Client builds currently use the V8 ARM JIT and
+ # arm/simulator-arm.cc to defer the significant effort required
+ # for NaCl JIT support. The nacl_target_arch variable provides
+ # the 'true' target arch for places in this file that need it.
+ # TODO(bradchen): get rid of nacl_target_arch when someday
+ # NaCl V8 builds stop using the ARM simulator
+ 'nacl_target_arch%': 'none', # must be set externally
# Setting 'v8_can_use_unaligned_accesses' to 'true' will allow the code
# generated by V8 to do unaligned memory access, and setting it to 'false'
@@ -44,30 +51,17 @@
# access is allowed for all CPUs.
'v8_can_use_unaligned_accesses%': 'default',
- # Setting 'v8_can_use_vfp2_instructions' to 'true' will enable use of ARM VFP
- # instructions in the V8 generated code. VFP instructions will be enabled
- # both for the snapshot and for the ARM target. Leaving the default value
- # of 'false' will avoid VFP instructions in the snapshot and use CPU feature
- # probing when running on the target.
- 'v8_can_use_vfp2_instructions%': 'false',
- 'v8_can_use_vfp3_instructions%': 'false',
-
# Setting 'v8_can_use_vfp32dregs' to 'true' will cause V8 to use the VFP
# registers d16-d31 in the generated code, both in the snapshot and for the
# ARM target. Leaving the default value of 'false' will avoid the use of
# these registers in the snapshot and use CPU feature probing when running
# on the target.
'v8_can_use_vfp32dregs%': 'false',
+ 'arm_test%': 'off',
# Similar to vfp but on MIPS.
'v8_can_use_fpu_instructions%': 'true',
- # Setting v8_use_arm_eabi_hardfloat to true will turn on V8 support for ARM
- # EABI calling convention where double arguments are passed in VFP
- # registers. Note that the GCC flag '-mfloat-abi=hard' should be used as
- # well when compiling for the ARM target.
- 'v8_use_arm_eabi_hardfloat%': 'false',
-
# Similar to the ARM hard float ABI but on MIPS.
'v8_use_mips_abi_hardfloat%': 'true',
@@ -136,55 +130,105 @@
'defines': [
'V8_TARGET_ARCH_ARM',
],
+ 'variables': {
+ 'armsimulator': '<!($(echo <(CXX)) -v 2>&1 | grep -q "^Target: arm" && echo "no" || echo "yes")',
+ },
'conditions': [
- ['armv7==1', {
- 'defines': [
- 'CAN_USE_ARMV7_INSTRUCTIONS=1',
- ],
- }],
[ 'v8_can_use_unaligned_accesses=="true"', {
'defines': [
'CAN_USE_UNALIGNED_ACCESSES=1',
],
- }],
- [ 'v8_can_use_unaligned_accesses=="false"', {
+ }, {
'defines': [
'CAN_USE_UNALIGNED_ACCESSES=0',
],
}],
- # NEON implies VFP3 and VFP3 implies VFP2.
- [ 'v8_can_use_vfp2_instructions=="true" or arm_neon==1 or \
- arm_fpu=="vfpv3" or arm_fpu=="vfpv3-d16"', {
- 'defines': [
- 'CAN_USE_VFP2_INSTRUCTIONS',
- ],
- }],
- # NEON implies VFP3.
- [ 'v8_can_use_vfp3_instructions=="true" or arm_neon==1 or \
- arm_fpu=="vfpv3" or arm_fpu=="vfpv3-d16"', {
- 'defines': [
- 'CAN_USE_VFP3_INSTRUCTIONS',
- ],
- }],
- [ 'v8_use_arm_eabi_hardfloat=="true"', {
- 'defines': [
- 'USE_EABI_HARDFLOAT=1',
- 'CAN_USE_VFP2_INSTRUCTIONS',
- ],
+ ['armsimulator=="no"', {
'target_conditions': [
['_toolset=="target"', {
- 'cflags': ['-mfloat-abi=hard',],
+ 'conditions': [
+ [ 'armv7==1', {
+ 'cflags': ['-march=armv7-a',],
+ }],
+ [ 'armv7==1 or armv7=="default"', {
+ 'conditions': [
+ [ 'arm_neon==1', {
+ 'cflags': ['-mfpu=neon',],
+ },
+ {
+ 'conditions': [
+ [ 'arm_fpu!="default"', {
+ 'cflags': ['-mfpu=<(arm_fpu)',],
+ }],
+ ]
+ }],
+ ]
+ }],
+ [ 'arm_float_abi!="default"', {
+ 'cflags': ['-mfloat-abi=<(arm_float_abi)',],
+ }],
+ [ 'arm_thumb==1', {
+ 'cflags': ['-mthumb',],
+ }],
+ [ 'arm_thumb==0', {
+ 'cflags': ['-marm',],
+ }],
+ ],
}],
],
- }, {
- 'defines': [
- 'USE_EABI_HARDFLOAT=0',
+ 'conditions': [
+ [ 'arm_test=="on"', {
+ 'defines': [
+ 'ARM_TEST',
+ ],
+ }],
],
}],
- [ 'v8_can_use_vfp32dregs=="true"', {
+ ['armsimulator=="yes"', {
'defines': [
- 'CAN_USE_VFP32DREGS',
+ 'ARM_TEST',
],
+ 'conditions': [
+ [ 'armv7==1 or armv7=="default"', {
+ 'defines': [
+ 'CAN_USE_ARMV7_INSTRUCTIONS=1',
+ ],
+ 'conditions': [
+ [ 'arm_fpu=="default"', {
+ 'defines': [
+ 'CAN_USE_VFP3_INSTRUCTIONS',
+ ],
+ }],
+ [ 'arm_fpu=="vfpv3-d16"', {
+ 'defines': [
+ 'CAN_USE_VFP3_INSTRUCTIONS',
+ ],
+ }],
+ [ 'arm_fpu=="vfpv3"', {
+ 'defines': [
+ 'CAN_USE_VFP3_INSTRUCTIONS',
+ 'CAN_USE_VFP32DREGS',
+ ],
+ }],
+ [ 'arm_fpu=="neon" or arm_neon==1', {
+ 'defines': [
+ 'CAN_USE_VFP3_INSTRUCTIONS',
+ 'CAN_USE_VFP32DREGS',
+ ],
+ }],
+ ],
+ }],
+ [ 'arm_float_abi=="hard"', {
+ 'defines': [
+ 'USE_EABI_HARDFLOAT=1',
+ ],
+ }],
+ [ 'arm_float_abi=="softfp" or arm_float_abi=="default"', {
+ 'defines': [
+ 'USE_EABI_HARDFLOAT=0',
+ ],
+ }],
+ ]
}],
],
}], # v8_target_arch=="arm"
@@ -320,7 +364,8 @@
'clang%': 0,
},
'conditions': [
- ['OS!="android" or clang==1', {
+ ['(OS!="android" or clang==1) and \
+ nacl_target_arch!="nacl_x64"', {
'cflags': [ '<(m32flag)' ],
'ldflags': [ '<(m32flag)' ],
}],
View
4 build/standalone.gypi
@@ -76,9 +76,11 @@
}],
],
# Default ARM variable settings.
- 'armv7%': 1,
+ 'armv7%': 'default',
'arm_neon%': 0,
'arm_fpu%': 'vfpv3',
+ 'arm_float_abi%': 'default',
+ 'arm_thumb': 'default',
},
'target_defaults': {
'default_configuration': 'Debug',
View
2  include/v8-preparser.h
@@ -115,4 +115,6 @@ PreParserData V8EXPORT Preparse(UnicodeInputStream* input,
} // namespace v8.
+#undef V8EXPORT
+
#endif // PREPARSER_H
View
49 include/v8-profiler.h
@@ -173,7 +173,7 @@ class V8EXPORT CpuProfiler {
*/
/** Deprecated. Use GetProfileCount instead. */
- static int GetProfilesCount();
+ V8_DEPRECATED(static int GetProfilesCount());
/**
* Returns the number of profiles collected (doesn't include
* profiles that are being collected at the moment of call.)
@@ -181,25 +181,26 @@ class V8EXPORT CpuProfiler {
int GetProfileCount();
/** Deprecated. Use GetCpuProfile instead. */
- static const CpuProfile* GetProfile(
+ V8_DEPRECATED(static const CpuProfile* GetProfile(
int index,
- Handle<Value> security_token = Handle<Value>());
+ Handle<Value> security_token = Handle<Value>()));
/** Returns a profile by index. */
const CpuProfile* GetCpuProfile(
int index,
Handle<Value> security_token = Handle<Value>());
/** Deprecated. Use FindProfile instead. */
- static const CpuProfile* FindProfile(
+ V8_DEPRECATED(static const CpuProfile* FindProfile(
unsigned uid,
- Handle<Value> security_token = Handle<Value>());
+ Handle<Value> security_token = Handle<Value>()));
/** Returns a profile by uid. */
const CpuProfile* FindCpuProfile(
unsigned uid,
Handle<Value> security_token = Handle<Value>());
/** Deprecated. Use StartCpuProfiling instead. */
- static void StartProfiling(Handle<String> title, bool record_samples = false);
+ V8_DEPRECATED(static void StartProfiling(Handle<String> title,
+ bool record_samples = false));
/**
* Starts collecting CPU profile. Title may be an empty string. It
* is allowed to have several profiles being collected at
@@ -214,9 +215,9 @@ class V8EXPORT CpuProfiler {
void StartCpuProfiling(Handle<String> title, bool record_samples = false);
/** Deprecated. Use StopCpuProfiling instead. */
- static const CpuProfile* StopProfiling(
+ V8_DEPRECATED(static const CpuProfile* StopProfiling(
Handle<String> title,
- Handle<Value> security_token = Handle<Value>());
+ Handle<Value> security_token = Handle<Value>()));
/**
* Stops collecting CPU profile with a given title and returns it.
* If the title given is empty, finishes the last profile started.
@@ -226,7 +227,7 @@ class V8EXPORT CpuProfiler {
Handle<Value> security_token = Handle<Value>());
/** Deprecated. Use DeleteAllCpuProfiles instead. */
- static void DeleteAllProfiles();
+ V8_DEPRECATED(static void DeleteAllProfiles());
/**
* Deletes all existing profiles, also cancelling all profiling
* activity. All previously returned pointers to profiles and their
@@ -425,22 +426,23 @@ class V8EXPORT HeapProfiler {
(uint16_t class_id, Handle<Value> wrapper);
/** Deprecated. Use GetSnapshotCount instead. */
- static int GetSnapshotsCount();
+ V8_DEPRECATED(static int GetSnapshotsCount());
/** Returns the number of snapshots taken. */
int GetSnapshotCount();
/** Deprecated. Use GetHeapSnapshot instead. */
- static const HeapSnapshot* GetSnapshot(int index);
+ V8_DEPRECATED(static const HeapSnapshot* GetSnapshot(int index));
/** Returns a snapshot by index. */
const HeapSnapshot* GetHeapSnapshot(int index);
/** Deprecated. Use FindHeapSnapshot instead. */
- static const HeapSnapshot* FindSnapshot(unsigned uid);
+ V8_DEPRECATED(static const HeapSnapshot* FindSnapshot(unsigned uid));
/** Returns a profile by uid. */
const HeapSnapshot* FindHeapSnapshot(unsigned uid);
/** Deprecated. Use GetObjectId instead. */
- static SnapshotObjectId GetSnapshotObjectId(Handle<Value> value);
+ V8_DEPRECATED(static SnapshotObjectId GetSnapshotObjectId(
+ Handle<Value> value));
/**
* Returns SnapshotObjectId for a heap object referenced by |value| if
* it has been seen by the heap profiler, kUnknownObjectId otherwise.
@@ -469,11 +471,11 @@ class V8EXPORT HeapProfiler {
};
/** Deprecated. Use TakeHeapSnapshot instead. */
- static const HeapSnapshot* TakeSnapshot(
+ V8_DEPRECATED(static const HeapSnapshot* TakeSnapshot(
Handle<String> title,
HeapSnapshot::Type type = HeapSnapshot::kFull,
ActivityControl* control = NULL,
- ObjectNameResolver* global_object_name_resolver = NULL);
+ ObjectNameResolver* global_object_name_resolver = NULL));
/**
* Takes a heap snapshot and returns it. Title may be an empty string.
*/
@@ -484,7 +486,7 @@ class V8EXPORT HeapProfiler {
/** Deprecated. Use StartTrackingHeapObjects instead. */
- static void StartHeapObjectsTracking();
+ V8_DEPRECATED(static void StartHeapObjectsTracking());
/**
* Starts tracking of heap objects population statistics. After calling
* this method, all heap objects relocations done by the garbage collector
@@ -493,7 +495,8 @@ class V8EXPORT HeapProfiler {
void StartTrackingHeapObjects();
/** Deprecated. Use GetHeapStats instead. */
- static SnapshotObjectId PushHeapObjectsStats(OutputStream* stream);
+ V8_DEPRECATED(static SnapshotObjectId PushHeapObjectsStats(
+ OutputStream* stream));
/**
* Adds a new time interval entry to the aggregated statistics array. The
* time interval entry contains information on the current heap objects
@@ -509,7 +512,7 @@ class V8EXPORT HeapProfiler {
SnapshotObjectId GetHeapStats(OutputStream* stream);
/** Deprecated. Use StopTrackingHeapObjects instead. */
- static void StopHeapObjectsTracking();
+ V8_DEPRECATED(static void StopHeapObjectsTracking());
/**
* Stops tracking of heap objects population statistics, cleans up all
* collected data. StartHeapObjectsTracking must be called again prior to
@@ -518,7 +521,7 @@ class V8EXPORT HeapProfiler {
void StopTrackingHeapObjects();
/** Deprecated. Use DeleteAllHeapSnapshots instead. */
- static void DeleteAllSnapshots();
+ V8_DEPRECATED(static void DeleteAllSnapshots());
/**
* Deletes all snapshots taken. All previously returned pointers to
* snapshots and their contents become invalid after this call.
@@ -526,9 +529,9 @@ class V8EXPORT HeapProfiler {
void DeleteAllHeapSnapshots();
/** Deprecated. Use SetWrapperClassInfoProvider instead. */
- static void DefineWrapperClass(
+ V8_DEPRECATED(static void DefineWrapperClass(
uint16_t class_id,
- WrapperInfoCallback callback);
+ WrapperInfoCallback callback));
/** Binds a callback to embedder's class ID. */
void SetWrapperClassInfoProvider(
uint16_t class_id,
@@ -544,10 +547,10 @@ class V8EXPORT HeapProfiler {
/**
* Deprecated. Returns the number of currently existing persistent handles.
*/
- static int GetPersistentHandleCount();
+ V8_DEPRECATED(static int GetPersistentHandleCount());
/** Deprecated. Use GetHeapProfilerMemorySize instead. */
- static size_t GetMemorySizeUsedByProfiler();
+ V8_DEPRECATED(static size_t GetMemorySizeUsedByProfiler());
/** Returns memory used for profiler internal data and snapshots. */
size_t GetProfilerMemorySize();
View
118 include/v8.h
@@ -127,6 +127,8 @@ class StackFrame;
class StackTrace;
class String;
class StringObject;
+class Symbol;
+class SymbolObject;
class Uint32;
class Utils;
class Value;
@@ -764,6 +766,17 @@ class V8EXPORT Script {
* debugger API.
*/
void SetData(Handle<String> data);
+
+ /**
+ * Returns the name value of one Script.
+ */
+ Handle<Value> GetScriptName();
+
+ /**
+ * Returns zero based line number of the code_pos location in the script.
+ * -1 will be returned if no information available.
+ */
+ int GetLineNumber(int code_pos);
};
@@ -973,6 +986,12 @@ class V8EXPORT Value : public Data {
V8_INLINE(bool IsString() const);
/**
+ * Returns true if this value is a symbol.
+ * This is an experimental feature.
+ */
+ bool IsSymbol() const;
+
+ /**
* Returns true if this value is a function.
*/
bool IsFunction() const;
@@ -1033,6 +1052,12 @@ class V8EXPORT Value : public Data {
bool IsStringObject() const;
/**
+ * Returns true if this value is a Symbol object.
+ * This is an experimental feature.
+ */
+ bool IsSymbolObject() const;
+
+ /**
* Returns true if this value is a NativeError.
*/
bool IsNativeError() const;
@@ -1311,7 +1336,11 @@ class V8EXPORT String : public Primitive {
/** Allocates a new string from 16-bit character codes.*/
static Local<String> New(const uint16_t* data, int length = -1);
- /** Creates a symbol. Returns one if it exists already.*/
+ /**
+ * Creates an internalized string (historically called a "symbol",
+ * not to be confused with ES6 symbols). Returns one if it exists already.
+ * TODO(rossberg): Deprecate me when the new string API is here.
+ */
static Local<String> NewSymbol(const char* data, int length = -1);
/**
@@ -1450,6 +1479,29 @@ class V8EXPORT String : public Primitive {
/**
+ * A JavaScript symbol (ECMA-262 edition 6)
+ *
+ * This is an experimental feature. Use at your own risk.
+ */
+class V8EXPORT Symbol : public Primitive {
+ public:
+ // Returns the print name string of the symbol, or undefined if none.
+ Local<Value> Name() const;
+
+ // Create a symbol without a print name.
+ static Local<Symbol> New(Isolate* isolate);
+
+ // Create a symbol with a print name.
+ static Local<Symbol> New(Isolate *isolate, const char* data, int length = -1);
+
+ V8_INLINE(static Symbol* Cast(v8::Value* obj));
+ private:
+ Symbol();
+ static void CheckCast(v8::Value* obj);
+};
+
+
+/**
* A JavaScript number value (ECMA-262, 4.3.20)
*/
class V8EXPORT Number : public Primitive {
@@ -1590,11 +1642,9 @@ class V8EXPORT Object : public Value {
*/
PropertyAttribute GetPropertyAttributes(Handle<Value> key);
- // TODO(1245389): Replace the type-specific versions of these
- // functions with generic ones that accept a Handle<Value> key.
- bool Has(Handle<String> key);
+ bool Has(Handle<Value> key);
- bool Delete(Handle<String> key);
+ bool Delete(Handle<Value> key);
// Delete a property on this object bypassing interceptors and
// ignoring dont-delete attributes.
@@ -1982,6 +2032,27 @@ class V8EXPORT StringObject : public Object {
/**
+ * A Symbol object (ECMA-262 edition 6).
+ *
+ * This is an experimental feature. Use at your own risk.
+ */
+class V8EXPORT SymbolObject : public Object {
+ public:
+ static Local<Value> New(Isolate* isolate, Handle<Symbol> value);
+
+ /**
+ * Returns the Symbol held by the object.
+ */
+ Local<Symbol> SymbolValue() const;
+
+ V8_INLINE(static SymbolObject* Cast(v8::Value* obj));
+
+ private:
+ static void CheckCast(v8::Value* obj);
+};
+
+
+/**
* An instance of the built-in RegExp constructor (ECMA-262, 15.10).
*/
class V8EXPORT RegExp : public Object {
@@ -3867,11 +3938,11 @@ class V8EXPORT Context {
*/
void ReattachGlobal(Handle<Object> global_object);
- /** Creates a new context.
+ /**
+ * Creates a new context and returns a handle to the newly allocated
+ * context.
*
- * Returns a persistent handle to the newly allocated context. This
- * persistent handle has to be disposed when the context is no
- * longer used so the context can be garbage collected.
+ * \param isolate The isolate in which to create the context.
*
* \param extensions An optional extension configuration containing
* the extensions to be installed in the newly created context.
@@ -3885,6 +3956,14 @@ class V8EXPORT Context {
* template. The state of the global object will be completely reset
* and only object identify will remain.
*/
+ static Local<Context> New(
+ Isolate* isolate,
+ ExtensionConfiguration* extensions = NULL,
+ Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
+ Handle<Value> global_object = Handle<Value>());
+
+ /** Deprecated. Use Isolate version instead. */
+ // TODO(mstarzinger): Put this behind the V8_DEPRECATED guard.
static Persistent<Context> New(
ExtensionConfiguration* extensions = NULL,
Handle<ObjectTemplate> global_template = Handle<ObjectTemplate>(),
@@ -3893,7 +3972,8 @@ class V8EXPORT Context {
/** Returns the last entered context. */
static Local<Context> GetEntered();
- /** Returns the context that is on the top of the stack. */
+ // TODO(svenpanne) Actually deprecate this.
+ /** Deprecated. Use Isolate::GetCurrentContext instead. */
static Local<Context> GetCurrent();
/**
@@ -4304,7 +4384,7 @@ class Internals {
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
- static const int kEmptyStringRootIndex = 119;
+ static const int kEmptyStringRootIndex = 118;
static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
@@ -4850,6 +4930,14 @@ bool Value::QuickIsString() const {
}
+Symbol* Symbol::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<Symbol*>(value);
+}
+
+
Number* Number::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
@@ -4882,6 +4970,14 @@ StringObject* StringObject::Cast(v8::Value* value) {
}
+SymbolObject* SymbolObject::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<SymbolObject*>(value);
+}
+
+
NumberObject* NumberObject::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
View
6 preparser/preparser-process.cc
@@ -30,6 +30,7 @@
#include <stdio.h>
#include <string.h>
+#include "../include/v8.h"
#include "../include/v8stdint.h"
#include "../include/v8-preparser.h"
@@ -37,8 +38,7 @@
namespace i = v8::internal;
-// This file is only used for testing the stand-alone preparser
-// library.
+// This file is only used for testing the preparser.
// The first argument must be the path of a JavaScript source file, or
// the flags "-e" and the next argument is then the source of a JavaScript
// program.
@@ -320,6 +320,8 @@ int main(int argc, const char* argv[]) {
ExceptionExpectation expects =
ParseExpectation(argc - arg_index, argv + arg_index);
+ v8::V8::Initialize();
+
ScopedPointer<uint8_t> buffer;
size_t length;
View
17 preparser/preparser.gyp
@@ -31,11 +31,24 @@
{
'target_name': 'preparser',
'type': 'executable',
- 'dependencies': [
- '../tools/gyp/v8.gyp:preparser_lib',
+ 'conditions': [
+ # preparser can't link against a shared library, so link against
+ # the underlying static targets.
+ ['v8_use_snapshot=="true"', {
+ 'dependencies': ['../tools/gyp/v8.gyp:v8_snapshot'],
+ }, {
+ 'dependencies': [
+ '../tools/gyp/v8.gyp:v8_nosnapshot.<(v8_target_arch)',
+ ],
+ }],
+ ],
+ 'include_dirs+': [
+ '../src',
],
'sources': [
'preparser-process.cc',
+ '../include/v8-preparser.h',
+ '../src/preparser-api.cc',
],
},
],
View
58 src/accessors.cc
@@ -783,64 +783,6 @@ const AccessorDescriptor Accessors::FunctionCaller = {
//
-// Accessors::ObjectPrototype
-//
-
-
-static inline Object* GetPrototypeSkipHiddenPrototypes(Isolate* isolate,
- Object* receiver) {
- Object* current = receiver->GetPrototype(isolate);
- while (current->IsJSObject() &&
- JSObject::cast(current)->map()->is_hidden_prototype()) {
- current = current->GetPrototype(isolate);
- }
- return current;
-}
-
-
-MaybeObject* Accessors::ObjectGetPrototype(Object* receiver, void*) {
- return GetPrototypeSkipHiddenPrototypes(Isolate::Current(), receiver);
-}
-
-
-MaybeObject* Accessors::ObjectSetPrototype(JSObject* receiver_raw,
- Object* value_raw,
- void*) {
- const bool kSkipHiddenPrototypes = true;
- // To be consistent with other Set functions, return the value.
- if (!(FLAG_harmony_observation && receiver_raw->map()->is_observed()))
- return receiver_raw->SetPrototype(value_raw, kSkipHiddenPrototypes);
-
- Isolate* isolate = receiver_raw->GetIsolate();
- HandleScope scope(isolate);
- Handle<JSObject> receiver(receiver_raw);
- Handle<Object> value(value_raw, isolate);
- Handle<Object> old_value(GetPrototypeSkipHiddenPrototypes(isolate, *receiver),
- isolate);
-
- MaybeObject* result = receiver->SetPrototype(*value, kSkipHiddenPrototypes);
- Handle<Object> hresult;
- if (!result->ToHandle(&hresult, isolate)) return result;
-
- Handle<Object> new_value(GetPrototypeSkipHiddenPrototypes(isolate, *receiver),
- isolate);
- if (!new_value->SameValue(*old_value)) {
- JSObject::EnqueueChangeRecord(receiver, "prototype",
- isolate->factory()->proto_string(),
- old_value);
- }
- return *hresult;
-}
-
-
-const AccessorDescriptor Accessors::ObjectPrototype = {
- ObjectGetPrototype,
- ObjectSetPrototype,
- 0
-};
-
-
-//
// Accessors::MakeModuleExport
//
View
7 src/accessors.h
@@ -56,8 +56,7 @@ namespace internal {
V(ScriptContextData) \
V(ScriptEvalFromScript) \
V(ScriptEvalFromScriptPosition) \
- V(ScriptEvalFromFunctionName) \
- V(ObjectPrototype)
+ V(ScriptEvalFromFunctionName)
// Accessors contains all predefined proxy accessors.
@@ -111,10 +110,6 @@ class Accessors : public AllStatic {
static MaybeObject* ScriptGetEvalFromScript(Object* object, void*);
static MaybeObject* ScriptGetEvalFromScriptPosition(Object* object, void*);
static MaybeObject* ScriptGetEvalFromFunctionName(Object* object, void*);
- static MaybeObject* ObjectGetPrototype(Object* receiver, void*);
- static MaybeObject* ObjectSetPrototype(JSObject* receiver,
- Object* value,
- void*);
// Helper functions.
static Object* FlattenNumber(Object* value);
View
6 src/allocation.cc
@@ -28,8 +28,8 @@
#include "allocation.h"
#include <stdlib.h> // For free, malloc.
-#include <string.h> // For memcpy.
#include "checks.h"
+#include "platform.h"
#include "utils.h"
namespace v8 {
@@ -85,7 +85,7 @@ void AllStatic::operator delete(void* p) {
char* StrDup(const char* str) {
int length = StrLength(str);
char* result = NewArray<char>(length + 1);
- memcpy(result, str, length);
+ OS::MemCopy(result, str, length);
result[length] = '\0';
return result;
}
@@ -95,7 +95,7 @@ char* StrNDup(const char* str, int n) {
int length = StrLength(str);
if (n < length) length = n;
char* result = NewArray<char>(length + 1);
- memcpy(result, str, length);
+ OS::MemCopy(result, str, length);
result[length] = '\0';
return result;
}
View
228 src/api.cc
@@ -1655,7 +1655,7 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
ScriptData* ScriptData::PreCompile(const char* input, int length) {
i::Utf8ToUtf16CharacterStream stream(
reinterpret_cast<const unsigned char*>(input), length);
- return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping);
+ return i::PreParserApi::PreParse(&stream);
}
@@ -1664,10 +1664,10 @@ ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
if (str->IsExternalTwoByteString()) {
i::ExternalTwoByteStringUtf16CharacterStream stream(
i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
- return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping);
+ return i::PreParserApi::PreParse(&stream);
} else {
i::GenericStringUtf16CharacterStream stream(str, 0, str->length());
- return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping);
+ return i::PreParserApi::PreParse(&stream);
}
}
@@ -1686,7 +1686,8 @@ ScriptData* ScriptData::New(const char* data, int length) {
}
// Copy the data to align it.
unsigned* deserialized_data = i::NewArray<unsigned>(deserialized_data_length);
- i::OS::MemCopy(deserialized_data, data, length);
+ i::CopyBytes(reinterpret_cast<char*>(deserialized_data),
+ data, static_cast<size_t>(length));
return new i::ScriptDataImpl(
i::Vector<unsigned>(deserialized_data, deserialized_data_length));
@@ -1852,6 +1853,34 @@ Local<Value> Script::Id() {
}
+int Script::GetLineNumber(int code_pos) {
+ i::Isolate* isolate = i::Isolate::Current();
+ ON_BAILOUT(isolate, "v8::Script::GetLineNumber()", return -1);
+ LOG_API(isolate, "Script::GetLineNumber");
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+ if (obj->IsScript()) {
+ i::Handle<i::Script> script = i::Handle<i::Script>(i::Script::cast(*obj));
+ return i::GetScriptLineNumber(script, code_pos);
+ } else {
+ return -1;
+ }
+}
+
+
+Handle<Value> Script::GetScriptName() {
+ i::Isolate* isolate = i::Isolate::Current();
+ ON_BAILOUT(isolate, "v8::Script::GetName()", return Handle<String>());
+ LOG_API(isolate, "Script::GetName");
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+ if (obj->IsScript()) {
+ i::Object* name = i::Script::cast(*obj)->name();
+ return Utils::ToLocal(i::Handle<i::Object>(name, isolate));
+ } else {
+ return Handle<String>();
+ }
+}
+
+
void Script::SetData(v8::Handle<String> data) {
i::Isolate* isolate = i::Isolate::Current();
ON_BAILOUT(isolate, "v8::Script::SetData()", return);
@@ -2367,6 +2396,12 @@ bool Value::FullIsString() const {
}
+bool Value::IsSymbol() const {
+ if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsSymbol()")) return false;
+ return Utils::OpenHandle(this)->IsSymbol();
+}
+
+
bool Value::IsArray() const {
if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsArray()")) return false;
return Utils::OpenHandle(this)->IsJSArray();
@@ -2451,6 +2486,16 @@ bool Value::IsStringObject() const {
}
+bool Value::IsSymbolObject() const {
+ // TODO(svenpanne): these and other test functions should be written such
+ // that they do not use Isolate::Current().
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::Value::IsSymbolObject()")) return false;
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+ return obj->HasSpecificClassOf(isolate->heap()->Symbol_string());
+}
+
+
bool Value::IsNumberObject() const {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::Value::IsNumberObject()")) return false;
@@ -2664,6 +2709,15 @@ void v8::String::CheckCast(v8::Value* that) {
}
+void v8::Symbol::CheckCast(v8::Value* that) {
+ if (IsDeadCheck(i::Isolate::Current(), "v8::Symbol::Cast()")) return;
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
+ ApiCheck(obj->IsSymbol(),
+ "v8::Symbol::Cast()",
+ "Could not convert to symbol");
+}
+
+
void v8::Number::CheckCast(v8::Value* that) {
if (IsDeadCheck(i::Isolate::Current(), "v8::Number::Cast()")) return;
i::Handle<i::Object> obj = Utils::OpenHandle(that);
@@ -2711,6 +2765,16 @@ void v8::StringObject::CheckCast(v8::Value* that) {
}
+void v8::SymbolObject::CheckCast(v8::Value* that) {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::SymbolObject::Cast()")) return;
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
+ ApiCheck(obj->HasSpecificClassOf(isolate->heap()->Symbol_string()),
+ "v8::SymbolObject::Cast()",
+ "Could not convert to SymbolObject");
+}
+
+
void v8::NumberObject::CheckCast(v8::Value* that) {
i::Isolate* isolate = i::Isolate::Current();
if (IsDeadCheck(isolate, "v8::NumberObject::Cast()")) return;
@@ -3079,13 +3143,13 @@ PropertyAttribute v8::Object::GetPropertyAttributes(v8::Handle<Value> key) {
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
- if (!key_obj->IsString()) {
+ if (!key_obj->IsName()) {
EXCEPTION_PREAMBLE(isolate);
key_obj = i::Execution::ToString(key_obj, &has_pending_exception);
EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
}
- i::Handle<i::String> key_string = i::Handle<i::String>::cast(key_obj);
- PropertyAttributes result = self->GetPropertyAttribute(*key_string);
+ i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj);
+ PropertyAttributes result = self->GetPropertyAttribute(*key_name);
if (result == ABSENT) return static_cast<PropertyAttribute>(NONE);
return static_cast<PropertyAttribute>(result);
}
@@ -3215,7 +3279,7 @@ Local<String> v8::Object::ObjectProtoToString() {
// Write prefix.
char* ptr = buf.start();
- memcpy(ptr, prefix, prefix_len * v8::internal::kCharSize);
+ i::OS::MemCopy(ptr, prefix, prefix_len * v8::internal::kCharSize);
ptr += prefix_len;
// Write real content.
@@ -3223,7 +3287,7 @@ Local<String> v8::Object::ObjectProtoToString() {
ptr += str_len;
// Write postfix.
- memcpy(ptr, postfix, postfix_len * v8::internal::kCharSize);
+ i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
// Copy the buffer into a heap-allocated string and return it.
Local<String> result = v8::String::New(buf.start(), buf_len);
@@ -3255,24 +3319,32 @@ Local<String> v8::Object::GetConstructorName() {
}
-bool v8::Object::Delete(v8::Handle<String> key) {
+bool v8::Object::Delete(v8::Handle<Value> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Delete()", return false);
ENTER_V8(isolate);
i::HandleScope scope(isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
- return i::JSObject::DeleteProperty(self, key_obj)->IsTrue();
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
+ EXCEPTION_PREAMBLE(isolate);
+ i::Handle<i::Object> obj = i::DeleteProperty(self, key_obj);
+ has_pending_exception = obj.is_null();
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
+ return obj->IsTrue();
}
-bool v8::Object::Has(v8::Handle<String> key) {
+bool v8::Object::Has(v8::Handle<Value> key) {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ON_BAILOUT(isolate, "v8::Object::Has()", return false);
ENTER_V8(isolate);
- i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
- return self->HasProperty(*key_obj);
+ i::Handle<i::JSReceiver> self = Utils::OpenHandle(this);
+ i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
+ EXCEPTION_PREAMBLE(isolate);
+ i::Handle<i::Object> obj = i::HasProperty(self, key_obj);
+ has_pending_exception = obj.is_null();
+ EXCEPTION_BAILOUT_CHECK(isolate, false);
+ return obj->IsTrue();
}
@@ -3352,15 +3424,16 @@ bool v8::Object::HasRealNamedProperty(Handle<String> key) {
ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()",
return false);
return Utils::OpenHandle(this)->HasRealNamedProperty(
+ isolate,
*Utils::OpenHandle(*key));
}
bool v8::Object::HasRealIndexedProperty(uint32_t index) {
- ON_BAILOUT(Utils::OpenHandle(this)->GetIsolate(),
- "v8::Object::HasRealIndexedProperty()",
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ON_BAILOUT(isolate, "v8::Object::HasRealIndexedProperty()",
return false);
- return Utils::OpenHandle(this)->HasRealElementProperty(index);
+ return Utils::OpenHandle(this)->HasRealElementProperty(isolate, index);
}
@@ -3371,6 +3444,7 @@ bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) {
return false);
ENTER_V8(isolate);
return Utils::OpenHandle(this)->HasRealNamedCallbackProperty(
+ isolate,
*Utils::OpenHandle(*key));
}
@@ -4591,6 +4665,15 @@ const v8::String::ExternalAsciiStringResource*
}
+Local<Value> Symbol::Name() const {
+ if (IsDeadCheck(i::Isolate::Current(), "v8::Symbol::Name()"))
+ return Local<Value>();
+ i::Handle<i::Symbol> sym = Utils::OpenHandle(this);
+ i::Handle<i::Object> name(sym->name(), sym->GetIsolate());
+ return Utils::ToLocal(name);
+}
+
+
double Number::Value() const {
if (IsDeadCheck(i::Isolate::Current(), "v8::Number::Value()")) return 0;
i::Handle<i::Object> obj = Utils::OpenHandle(this);
@@ -4861,18 +4944,14 @@ static i::Handle<i::FunctionTemplateInfo>
}
-Persistent<Context> v8::Context::New(
+static i::Handle<i::Context> CreateEnvironment(
+ i::Isolate* isolate,
v8::ExtensionConfiguration* extensions,
v8::Handle<ObjectTemplate> global_template,
v8::Handle<Value> global_object) {
- i::Isolate::EnsureDefaultIsolate();
- i::Isolate* isolate = i::Isolate::Current();
- EnsureInitializedForIsolate(isolate, "v8::Context::New()");
- LOG_API(isolate, "Context::New");
- ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>());
+ i::Handle<i::Context> env;
// Enter V8 via an ENTER_V8 scope.
- i::Handle<i::Context> env;
{
ENTER_V8(isolate);
v8::Handle<ObjectTemplate> proxy_template = global_template;
@@ -4927,10 +5006,43 @@ Persistent<Context> v8::Context::New(
}
// Leave V8.
- if (env.is_null()) {
- return Persistent<Context>();
- }
- return Persistent<Context>(Utils::ToLocal(env));
+ return env;
+}
+
+
+Persistent<Context> v8::Context::New(
+ v8::ExtensionConfiguration* extensions,
+ v8::Handle<ObjectTemplate> global_template,
+ v8::Handle<Value> global_object) {
+ i::Isolate::EnsureDefaultIsolate();
+ i::Isolate* isolate = i::Isolate::Current();
+ Isolate* external_isolate = reinterpret_cast<Isolate*>(isolate);
+ EnsureInitializedForIsolate(isolate, "v8::Context::New()");
+ LOG_API(isolate, "Context::New");
+ ON_BAILOUT(isolate, "v8::Context::New()", return Persistent<Context>());
+ i::HandleScope scope(isolate);
+ i::Handle<i::Context> env =
+ CreateEnvironment(isolate, extensions, global_template, global_object);
+ if (env.is_null()) return Persistent<Context>();
+ return Persistent<Context>::New(external_isolate, Utils::ToLocal(env));
+}
+
+
+Local<Context> v8::Context::New(
+ v8::Isolate* external_isolate,
+ v8::ExtensionConfiguration* extensions,
+ v8::Handle<ObjectTemplate> global_template,
+ v8::Handle<Value> global_object) {
+ i::Isolate::EnsureDefaultIsolate();
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
+ EnsureInitializedForIsolate(isolate, "v8::Context::New()");
+ LOG_API(isolate, "Context::New");
+ ON_BAILOUT(isolate, "v8::Context::New()", return Local<Context>());
+ i::HandleScope scope(isolate);
+ i::Handle<i::Context> env =
+ CreateEnvironment(isolate, extensions, global_template, global_object);
+ if (env.is_null()) return Local<Context>();
+ return Utils::ToLocal(scope.CloseAndEscape(env));
}
@@ -5005,10 +5117,7 @@ v8::Local<v8::Context> Context::GetCurrent() {
if (IsDeadCheck(isolate, "v8::Context::GetCurrent()")) {
return Local<Context>();
}
- i::Handle<i::Object> current = isolate->native_context();
- if (current.is_null()) return Local<Context>();
- i::Handle<i::Context> context = i::Handle<i::Context>::cast(current);
- return Utils::ToLocal(context);
+ return reinterpret_cast<Isolate*>(isolate)->GetCurrentContext();
}
@@ -5429,6 +5538,29 @@ Local<v8::String> v8::StringObject::StringValue() const {
}
+Local<v8::Value> v8::SymbolObject::New(Isolate* isolate, Handle<Symbol> value) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ EnsureInitializedForIsolate(i_isolate, "v8::SymbolObject::New()");
+ LOG_API(i_isolate, "SymbolObject::New");
+ ENTER_V8(i_isolate);
+ i::Handle<i::Object> obj =
+ i_isolate->factory()->ToObject(Utils::OpenHandle(*value));
+ return Utils::ToLocal(obj);
+}
+
+
+Local<v8::Symbol> v8::SymbolObject::SymbolValue() const {
+ i::Isolate* isolate = i::Isolate::Current();
+ if (IsDeadCheck(isolate, "v8::SymbolObject::SymbolValue()"))
+ return Local<v8::Symbol>();
+ LOG_API(isolate, "SymbolObject::SymbolValue");
+ i::Handle<i::Object> obj = Utils::OpenHandle(this);
+ i::Handle<i::JSValue> jsvalue = i::Handle<i::JSValue>::cast(obj);
+ return Utils::ToLocal(
+ i::Handle<i::Symbol>(i::Symbol::cast(jsvalue->value())));
+}
+
+
Local<v8::Value> v8::Date::New(double time) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Date::New()");
@@ -5610,6 +5742,30 @@ Local<String> v8::String::NewSymbol(const char* data, int length) {
}
+Local<Symbol> v8::Symbol::New(Isolate* isolate) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()");
+ LOG_API(i_isolate, "Symbol::New()");
+ ENTER_V8(i_isolate);
+ i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol();
+ return Utils::ToLocal(result);
+}
+
+
+Local<Symbol> v8::Symbol::New(Isolate* isolate, const char* data, int length) {
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ EnsureInitializedForIsolate(i_isolate, "v8::Symbol::New()");
+ LOG_API(i_isolate, "Symbol::New(char)");
+ ENTER_V8(i_isolate);
+ if (length == -1) length = i::StrLength(data);
+ i::Handle<i::String> name = i_isolate->factory()->NewStringFromUtf8(
+ i::Vector<const char>(data, length));
+ i::Handle<i::Symbol> result = i_isolate->factory()->NewSymbol();
+ result->set_name(*name);
+ return Utils::ToLocal(result);
+}
+
+
Local<Number> v8::Number::New(double value) {
i::Isolate* isolate = i::Isolate::Current();
EnsureInitializedForIsolate(isolate, "v8::Number::New()");
@@ -7095,7 +7251,7 @@ char* HandleScopeImplementer::ArchiveThread(char* storage) {
v8::ImplementationUtilities::HandleScopeData* current =
isolate_->handle_scope_data();
handle_scope_data_ = *current;
- memcpy(storage, this, sizeof(*this));
+ OS::MemCopy(storage, this, sizeof(*this));
ResetAfterArchive();
current->Initialize();
@@ -7110,7 +7266,7 @@ int HandleScopeImplementer::ArchiveSpacePerThread() {
char* HandleScopeImplementer::RestoreThread(char* storage) {
- memcpy(this, storage, sizeof(*this));
+ OS::MemCopy(this, storage, sizeof(*this));
*isolate_->handle_scope_data() = handle_scope_data_;
return storage + ArchiveSpacePerThread();
}
View
4 src/api.h
@@ -171,6 +171,7 @@ class RegisteredExtension {
V(Object, JSObject) \
V(Array, JSArray) \
V(String, String) \
+ V(Symbol, Symbol) \
V(Script, Object) \
V(Function, JSFunction) \
V(Message, JSObject) \
@@ -196,6 +197,8 @@ class Utils {
v8::internal::Handle<v8::internal::JSFunction> obj);
static inline Local<String> ToLocal(
v8::internal::Handle<v8::internal::String> obj);
+ static inline Local<Symbol> ToLocal(
+ v8::internal::Handle<v8::internal::Symbol> obj);
static inline Local<RegExp> ToLocal(
v8::internal::Handle<v8::internal::JSRegExp> obj);
static inline Local<Object> ToLocal(
@@ -268,6 +271,7 @@ MAKE_TO_LOCAL(ToLocal, Context, Context)
MAKE_TO_LOCAL(ToLocal, Object, Value)
MAKE_TO_LOCAL(ToLocal, JSFunction, Function)
MAKE_TO_LOCAL(ToLocal, String, String)
+MAKE_TO_LOCAL(ToLocal, Symbol, Symbol)
MAKE_TO_LOCAL(ToLocal, JSRegExp, RegExp)
MAKE_TO_LOCAL(ToLocal, JSObject, Object)
MAKE_TO_LOCAL(ToLocal, JSArray, Array)
View
21 src/arguments.h
@@ -115,15 +115,18 @@ class CustomArguments : public Relocatable {
#define DECLARE_RUNTIME_FUNCTION(Type, Name) \
-Type Name(Arguments args, Isolate* isolate)
-
-
-#define RUNTIME_FUNCTION(Type, Name) \
-Type Name(Arguments args, Isolate* isolate)
-
-
-#define RUNTIME_ARGUMENTS(isolate, args) args, isolate
-
+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
} } // namespace v8::internal
View
18 src/arm/assembler-arm-inl.h
@@ -48,29 +48,17 @@ namespace internal {
int Register::NumAllocatableRegisters() {
- if (CpuFeatures::IsSupported(VFP2)) {
- return kMaxNumAllocatableRegisters;
- } else {
- return kMaxNumAllocatableRegisters - kGPRsPerNonVFP2Double;
- }
+ return kMaxNumAllocatableRegisters;
}
int DwVfpRegister::NumRegisters() {
- if (CpuFeatures::IsSupported(VFP2)) {
- return CpuFeatures::IsSupported(VFP32DREGS) ? 32 : 16;
- } else {
- return 1;
- }
+ return CpuFeatures::IsSupported(VFP32DREGS) ? 32 : 16;
}
int DwVfpRegister::NumAllocatableRegisters() {
- if (CpuFeatures::IsSupported(VFP2)) {
- return NumRegisters() - kNumReservedRegisters;
- } else {
- return 1;
- }
+ return NumRegisters() - kNumReservedRegisters;
}
View
202 src/arm/assembler-arm.cc
@@ -63,29 +63,21 @@ ExternalReference ExternalReference::cpu_features() {
static unsigned CpuFeaturesImpliedByCompiler() {
unsigned answer = 0;
#ifdef CAN_USE_ARMV7_INSTRUCTIONS
- answer |= 1u << ARMv7;
+ if (FLAG_enable_armv7) {
+ answer |= 1u << ARMv7;
+ }
#endif // CAN_USE_ARMV7_INSTRUCTIONS
#ifdef CAN_USE_VFP3_INSTRUCTIONS
- answer |= 1u << VFP3 | 1u << VFP2 | 1u << ARMv7;
+ if (FLAG_enable_vfp3) {
+ answer |= 1u << VFP3 | 1u << ARMv7;
+ }
#endif // CAN_USE_VFP3_INSTRUCTIONS
-#ifdef CAN_USE_VFP2_INSTRUCTIONS
- answer |= 1u << VFP2;
-#endif // CAN_USE_VFP2_INSTRUCTIONS
#ifdef CAN_USE_VFP32DREGS
- answer |= 1u << VFP32DREGS;
+ if (FLAG_enable_32dregs) {
+ answer |= 1u << VFP32DREGS;
+ }
#endif // CAN_USE_VFP32DREGS
-
-#ifdef __arm__
- // If the compiler is allowed to use VFP then we can use VFP too in our code
- // generation even when generating snapshots. ARMv7 and hardware floating
- // point support implies VFPv3, see ARM DDI 0406B, page A1-6.
-#if defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) \
- && !defined(__SOFTFP__)
- answer |= 1u << VFP3 | 1u << ARMv7 | 1u << VFP2;
-#endif // defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__)
- // && !defined(__SOFTFP__)
-#endif // _arm__
- if (answer & (1u << ARMv7)) {
+ if ((answer & (1u << ARMv7)) && FLAG_enable_unaligned_accesses) {
answer |= 1u << UNALIGNED_ACCESSES;
}
@@ -94,18 +86,13 @@ static unsigned CpuFeaturesImpliedByCompiler() {
const char* DwVfpRegister::AllocationIndexToString(int index) {
- if (CpuFeatures::IsSupported(VFP2)) {
- ASSERT(index >= 0 && index < NumAllocatableRegisters());
- ASSERT(kScratchDoubleReg.code() - kDoubleRegZero.code() ==
- kNumReservedRegisters - 1);
- if (index >= kDoubleRegZero.code())
- index += kNumReservedRegisters;
-
- return VFPRegisters::Name(index, true);
- } else {
- ASSERT(index == 0);
- return "sfpd0";
- }
+ ASSERT(index >= 0 && index < NumAllocatableRegisters());
+ ASSERT(kScratchDoubleReg.code() - kDoubleRegZero.code() ==
+ kNumReservedRegisters - 1);
+ if (index >= kDoubleRegZero.code())
+ index += kNumReservedRegisters;
+
+ return VFPRegisters::Name(index, true);
}
@@ -124,6 +111,8 @@ void CpuFeatures::Probe() {
if (Serializer::enabled()) {
// No probing for features if we might serialize (generate snapshot).
+ printf(" ");
+ PrintFeatures();
return;
}
@@ -133,8 +122,7 @@ void CpuFeatures::Probe() {
if (FLAG_enable_vfp3) {
supported_ |=
static_cast<uint64_t>(1) << VFP3 |
- static_cast<uint64_t>(1) << ARMv7 |
- static_cast<uint64_t>(1) << VFP2;
+ static_cast<uint64_t>(1) << ARMv7;
}
// For the simulator=arm build, use ARMv7 when FLAG_enable_armv7 is enabled
if (FLAG_enable_armv7) {
@@ -153,48 +141,127 @@ void CpuFeatures::Probe() {
supported_ |= static_cast<uint64_t>(1) << VFP32DREGS;
}
+ if (FLAG_enable_unaligned_accesses) {
+ supported_ |= static_cast<uint64_t>(1) << UNALIGNED_ACCESSES;
+ }
+
#else // __arm__
// Probe for additional features not already known to be available.
- if (!IsSupported(VFP3) && OS::ArmCpuHasFeature(VFP3)) {
+ if (!IsSupported(VFP3) && FLAG_enable_vfp3 && OS::ArmCpuHasFeature(VFP3)) {
// This implementation also sets the VFP flags if runtime
- // detection of VFP returns true. VFPv3 implies ARMv7 and VFP2, see ARM DDI
+ // detection of VFP returns true. VFPv3 implies ARMv7, see ARM DDI
// 0406B, page A1-6.
found_by_runtime_probing_only_ |=
static_cast<uint64_t>(1) << VFP3 |
- static_cast<uint64_t>(1) << ARMv7 |
- static_cast<uint64_t>(1) << VFP2;
- } else if (!IsSupported(VFP2) && OS::ArmCpuHasFeature(VFP2)) {
- found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << VFP2;
+ static_cast<uint64_t>(1) << ARMv7;
}
- if (!IsSupported(ARMv7) && OS::ArmCpuHasFeature(ARMv7)) {
+ if (!IsSupported(ARMv7) && FLAG_enable_armv7 && OS::ArmCpuHasFeature(ARMv7)) {
found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << ARMv7;
}
- if (!IsSupported(SUDIV) && OS::ArmCpuHasFeature(SUDIV)) {
+ if (!IsSupported(SUDIV) && FLAG_enable_sudiv && OS::ArmCpuHasFeature(SUDIV)) {
found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << SUDIV;
}
- if (!IsSupported(UNALIGNED_ACCESSES) && OS::ArmCpuHasFeature(ARMv7)) {
+ if (!IsSupported(UNALIGNED_ACCESSES) && FLAG_enable_unaligned_accesses
+ && OS::ArmCpuHasFeature(ARMv7)) {
found_by_runtime_probing_only_ |=
static_cast<uint64_t>(1) << UNALIGNED_ACCESSES;
}
if (OS::GetCpuImplementer() == QUALCOMM_IMPLEMENTER &&
- OS::ArmCpuHasFeature(ARMv7)) {
+ FLAG_enable_movw_movt && OS::ArmCpuHasFeature(ARMv7)) {
found_by_runtime_probing_only_ |=
static_cast<uint64_t>(1) << MOVW_MOVT_IMMEDIATE_LOADS;
}
- if (!IsSupported(VFP32DREGS) && OS::ArmCpuHasFeature(VFP32DREGS)) {
+ if (!IsSupported(VFP32DREGS) && FLAG_enable_32dregs
+ && OS::ArmCpuHasFeature(VFP32DREGS)) {
found_by_runtime_probing_only_ |= static_cast<uint64_t>(1) << VFP32DREGS;
}
supported_ |= found_by_runtime_probing_only_;
#endif
- // Assert that VFP3 implies VFP2 and ARMv7.
- ASSERT(!IsSupported(VFP3) || (IsSupported(VFP2) && IsSupported(ARMv7)));
+ // Assert that VFP3 implies ARMv7.
+ ASSERT(!IsSupported(VFP3) || IsSupported(ARMv7));
+}
+
+
+void CpuFeatures::PrintTarget() {
+ const char* arm_arch = NULL;
+ const char* arm_test = "";
+ const char* arm_fpu = "";
+ const char* arm_thumb = "";
+ const char* arm_float_abi = NULL;
+
+#if defined CAN_USE_ARMV7_INSTRUCTIONS
+ arm_arch = "arm v7";
+#else
+ arm_arch = "arm v6";
+#endif
+
+#ifdef __arm__
+
+# ifdef ARM_TEST
+ arm_test = " test";
+# endif
+# if defined __ARM_NEON__
+ arm_fpu = " neon";
+# elif defined CAN_USE_VFP3_INSTRUCTIONS
+ arm_fpu = " vfp3";
+# else
+ arm_fpu = " vfp2";
+# endif
+# if (defined __thumb__) || (defined __thumb2__)
+ arm_thumb = " thumb";
+# endif
+ arm_float_abi = OS::ArmUsingHardFloat() ? "hard" : "softfp";
+
+#else // __arm__
+
+ arm_test = " simulator";
+# if defined CAN_USE_VFP3_INSTRUCTIONS
+# if defined CAN_USE_VFP32DREGS
+ arm_fpu = " vfp3";
+# else
+ arm_fpu = " vfp3-d16";
+# endif
+# else
+ arm_fpu = " vfp2";
+# endif
+# if USE_EABI_HARDFLOAT == 1
+ arm_float_abi = "hard";
+# else
+ arm_float_abi = "softfp";
+# endif
+
+#endif // __arm__
+
+ printf("target%s %s%s%s %s\n",
+ arm_test, arm_arch, arm_fpu, arm_thumb, arm_float_abi);
+}
+
+
+void CpuFeatures::PrintFeatures() {
+ printf(
+ "ARMv7=%d VFP3=%d VFP32DREGS=%d SUDIV=%d UNALIGNED_ACCESSES=%d "
+ "MOVW_MOVT_IMMEDIATE_LOADS=%d",
+ CpuFeatures::IsSupported(ARMv7),
+ CpuFeatures::IsSupported(VFP3),
+ CpuFeatures::IsSupported(VFP32DREGS),
+ CpuFeatures::IsSupported(SUDIV),
+ CpuFeatures::IsSupported(UNALIGNED_ACCESSES),
+ CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS));
+#ifdef __arm__
+ bool eabi_hardfloat = OS::ArmUsingHardFloat();
+#elif USE_EABI_HARDFLOAT
+ bool eabi_hardfloat = true;
+#else
+ bool eabi_hardfloat = false;
+#endif
+ printf(" USE_EABI_HARDFLOAT=%d\n", eabi_hardfloat);
}
@@ -1763,7 +1830,6 @@ void Assembler::vldr(const DwVfpRegister dst,
// Instruction details available in ARM DDI 0406C.b, A8-924.
// cond(31-28) | 1101(27-24)| U(23) | D(22) | 01(21-20) | Rbase(19-16) |
// Vd(15-12) | 1011(11-8) | offset
- ASSERT(IsEnabled(VFP2));
int u = 1;
if (offset < 0) {
offset = -offset;
@@ -1807,7 +1873,6 @@ void Assembler::vldr(const SwVfpRegister dst,
// Instruction details available in ARM DDI 0406A, A8-628.
// cond(31-28) | 1101(27-24)| U001(23-20) | Rbase(19-16) |
// Vdst(15-12) | 1010(11-8) | offset
- ASSERT(IsEnabled(VFP2));
int u = 1;
if (offset < 0) {
offset = -offset;
@@ -1851,7 +1916,6 @@ void Assembler::vstr(const DwVfpRegister src,
// Instruction details available in ARM DDI 0406C.b, A8-1082.
// cond(31-28) | 1101(27-24)| U(23) | D(22) | 00(21-20) | Rbase(19-16) |
// Vd(15-12) | 1011(11-8) | (offset/4)
- ASSERT(IsEnabled(VFP2));
int u = 1;
if (offset < 0) {
offset = -offset;
@@ -1895,7 +1959,6 @@ void Assembler::vstr(const SwVfpRegister src,
// Instruction details available in ARM DDI 0406A, A8-786.
// cond(31-28) | 1101(27-24)| U000(23-20) | Rbase(19-16) |
// Vdst(15-12) | 1010(11-8) | (offset/4)
- ASSERT(IsEnabled(VFP2));