From f69be329f0d78f19e71ac9e75d6e4ee816e13c97 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 10 Aug 2013 16:27:43 +0200 Subject: [PATCH] v8: upgrade v8 to 3.20.14.1 --- deps/v8/.gitignore | 12 +- deps/v8/AUTHORS | 1 + deps/v8/ChangeLog | 41 + deps/v8/DEPS | 4 +- deps/v8/Makefile | 13 +- deps/v8/PRESUBMIT.py | 3 + deps/v8/build/standalone.gypi | 6 +- deps/v8/build/toolchain.gypi | 47 +- deps/v8/include/v8-debug.h | 36 +- deps/v8/include/v8-preparser.h | 44 +- deps/v8/include/v8-profiler.h | 61 +- deps/v8/include/v8-testing.h | 34 +- deps/v8/include/v8.h | 289 ++- deps/v8/src/api.cc | 78 +- deps/v8/src/arm/assembler-arm.cc | 59 +- deps/v8/src/arm/assembler-arm.h | 1 - deps/v8/src/arm/builtins-arm.cc | 20 +- deps/v8/src/arm/code-stubs-arm.cc | 48 +- deps/v8/src/arm/codegen-arm.cc | 4 +- deps/v8/src/arm/debug-arm.cc | 6 +- deps/v8/src/arm/frames-arm.h | 5 + deps/v8/src/arm/full-codegen-arm.cc | 43 +- deps/v8/src/arm/lithium-arm.cc | 86 +- deps/v8/src/arm/lithium-arm.h | 70 +- deps/v8/src/arm/lithium-codegen-arm.cc | 160 +- deps/v8/src/arm/lithium-codegen-arm.h | 7 +- deps/v8/src/arm/lithium-gap-resolver-arm.cc | 2 +- deps/v8/src/arm/macro-assembler-arm.cc | 55 +- deps/v8/src/arm/macro-assembler-arm.h | 8 +- deps/v8/src/array-iterator.js | 7 +- deps/v8/src/ast.cc | 11 - deps/v8/src/ast.h | 5 - deps/v8/src/atomicops_internals_tsan.h | 12 +- deps/v8/src/bootstrapper.cc | 11 + deps/v8/src/builtins.h | 2 - deps/v8/src/checks.h | 6 +- deps/v8/src/code-stubs-hydrogen.cc | 189 +- deps/v8/src/code-stubs.cc | 88 - deps/v8/src/code-stubs.h | 68 - deps/v8/src/collection.js | 8 +- deps/v8/src/compilation-cache.cc | 26 +- deps/v8/src/compilation-cache.h | 5 +- deps/v8/src/compiler.cc | 27 +- deps/v8/src/compiler.h | 7 +- deps/v8/src/d8.cc | 89 +- deps/v8/src/d8.h | 2 + deps/v8/src/debug.cc | 2 +- deps/v8/src/deoptimizer.cc | 55 +- deps/v8/src/extensions/i18n/date-format.cc | 329 ---- deps/v8/src/extensions/i18n/date-format.js | 10 +- deps/v8/src/extensions/i18n/footer.js | 2 +- deps/v8/src/extensions/i18n/header.js | 2 +- deps/v8/src/extensions/i18n/i18n-extension.cc | 22 - deps/v8/src/extensions/i18n/i18n-utils.cc | 46 +- deps/v8/src/extensions/i18n/i18n-utils.js | 11 +- deps/v8/src/extensions/i18n/locale.cc | 251 --- deps/v8/src/extensions/i18n/locale.js | 4 +- deps/v8/src/factory.cc | 54 +- deps/v8/src/flag-definitions.h | 8 +- deps/v8/src/frames.cc | 10 +- deps/v8/src/frames.h | 3 +- deps/v8/src/full-codegen.cc | 16 +- deps/v8/src/full-codegen.h | 64 +- deps/v8/src/global-handles.cc | 594 ++++-- deps/v8/src/global-handles.h | 135 +- deps/v8/src/globals.h | 392 ++-- deps/v8/src/harmony-array.js | 124 ++ deps/v8/src/harmony-string.js | 154 ++ deps/v8/src/heap-snapshot-generator.cc | 24 +- deps/v8/src/heap-snapshot-generator.h | 10 - deps/v8/src/heap.cc | 67 +- deps/v8/src/heap.h | 27 +- deps/v8/src/hydrogen-bce.cc | 8 +- deps/v8/src/hydrogen-bch.cc | 14 +- deps/v8/src/hydrogen-dehoist.cc | 2 +- deps/v8/src/hydrogen-instructions.cc | 681 ++----- deps/v8/src/hydrogen-instructions.h | 1945 +++++++++----------- deps/v8/src/hydrogen-uint32-analysis.cc | 6 +- deps/v8/src/hydrogen.cc | 1090 +++++------ deps/v8/src/hydrogen.h | 293 ++- deps/v8/src/i18n.cc | 297 +++ .../src/{extensions/i18n/date-format.h => i18n.h} | 48 +- deps/v8/src/ia32/assembler-ia32.cc | 4 + deps/v8/src/ia32/builtins-ia32.cc | 20 +- deps/v8/src/ia32/code-stubs-ia32.cc | 54 +- deps/v8/src/ia32/codegen-ia32.cc | 4 +- deps/v8/src/ia32/debug-ia32.cc | 2 +- deps/v8/src/ia32/deoptimizer-ia32.cc | 2 +- deps/v8/src/ia32/frames-ia32.h | 5 + deps/v8/src/ia32/full-codegen-ia32.cc | 44 +- deps/v8/src/ia32/ic-ia32.cc | 2 +- deps/v8/src/ia32/lithium-codegen-ia32.cc | 175 +- deps/v8/src/ia32/lithium-codegen-ia32.h | 15 +- deps/v8/src/ia32/lithium-ia32.cc | 82 +- deps/v8/src/ia32/lithium-ia32.h | 70 +- deps/v8/src/ia32/macro-assembler-ia32.cc | 59 +- deps/v8/src/ia32/macro-assembler-ia32.h | 8 +- deps/v8/src/ia32/stub-cache-ia32.cc | 2 +- deps/v8/src/ic.cc | 36 +- deps/v8/src/ic.h | 8 - deps/v8/src/icu_util.cc | 4 +- deps/v8/src/isolate.cc | 4 + deps/v8/src/isolate.h | 3 + deps/v8/src/lithium.cc | 4 +- deps/v8/src/log.cc | 1 - deps/v8/src/mark-compact.cc | 13 +- deps/v8/src/mark-compact.h | 4 +- deps/v8/src/messages.js | 23 +- deps/v8/src/mips/assembler-mips.h | 5 + deps/v8/src/mips/builtins-mips.cc | 20 +- deps/v8/src/mips/code-stubs-mips.cc | 58 +- deps/v8/src/mips/codegen-mips.cc | 4 +- deps/v8/src/mips/debug-mips.cc | 7 +- deps/v8/src/mips/frames-mips.h | 5 + deps/v8/src/mips/full-codegen-mips.cc | 58 +- deps/v8/src/mips/lithium-codegen-mips.cc | 174 +- deps/v8/src/mips/lithium-codegen-mips.h | 6 +- deps/v8/src/mips/lithium-gap-resolver-mips.cc | 2 +- deps/v8/src/mips/lithium-mips.cc | 86 +- deps/v8/src/mips/lithium-mips.h | 70 +- deps/v8/src/mips/macro-assembler-mips.cc | 63 +- deps/v8/src/mips/macro-assembler-mips.h | 12 +- deps/v8/src/object-observe.js | 5 +- deps/v8/src/objects-debug.cc | 13 +- deps/v8/src/objects-inl.h | 88 +- deps/v8/src/objects-printer.cc | 44 +- deps/v8/src/objects-visiting.h | 2 +- deps/v8/src/objects.cc | 64 +- deps/v8/src/objects.h | 320 +++- deps/v8/src/parser.cc | 14 + deps/v8/src/platform-linux.cc | 3 +- deps/v8/src/profile-generator.cc | 12 +- deps/v8/src/profile-generator.h | 17 +- deps/v8/src/runtime.cc | 655 +++++-- deps/v8/src/runtime.h | 29 +- deps/v8/src/runtime.js | 14 - deps/v8/src/sampler.cc | 8 +- deps/v8/src/serialize.cc | 1 + deps/v8/src/spaces.h | 5 +- deps/v8/src/transitions-inl.h | 24 +- deps/v8/src/transitions.cc | 5 - deps/v8/src/transitions.h | 44 +- deps/v8/src/type-info.cc | 12 - deps/v8/src/type-info.h | 1 - deps/v8/src/typedarray.js | 120 +- deps/v8/src/typing.cc | 12 - deps/v8/src/v8.cc | 7 +- deps/v8/src/version.cc | 4 +- deps/v8/src/x64/assembler-x64-inl.h | 5 +- deps/v8/src/x64/assembler-x64.cc | 7 +- deps/v8/src/x64/assembler-x64.h | 51 +- deps/v8/src/x64/builtins-x64.cc | 48 +- deps/v8/src/x64/code-stubs-x64.cc | 112 +- deps/v8/src/x64/codegen-x64.cc | 4 +- deps/v8/src/x64/debug-x64.cc | 7 +- deps/v8/src/x64/deoptimizer-x64.cc | 4 +- deps/v8/src/x64/frames-x64.h | 6 + deps/v8/src/x64/full-codegen-x64.cc | 47 +- deps/v8/src/x64/ic-x64.cc | 44 +- deps/v8/src/x64/lithium-codegen-x64.cc | 181 +- deps/v8/src/x64/lithium-codegen-x64.h | 14 +- deps/v8/src/x64/lithium-x64.cc | 81 +- deps/v8/src/x64/lithium-x64.h | 68 +- deps/v8/src/x64/macro-assembler-x64.cc | 94 +- deps/v8/src/x64/macro-assembler-x64.h | 18 +- deps/v8/src/x64/regexp-macro-assembler-x64.cc | 2 +- deps/v8/src/x64/stub-cache-x64.cc | 36 +- deps/v8/src/zone.h | 5 + deps/v8/test/benchmarks/benchmarks.status | 29 + deps/v8/test/benchmarks/testcfg.py | 181 ++ deps/v8/test/cctest/cctest.cc | 5 +- deps/v8/test/cctest/cctest.h | 53 + deps/v8/test/cctest/test-api.cc | 175 +- deps/v8/test/cctest/test-assembler-arm.cc | 21 + deps/v8/test/cctest/test-code-stubs-ia32.cc | 2 +- deps/v8/test/cctest/test-code-stubs-x64.cc | 2 +- deps/v8/test/cctest/test-compiler.cc | 1 + deps/v8/test/cctest/test-cpu-profiler.cc | 15 + deps/v8/test/cctest/test-global-handles.cc | 204 ++ deps/v8/test/cctest/test-heap.cc | 4 +- deps/v8/test/cctest/test-strings.cc | 52 - deps/v8/test/intl/break-iterator/default-locale.js | 2 +- .../wellformed-unsupported-locale.js | 2 +- deps/v8/test/intl/collator/default-locale.js | 4 +- .../intl/collator/wellformed-unsupported-locale.js | 2 +- deps/v8/test/intl/date-format/default-locale.js | 2 +- .../date-format/wellformed-unsupported-locale.js | 2 +- deps/v8/test/intl/intl.status | 10 +- deps/v8/test/intl/number-format/default-locale.js | 2 +- .../number-format/wellformed-unsupported-locale.js | 2 +- deps/v8/test/intl/testcfg.py | 2 +- deps/v8/test/mjsunit/harmony/array-find.js | 280 +++ deps/v8/test/mjsunit/harmony/array-findindex.js | 280 +++ deps/v8/test/mjsunit/harmony/array-iterator.js | 34 +- deps/v8/test/mjsunit/harmony/collections.js | 9 +- deps/v8/test/mjsunit/harmony/object-observe.js | 16 +- .../mjsunit/harmony/proxies-example-membrane.js | 4 +- deps/v8/test/mjsunit/harmony/proxies-hash.js | 4 +- deps/v8/test/mjsunit/harmony/string-contains.js | 151 ++ deps/v8/test/mjsunit/harmony/string-endswith.js | 136 ++ deps/v8/test/mjsunit/harmony/string-repeat.js | 74 + deps/v8/test/mjsunit/harmony/string-startswith.js | 135 ++ deps/v8/test/mjsunit/math-abs.js | 11 + .../regress/regress-264203.js} | 22 +- deps/v8/test/mjsunit/regress/regress-2813.js | 44 + .../v8/test/mjsunit/regress/regress-omit-checks.js | 55 + .../locale.h => test/mjsunit/unary-minus-deopt.js} | 57 +- deps/v8/test/webkit/webkit.status | 3 + deps/v8/tools/grokdump.py | 274 +-- deps/v8/tools/gyp/v8.gyp | 10 +- deps/v8/tools/run-tests.py | 8 +- deps/v8/tools/testrunner/local/old_statusfile.py | 2 + deps/v8/tools/testrunner/local/statusfile.py | 7 +- deps/v8/tools/testrunner/local/testsuite.py | 47 +- deps/v8/tools/testrunner/local/verbose.py | 2 +- deps/v8/tools/v8heapconst.py | 252 +++ deps/v8/tools/v8heapconst.py.tmpl | 30 + 217 files changed, 8264 insertions(+), 6638 deletions(-) delete mode 100644 deps/v8/src/extensions/i18n/date-format.cc delete mode 100644 deps/v8/src/extensions/i18n/locale.cc create mode 100644 deps/v8/src/harmony-array.js create mode 100644 deps/v8/src/harmony-string.js create mode 100644 deps/v8/src/i18n.cc rename deps/v8/src/{extensions/i18n/date-format.h => i18n.h} (69%) create mode 100644 deps/v8/test/benchmarks/benchmarks.status create mode 100644 deps/v8/test/benchmarks/testcfg.py create mode 100644 deps/v8/test/mjsunit/harmony/array-find.js create mode 100644 deps/v8/test/mjsunit/harmony/array-findindex.js create mode 100644 deps/v8/test/mjsunit/harmony/string-contains.js create mode 100644 deps/v8/test/mjsunit/harmony/string-endswith.js create mode 100644 deps/v8/test/mjsunit/harmony/string-repeat.js create mode 100644 deps/v8/test/mjsunit/harmony/string-startswith.js rename deps/v8/test/{intl/general/v8Intl-exists.js => mjsunit/regress/regress-264203.js} (83%) create mode 100644 deps/v8/test/mjsunit/regress/regress-2813.js create mode 100644 deps/v8/test/mjsunit/regress/regress-omit-checks.js rename deps/v8/{src/extensions/i18n/locale.h => test/mjsunit/unary-minus-deopt.js} (60%) create mode 100644 deps/v8/tools/v8heapconst.py create mode 100644 deps/v8/tools/v8heapconst.py.tmpl diff --git a/deps/v8/.gitignore b/deps/v8/.gitignore index 2f524be..282e463 100644 --- a/deps/v8/.gitignore +++ b/deps/v8/.gitignore @@ -27,12 +27,22 @@ d8 d8_g shell shell_g +/_* /build/Debug /build/gyp /build/ipch/ /build/Release +/hydrogen.cfg /obj /out +/perf.data +/perf.data.old +/test/benchmarks/benchmarks.status2 +/test/benchmarks/CHECKED_OUT_* +/test/benchmarks/downloaded_* +/test/benchmarks/kraken +/test/benchmarks/octane +/test/benchmarks/sunspider /test/cctest/cctest.status2 /test/message/message.status2 /test/mjsunit/mjsunit.status2 @@ -52,6 +62,7 @@ shell_g /tools/oom_dump/oom_dump.o /tools/visual_studio/Debug /tools/visual_studio/Release +/v8.log.ll /xcodebuild TAGS *.Makefile @@ -59,4 +70,3 @@ GTAGS GRTAGS GSYMS GPATH -/_* diff --git a/deps/v8/AUTHORS b/deps/v8/AUTHORS index 1a927c4..46e3a14 100644 --- a/deps/v8/AUTHORS +++ b/deps/v8/AUTHORS @@ -10,6 +10,7 @@ Hewlett-Packard Development Company, LP Igalia, S.L. Joyent, Inc. Bloomberg Finance L.P. +NVIDIA Corporation Akinori MUSHA Alexander Botero-Lowry diff --git a/deps/v8/ChangeLog b/deps/v8/ChangeLog index 567afd2..b19fda2 100644 --- a/deps/v8/ChangeLog +++ b/deps/v8/ChangeLog @@ -1,3 +1,44 @@ +2013-08-07: Version 3.20.14 + + Exposed eternal handle api. + + Bugfix to solve issues with enabling V8 typed arrays in Blink. + + Fixed Array index dehoisting. (Chromium issue 264203) + + Updated Array Iterator to use numeric indexes (issue 2818) + + Return start/end profiling time in microseconds instead of milliseconds + (issue 2824) + + Performance and stability improvements on all platforms. + + +2013-08-06: Version 3.20.14 + + Added new Harmony methods to Array.prototype object. + (issue 2776,v8:2777) + + Performance and stability improvements on all platforms. + + +2013-08-01: Version 3.20.12 + + Removed buggy ToNumber truncation (partial fix for issue 2813) + + Calling Map etc without new should throw TypeError (issue 2819) + + Fixed a crash for large code objects on ARM (Chromium issue 2736) + + Fixed stale unhandlified value in JSObject::SetPropertyForResult. + (Chromium issue 265894) + + Added new Harmony methods to String.prototype object. + (issue 2796,v8:2797,v8:2798,v8:2799) + + Performance and stability improvements on all platforms. + + 2013-07-30: Version 3.20.11 Performance and stability improvements on all platforms. diff --git a/deps/v8/DEPS b/deps/v8/DEPS index da87853..b91ae4e 100644 --- a/deps/v8/DEPS +++ b/deps/v8/DEPS @@ -5,10 +5,10 @@ deps = { # Remember to keep the revision in sync with the Makefile. "v8/build/gyp": - "http://gyp.googlecode.com/svn/trunk@1656", + "http://gyp.googlecode.com/svn/trunk@1685", "v8/third_party/icu": - "https://src.chromium.org/chrome/trunk/deps/third_party/icu46@213354", + "https://src.chromium.org/chrome/trunk/deps/third_party/icu46@214189", } deps_os = { diff --git a/deps/v8/Makefile b/deps/v8/Makefile index a749fd0..288c257 100644 --- a/deps/v8/Makefile +++ b/deps/v8/Makefile @@ -192,6 +192,7 @@ endif # ----------------- available targets: -------------------- # - "dependencies": pulls in external dependencies (currently: GYP) +# - "grokdump": rebuilds heap constants lists used by grokdump # - any arch listed in ARCHES (see below) # - any mode listed in MODES # - every combination ., e.g. "ia32.release" @@ -392,7 +393,7 @@ endif # Replaces the old with the new environment file if they're different, which # will trigger GYP to regenerate Makefiles. $(ENVFILE): $(ENVFILE).new - @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ + @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) > /dev/null; \ then rm $(ENVFILE).new; \ else mv $(ENVFILE).new $(ENVFILE); fi @@ -401,11 +402,17 @@ $(ENVFILE).new: @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; \ echo "CXX=$(CXX)" >> $(ENVFILE).new +# Heap constants for grokdump. +DUMP_FILE = tools/v8heapconst.py +grokdump: ia32.release + @cat $(DUMP_FILE).tmpl > $(DUMP_FILE) + @$(OUTDIR)/ia32.release/d8 --dump-heap-constants >> $(DUMP_FILE) + # Dependencies. # Remember to keep these in sync with the DEPS file. dependencies: svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ - --revision 1656 + --revision 1685 svn checkout --force \ https://src.chromium.org/chrome/trunk/deps/third_party/icu46 \ - third_party/icu --revision 213354 + third_party/icu --revision 214189 diff --git a/deps/v8/PRESUBMIT.py b/deps/v8/PRESUBMIT.py index 1f176e0..819331f 100644 --- a/deps/v8/PRESUBMIT.py +++ b/deps/v8/PRESUBMIT.py @@ -69,4 +69,7 @@ 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(input_api.canned_checks.CheckTreeIsOpen( + input_api, output_api, + json_url='http://v8-status.appspot.com/current?format=json')) return results diff --git a/deps/v8/build/standalone.gypi b/deps/v8/build/standalone.gypi index ab2dfd5..5c017d5 100644 --- a/deps/v8/build/standalone.gypi +++ b/deps/v8/build/standalone.gypi @@ -120,6 +120,9 @@ }, 'target_conditions': [ ['v8_code == 0', { + 'defines!': [ + 'DEBUG', + ], 'conditions': [ ['os_posix == 1 and OS != "mac"', { 'cflags!': [ @@ -132,9 +135,6 @@ }, }], ['OS == "win"', { - 'defines!': [ - 'DEBUG', - ], 'msvs_settings': { 'VCCLCompilerTool': { 'WarnAsError': 'false', diff --git a/deps/v8/build/toolchain.gypi b/deps/v8/build/toolchain.gypi index 36d60c2..ddb8aaf 100644 --- a/deps/v8/build/toolchain.gypi +++ b/deps/v8/build/toolchain.gypi @@ -61,11 +61,10 @@ 'v8_enable_backtrace%': 0, # Speeds up Debug builds: - # 0 - compiler optimizations off (debuggable) (default). This may + # 0 - Compiler optimizations off (debuggable) (default). This may # be 5x slower than Release (or worse). - # 1 - turn on compiler optimizations. and #undef DEBUG/#define NDEBUG. - # This may be hard or impossible to debug. This may still be - # 2x slower than Release (or worse). + # 1 - Turn on compiler optimizations. This may be hard or impossible to + # debug. This may still be 2x slower than Release (or worse). # 2 - Turn on optimizations, and also #undef DEBUG / #define NDEBUG # (but leave V8_ENABLE_CHECKS and most other assertions enabled. # This may cause some v8 tests to fail in the Debug configuration. @@ -455,14 +454,32 @@ 'msvs_settings': { 'VCCLCompilerTool': { 'conditions': [ - ['component=="shared_library"', { - 'RuntimeLibrary': '3', # /MDd - }, { - 'RuntimeLibrary': '1', # /MTd - }], ['v8_optimized_debug==0', { 'Optimization': '0', - }, { + 'conditions': [ + ['component=="shared_library"', { + 'RuntimeLibrary': '3', # /MDd + }, { + 'RuntimeLibrary': '1', # /MTd + }], + ], + }], + ['v8_optimized_debug==1', { + 'Optimization': '1', + 'InlineFunctionExpansion': '2', + 'EnableIntrinsicFunctions': 'true', + 'FavorSizeOrSpeed': '0', + 'StringPooling': 'true', + 'BasicRuntimeChecks': '0', + 'conditions': [ + ['component=="shared_library"', { + 'RuntimeLibrary': '3', # /MDd + }, { + 'RuntimeLibrary': '1', # /MTd + }], + ], + }], + ['v8_optimized_debug==2', { 'Optimization': '2', 'InlineFunctionExpansion': '2', 'EnableIntrinsicFunctions': 'true', @@ -471,9 +488,9 @@ 'BasicRuntimeChecks': '0', 'conditions': [ ['component=="shared_library"', { - 'RuntimeLibrary': '2', #/MD + 'RuntimeLibrary': '3', #/MDd }, { - 'RuntimeLibrary': '0', #/MT + 'RuntimeLibrary': '1', #/MTd }], ['v8_target_arch=="x64"', { # TODO(2207): remove this option once the bug is fixed. @@ -487,7 +504,11 @@ 'conditions': [ ['v8_optimized_debug==0', { 'LinkIncremental': '2', - }, { + }], + ['v8_optimized_debug==1', { + 'LinkIncremental': '2', + }], + ['v8_optimized_debug==2', { 'LinkIncremental': '1', 'OptimizeReferences': '2', 'EnableCOMDATFolding': '2', diff --git a/deps/v8/include/v8-debug.h b/deps/v8/include/v8-debug.h index e488aaa..bacccb6 100755 --- a/deps/v8/include/v8-debug.h +++ b/deps/v8/include/v8-debug.h @@ -30,40 +30,6 @@ #include "v8.h" -#ifdef _WIN32 -typedef int int32_t; -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; // NOLINT -typedef long long int64_t; // NOLINT - -// Setup for Windows DLL export/import. See v8.h in this directory for -// information on how to build/use V8 as a DLL. -#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) -#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ - build configuration to ensure that at most one of these is set -#endif - -#ifdef BUILDING_V8_SHARED -#define EXPORT __declspec(dllexport) -#elif USING_V8_SHARED -#define EXPORT __declspec(dllimport) -#else -#define EXPORT -#endif - -#else // _WIN32 - -// 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) -#define EXPORT __attribute__ ((visibility("default"))) -#else // defined(__GNUC__) && (__GNUC__ >= 4) -#define EXPORT -#endif // defined(__GNUC__) && (__GNUC__ >= 4) - -#endif // _WIN32 - - /** * Debugger support for the V8 JavaScript engine. */ @@ -81,7 +47,7 @@ enum DebugEvent { }; -class EXPORT Debug { +class V8_EXPORT Debug { public: /** * A client object passed to the v8 debugger whose ownership will be taken by diff --git a/deps/v8/include/v8-preparser.h b/deps/v8/include/v8-preparser.h index 3e39823..1da7718 100644 --- a/deps/v8/include/v8-preparser.h +++ b/deps/v8/include/v8-preparser.h @@ -28,48 +28,14 @@ #ifndef PREPARSER_H #define PREPARSER_H +#include "v8.h" #include "v8stdint.h" -#ifdef _WIN32 - -// Setup for Windows DLL export/import. When building the V8 DLL the -// BUILDING_V8_SHARED needs to be defined. When building a program which uses -// the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8 -// static library or building a program which uses the V8 static library neither -// BUILDING_V8_SHARED nor USING_V8_SHARED should be defined. -#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) -#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ - build configuration to ensure that at most one of these is set -#endif - -#ifdef BUILDING_V8_SHARED -#define V8EXPORT __declspec(dllexport) -#elif USING_V8_SHARED -#define V8EXPORT __declspec(dllimport) -#else -#define V8EXPORT -#endif // BUILDING_V8_SHARED - -#else // _WIN32 - -// 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) || \ - (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) -#define V8EXPORT __attribute__ ((visibility("default"))) -#else -#define V8EXPORT -#endif - -#endif // _WIN32 - - namespace v8 { // The result of preparsing is either a stack overflow error, or an opaque // blob of data that can be passed back into the parser. -class V8EXPORT PreParserData { +class V8_EXPORT PreParserData { public: PreParserData(size_t size, const uint8_t* data) : data_(data), size_(size) { } @@ -94,7 +60,7 @@ class V8EXPORT PreParserData { // Interface for a stream of Unicode characters. -class V8EXPORT UnicodeInputStream { // NOLINT - Thinks V8EXPORT is class name. +class V8_EXPORT UnicodeInputStream { // NOLINT - V8_EXPORT is not a class name. public: virtual ~UnicodeInputStream(); @@ -110,11 +76,9 @@ class V8EXPORT UnicodeInputStream { // NOLINT - Thinks V8EXPORT is class name. // more stack space than the limit provided, the result's stack_overflow() // method will return true. Otherwise the result contains preparser // data that can be used by the V8 parser to speed up parsing. -PreParserData V8EXPORT Preparse(UnicodeInputStream* input, +PreParserData V8_EXPORT Preparse(UnicodeInputStream* input, size_t max_stack_size); } // namespace v8. -#undef V8EXPORT - #endif // PREPARSER_H diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index cf28341..1d7b70d 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -30,36 +30,6 @@ #include "v8.h" -#ifdef _WIN32 -// Setup for Windows DLL export/import. See v8.h in this directory for -// information on how to build/use V8 as a DLL. -#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) -#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ - build configuration to ensure that at most one of these is set -#endif - -#ifdef BUILDING_V8_SHARED -#define V8EXPORT __declspec(dllexport) -#elif USING_V8_SHARED -#define V8EXPORT __declspec(dllimport) -#else -#define V8EXPORT -#endif - -#else // _WIN32 - -// 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) || \ - (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) -#define V8EXPORT __attribute__ ((visibility("default"))) -#else -#define V8EXPORT -#endif - -#endif // _WIN32 - - /** * Profiler support for the V8 JavaScript engine. */ @@ -70,7 +40,7 @@ typedef uint32_t SnapshotObjectId; /** * CpuProfileNode represents a node in a call graph. */ -class V8EXPORT CpuProfileNode { +class V8_EXPORT CpuProfileNode { public: /** Returns function name (empty string for anonymous functions.) */ Handle GetFunctionName() const; @@ -125,7 +95,7 @@ class V8EXPORT CpuProfileNode { * CpuProfile contains a CPU profile in a form of top-down call tree * (from main() down to functions that do all the work). */ -class V8EXPORT CpuProfile { +class V8_EXPORT CpuProfile { public: /** Returns CPU profile UID (assigned by the profiler.) */ unsigned GetUid() const; @@ -149,6 +119,18 @@ class V8EXPORT CpuProfile { const CpuProfileNode* GetSample(int index) const; /** + * Returns time when the profile recording started (in microseconds + * since the Epoch). + */ + int64_t GetStartTime() const; + + /** + * Returns time when the profile recording was stopped (in microseconds + * since the Epoch). + */ + int64_t GetEndTime() const; + + /** * Deletes the profile and removes it from CpuProfiler's list. * All pointers to nodes previously returned become invalid. * Profiles with the same uid but obtained using different @@ -164,7 +146,7 @@ class V8EXPORT CpuProfile { * Interface for controlling CPU profiling. Instance of the * profiler can be retrieved using v8::Isolate::GetCpuProfiler. */ -class V8EXPORT CpuProfiler { +class V8_EXPORT CpuProfiler { public: /** * A note on security tokens usage. As scripts from different @@ -225,7 +207,7 @@ class HeapGraphNode; * HeapSnapshotEdge represents a directed connection between heap * graph nodes: from retainers to retained nodes. */ -class V8EXPORT HeapGraphEdge { +class V8_EXPORT HeapGraphEdge { public: enum Type { kContextVariable = 0, // A variable from a function context. @@ -261,7 +243,7 @@ class V8EXPORT HeapGraphEdge { /** * HeapGraphNode represents a node in a heap graph. */ -class V8EXPORT HeapGraphNode { +class V8_EXPORT HeapGraphNode { public: enum Type { kHidden = 0, // Hidden node, may be filtered when shown to user. @@ -313,7 +295,7 @@ class V8EXPORT HeapGraphNode { /** * HeapSnapshots record the state of the JS heap at some moment. */ -class V8EXPORT HeapSnapshot { +class V8_EXPORT HeapSnapshot { public: enum SerializationFormat { kJSON = 0 // See format description near 'Serialize' method. @@ -383,7 +365,7 @@ class RetainedObjectInfo; * Interface for controlling heap profiling. Instance of the * profiler can be retrieved using v8::Isolate::GetHeapProfiler. */ -class V8EXPORT HeapProfiler { +class V8_EXPORT HeapProfiler { public: /** * Callback function invoked for obtaining RetainedObjectInfo for @@ -521,7 +503,7 @@ class V8EXPORT HeapProfiler { * keeps them alive only during snapshot collection. Afterwards, they * are freed by calling the Dispose class function. */ -class V8EXPORT RetainedObjectInfo { // NOLINT +class V8_EXPORT RetainedObjectInfo { // NOLINT public: /** Called by V8 when it no longer needs an instance. */ virtual void Dispose() = 0; @@ -587,7 +569,4 @@ struct HeapStatsUpdate { } // namespace v8 -#undef V8EXPORT - - #endif // V8_V8_PROFILER_H_ diff --git a/deps/v8/include/v8-testing.h b/deps/v8/include/v8-testing.h index 59eebf9..97b467a 100644 --- a/deps/v8/include/v8-testing.h +++ b/deps/v8/include/v8-testing.h @@ -30,42 +30,12 @@ #include "v8.h" -#ifdef _WIN32 -// Setup for Windows DLL export/import. See v8.h in this directory for -// information on how to build/use V8 as a DLL. -#if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED) -#error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\ - build configuration to ensure that at most one of these is set -#endif - -#ifdef BUILDING_V8_SHARED -#define V8EXPORT __declspec(dllexport) -#elif USING_V8_SHARED -#define V8EXPORT __declspec(dllimport) -#else -#define V8EXPORT -#endif - -#else // _WIN32 - -// 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) || \ - (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) -#define V8EXPORT __attribute__ ((visibility("default"))) -#else -#define V8EXPORT -#endif - -#endif // _WIN32 - - /** * Testing support for the V8 JavaScript engine. */ namespace v8 { -class V8EXPORT Testing { +class V8_EXPORT Testing { public: enum StressType { kStressTypeOpt, @@ -99,7 +69,7 @@ class V8EXPORT Testing { } // namespace v8 -#undef V8EXPORT +#undef V8_EXPORT #endif // V8_V8_TEST_H_ diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index eb166ab..4b31e87 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -40,6 +40,9 @@ #include "v8stdint.h" +// We reserve the V8_* prefix for macros defined in V8 public API and +// assume there are no name conflicts with the embedder's code. + #ifdef _WIN32 // Setup for Windows DLL export/import. When building the V8 DLL the @@ -53,11 +56,11 @@ #endif #ifdef BUILDING_V8_SHARED -#define V8EXPORT __declspec(dllexport) +#define V8_EXPORT __declspec(dllexport) #elif USING_V8_SHARED -#define V8EXPORT __declspec(dllimport) +#define V8_EXPORT __declspec(dllimport) #else -#define V8EXPORT +#define V8_EXPORT #endif // BUILDING_V8_SHARED #else // _WIN32 @@ -66,12 +69,12 @@ #if defined(__GNUC__) && ((__GNUC__ >= 4) || \ (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(V8_SHARED) #ifdef BUILDING_V8_SHARED -#define V8EXPORT __attribute__ ((visibility("default"))) +#define V8_EXPORT __attribute__ ((visibility("default"))) #else -#define V8EXPORT +#define V8_EXPORT #endif #else -#define V8EXPORT +#define V8_EXPORT #endif #endif // _WIN32 @@ -385,6 +388,11 @@ template class Handle { }; +// A value which will never be returned by Local::Eternalize +// Useful for static initialization +const int kUninitializedEternalIndex = -1; + + /** * A light-weight stack-allocated object handle. All operations * that return objects from within v8 return them in local handles. They @@ -430,6 +438,11 @@ template class Local : public Handle { return Local::Cast(*this); } + // Keep this Local alive for the lifetime of the Isolate. + // It remains retrievable via the returned index, + V8_INLINE(int Eternalize(Isolate* isolate)); + V8_INLINE(static Local GetEternal(Isolate* isolate, int index)); + /** * Create a local handle for the content of another handle. * The referee is kept alive by the local handle even when @@ -801,7 +814,7 @@ template class Persistent // NOLINT * handle and may deallocate it. The behavior of accessing a handle * for which the handle scope has been deleted is undefined. */ -class V8EXPORT HandleScope { +class V8_EXPORT HandleScope { public: // TODO(svenpanne) Deprecate me when Chrome is fixed! HandleScope(); @@ -840,7 +853,7 @@ class V8EXPORT HandleScope { // This Data class is accessible internally as HandleScopeData through a // typedef in the ImplementationUtilities class. - class V8EXPORT Data { + class V8_EXPORT Data { public: internal::Object** next; internal::Object** limit; @@ -873,7 +886,7 @@ class V8EXPORT HandleScope { /** * The superclass of values and API object templates. */ -class V8EXPORT Data { +class V8_EXPORT Data { private: Data(); }; @@ -885,7 +898,7 @@ class V8EXPORT Data { * compiling it, and can be stored between compilations. When script * data is given to the compile method compilation will be faster. */ -class V8EXPORT ScriptData { // NOLINT +class V8_EXPORT ScriptData { // NOLINT public: virtual ~ScriptData() { } @@ -942,24 +955,28 @@ class ScriptOrigin { V8_INLINE(ScriptOrigin( Handle resource_name, Handle resource_line_offset = Handle(), - Handle resource_column_offset = Handle())) + Handle resource_column_offset = Handle(), + Handle resource_is_shared_cross_origin = Handle())) : resource_name_(resource_name), resource_line_offset_(resource_line_offset), - resource_column_offset_(resource_column_offset) { } + resource_column_offset_(resource_column_offset), + resource_is_shared_cross_origin_(resource_is_shared_cross_origin) { } V8_INLINE(Handle ResourceName() const); V8_INLINE(Handle ResourceLineOffset() const); V8_INLINE(Handle ResourceColumnOffset() const); + V8_INLINE(Handle ResourceIsSharedCrossOrigin() const); private: Handle resource_name_; Handle resource_line_offset_; Handle resource_column_offset_; + Handle resource_is_shared_cross_origin_; }; /** * A compiled JavaScript script. */ -class V8EXPORT Script { +class V8_EXPORT Script { public: /** * Compiles the specified script (context-independent). @@ -1077,7 +1094,7 @@ class V8EXPORT Script { /** * An error message. */ -class V8EXPORT Message { +class V8_EXPORT Message { public: Local Get() const; Local GetSourceLine() const; @@ -1130,6 +1147,12 @@ class V8EXPORT Message { */ int GetEndColumn() const; + /** + * Passes on the value set by the embedder when it fed the script from which + * this Message was generated to V8. + */ + bool IsSharedCrossOrigin() const; + // TODO(1245381): Print to a string instead of on a FILE. static void PrintCurrentStackTrace(FILE* out); @@ -1143,7 +1166,7 @@ class V8EXPORT Message { * snapshot of the execution stack and the information remains valid after * execution continues. */ -class V8EXPORT StackTrace { +class V8_EXPORT StackTrace { public: /** * Flags that determine what information is placed captured for each @@ -1192,7 +1215,7 @@ class V8EXPORT StackTrace { /** * A single JavaScript stack frame. */ -class V8EXPORT StackFrame { +class V8_EXPORT StackFrame { public: /** * Returns the number, 1-based, of the line for the associate function call. @@ -1244,13 +1267,29 @@ class V8EXPORT StackFrame { }; +/** + * A JSON Parser. + */ +class V8_EXPORT JSON { + public: + /** + * Tries to parse the string |json_string| and returns it as object if + * successful. + * + * \param json_string The string to parse. + * \return The corresponding object if successfully parsed. + */ + static Local Parse(Local json_string); +}; + + // --- Value --- /** * The superclass of all JavaScript values and objects. */ -class V8EXPORT Value : public Data { +class V8_EXPORT Value : public Data { public: /** * Returns true if this value is the undefined value. See ECMA-262 @@ -1481,14 +1520,14 @@ class V8EXPORT Value : public Data { /** * The superclass of primitive values. See ECMA-262 4.3.2. */ -class V8EXPORT Primitive : public Value { }; +class V8_EXPORT Primitive : public Value { }; /** * A primitive boolean value (ECMA-262, 4.3.14). Either the true * or false value. */ -class V8EXPORT Boolean : public Primitive { +class V8_EXPORT Boolean : public Primitive { public: bool Value() const; V8_INLINE(static Handle New(bool value)); @@ -1498,7 +1537,7 @@ class V8EXPORT Boolean : public Primitive { /** * A JavaScript string value (ECMA-262, 4.3.17). */ -class V8EXPORT String : public Primitive { +class V8_EXPORT String : public Primitive { public: enum Encoding { UNKNOWN_ENCODING = 0x1, @@ -1604,7 +1643,7 @@ class V8EXPORT String : public Primitive { */ bool IsExternalAscii() const; - class V8EXPORT ExternalStringResourceBase { // NOLINT + class V8_EXPORT ExternalStringResourceBase { // NOLINT public: virtual ~ExternalStringResourceBase() {} @@ -1633,7 +1672,7 @@ class V8EXPORT String : public Primitive { * ExternalStringResource to manage the life cycle of the underlying * buffer. Note that the string data must be immutable. */ - class V8EXPORT ExternalStringResource + class V8_EXPORT ExternalStringResource : public ExternalStringResourceBase { public: /** @@ -1667,7 +1706,7 @@ class V8EXPORT String : public Primitive { * Use String::New or convert to 16 bit data for non-ASCII. */ - class V8EXPORT ExternalAsciiStringResource + class V8_EXPORT ExternalAsciiStringResource : public ExternalStringResourceBase { public: /** @@ -1820,7 +1859,7 @@ class V8EXPORT String : public Primitive { * then the length() method returns 0 and the * operator returns * NULL. */ - class V8EXPORT Utf8Value { + class V8_EXPORT Utf8Value { public: explicit Utf8Value(Handle obj); ~Utf8Value(); @@ -1843,7 +1882,7 @@ class V8EXPORT String : public Primitive { * method of the object) then the length() method returns 0 and the * operator * returns NULL. */ - class V8EXPORT AsciiValue { + class V8_EXPORT AsciiValue { public: // TODO(dcarney): deprecate explicit AsciiValue(Handle obj); @@ -1866,7 +1905,7 @@ class V8EXPORT String : public Primitive { * method of the object) then the length() method returns 0 and the * operator * returns NULL. */ - class V8EXPORT Value { + class V8_EXPORT Value { public: explicit Value(Handle obj); ~Value(); @@ -1895,7 +1934,7 @@ class V8EXPORT String : public Primitive { * * This is an experimental feature. Use at your own risk. */ -class V8EXPORT Symbol : public Primitive { +class V8_EXPORT Symbol : public Primitive { public: // Returns the print name string of the symbol, or undefined if none. Local Name() const; @@ -1916,7 +1955,7 @@ class V8EXPORT Symbol : public Primitive { /** * A JavaScript number value (ECMA-262, 4.3.20) */ -class V8EXPORT Number : public Primitive { +class V8_EXPORT Number : public Primitive { public: double Value() const; static Local New(double value); @@ -1931,7 +1970,7 @@ class V8EXPORT Number : public Primitive { /** * A JavaScript value representing a signed integer. */ -class V8EXPORT Integer : public Number { +class V8_EXPORT Integer : public Number { public: static Local New(int32_t value); static Local NewFromUnsigned(uint32_t value); @@ -1948,7 +1987,7 @@ class V8EXPORT Integer : public Number { /** * A JavaScript value representing a 32-bit signed integer. */ -class V8EXPORT Int32 : public Integer { +class V8_EXPORT Int32 : public Integer { public: int32_t Value() const; private: @@ -1959,7 +1998,7 @@ class V8EXPORT Int32 : public Integer { /** * A JavaScript value representing a 32-bit unsigned integer. */ -class V8EXPORT Uint32 : public Integer { +class V8_EXPORT Uint32 : public Integer { public: uint32_t Value() const; private: @@ -2031,7 +2070,7 @@ enum AccessControl { /** * A JavaScript object (ECMA-262, 4.3.3) */ -class V8EXPORT Object : public Value { +class V8_EXPORT Object : public Value { public: bool Set(Handle key, Handle value, @@ -2303,7 +2342,7 @@ class V8EXPORT Object : public Value { /** * An instance of the built-in array constructor (ECMA-262, 15.4.2). */ -class V8EXPORT Array : public Object { +class V8_EXPORT Array : public Object { public: uint32_t Length() const; @@ -2329,7 +2368,7 @@ class V8EXPORT Array : public Object { /** * A JavaScript function object (ECMA-262, 15.3). */ -class V8EXPORT Function : public Object { +class V8_EXPORT Function : public Object { public: Local NewInstance() const; Local NewInstance(int argc, Handle argv[]) const; @@ -2385,7 +2424,7 @@ class V8EXPORT Function : public Object { * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5). * This API is experimental and may change significantly. */ -class V8EXPORT ArrayBuffer : public Object { +class V8_EXPORT ArrayBuffer : public Object { public: /** * Allocator that V8 uses to allocate |ArrayBuffer|'s memory. @@ -2394,19 +2433,41 @@ class V8EXPORT ArrayBuffer : public Object { * * This API is experimental and may change significantly. */ - class V8EXPORT Allocator { // NOLINT + class V8_EXPORT Allocator { // NOLINT public: virtual ~Allocator() {} /** * Allocate |length| bytes. Return NULL if allocation is not successful. + * Memory should be initialized to zeroes. */ virtual void* Allocate(size_t length) = 0; + /** - * Free the memory pointed to |data|. That memory is guaranteed to be - * previously allocated by |Allocate|. + * Allocate |length| bytes. Return NULL if allocation is not successful. + * Memory does not have to be initialized. */ - virtual void Free(void* data) = 0; + virtual void* AllocateUninitialized(size_t length) { + // Override with call to |Allocate| for compatibility + // with legacy version. + return Allocate(length); + } + + /** + * Free the memory block of size |length|, pointed to by |data|. + * That memory is guaranteed to be previously allocated by |Allocate|. + */ + virtual void Free(void* data, size_t length) { + // Override with call to |Free(void*)| for compatibility + // with legacy version. + Free(data); + } + + /** + * Deprecated. Never called directly by V8. + * For compatibility with legacy version of this interface. + */ + virtual void Free(void* data); }; /** @@ -2419,7 +2480,7 @@ class V8EXPORT ArrayBuffer : public Object { * * This API is experimental and may change significantly. */ - class V8EXPORT Contents { // NOLINT + class V8_EXPORT Contents { // NOLINT public: Contents() : data_(NULL), byte_length_(0) {} @@ -2502,7 +2563,7 @@ class V8EXPORT ArrayBuffer : public Object { * * This API is experimental and may change significantly. */ -class V8EXPORT ArrayBufferView : public Object { +class V8_EXPORT ArrayBufferView : public Object { public: /** * Returns underlying ArrayBuffer. @@ -2537,7 +2598,7 @@ class V8EXPORT ArrayBufferView : public Object { * (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT TypedArray : public ArrayBufferView { +class V8_EXPORT TypedArray : public ArrayBufferView { public: /** * Number of elements in this typed array @@ -2557,7 +2618,7 @@ class V8EXPORT TypedArray : public ArrayBufferView { * An instance of Uint8Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Uint8Array : public TypedArray { +class V8_EXPORT Uint8Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2573,7 +2634,7 @@ class V8EXPORT Uint8Array : public TypedArray { * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Uint8ClampedArray : public TypedArray { +class V8_EXPORT Uint8ClampedArray : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2588,7 +2649,7 @@ class V8EXPORT Uint8ClampedArray : public TypedArray { * An instance of Int8Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Int8Array : public TypedArray { +class V8_EXPORT Int8Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2604,7 +2665,7 @@ class V8EXPORT Int8Array : public TypedArray { * An instance of Uint16Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Uint16Array : public TypedArray { +class V8_EXPORT Uint16Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2620,7 +2681,7 @@ class V8EXPORT Uint16Array : public TypedArray { * An instance of Int16Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Int16Array : public TypedArray { +class V8_EXPORT Int16Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2636,7 +2697,7 @@ class V8EXPORT Int16Array : public TypedArray { * An instance of Uint32Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Uint32Array : public TypedArray { +class V8_EXPORT Uint32Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2652,7 +2713,7 @@ class V8EXPORT Uint32Array : public TypedArray { * An instance of Int32Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Int32Array : public TypedArray { +class V8_EXPORT Int32Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2668,7 +2729,7 @@ class V8EXPORT Int32Array : public TypedArray { * An instance of Float32Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Float32Array : public TypedArray { +class V8_EXPORT Float32Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2684,7 +2745,7 @@ class V8EXPORT Float32Array : public TypedArray { * An instance of Float64Array constructor (ES6 draft 15.13.6). * This API is experimental and may change significantly. */ -class V8EXPORT Float64Array : public TypedArray { +class V8_EXPORT Float64Array : public TypedArray { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2700,7 +2761,7 @@ class V8EXPORT Float64Array : public TypedArray { * An instance of DataView constructor (ES6 draft 15.13.7). * This API is experimental and may change significantly. */ -class V8EXPORT DataView : public ArrayBufferView { +class V8_EXPORT DataView : public ArrayBufferView { public: static Local New(Handle array_buffer, size_t byte_offset, size_t length); @@ -2715,7 +2776,7 @@ class V8EXPORT DataView : public ArrayBufferView { /** * An instance of the built-in Date constructor (ECMA-262, 15.9). */ -class V8EXPORT Date : public Object { +class V8_EXPORT Date : public Object { public: static Local New(double time); @@ -2753,7 +2814,7 @@ class V8EXPORT Date : public Object { /** * A Number object (ECMA-262, 4.3.21). */ -class V8EXPORT NumberObject : public Object { +class V8_EXPORT NumberObject : public Object { public: static Local New(double value); @@ -2776,7 +2837,7 @@ class V8EXPORT NumberObject : public Object { /** * A Boolean object (ECMA-262, 4.3.15). */ -class V8EXPORT BooleanObject : public Object { +class V8_EXPORT BooleanObject : public Object { public: static Local New(bool value); @@ -2799,7 +2860,7 @@ class V8EXPORT BooleanObject : public Object { /** * A String object (ECMA-262, 4.3.18). */ -class V8EXPORT StringObject : public Object { +class V8_EXPORT StringObject : public Object { public: static Local New(Handle value); @@ -2824,7 +2885,7 @@ class V8EXPORT StringObject : public Object { * * This is an experimental feature. Use at your own risk. */ -class V8EXPORT SymbolObject : public Object { +class V8_EXPORT SymbolObject : public Object { public: static Local New(Isolate* isolate, Handle value); @@ -2847,7 +2908,7 @@ class V8EXPORT SymbolObject : public Object { /** * An instance of the built-in RegExp constructor (ECMA-262, 15.10). */ -class V8EXPORT RegExp : public Object { +class V8_EXPORT RegExp : public Object { public: /** * Regular expression flag bits. They can be or'ed to enable a set @@ -2894,7 +2955,7 @@ class V8EXPORT RegExp : public Object { * A JavaScript value that wraps a C++ void*. This type of value is mainly used * to associate C++ data structures with JavaScript objects. */ -class V8EXPORT External : public Value { +class V8_EXPORT External : public Value { public: static Local New(void* value); V8_INLINE(static External* Cast(Value* obj)); @@ -2910,7 +2971,7 @@ class V8EXPORT External : public Value { /** * The superclass of object and function templates. */ -class V8EXPORT Template : public Data { +class V8_EXPORT Template : public Data { public: /** Adds a property to each instance created by this template.*/ void Set(Handle name, Handle value, @@ -2998,7 +3059,7 @@ class FunctionCallbackInfo { }; -class V8EXPORT Arguments : public FunctionCallbackInfo { +class V8_EXPORT Arguments : public FunctionCallbackInfo { private: friend class internal::FunctionCallbackArguments; V8_INLINE(Arguments(internal::Object** implicit_args, @@ -3039,7 +3100,7 @@ class PropertyCallbackInfo { }; -class V8EXPORT AccessorInfo : public PropertyCallbackInfo { +class V8_EXPORT AccessorInfo : public PropertyCallbackInfo { private: friend class internal::PropertyCallbackArguments; V8_INLINE(AccessorInfo(internal::Object** args)) @@ -3287,7 +3348,7 @@ typedef bool (*IndexedSecurityCallback)(Local host, * child_instance.instance_property == 3; * \endcode */ -class V8EXPORT FunctionTemplate : public Template { +class V8_EXPORT FunctionTemplate : public Template { public: /** Creates a function template.*/ V8_DEPRECATED(static Local New( @@ -3378,7 +3439,7 @@ class V8EXPORT FunctionTemplate : public Template { * Properties added to an ObjectTemplate are added to each object * created from the ObjectTemplate. */ -class V8EXPORT ObjectTemplate : public Template { +class V8_EXPORT ObjectTemplate : public Template { public: /** Creates an ObjectTemplate. */ static Local New(); @@ -3564,7 +3625,7 @@ class V8EXPORT ObjectTemplate : public Template { * A Signature specifies which receivers and arguments are valid * parameters to a function. */ -class V8EXPORT Signature : public Data { +class V8_EXPORT Signature : public Data { public: static Local New(Handle receiver = Handle(), @@ -3579,7 +3640,7 @@ class V8EXPORT Signature : public Data { * An AccessorSignature specifies which receivers are valid parameters * to an accessor callback. */ -class V8EXPORT AccessorSignature : public Data { +class V8_EXPORT AccessorSignature : public Data { public: static Local New(Handle receiver = Handle()); @@ -3588,13 +3649,13 @@ class V8EXPORT AccessorSignature : public Data { }; -class V8EXPORT DeclaredAccessorDescriptor : public Data { +class V8_EXPORT DeclaredAccessorDescriptor : public Data { private: DeclaredAccessorDescriptor(); }; -class V8EXPORT ObjectOperationDescriptor : public Data { +class V8_EXPORT ObjectOperationDescriptor : public Data { public: // This function is not yet stable and should not be used at this time. static Local NewInternalFieldDereference( @@ -3614,7 +3675,7 @@ enum DeclaredAccessorDescriptorDataType { }; -class V8EXPORT RawOperationDescriptor : public Data { +class V8_EXPORT RawOperationDescriptor : public Data { public: Local NewHandleDereference(Isolate* isolate); Local NewRawDereference(Isolate* isolate); @@ -3647,7 +3708,7 @@ class V8EXPORT RawOperationDescriptor : public Data { * A utility for determining the type of objects based on the template * they were constructed from. */ -class V8EXPORT TypeSwitch : public Data { +class V8_EXPORT TypeSwitch : public Data { public: static Local New(Handle type); static Local New(int argc, Handle types[]); @@ -3659,7 +3720,7 @@ class V8EXPORT TypeSwitch : public Data { // --- Extensions --- -class V8EXPORT ExternalAsciiStringResourceImpl +class V8_EXPORT ExternalAsciiStringResourceImpl : public String::ExternalAsciiStringResource { public: ExternalAsciiStringResourceImpl() : data_(0), length_(0) {} @@ -3676,7 +3737,7 @@ class V8EXPORT ExternalAsciiStringResourceImpl /** * Ignore */ -class V8EXPORT Extension { // NOLINT +class V8_EXPORT Extension { // NOLINT public: // Note that the strings passed into this constructor must live as long // as the Extension itself. @@ -3714,13 +3775,13 @@ class V8EXPORT Extension { // NOLINT }; -void V8EXPORT RegisterExtension(Extension* extension); +void V8_EXPORT RegisterExtension(Extension* extension); /** * Ignore */ -class V8EXPORT DeclareExtension { +class V8_EXPORT DeclareExtension { public: V8_INLINE(DeclareExtension(Extension* extension)) { RegisterExtension(extension); @@ -3731,10 +3792,10 @@ class V8EXPORT DeclareExtension { // --- Statics --- -Handle V8EXPORT Undefined(); -Handle V8EXPORT Null(); -Handle V8EXPORT True(); -Handle V8EXPORT False(); +Handle V8_EXPORT Undefined(); +Handle V8_EXPORT Null(); +Handle V8_EXPORT True(); +Handle V8_EXPORT False(); V8_INLINE(Handle Undefined(Isolate* isolate)); V8_INLINE(Handle Null(Isolate* isolate)); @@ -3751,7 +3812,7 @@ V8_INLINE(Handle False(Isolate* isolate)); * setting the stack limit and you must set a non-default stack limit separately * for each thread. */ -class V8EXPORT ResourceConstraints { +class V8_EXPORT ResourceConstraints { public: ResourceConstraints(); int max_young_space_size() const { return max_young_space_size_; } @@ -3771,7 +3832,7 @@ class V8EXPORT ResourceConstraints { }; -bool V8EXPORT SetResourceConstraints(ResourceConstraints* constraints); +bool V8_EXPORT SetResourceConstraints(ResourceConstraints* constraints); // --- Exceptions --- @@ -3789,13 +3850,13 @@ typedef void (*MessageCallback)(Handle message, Handle error); * operation; the caller must return immediately and only after the exception * has been handled does it become legal to invoke JavaScript operations. */ -Handle V8EXPORT ThrowException(Handle exception); +Handle V8_EXPORT ThrowException(Handle exception); /** * Create new error objects by calling the corresponding error object * constructor with the message. */ -class V8EXPORT Exception { +class V8_EXPORT Exception { public: static Local RangeError(Handle message); static Local ReferenceError(Handle message); @@ -3889,7 +3950,7 @@ typedef void (*GCCallback)(); * Instances of this class can be passed to v8::V8::HeapStatistics to * get heap statistics from V8. */ -class V8EXPORT HeapStatistics { +class V8_EXPORT HeapStatistics { public: HeapStatistics(); size_t total_heap_size() { return total_heap_size_; } @@ -3921,13 +3982,13 @@ class RetainedObjectInfo; * threads. An isolate can be entered by at most one thread at any * given time. The Locker/Unlocker API must be used to synchronize. */ -class V8EXPORT Isolate { +class V8_EXPORT Isolate { public: /** * Stack-allocated class which sets the isolate for all operations * executed within a local scope. */ - class V8EXPORT Scope { + class V8_EXPORT Scope { public: explicit Scope(Isolate* isolate) : isolate_(isolate) { isolate->Enter(); @@ -4075,7 +4136,7 @@ class V8EXPORT Isolate { }; -class V8EXPORT StartupData { +class V8_EXPORT StartupData { public: enum CompressionAlgorithm { kUncompressed, @@ -4096,7 +4157,7 @@ class V8EXPORT StartupData { * * For an example of the class usage, see the "shell.cc" sample application. */ -class V8EXPORT StartupDataDecompressor { // NOLINT +class V8_EXPORT StartupDataDecompressor { // NOLINT public: StartupDataDecompressor(); virtual ~StartupDataDecompressor(); @@ -4240,7 +4301,7 @@ typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); /** * Interface for iterating through all external resources in the heap. */ -class V8EXPORT ExternalResourceVisitor { // NOLINT +class V8_EXPORT ExternalResourceVisitor { // NOLINT public: virtual ~ExternalResourceVisitor() {} virtual void VisitExternalString(Handle string) {} @@ -4250,7 +4311,7 @@ class V8EXPORT ExternalResourceVisitor { // NOLINT /** * Interface for iterating through all the persistent handles in the heap. */ -class V8EXPORT PersistentHandleVisitor { // NOLINT +class V8_EXPORT PersistentHandleVisitor { // NOLINT public: virtual ~PersistentHandleVisitor() {} virtual void VisitPersistentHandle(Persistent* value, @@ -4263,7 +4324,7 @@ class V8EXPORT PersistentHandleVisitor { // NOLINT * to be modified. Useful when otherwise unsafe handle operations need to * be performed. */ -class V8EXPORT AssertNoGCScope { +class V8_EXPORT AssertNoGCScope { #ifndef DEBUG // TODO(yangguo): remove isolate argument. V8_INLINE(AssertNoGCScope(Isolate* isolate)) { } @@ -4279,7 +4340,7 @@ class V8EXPORT AssertNoGCScope { /** * Container class for static utility functions. */ -class V8EXPORT V8 { +class V8_EXPORT V8 { public: /** Set the callback to invoke in case of fatal errors. */ static void SetFatalErrorHandler(FatalErrorCallback that); @@ -4736,6 +4797,9 @@ class V8EXPORT V8 { void* data, RevivableCallback weak_reference_callback); static void ClearWeak(internal::Object** global_handle); + static int Eternalize(internal::Isolate* isolate, + internal::Object** handle); + static internal::Object** GetEternal(internal::Isolate* isolate, int index); template friend class Handle; template friend class Local; @@ -4747,7 +4811,7 @@ class V8EXPORT V8 { /** * An external exception handler. */ -class V8EXPORT TryCatch { +class V8_EXPORT TryCatch { public: /** * Creates a new try/catch block and registers it with v8. Note that @@ -4880,7 +4944,7 @@ class V8EXPORT TryCatch { /** * Ignore */ -class V8EXPORT ExtensionConfiguration { +class V8_EXPORT ExtensionConfiguration { public: ExtensionConfiguration(int name_count, const char* names[]) : name_count_(name_count), names_(names) { } @@ -4895,7 +4959,7 @@ class V8EXPORT ExtensionConfiguration { * A sandboxed execution context with its own set of built-in objects * and functions. */ -class V8EXPORT Context { +class V8_EXPORT Context { public: /** * Returns the global proxy object or global object itself for @@ -5180,7 +5244,7 @@ class V8EXPORT Context { * // V8 Now no longer locked. * \endcode */ -class V8EXPORT Unlocker { +class V8_EXPORT Unlocker { public: /** * Initialize Unlocker for a given Isolate. @@ -5198,7 +5262,7 @@ class V8EXPORT Unlocker { }; -class V8EXPORT Locker { +class V8_EXPORT Locker { public: /** * Initialize Locker for a given Isolate. @@ -5259,7 +5323,7 @@ struct HeapStatsUpdate; /** * An interface for exporting data from V8, using "push" model. */ -class V8EXPORT OutputStream { // NOLINT +class V8_EXPORT OutputStream { // NOLINT public: enum OutputEncoding { kAscii = 0 // 7-bit ASCII. @@ -5296,7 +5360,7 @@ class V8EXPORT OutputStream { // NOLINT * An interface for reporting progress and controlling long-running * activities. */ -class V8EXPORT ActivityControl { // NOLINT +class V8_EXPORT ActivityControl { // NOLINT public: enum ControlOption { kContinue = 0, @@ -5419,12 +5483,13 @@ class Internals { static const int kNullValueRootIndex = 7; static const int kTrueValueRootIndex = 8; static const int kFalseValueRootIndex = 9; - static const int kEmptyStringRootIndex = 134; + static const int kEmptyStringRootIndex = 133; static const int kNodeClassIdOffset = 1 * kApiPointerSize; static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3; static const int kNodeStateMask = 0xf; static const int kNodeStateIsWeakValue = 2; + static const int kNodeStateIsPendingValue = 3; static const int kNodeStateIsNearDeathValue = 4; static const int kNodeIsIndependentShift = 4; static const int kNodeIsPartiallyDependentShift = 5; @@ -5598,6 +5663,21 @@ Local Local::New(Isolate* isolate, T* that) { } +template +int Local::Eternalize(Isolate* isolate) { + return V8::Eternalize(reinterpret_cast(isolate), + reinterpret_cast(this->val_)); +} + + +template +Local Local::GetEternal(Isolate* isolate, int index) { + internal::Object** handle = + V8::GetEternal(reinterpret_cast(isolate), index); + return Local(T::Cast(reinterpret_cast(handle))); +} + + #ifdef V8_USE_UNSAFE_HANDLES template Persistent Persistent::New(Handle that) { @@ -5640,8 +5720,10 @@ template bool Persistent::IsNearDeath() const { typedef internal::Internals I; if (this->IsEmpty()) return false; - return I::GetNodeState(reinterpret_cast(this->val_)) == - I::kNodeStateIsNearDeathValue; + uint8_t node_state = + I::GetNodeState(reinterpret_cast(this->val_)); + return node_state == I::kNodeStateIsNearDeathValue || + node_state == I::kNodeStateIsPendingValue; } @@ -5996,6 +6078,10 @@ Handle ScriptOrigin::ResourceColumnOffset() const { return resource_column_offset_; } +Handle ScriptOrigin::ResourceIsSharedCrossOrigin() const { + return resource_is_shared_cross_origin_; +} + Handle Boolean::New(bool value) { return value ? True() : False(); @@ -6503,7 +6589,6 @@ void* Context::GetAlignedPointerFromEmbedderData(int index) { } // namespace v8 -#undef V8EXPORT #undef TYPE_CHECK diff --git a/deps/v8/src/api.cc b/deps/v8/src/api.cc index d587b81..e04fbef 100644 --- a/deps/v8/src/api.cc +++ b/deps/v8/src/api.cc @@ -46,6 +46,7 @@ #include "heap-profiler.h" #include "heap-snapshot-generator-inl.h" #include "icu_util.h" +#include "json-parser.h" #include "messages.h" #ifdef COMPRESS_STARTUP_DATA_BZ2 #include "natives.h" @@ -398,7 +399,7 @@ enum CompressedStartupDataItems { kSnapshotContext, kLibraries, kExperimentalLibraries, -#if defined(ENABLE_I18N_SUPPORT) +#if defined(V8_I18N_SUPPORT) kI18NExtension, #endif kCompressedStartupDataCount @@ -442,7 +443,7 @@ void V8::GetCompressedStartupData(StartupData* compressed_data) { compressed_data[kExperimentalLibraries].raw_size = i::ExperimentalNatives::GetRawScriptsSize(); -#if defined(ENABLE_I18N_SUPPORT) +#if defined(V8_I18N_SUPPORT) i::Vector i18n_extension_source = i::I18NNatives::GetScriptsSource(); compressed_data[kI18NExtension].data = @@ -482,7 +483,7 @@ void V8::SetDecompressedStartupData(StartupData* decompressed_data) { decompressed_data[kExperimentalLibraries].raw_size); i::ExperimentalNatives::SetRawScriptsSource(exp_libraries_source); -#if defined(ENABLE_I18N_SUPPORT) +#if defined(V8_I18N_SUPPORT) ASSERT_EQ(i::I18NNatives::GetRawScriptsSize(), decompressed_data[kI18NExtension].raw_size); i::Vector i18n_extension_source( @@ -675,6 +676,16 @@ void V8::DisposeGlobal(i::Object** obj) { } +int V8::Eternalize(i::Isolate* isolate, i::Object** handle) { + return isolate->eternal_handles()->Create(isolate, *handle); +} + + +i::Object** V8::GetEternal(i::Isolate* isolate, int index) { + return isolate->eternal_handles()->Get(index).location(); +} + + // --- H a n d l e s --- @@ -1918,6 +1929,7 @@ Local