libv8 3.11.8.17 → 3.16.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/Gemfile +1 -1
- data/Rakefile +6 -7
- data/lib/libv8/version.rb +1 -1
- data/vendor/v8/.gitignore +24 -3
- data/vendor/v8/AUTHORS +7 -0
- data/vendor/v8/ChangeLog +839 -0
- data/vendor/v8/DEPS +1 -1
- data/vendor/v8/Makefile.android +92 -0
- data/vendor/v8/OWNERS +11 -0
- data/vendor/v8/PRESUBMIT.py +71 -0
- data/vendor/v8/SConstruct +34 -39
- data/vendor/v8/build/android.gypi +56 -37
- data/vendor/v8/build/common.gypi +112 -30
- data/vendor/v8/build/gyp_v8 +1 -1
- data/vendor/v8/build/standalone.gypi +15 -11
- data/vendor/v8/include/v8-debug.h +9 -1
- data/vendor/v8/include/v8-preparser.h +4 -3
- data/vendor/v8/include/v8-profiler.h +25 -25
- data/vendor/v8/include/v8-testing.h +4 -3
- data/vendor/v8/include/v8.h +994 -540
- data/vendor/v8/preparser/preparser-process.cc +3 -3
- data/vendor/v8/samples/lineprocessor.cc +20 -27
- data/vendor/v8/samples/process.cc +18 -14
- data/vendor/v8/samples/shell.cc +16 -15
- data/vendor/v8/src/SConscript +15 -14
- data/vendor/v8/src/accessors.cc +169 -77
- data/vendor/v8/src/accessors.h +4 -0
- data/vendor/v8/src/allocation-inl.h +2 -2
- data/vendor/v8/src/allocation.h +7 -7
- data/vendor/v8/src/api.cc +810 -497
- data/vendor/v8/src/api.h +85 -60
- data/vendor/v8/src/arm/assembler-arm-inl.h +179 -22
- data/vendor/v8/src/arm/assembler-arm.cc +633 -264
- data/vendor/v8/src/arm/assembler-arm.h +264 -197
- data/vendor/v8/src/arm/builtins-arm.cc +117 -27
- data/vendor/v8/src/arm/code-stubs-arm.cc +1241 -700
- data/vendor/v8/src/arm/code-stubs-arm.h +35 -138
- data/vendor/v8/src/arm/codegen-arm.cc +285 -16
- data/vendor/v8/src/arm/codegen-arm.h +22 -0
- data/vendor/v8/src/arm/constants-arm.cc +5 -3
- data/vendor/v8/src/arm/constants-arm.h +24 -11
- data/vendor/v8/src/arm/debug-arm.cc +3 -3
- data/vendor/v8/src/arm/deoptimizer-arm.cc +382 -92
- data/vendor/v8/src/arm/disasm-arm.cc +61 -12
- data/vendor/v8/src/arm/frames-arm.h +0 -14
- data/vendor/v8/src/arm/full-codegen-arm.cc +332 -304
- data/vendor/v8/src/arm/ic-arm.cc +180 -259
- data/vendor/v8/src/arm/lithium-arm.cc +364 -316
- data/vendor/v8/src/arm/lithium-arm.h +512 -275
- data/vendor/v8/src/arm/lithium-codegen-arm.cc +1768 -809
- data/vendor/v8/src/arm/lithium-codegen-arm.h +97 -35
- data/vendor/v8/src/arm/lithium-gap-resolver-arm.cc +12 -5
- data/vendor/v8/src/arm/macro-assembler-arm.cc +439 -228
- data/vendor/v8/src/arm/macro-assembler-arm.h +116 -70
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +54 -44
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +3 -10
- data/vendor/v8/src/arm/simulator-arm.cc +272 -238
- data/vendor/v8/src/arm/simulator-arm.h +38 -8
- data/vendor/v8/src/arm/stub-cache-arm.cc +522 -895
- data/vendor/v8/src/array.js +101 -70
- data/vendor/v8/src/assembler.cc +270 -19
- data/vendor/v8/src/assembler.h +110 -15
- data/vendor/v8/src/ast.cc +79 -69
- data/vendor/v8/src/ast.h +255 -301
- data/vendor/v8/src/atomicops.h +7 -1
- data/vendor/v8/src/atomicops_internals_tsan.h +335 -0
- data/vendor/v8/src/bootstrapper.cc +481 -418
- data/vendor/v8/src/bootstrapper.h +4 -4
- data/vendor/v8/src/builtins.cc +498 -311
- data/vendor/v8/src/builtins.h +75 -47
- data/vendor/v8/src/checks.cc +2 -1
- data/vendor/v8/src/checks.h +8 -0
- data/vendor/v8/src/code-stubs-hydrogen.cc +253 -0
- data/vendor/v8/src/code-stubs.cc +249 -84
- data/vendor/v8/src/code-stubs.h +501 -169
- data/vendor/v8/src/codegen.cc +36 -18
- data/vendor/v8/src/codegen.h +25 -3
- data/vendor/v8/src/collection.js +54 -17
- data/vendor/v8/src/compilation-cache.cc +24 -16
- data/vendor/v8/src/compilation-cache.h +15 -6
- data/vendor/v8/src/compiler.cc +497 -195
- data/vendor/v8/src/compiler.h +246 -38
- data/vendor/v8/src/contexts.cc +64 -24
- data/vendor/v8/src/contexts.h +60 -29
- data/vendor/v8/src/conversions-inl.h +24 -14
- data/vendor/v8/src/conversions.h +7 -4
- data/vendor/v8/src/counters.cc +21 -12
- data/vendor/v8/src/counters.h +44 -16
- data/vendor/v8/src/cpu-profiler.h +1 -1
- data/vendor/v8/src/d8-debug.cc +2 -2
- data/vendor/v8/src/d8-readline.cc +13 -2
- data/vendor/v8/src/d8.cc +681 -273
- data/vendor/v8/src/d8.gyp +4 -4
- data/vendor/v8/src/d8.h +38 -18
- data/vendor/v8/src/d8.js +0 -617
- data/vendor/v8/src/data-flow.h +55 -0
- data/vendor/v8/src/date.js +1 -42
- data/vendor/v8/src/dateparser-inl.h +5 -1
- data/vendor/v8/src/debug-agent.cc +10 -15
- data/vendor/v8/src/debug-debugger.js +147 -149
- data/vendor/v8/src/debug.cc +323 -164
- data/vendor/v8/src/debug.h +26 -14
- data/vendor/v8/src/deoptimizer.cc +765 -290
- data/vendor/v8/src/deoptimizer.h +130 -28
- data/vendor/v8/src/disassembler.cc +10 -4
- data/vendor/v8/src/elements-kind.cc +7 -2
- data/vendor/v8/src/elements-kind.h +19 -0
- data/vendor/v8/src/elements.cc +607 -285
- data/vendor/v8/src/elements.h +36 -13
- data/vendor/v8/src/execution.cc +52 -31
- data/vendor/v8/src/execution.h +4 -4
- data/vendor/v8/src/extensions/externalize-string-extension.cc +5 -4
- data/vendor/v8/src/extensions/gc-extension.cc +5 -1
- data/vendor/v8/src/extensions/statistics-extension.cc +153 -0
- data/vendor/v8/src/{inspector.h → extensions/statistics-extension.h} +12 -23
- data/vendor/v8/src/factory.cc +101 -134
- data/vendor/v8/src/factory.h +36 -31
- data/vendor/v8/src/flag-definitions.h +102 -25
- data/vendor/v8/src/flags.cc +9 -5
- data/vendor/v8/src/frames-inl.h +10 -0
- data/vendor/v8/src/frames.cc +116 -26
- data/vendor/v8/src/frames.h +96 -12
- data/vendor/v8/src/full-codegen.cc +219 -74
- data/vendor/v8/src/full-codegen.h +63 -21
- data/vendor/v8/src/func-name-inferrer.cc +8 -7
- data/vendor/v8/src/func-name-inferrer.h +5 -3
- data/vendor/v8/src/gdb-jit.cc +71 -57
- data/vendor/v8/src/global-handles.cc +230 -101
- data/vendor/v8/src/global-handles.h +26 -27
- data/vendor/v8/src/globals.h +17 -19
- data/vendor/v8/src/handles-inl.h +59 -12
- data/vendor/v8/src/handles.cc +180 -200
- data/vendor/v8/src/handles.h +80 -11
- data/vendor/v8/src/hashmap.h +60 -40
- data/vendor/v8/src/heap-inl.h +107 -45
- data/vendor/v8/src/heap-profiler.cc +38 -19
- data/vendor/v8/src/heap-profiler.h +24 -14
- data/vendor/v8/src/heap.cc +1123 -738
- data/vendor/v8/src/heap.h +385 -146
- data/vendor/v8/src/hydrogen-instructions.cc +700 -217
- data/vendor/v8/src/hydrogen-instructions.h +1158 -472
- data/vendor/v8/src/hydrogen.cc +3319 -1662
- data/vendor/v8/src/hydrogen.h +411 -170
- data/vendor/v8/src/ia32/assembler-ia32-inl.h +46 -16
- data/vendor/v8/src/ia32/assembler-ia32.cc +131 -61
- data/vendor/v8/src/ia32/assembler-ia32.h +115 -57
- data/vendor/v8/src/ia32/builtins-ia32.cc +99 -5
- data/vendor/v8/src/ia32/code-stubs-ia32.cc +787 -495
- data/vendor/v8/src/ia32/code-stubs-ia32.h +10 -100
- data/vendor/v8/src/ia32/codegen-ia32.cc +227 -23
- data/vendor/v8/src/ia32/codegen-ia32.h +14 -0
- data/vendor/v8/src/ia32/deoptimizer-ia32.cc +428 -87
- data/vendor/v8/src/ia32/disasm-ia32.cc +28 -1
- data/vendor/v8/src/ia32/frames-ia32.h +6 -16
- data/vendor/v8/src/ia32/full-codegen-ia32.cc +280 -272
- data/vendor/v8/src/ia32/ic-ia32.cc +150 -250
- data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +1600 -517
- data/vendor/v8/src/ia32/lithium-codegen-ia32.h +90 -24
- data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.cc +10 -6
- data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.h +2 -2
- data/vendor/v8/src/ia32/lithium-ia32.cc +405 -302
- data/vendor/v8/src/ia32/lithium-ia32.h +526 -271
- data/vendor/v8/src/ia32/macro-assembler-ia32.cc +378 -119
- data/vendor/v8/src/ia32/macro-assembler-ia32.h +62 -28
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +43 -30
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +2 -10
- data/vendor/v8/src/ia32/stub-cache-ia32.cc +492 -678
- data/vendor/v8/src/ic-inl.h +9 -4
- data/vendor/v8/src/ic.cc +836 -923
- data/vendor/v8/src/ic.h +228 -247
- data/vendor/v8/src/incremental-marking-inl.h +26 -30
- data/vendor/v8/src/incremental-marking.cc +276 -248
- data/vendor/v8/src/incremental-marking.h +29 -37
- data/vendor/v8/src/interface.cc +34 -25
- data/vendor/v8/src/interface.h +69 -25
- data/vendor/v8/src/interpreter-irregexp.cc +2 -2
- data/vendor/v8/src/isolate.cc +382 -76
- data/vendor/v8/src/isolate.h +109 -56
- data/vendor/v8/src/json-parser.h +217 -104
- data/vendor/v8/src/json-stringifier.h +745 -0
- data/vendor/v8/src/json.js +10 -132
- data/vendor/v8/src/jsregexp-inl.h +106 -0
- data/vendor/v8/src/jsregexp.cc +517 -285
- data/vendor/v8/src/jsregexp.h +145 -117
- data/vendor/v8/src/list-inl.h +35 -22
- data/vendor/v8/src/list.h +46 -19
- data/vendor/v8/src/lithium-allocator-inl.h +22 -2
- data/vendor/v8/src/lithium-allocator.cc +85 -70
- data/vendor/v8/src/lithium-allocator.h +21 -39
- data/vendor/v8/src/lithium.cc +259 -5
- data/vendor/v8/src/lithium.h +131 -32
- data/vendor/v8/src/liveedit-debugger.js +52 -3
- data/vendor/v8/src/liveedit.cc +393 -113
- data/vendor/v8/src/liveedit.h +7 -3
- data/vendor/v8/src/log-utils.cc +4 -2
- data/vendor/v8/src/log.cc +170 -140
- data/vendor/v8/src/log.h +62 -11
- data/vendor/v8/src/macro-assembler.h +17 -0
- data/vendor/v8/src/macros.py +2 -0
- data/vendor/v8/src/mark-compact-inl.h +3 -23
- data/vendor/v8/src/mark-compact.cc +801 -830
- data/vendor/v8/src/mark-compact.h +154 -47
- data/vendor/v8/src/marking-thread.cc +85 -0
- data/vendor/v8/src/{inspector.cc → marking-thread.h} +32 -24
- data/vendor/v8/src/math.js +12 -18
- data/vendor/v8/src/messages.cc +18 -8
- data/vendor/v8/src/messages.js +314 -261
- data/vendor/v8/src/mips/assembler-mips-inl.h +58 -6
- data/vendor/v8/src/mips/assembler-mips.cc +92 -75
- data/vendor/v8/src/mips/assembler-mips.h +54 -60
- data/vendor/v8/src/mips/builtins-mips.cc +116 -17
- data/vendor/v8/src/mips/code-stubs-mips.cc +919 -556
- data/vendor/v8/src/mips/code-stubs-mips.h +22 -131
- data/vendor/v8/src/mips/codegen-mips.cc +281 -6
- data/vendor/v8/src/mips/codegen-mips.h +22 -0
- data/vendor/v8/src/mips/constants-mips.cc +2 -0
- data/vendor/v8/src/mips/constants-mips.h +12 -2
- data/vendor/v8/src/mips/deoptimizer-mips.cc +286 -50
- data/vendor/v8/src/mips/disasm-mips.cc +13 -0
- data/vendor/v8/src/mips/full-codegen-mips.cc +297 -284
- data/vendor/v8/src/mips/ic-mips.cc +182 -263
- data/vendor/v8/src/mips/lithium-codegen-mips.cc +1208 -556
- data/vendor/v8/src/mips/lithium-codegen-mips.h +72 -19
- data/vendor/v8/src/mips/lithium-gap-resolver-mips.cc +9 -2
- data/vendor/v8/src/mips/lithium-mips.cc +290 -302
- data/vendor/v8/src/mips/lithium-mips.h +463 -266
- data/vendor/v8/src/mips/macro-assembler-mips.cc +208 -115
- data/vendor/v8/src/mips/macro-assembler-mips.h +67 -24
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +40 -25
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +3 -9
- data/vendor/v8/src/mips/simulator-mips.cc +112 -40
- data/vendor/v8/src/mips/simulator-mips.h +5 -0
- data/vendor/v8/src/mips/stub-cache-mips.cc +502 -884
- data/vendor/v8/src/mirror-debugger.js +157 -30
- data/vendor/v8/src/mksnapshot.cc +88 -14
- data/vendor/v8/src/object-observe.js +235 -0
- data/vendor/v8/src/objects-debug.cc +178 -176
- data/vendor/v8/src/objects-inl.h +1333 -486
- data/vendor/v8/src/objects-printer.cc +125 -43
- data/vendor/v8/src/objects-visiting-inl.h +578 -6
- data/vendor/v8/src/objects-visiting.cc +2 -2
- data/vendor/v8/src/objects-visiting.h +172 -79
- data/vendor/v8/src/objects.cc +3533 -2885
- data/vendor/v8/src/objects.h +1352 -1131
- data/vendor/v8/src/optimizing-compiler-thread.cc +152 -0
- data/vendor/v8/src/optimizing-compiler-thread.h +111 -0
- data/vendor/v8/src/parser.cc +390 -500
- data/vendor/v8/src/parser.h +45 -33
- data/vendor/v8/src/platform-cygwin.cc +10 -21
- data/vendor/v8/src/platform-freebsd.cc +36 -41
- data/vendor/v8/src/platform-linux.cc +160 -124
- data/vendor/v8/src/platform-macos.cc +30 -27
- data/vendor/v8/src/platform-nullos.cc +17 -1
- data/vendor/v8/src/platform-openbsd.cc +19 -50
- data/vendor/v8/src/platform-posix.cc +14 -0
- data/vendor/v8/src/platform-solaris.cc +20 -53
- data/vendor/v8/src/platform-win32.cc +49 -26
- data/vendor/v8/src/platform.h +40 -1
- data/vendor/v8/src/preparser.cc +8 -5
- data/vendor/v8/src/preparser.h +2 -2
- data/vendor/v8/src/prettyprinter.cc +16 -0
- data/vendor/v8/src/prettyprinter.h +2 -0
- data/vendor/v8/src/profile-generator-inl.h +1 -0
- data/vendor/v8/src/profile-generator.cc +209 -147
- data/vendor/v8/src/profile-generator.h +15 -12
- data/vendor/v8/src/property-details.h +46 -31
- data/vendor/v8/src/property.cc +27 -46
- data/vendor/v8/src/property.h +163 -83
- data/vendor/v8/src/proxy.js +7 -2
- data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +4 -13
- data/vendor/v8/src/regexp-macro-assembler-irregexp.h +1 -2
- data/vendor/v8/src/regexp-macro-assembler-tracer.cc +1 -11
- data/vendor/v8/src/regexp-macro-assembler-tracer.h +0 -1
- data/vendor/v8/src/regexp-macro-assembler.cc +31 -14
- data/vendor/v8/src/regexp-macro-assembler.h +14 -11
- data/vendor/v8/src/regexp-stack.cc +1 -0
- data/vendor/v8/src/regexp.js +9 -8
- data/vendor/v8/src/rewriter.cc +18 -7
- data/vendor/v8/src/runtime-profiler.cc +52 -43
- data/vendor/v8/src/runtime-profiler.h +0 -25
- data/vendor/v8/src/runtime.cc +2006 -2023
- data/vendor/v8/src/runtime.h +56 -49
- data/vendor/v8/src/safepoint-table.cc +12 -18
- data/vendor/v8/src/safepoint-table.h +11 -8
- data/vendor/v8/src/scanner.cc +1 -0
- data/vendor/v8/src/scanner.h +4 -10
- data/vendor/v8/src/scopeinfo.cc +35 -9
- data/vendor/v8/src/scopeinfo.h +64 -3
- data/vendor/v8/src/scopes.cc +251 -156
- data/vendor/v8/src/scopes.h +61 -27
- data/vendor/v8/src/serialize.cc +348 -396
- data/vendor/v8/src/serialize.h +125 -114
- data/vendor/v8/src/small-pointer-list.h +11 -11
- data/vendor/v8/src/{smart-array-pointer.h → smart-pointers.h} +64 -15
- data/vendor/v8/src/snapshot-common.cc +64 -15
- data/vendor/v8/src/snapshot-empty.cc +7 -1
- data/vendor/v8/src/snapshot.h +9 -2
- data/vendor/v8/src/spaces-inl.h +17 -0
- data/vendor/v8/src/spaces.cc +477 -183
- data/vendor/v8/src/spaces.h +238 -58
- data/vendor/v8/src/splay-tree-inl.h +8 -7
- data/vendor/v8/src/splay-tree.h +24 -10
- data/vendor/v8/src/store-buffer.cc +12 -5
- data/vendor/v8/src/store-buffer.h +2 -4
- data/vendor/v8/src/string-search.h +22 -6
- data/vendor/v8/src/string-stream.cc +11 -8
- data/vendor/v8/src/string.js +47 -15
- data/vendor/v8/src/stub-cache.cc +461 -224
- data/vendor/v8/src/stub-cache.h +164 -102
- data/vendor/v8/src/sweeper-thread.cc +105 -0
- data/vendor/v8/src/sweeper-thread.h +81 -0
- data/vendor/v8/src/token.h +1 -0
- data/vendor/v8/src/transitions-inl.h +220 -0
- data/vendor/v8/src/transitions.cc +160 -0
- data/vendor/v8/src/transitions.h +207 -0
- data/vendor/v8/src/type-info.cc +182 -181
- data/vendor/v8/src/type-info.h +31 -19
- data/vendor/v8/src/unicode-inl.h +62 -106
- data/vendor/v8/src/unicode.cc +57 -67
- data/vendor/v8/src/unicode.h +45 -91
- data/vendor/v8/src/uri.js +57 -29
- data/vendor/v8/src/utils.h +105 -5
- data/vendor/v8/src/v8-counters.cc +54 -11
- data/vendor/v8/src/v8-counters.h +134 -19
- data/vendor/v8/src/v8.cc +29 -29
- data/vendor/v8/src/v8.h +1 -0
- data/vendor/v8/src/v8conversions.cc +26 -22
- data/vendor/v8/src/v8globals.h +56 -43
- data/vendor/v8/src/v8natives.js +83 -30
- data/vendor/v8/src/v8threads.cc +42 -21
- data/vendor/v8/src/v8threads.h +4 -1
- data/vendor/v8/src/v8utils.cc +9 -93
- data/vendor/v8/src/v8utils.h +37 -33
- data/vendor/v8/src/variables.cc +6 -3
- data/vendor/v8/src/variables.h +6 -13
- data/vendor/v8/src/version.cc +2 -2
- data/vendor/v8/src/vm-state-inl.h +11 -0
- data/vendor/v8/src/x64/assembler-x64-inl.h +39 -8
- data/vendor/v8/src/x64/assembler-x64.cc +78 -64
- data/vendor/v8/src/x64/assembler-x64.h +38 -33
- data/vendor/v8/src/x64/builtins-x64.cc +105 -7
- data/vendor/v8/src/x64/code-stubs-x64.cc +790 -413
- data/vendor/v8/src/x64/code-stubs-x64.h +10 -106
- data/vendor/v8/src/x64/codegen-x64.cc +210 -8
- data/vendor/v8/src/x64/codegen-x64.h +20 -1
- data/vendor/v8/src/x64/deoptimizer-x64.cc +336 -75
- data/vendor/v8/src/x64/disasm-x64.cc +15 -0
- data/vendor/v8/src/x64/frames-x64.h +0 -14
- data/vendor/v8/src/x64/full-codegen-x64.cc +293 -270
- data/vendor/v8/src/x64/ic-x64.cc +153 -251
- data/vendor/v8/src/x64/lithium-codegen-x64.cc +1379 -531
- data/vendor/v8/src/x64/lithium-codegen-x64.h +67 -23
- data/vendor/v8/src/x64/lithium-gap-resolver-x64.cc +2 -2
- data/vendor/v8/src/x64/lithium-x64.cc +349 -289
- data/vendor/v8/src/x64/lithium-x64.h +460 -250
- data/vendor/v8/src/x64/macro-assembler-x64.cc +350 -177
- data/vendor/v8/src/x64/macro-assembler-x64.h +67 -49
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +46 -33
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +2 -3
- data/vendor/v8/src/x64/stub-cache-x64.cc +484 -653
- data/vendor/v8/src/zone-inl.h +9 -27
- data/vendor/v8/src/zone.cc +5 -5
- data/vendor/v8/src/zone.h +53 -27
- data/vendor/v8/test/benchmarks/testcfg.py +5 -0
- data/vendor/v8/test/cctest/cctest.cc +4 -0
- data/vendor/v8/test/cctest/cctest.gyp +3 -1
- data/vendor/v8/test/cctest/cctest.h +57 -9
- data/vendor/v8/test/cctest/cctest.status +15 -15
- data/vendor/v8/test/cctest/test-accessors.cc +26 -0
- data/vendor/v8/test/cctest/test-alloc.cc +22 -30
- data/vendor/v8/test/cctest/test-api.cc +1943 -314
- data/vendor/v8/test/cctest/test-assembler-arm.cc +133 -13
- data/vendor/v8/test/cctest/test-assembler-ia32.cc +1 -1
- data/vendor/v8/test/cctest/test-assembler-mips.cc +12 -0
- data/vendor/v8/test/cctest/test-ast.cc +4 -2
- data/vendor/v8/test/cctest/test-compiler.cc +61 -29
- data/vendor/v8/test/cctest/test-dataflow.cc +2 -2
- data/vendor/v8/test/cctest/test-debug.cc +212 -33
- data/vendor/v8/test/cctest/test-decls.cc +257 -11
- data/vendor/v8/test/cctest/test-dictionary.cc +24 -10
- data/vendor/v8/test/cctest/test-disasm-arm.cc +118 -1
- data/vendor/v8/test/cctest/test-disasm-ia32.cc +3 -2
- data/vendor/v8/test/cctest/test-flags.cc +14 -1
- data/vendor/v8/test/cctest/test-func-name-inference.cc +7 -4
- data/vendor/v8/test/cctest/test-global-object.cc +51 -0
- data/vendor/v8/test/cctest/test-hashing.cc +32 -23
- data/vendor/v8/test/cctest/test-heap-profiler.cc +131 -77
- data/vendor/v8/test/cctest/test-heap.cc +1084 -143
- data/vendor/v8/test/cctest/test-list.cc +1 -1
- data/vendor/v8/test/cctest/test-liveedit.cc +3 -2
- data/vendor/v8/test/cctest/test-lockers.cc +12 -13
- data/vendor/v8/test/cctest/test-log.cc +10 -8
- data/vendor/v8/test/cctest/test-macro-assembler-x64.cc +2 -2
- data/vendor/v8/test/cctest/test-mark-compact.cc +44 -22
- data/vendor/v8/test/cctest/test-object-observe.cc +434 -0
- data/vendor/v8/test/cctest/test-parsing.cc +86 -39
- data/vendor/v8/test/cctest/test-platform-linux.cc +6 -0
- data/vendor/v8/test/cctest/test-platform-win32.cc +7 -0
- data/vendor/v8/test/cctest/test-random.cc +5 -4
- data/vendor/v8/test/cctest/test-regexp.cc +137 -101
- data/vendor/v8/test/cctest/test-serialize.cc +150 -230
- data/vendor/v8/test/cctest/test-sockets.cc +1 -1
- data/vendor/v8/test/cctest/test-spaces.cc +139 -0
- data/vendor/v8/test/cctest/test-strings.cc +736 -74
- data/vendor/v8/test/cctest/test-thread-termination.cc +10 -11
- data/vendor/v8/test/cctest/test-threads.cc +4 -4
- data/vendor/v8/test/cctest/test-utils.cc +16 -0
- data/vendor/v8/test/cctest/test-weakmaps.cc +7 -3
- data/vendor/v8/test/cctest/testcfg.py +64 -5
- data/vendor/v8/test/es5conform/testcfg.py +5 -0
- data/vendor/v8/test/message/message.status +1 -1
- data/vendor/v8/test/message/overwritten-builtins.out +3 -0
- data/vendor/v8/test/message/testcfg.py +89 -8
- data/vendor/v8/test/message/try-catch-finally-no-message.out +26 -26
- data/vendor/v8/test/mjsunit/accessor-map-sharing.js +18 -2
- data/vendor/v8/test/mjsunit/allocation-site-info.js +126 -0
- data/vendor/v8/test/mjsunit/array-bounds-check-removal.js +62 -1
- data/vendor/v8/test/mjsunit/array-iteration.js +1 -1
- data/vendor/v8/test/mjsunit/array-literal-transitions.js +2 -0
- data/vendor/v8/test/mjsunit/array-natives-elements.js +317 -0
- data/vendor/v8/test/mjsunit/array-reduce.js +8 -8
- data/vendor/v8/test/mjsunit/array-slice.js +12 -0
- data/vendor/v8/test/mjsunit/array-store-and-grow.js +4 -1
- data/vendor/v8/test/mjsunit/assert-opt-and-deopt.js +1 -1
- data/vendor/v8/test/mjsunit/bugs/bug-2337.js +53 -0
- data/vendor/v8/test/mjsunit/compare-known-objects-slow.js +69 -0
- data/vendor/v8/test/mjsunit/compiler/alloc-object-huge.js +3 -1
- data/vendor/v8/test/mjsunit/compiler/inline-accessors.js +368 -0
- data/vendor/v8/test/mjsunit/compiler/inline-arguments.js +87 -1
- data/vendor/v8/test/mjsunit/compiler/inline-closures.js +49 -0
- data/vendor/v8/test/mjsunit/compiler/inline-construct.js +55 -43
- data/vendor/v8/test/mjsunit/compiler/inline-literals.js +39 -0
- data/vendor/v8/test/mjsunit/compiler/multiply-add.js +69 -0
- data/vendor/v8/test/mjsunit/compiler/optimized-closures.js +57 -0
- data/vendor/v8/test/mjsunit/compiler/parallel-proto-change.js +44 -0
- data/vendor/v8/test/mjsunit/compiler/property-static.js +69 -0
- data/vendor/v8/test/mjsunit/compiler/proto-chain-constant.js +55 -0
- data/vendor/v8/test/mjsunit/compiler/proto-chain-load.js +44 -0
- data/vendor/v8/test/mjsunit/compiler/regress-gvn.js +3 -2
- data/vendor/v8/test/mjsunit/compiler/regress-or.js +6 -2
- data/vendor/v8/test/mjsunit/compiler/rotate.js +224 -0
- data/vendor/v8/test/mjsunit/compiler/uint32.js +173 -0
- data/vendor/v8/test/mjsunit/count-based-osr.js +2 -1
- data/vendor/v8/test/mjsunit/d8-os.js +3 -3
- data/vendor/v8/test/mjsunit/date-parse.js +3 -0
- data/vendor/v8/test/mjsunit/date.js +22 -0
- data/vendor/v8/test/mjsunit/debug-break-inline.js +1 -0
- data/vendor/v8/test/mjsunit/debug-evaluate-locals-optimized-double.js +22 -12
- data/vendor/v8/test/mjsunit/debug-evaluate-locals-optimized.js +21 -10
- data/vendor/v8/test/mjsunit/debug-liveedit-compile-error.js +60 -0
- data/vendor/v8/test/mjsunit/debug-liveedit-double-call.js +142 -0
- data/vendor/v8/test/mjsunit/debug-liveedit-literals.js +94 -0
- data/vendor/v8/test/mjsunit/debug-liveedit-restart-frame.js +153 -0
- data/vendor/v8/test/mjsunit/debug-multiple-breakpoints.js +1 -1
- data/vendor/v8/test/mjsunit/debug-script-breakpoints-closure.js +67 -0
- data/vendor/v8/test/mjsunit/debug-script-breakpoints-nested.js +82 -0
- data/vendor/v8/test/mjsunit/debug-script.js +4 -2
- data/vendor/v8/test/mjsunit/debug-set-variable-value.js +308 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part1.js +190 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part2.js +83 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part3.js +80 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part4.js +80 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part5.js +77 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part6.js +79 -0
- data/vendor/v8/test/mjsunit/debug-stepout-scope-part7.js +79 -0
- data/vendor/v8/test/mjsunit/{debug-stepout-scope.js → debug-stepout-scope-part8.js} +0 -189
- data/vendor/v8/test/mjsunit/delete-non-configurable.js +74 -0
- data/vendor/v8/test/mjsunit/deopt-minus-zero.js +56 -0
- data/vendor/v8/test/mjsunit/elements-kind.js +6 -4
- data/vendor/v8/test/mjsunit/elements-length-no-holey.js +33 -0
- data/vendor/v8/test/mjsunit/elements-transition-hoisting.js +46 -19
- data/vendor/v8/test/mjsunit/error-accessors.js +54 -0
- data/vendor/v8/test/mjsunit/error-constructors.js +1 -14
- data/vendor/v8/test/mjsunit/error-tostring.js +8 -0
- data/vendor/v8/test/mjsunit/eval-stack-trace.js +204 -0
- data/vendor/v8/test/mjsunit/external-array.js +364 -1
- data/vendor/v8/test/mjsunit/fast-array-length.js +37 -0
- data/vendor/v8/test/mjsunit/fast-non-keyed.js +113 -0
- data/vendor/v8/test/mjsunit/fast-prototype.js +117 -0
- data/vendor/v8/test/mjsunit/function-call.js +14 -18
- data/vendor/v8/test/mjsunit/fuzz-natives-part1.js +230 -0
- data/vendor/v8/test/mjsunit/fuzz-natives-part2.js +229 -0
- data/vendor/v8/test/mjsunit/fuzz-natives-part3.js +229 -0
- data/vendor/v8/test/mjsunit/{fuzz-natives.js → fuzz-natives-part4.js} +12 -2
- data/vendor/v8/test/mjsunit/generated-transition-stub.js +218 -0
- data/vendor/v8/test/mjsunit/greedy.js +1 -1
- data/vendor/v8/test/mjsunit/harmony/block-conflicts.js +2 -1
- data/vendor/v8/test/mjsunit/harmony/block-let-crankshaft.js +1 -1
- data/vendor/v8/test/mjsunit/harmony/collections.js +69 -11
- data/vendor/v8/test/mjsunit/harmony/debug-blockscopes.js +2 -2
- data/vendor/v8/test/mjsunit/harmony/module-linking.js +180 -3
- data/vendor/v8/test/mjsunit/harmony/module-parsing.js +31 -0
- data/vendor/v8/test/mjsunit/harmony/module-recompile.js +87 -0
- data/vendor/v8/test/mjsunit/harmony/module-resolution.js +15 -2
- data/vendor/v8/test/mjsunit/harmony/object-observe.js +1056 -0
- data/vendor/v8/test/mjsunit/harmony/proxies-json.js +178 -0
- data/vendor/v8/test/mjsunit/harmony/proxies.js +25 -10
- data/vendor/v8/test/mjsunit/json-parser-recursive.js +33 -0
- data/vendor/v8/test/mjsunit/json-stringify-recursive.js +52 -0
- data/vendor/v8/test/mjsunit/json.js +38 -2
- data/vendor/v8/test/mjsunit/json2.js +153 -0
- data/vendor/v8/test/mjsunit/limit-locals.js +5 -4
- data/vendor/v8/test/mjsunit/manual-parallel-recompile.js +79 -0
- data/vendor/v8/test/mjsunit/math-exp-precision.js +64 -0
- data/vendor/v8/test/mjsunit/math-floor-negative.js +59 -0
- data/vendor/v8/test/mjsunit/math-floor-of-div-minus-zero.js +41 -0
- data/vendor/v8/test/mjsunit/math-floor-of-div-nosudiv.js +288 -0
- data/vendor/v8/test/mjsunit/math-floor-of-div.js +81 -9
- data/vendor/v8/test/mjsunit/{math-floor.js → math-floor-part1.js} +1 -72
- data/vendor/v8/test/mjsunit/math-floor-part2.js +76 -0
- data/vendor/v8/test/mjsunit/math-floor-part3.js +78 -0
- data/vendor/v8/test/mjsunit/math-floor-part4.js +76 -0
- data/vendor/v8/test/mjsunit/mirror-object.js +43 -9
- data/vendor/v8/test/mjsunit/mjsunit.js +1 -1
- data/vendor/v8/test/mjsunit/mjsunit.status +52 -27
- data/vendor/v8/test/mjsunit/mul-exhaustive-part1.js +491 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part10.js +470 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part2.js +525 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part3.js +532 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part4.js +509 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part5.js +505 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part6.js +554 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part7.js +497 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part8.js +526 -0
- data/vendor/v8/test/mjsunit/mul-exhaustive-part9.js +533 -0
- data/vendor/v8/test/mjsunit/new-function.js +34 -0
- data/vendor/v8/test/mjsunit/numops-fuzz-part1.js +1172 -0
- data/vendor/v8/test/mjsunit/numops-fuzz-part2.js +1178 -0
- data/vendor/v8/test/mjsunit/numops-fuzz-part3.js +1178 -0
- data/vendor/v8/test/mjsunit/numops-fuzz-part4.js +1177 -0
- data/vendor/v8/test/mjsunit/object-define-property.js +107 -2
- data/vendor/v8/test/mjsunit/override-read-only-property.js +6 -4
- data/vendor/v8/test/mjsunit/packed-elements.js +2 -2
- data/vendor/v8/test/mjsunit/parse-int-float.js +4 -4
- data/vendor/v8/test/mjsunit/pixel-array-rounding.js +1 -1
- data/vendor/v8/test/mjsunit/readonly.js +228 -0
- data/vendor/v8/test/mjsunit/regexp-capture-3.js +16 -18
- data/vendor/v8/test/mjsunit/regexp-capture.js +2 -0
- data/vendor/v8/test/mjsunit/regexp-global.js +122 -0
- data/vendor/v8/test/mjsunit/regexp-results-cache.js +78 -0
- data/vendor/v8/test/mjsunit/regress/regress-1117.js +12 -3
- data/vendor/v8/test/mjsunit/regress/regress-1118.js +1 -1
- data/vendor/v8/test/mjsunit/regress/regress-115100.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-1199637.js +1 -3
- data/vendor/v8/test/mjsunit/regress/regress-121407.js +1 -1
- data/vendor/v8/test/mjsunit/regress/regress-131923.js +30 -0
- data/vendor/v8/test/mjsunit/regress/regress-131994.js +70 -0
- data/vendor/v8/test/mjsunit/regress/regress-133211.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-133211b.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-136048.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-137768.js +73 -0
- data/vendor/v8/test/mjsunit/regress/regress-143967.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-145201.js +107 -0
- data/vendor/v8/test/mjsunit/regress/regress-147497.js +45 -0
- data/vendor/v8/test/mjsunit/regress/regress-148378.js +38 -0
- data/vendor/v8/test/mjsunit/regress/regress-1563.js +1 -1
- data/vendor/v8/test/mjsunit/regress/regress-1591.js +48 -0
- data/vendor/v8/test/mjsunit/regress/regress-164442.js +45 -0
- data/vendor/v8/test/mjsunit/regress/regress-165637.js +61 -0
- data/vendor/v8/test/mjsunit/regress/regress-166379.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-166553.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-1692.js +1 -1
- data/vendor/v8/test/mjsunit/regress/regress-171641.js +40 -0
- data/vendor/v8/test/mjsunit/regress/regress-1980.js +1 -1
- data/vendor/v8/test/mjsunit/regress/regress-2073.js +99 -0
- data/vendor/v8/test/mjsunit/regress/regress-2119.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-2156.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-2163.js +70 -0
- data/vendor/v8/test/mjsunit/regress/regress-2170.js +58 -0
- data/vendor/v8/test/mjsunit/regress/regress-2172.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-2185-2.js +145 -0
- data/vendor/v8/test/mjsunit/regress/regress-2185.js +38 -0
- data/vendor/v8/test/mjsunit/regress/regress-2186.js +49 -0
- data/vendor/v8/test/mjsunit/regress/regress-2193.js +58 -0
- data/vendor/v8/test/mjsunit/regress/regress-2219.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-2225.js +65 -0
- data/vendor/v8/test/mjsunit/regress/regress-2226.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-2234.js +41 -0
- data/vendor/v8/test/mjsunit/regress/regress-2243.js +31 -0
- data/vendor/v8/test/mjsunit/regress/regress-2249.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-2250.js +68 -0
- data/vendor/v8/test/mjsunit/regress/regress-2261.js +113 -0
- data/vendor/v8/test/mjsunit/regress/regress-2263.js +30 -0
- data/vendor/v8/test/mjsunit/regress/regress-2284.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-2285.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-2286.js +32 -0
- data/vendor/v8/test/mjsunit/regress/regress-2289.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-2291.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-2294.js +70 -0
- data/vendor/v8/test/mjsunit/regress/regress-2296.js +40 -0
- data/vendor/v8/test/mjsunit/regress/regress-2315.js +40 -0
- data/vendor/v8/test/mjsunit/regress/regress-2318.js +66 -0
- data/vendor/v8/test/mjsunit/regress/regress-2322.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-2326.js +54 -0
- data/vendor/v8/test/mjsunit/regress/regress-2336.js +53 -0
- data/vendor/v8/test/mjsunit/regress/regress-2339.js +59 -0
- data/vendor/v8/test/mjsunit/regress/regress-2346.js +123 -0
- data/vendor/v8/test/mjsunit/regress/regress-2373.js +29 -0
- data/vendor/v8/test/mjsunit/regress/regress-2374.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-2398.js +41 -0
- data/vendor/v8/test/mjsunit/regress/regress-2410.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-2416.js +75 -0
- data/vendor/v8/test/mjsunit/regress/regress-2419.js +37 -0
- data/vendor/v8/test/mjsunit/regress/regress-2433.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-2437.js +156 -0
- data/vendor/v8/test/mjsunit/regress/regress-2438.js +52 -0
- data/vendor/v8/test/mjsunit/regress/regress-2443.js +129 -0
- data/vendor/v8/test/mjsunit/regress/regress-2444.js +120 -0
- data/vendor/v8/test/mjsunit/regress/regress-2489.js +50 -0
- data/vendor/v8/test/mjsunit/regress/regress-2499.js +40 -0
- data/vendor/v8/test/mjsunit/regress/regress-334.js +1 -1
- data/vendor/v8/test/mjsunit/regress/regress-492.js +39 -1
- data/vendor/v8/test/mjsunit/regress/regress-builtin-array-op.js +38 -0
- data/vendor/v8/test/mjsunit/regress/regress-cnlt-elements.js +43 -0
- data/vendor/v8/test/mjsunit/regress/regress-cnlt-enum-indices.js +45 -0
- data/vendor/v8/test/mjsunit/regress/regress-cntl-descriptors-enum.js +46 -0
- data/vendor/v8/test/mjsunit/regress/regress-convert-enum.js +60 -0
- data/vendor/v8/test/mjsunit/regress/regress-convert-enum2.js +46 -0
- data/vendor/v8/test/mjsunit/regress/regress-convert-transition.js +40 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-119926.js +3 -1
- data/vendor/v8/test/mjsunit/regress/regress-crbug-125148.js +90 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-134055.js +63 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-134609.js +59 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-135008.js +45 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-135066.js +55 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-137689.js +47 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-138887.js +48 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-140083.js +44 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-142087.js +38 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-142218.js +44 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-145961.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-146910.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-147475.js +48 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-148376.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-150545.js +53 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-150729.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-157019.js +54 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-157520.js +38 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-158185.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-160010.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-162085.js +71 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-168545.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-170856.js +33 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-172345.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-173974.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-crbug-18639.js +9 -5
- data/vendor/v8/test/mjsunit/regress/regress-debug-code-recompilation.js +2 -1
- data/vendor/v8/test/mjsunit/regress/regress-deep-proto.js +45 -0
- data/vendor/v8/test/mjsunit/regress/regress-delete-empty-double.js +40 -0
- data/vendor/v8/test/mjsunit/regress/regress-iteration-order.js +42 -0
- data/vendor/v8/test/mjsunit/regress/regress-json-stringify-gc.js +41 -0
- data/vendor/v8/test/mjsunit/regress/regress-latin-1.js +78 -0
- data/vendor/v8/test/mjsunit/regress/regress-load-elements.js +49 -0
- data/vendor/v8/test/mjsunit/regress/regress-observe-empty-double-array.js +38 -0
- data/vendor/v8/test/mjsunit/regress/regress-undefined-store-keyed-fast-element.js +37 -0
- data/vendor/v8/test/mjsunit/shift-for-integer-div.js +59 -0
- data/vendor/v8/test/mjsunit/stack-traces-gc.js +119 -0
- data/vendor/v8/test/mjsunit/stack-traces-overflow.js +122 -0
- data/vendor/v8/test/mjsunit/stack-traces.js +39 -1
- data/vendor/v8/test/mjsunit/str-to-num.js +7 -2
- data/vendor/v8/test/mjsunit/strict-mode.js +36 -11
- data/vendor/v8/test/mjsunit/string-charcodeat.js +3 -0
- data/vendor/v8/test/mjsunit/string-natives.js +72 -0
- data/vendor/v8/test/mjsunit/string-split.js +17 -0
- data/vendor/v8/test/mjsunit/testcfg.py +76 -6
- data/vendor/v8/test/mjsunit/tools/tickprocessor.js +4 -1
- data/vendor/v8/test/mjsunit/try-finally-continue.js +72 -0
- data/vendor/v8/test/mjsunit/typed-array-slice.js +61 -0
- data/vendor/v8/test/mjsunit/unbox-double-arrays.js +2 -0
- data/vendor/v8/test/mjsunit/uri.js +12 -0
- data/vendor/v8/test/mjsunit/with-readonly.js +4 -2
- data/vendor/v8/test/mozilla/mozilla.status +19 -113
- data/vendor/v8/test/mozilla/testcfg.py +122 -3
- data/vendor/v8/test/preparser/preparser.status +5 -0
- data/vendor/v8/test/preparser/strict-identifiers.pyt +1 -1
- data/vendor/v8/test/preparser/testcfg.py +101 -5
- data/vendor/v8/test/sputnik/sputnik.status +1 -1
- data/vendor/v8/test/sputnik/testcfg.py +5 -0
- data/vendor/v8/test/test262/README +2 -2
- data/vendor/v8/test/test262/test262.status +13 -36
- data/vendor/v8/test/test262/testcfg.py +102 -8
- data/vendor/v8/tools/android-build.sh +0 -0
- data/vendor/v8/tools/android-ll-prof.sh +69 -0
- data/vendor/v8/tools/android-run.py +109 -0
- data/vendor/v8/tools/android-sync.sh +105 -0
- data/vendor/v8/tools/bash-completion.sh +0 -0
- data/vendor/v8/tools/check-static-initializers.sh +0 -0
- data/vendor/v8/tools/common-includes.sh +15 -22
- data/vendor/v8/tools/disasm.py +4 -4
- data/vendor/v8/tools/fuzz-harness.sh +0 -0
- data/vendor/v8/tools/gen-postmortem-metadata.py +6 -8
- data/vendor/v8/tools/grokdump.py +404 -129
- data/vendor/v8/tools/gyp/v8.gyp +105 -43
- data/vendor/v8/tools/linux-tick-processor +5 -5
- data/vendor/v8/tools/ll_prof.py +75 -15
- data/vendor/v8/tools/merge-to-branch.sh +2 -2
- data/vendor/v8/tools/plot-timer-events +70 -0
- data/vendor/v8/tools/plot-timer-events.js +510 -0
- data/vendor/v8/tools/presubmit.py +1 -0
- data/vendor/v8/tools/push-to-trunk.sh +14 -4
- data/vendor/v8/tools/run-llprof.sh +69 -0
- data/vendor/v8/tools/run-tests.py +372 -0
- data/vendor/v8/tools/run-valgrind.py +1 -1
- data/vendor/v8/tools/status-file-converter.py +39 -0
- data/vendor/v8/tools/test-server.py +224 -0
- data/vendor/v8/tools/test-wrapper-gypbuild.py +13 -16
- data/vendor/v8/tools/test.py +10 -19
- data/vendor/v8/tools/testrunner/README +174 -0
- data/vendor/v8/tools/testrunner/__init__.py +26 -0
- data/vendor/v8/tools/testrunner/local/__init__.py +26 -0
- data/vendor/v8/tools/testrunner/local/commands.py +153 -0
- data/vendor/v8/tools/testrunner/local/execution.py +182 -0
- data/vendor/v8/tools/testrunner/local/old_statusfile.py +460 -0
- data/vendor/v8/tools/testrunner/local/progress.py +238 -0
- data/vendor/v8/tools/testrunner/local/statusfile.py +145 -0
- data/vendor/v8/tools/testrunner/local/testsuite.py +187 -0
- data/vendor/v8/tools/testrunner/local/utils.py +108 -0
- data/vendor/v8/tools/testrunner/local/verbose.py +99 -0
- data/vendor/v8/tools/testrunner/network/__init__.py +26 -0
- data/vendor/v8/tools/testrunner/network/distro.py +90 -0
- data/vendor/v8/tools/testrunner/network/endpoint.py +124 -0
- data/vendor/v8/tools/testrunner/network/network_execution.py +253 -0
- data/vendor/v8/tools/testrunner/network/perfdata.py +120 -0
- data/vendor/v8/tools/testrunner/objects/__init__.py +26 -0
- data/vendor/v8/tools/testrunner/objects/context.py +50 -0
- data/vendor/v8/tools/testrunner/objects/output.py +60 -0
- data/vendor/v8/tools/testrunner/objects/peer.py +80 -0
- data/vendor/v8/tools/testrunner/objects/testcase.py +83 -0
- data/vendor/v8/tools/testrunner/objects/workpacket.py +90 -0
- data/vendor/v8/tools/testrunner/server/__init__.py +26 -0
- data/vendor/v8/tools/testrunner/server/compression.py +111 -0
- data/vendor/v8/tools/testrunner/server/constants.py +51 -0
- data/vendor/v8/tools/testrunner/server/daemon.py +147 -0
- data/vendor/v8/tools/testrunner/server/local_handler.py +119 -0
- data/vendor/v8/tools/testrunner/server/main.py +245 -0
- data/vendor/v8/tools/testrunner/server/presence_handler.py +120 -0
- data/vendor/v8/tools/testrunner/server/signatures.py +63 -0
- data/vendor/v8/tools/testrunner/server/status_handler.py +112 -0
- data/vendor/v8/tools/testrunner/server/work_handler.py +150 -0
- data/vendor/v8/tools/tick-processor.html +168 -0
- data/vendor/v8/tools/tickprocessor-driver.js +5 -3
- data/vendor/v8/tools/tickprocessor.js +58 -15
- metadata +534 -30
- data/patches/add-freebsd9-and-freebsd10-to-gyp-GetFlavor.patch +0 -11
- data/patches/do-not-imply-vfp3-and-armv7.patch +0 -44
- data/patches/fPIC-on-x64.patch +0 -14
- data/vendor/v8/src/liveobjectlist-inl.h +0 -126
- data/vendor/v8/src/liveobjectlist.cc +0 -2631
- data/vendor/v8/src/liveobjectlist.h +0 -319
- data/vendor/v8/test/mjsunit/mul-exhaustive.js +0 -4629
- data/vendor/v8/test/mjsunit/numops-fuzz.js +0 -4609
- data/vendor/v8/test/mjsunit/regress/regress-1969.js +0 -5045
@@ -0,0 +1,152 @@
|
|
1
|
+
// Copyright 2012 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#include "optimizing-compiler-thread.h"
|
29
|
+
|
30
|
+
#include "v8.h"
|
31
|
+
|
32
|
+
#include "hydrogen.h"
|
33
|
+
#include "isolate.h"
|
34
|
+
#include "v8threads.h"
|
35
|
+
|
36
|
+
namespace v8 {
|
37
|
+
namespace internal {
|
38
|
+
|
39
|
+
|
40
|
+
void OptimizingCompilerThread::Run() {
|
41
|
+
#ifdef DEBUG
|
42
|
+
thread_id_ = ThreadId::Current().ToInteger();
|
43
|
+
#endif
|
44
|
+
Isolate::SetIsolateThreadLocals(isolate_, NULL);
|
45
|
+
|
46
|
+
int64_t epoch = 0;
|
47
|
+
if (FLAG_trace_parallel_recompilation) epoch = OS::Ticks();
|
48
|
+
|
49
|
+
while (true) {
|
50
|
+
input_queue_semaphore_->Wait();
|
51
|
+
Logger::TimerEventScope timer(
|
52
|
+
isolate_, Logger::TimerEventScope::v8_recompile_parallel);
|
53
|
+
if (Acquire_Load(&stop_thread_)) {
|
54
|
+
stop_semaphore_->Signal();
|
55
|
+
if (FLAG_trace_parallel_recompilation) {
|
56
|
+
time_spent_total_ = OS::Ticks() - epoch;
|
57
|
+
}
|
58
|
+
return;
|
59
|
+
}
|
60
|
+
|
61
|
+
int64_t compiling_start = 0;
|
62
|
+
if (FLAG_trace_parallel_recompilation) compiling_start = OS::Ticks();
|
63
|
+
|
64
|
+
Heap::RelocationLock relocation_lock(isolate_->heap());
|
65
|
+
OptimizingCompiler* optimizing_compiler = NULL;
|
66
|
+
input_queue_.Dequeue(&optimizing_compiler);
|
67
|
+
Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(-1));
|
68
|
+
|
69
|
+
ASSERT(!optimizing_compiler->info()->closure()->IsOptimized());
|
70
|
+
|
71
|
+
OptimizingCompiler::Status status = optimizing_compiler->OptimizeGraph();
|
72
|
+
ASSERT(status != OptimizingCompiler::FAILED);
|
73
|
+
// Prevent an unused-variable error in release mode.
|
74
|
+
USE(status);
|
75
|
+
|
76
|
+
output_queue_.Enqueue(optimizing_compiler);
|
77
|
+
if (!FLAG_manual_parallel_recompilation) {
|
78
|
+
isolate_->stack_guard()->RequestCodeReadyEvent();
|
79
|
+
} else {
|
80
|
+
// In manual mode, do not trigger a code ready event.
|
81
|
+
// Instead, wait for the optimized functions to be installed manually.
|
82
|
+
output_queue_semaphore_->Signal();
|
83
|
+
}
|
84
|
+
|
85
|
+
if (FLAG_trace_parallel_recompilation) {
|
86
|
+
time_spent_compiling_ += OS::Ticks() - compiling_start;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
void OptimizingCompilerThread::Stop() {
|
93
|
+
Release_Store(&stop_thread_, static_cast<AtomicWord>(true));
|
94
|
+
input_queue_semaphore_->Signal();
|
95
|
+
stop_semaphore_->Wait();
|
96
|
+
|
97
|
+
if (FLAG_trace_parallel_recompilation) {
|
98
|
+
double compile_time = static_cast<double>(time_spent_compiling_);
|
99
|
+
double total_time = static_cast<double>(time_spent_total_);
|
100
|
+
double percentage = (compile_time * 100) / total_time;
|
101
|
+
PrintF(" ** Compiler thread did %.2f%% useful work\n", percentage);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
void OptimizingCompilerThread::InstallOptimizedFunctions() {
|
107
|
+
HandleScope handle_scope(isolate_);
|
108
|
+
int functions_installed = 0;
|
109
|
+
while (!output_queue_.IsEmpty()) {
|
110
|
+
if (FLAG_manual_parallel_recompilation) {
|
111
|
+
output_queue_semaphore_->Wait();
|
112
|
+
}
|
113
|
+
OptimizingCompiler* compiler = NULL;
|
114
|
+
output_queue_.Dequeue(&compiler);
|
115
|
+
Compiler::InstallOptimizedCode(compiler);
|
116
|
+
functions_installed++;
|
117
|
+
}
|
118
|
+
if (FLAG_trace_parallel_recompilation && functions_installed != 0) {
|
119
|
+
PrintF(" ** Installed %d function(s).\n", functions_installed);
|
120
|
+
}
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
Handle<SharedFunctionInfo>
|
125
|
+
OptimizingCompilerThread::InstallNextOptimizedFunction() {
|
126
|
+
ASSERT(FLAG_manual_parallel_recompilation);
|
127
|
+
output_queue_semaphore_->Wait();
|
128
|
+
OptimizingCompiler* compiler = NULL;
|
129
|
+
output_queue_.Dequeue(&compiler);
|
130
|
+
Handle<SharedFunctionInfo> shared = compiler->info()->shared_info();
|
131
|
+
Compiler::InstallOptimizedCode(compiler);
|
132
|
+
return shared;
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
void OptimizingCompilerThread::QueueForOptimization(
|
137
|
+
OptimizingCompiler* optimizing_compiler) {
|
138
|
+
ASSERT(IsQueueAvailable());
|
139
|
+
Barrier_AtomicIncrement(&queue_length_, static_cast<Atomic32>(1));
|
140
|
+
input_queue_.Enqueue(optimizing_compiler);
|
141
|
+
input_queue_semaphore_->Signal();
|
142
|
+
}
|
143
|
+
|
144
|
+
#ifdef DEBUG
|
145
|
+
bool OptimizingCompilerThread::IsOptimizerThread() {
|
146
|
+
if (!FLAG_parallel_recompilation) return false;
|
147
|
+
return ThreadId::Current().ToInteger() == thread_id_;
|
148
|
+
}
|
149
|
+
#endif
|
150
|
+
|
151
|
+
|
152
|
+
} } // namespace v8::internal
|
@@ -0,0 +1,111 @@
|
|
1
|
+
// Copyright 2012 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#ifndef V8_OPTIMIZING_COMPILER_THREAD_H_
|
29
|
+
#define V8_OPTIMIZING_COMPILER_THREAD_H_
|
30
|
+
|
31
|
+
#include "atomicops.h"
|
32
|
+
#include "flags.h"
|
33
|
+
#include "platform.h"
|
34
|
+
#include "unbound-queue.h"
|
35
|
+
|
36
|
+
namespace v8 {
|
37
|
+
namespace internal {
|
38
|
+
|
39
|
+
class HOptimizedGraphBuilder;
|
40
|
+
class OptimizingCompiler;
|
41
|
+
class SharedFunctionInfo;
|
42
|
+
|
43
|
+
class OptimizingCompilerThread : public Thread {
|
44
|
+
public:
|
45
|
+
explicit OptimizingCompilerThread(Isolate *isolate) :
|
46
|
+
Thread("OptimizingCompilerThread"),
|
47
|
+
#ifdef DEBUG
|
48
|
+
thread_id_(0),
|
49
|
+
#endif
|
50
|
+
isolate_(isolate),
|
51
|
+
stop_semaphore_(OS::CreateSemaphore(0)),
|
52
|
+
input_queue_semaphore_(OS::CreateSemaphore(0)),
|
53
|
+
output_queue_semaphore_(OS::CreateSemaphore(0)),
|
54
|
+
time_spent_compiling_(0),
|
55
|
+
time_spent_total_(0) {
|
56
|
+
NoBarrier_Store(&stop_thread_, static_cast<AtomicWord>(false));
|
57
|
+
NoBarrier_Store(&queue_length_, static_cast<AtomicWord>(0));
|
58
|
+
}
|
59
|
+
|
60
|
+
void Run();
|
61
|
+
void Stop();
|
62
|
+
void QueueForOptimization(OptimizingCompiler* optimizing_compiler);
|
63
|
+
void InstallOptimizedFunctions();
|
64
|
+
|
65
|
+
// Wait for the next optimized function and install it.
|
66
|
+
Handle<SharedFunctionInfo> InstallNextOptimizedFunction();
|
67
|
+
|
68
|
+
inline bool IsQueueAvailable() {
|
69
|
+
// We don't need a barrier since we have a data dependency right
|
70
|
+
// after.
|
71
|
+
Atomic32 current_length = NoBarrier_Load(&queue_length_);
|
72
|
+
|
73
|
+
// This can be queried only from the execution thread.
|
74
|
+
ASSERT(!IsOptimizerThread());
|
75
|
+
// Since only the execution thread increments queue_length_ and
|
76
|
+
// only one thread can run inside an Isolate at one time, a direct
|
77
|
+
// doesn't introduce a race -- queue_length_ may decreased in
|
78
|
+
// meantime, but not increased.
|
79
|
+
return (current_length < FLAG_parallel_recompilation_queue_length);
|
80
|
+
}
|
81
|
+
|
82
|
+
#ifdef DEBUG
|
83
|
+
bool IsOptimizerThread();
|
84
|
+
#endif
|
85
|
+
|
86
|
+
~OptimizingCompilerThread() {
|
87
|
+
delete output_queue_semaphore_; // Only used for manual mode.
|
88
|
+
delete input_queue_semaphore_;
|
89
|
+
delete stop_semaphore_;
|
90
|
+
}
|
91
|
+
|
92
|
+
private:
|
93
|
+
#ifdef DEBUG
|
94
|
+
int thread_id_;
|
95
|
+
#endif
|
96
|
+
|
97
|
+
Isolate* isolate_;
|
98
|
+
Semaphore* stop_semaphore_;
|
99
|
+
Semaphore* input_queue_semaphore_;
|
100
|
+
Semaphore* output_queue_semaphore_;
|
101
|
+
UnboundQueue<OptimizingCompiler*> input_queue_;
|
102
|
+
UnboundQueue<OptimizingCompiler*> output_queue_;
|
103
|
+
volatile AtomicWord stop_thread_;
|
104
|
+
volatile Atomic32 queue_length_;
|
105
|
+
int64_t time_spent_compiling_;
|
106
|
+
int64_t time_spent_total_;
|
107
|
+
};
|
108
|
+
|
109
|
+
} } // namespace v8::internal
|
110
|
+
|
111
|
+
#endif // V8_OPTIMIZING_COMPILER_THREAD_H_
|
data/vendor/v8/src/parser.cc
CHANGED
@@ -52,7 +52,10 @@ namespace internal {
|
|
52
52
|
class PositionStack {
|
53
53
|
public:
|
54
54
|
explicit PositionStack(bool* ok) : top_(NULL), ok_(ok) {}
|
55
|
-
~PositionStack() {
|
55
|
+
~PositionStack() {
|
56
|
+
ASSERT(!*ok_ || is_empty());
|
57
|
+
USE(ok_);
|
58
|
+
}
|
56
59
|
|
57
60
|
class Element {
|
58
61
|
public:
|
@@ -86,8 +89,8 @@ class PositionStack {
|
|
86
89
|
};
|
87
90
|
|
88
91
|
|
89
|
-
RegExpBuilder::RegExpBuilder()
|
90
|
-
: zone_(
|
92
|
+
RegExpBuilder::RegExpBuilder(Zone* zone)
|
93
|
+
: zone_(zone),
|
91
94
|
pending_empty_(false),
|
92
95
|
characters_(NULL),
|
93
96
|
terms_(),
|
@@ -103,7 +106,7 @@ void RegExpBuilder::FlushCharacters() {
|
|
103
106
|
if (characters_ != NULL) {
|
104
107
|
RegExpTree* atom = new(zone()) RegExpAtom(characters_->ToConstVector());
|
105
108
|
characters_ = NULL;
|
106
|
-
text_.Add(atom);
|
109
|
+
text_.Add(atom, zone());
|
107
110
|
LAST(ADD_ATOM);
|
108
111
|
}
|
109
112
|
}
|
@@ -115,12 +118,12 @@ void RegExpBuilder::FlushText() {
|
|
115
118
|
if (num_text == 0) {
|
116
119
|
return;
|
117
120
|
} else if (num_text == 1) {
|
118
|
-
terms_.Add(text_.last());
|
121
|
+
terms_.Add(text_.last(), zone());
|
119
122
|
} else {
|
120
|
-
RegExpText* text = new(zone()) RegExpText();
|
123
|
+
RegExpText* text = new(zone()) RegExpText(zone());
|
121
124
|
for (int i = 0; i < num_text; i++)
|
122
|
-
text_.Get(i)->AppendToText(text);
|
123
|
-
terms_.Add(text);
|
125
|
+
text_.Get(i)->AppendToText(text, zone());
|
126
|
+
terms_.Add(text, zone());
|
124
127
|
}
|
125
128
|
text_.Clear();
|
126
129
|
}
|
@@ -129,9 +132,9 @@ void RegExpBuilder::FlushText() {
|
|
129
132
|
void RegExpBuilder::AddCharacter(uc16 c) {
|
130
133
|
pending_empty_ = false;
|
131
134
|
if (characters_ == NULL) {
|
132
|
-
characters_ = new(zone()) ZoneList<uc16>(4);
|
135
|
+
characters_ = new(zone()) ZoneList<uc16>(4, zone());
|
133
136
|
}
|
134
|
-
characters_->Add(c);
|
137
|
+
characters_->Add(c, zone());
|
135
138
|
LAST(ADD_CHAR);
|
136
139
|
}
|
137
140
|
|
@@ -148,10 +151,10 @@ void RegExpBuilder::AddAtom(RegExpTree* term) {
|
|
148
151
|
}
|
149
152
|
if (term->IsTextElement()) {
|
150
153
|
FlushCharacters();
|
151
|
-
text_.Add(term);
|
154
|
+
text_.Add(term, zone());
|
152
155
|
} else {
|
153
156
|
FlushText();
|
154
|
-
terms_.Add(term);
|
157
|
+
terms_.Add(term, zone());
|
155
158
|
}
|
156
159
|
LAST(ADD_ATOM);
|
157
160
|
}
|
@@ -159,7 +162,7 @@ void RegExpBuilder::AddAtom(RegExpTree* term) {
|
|
159
162
|
|
160
163
|
void RegExpBuilder::AddAssertion(RegExpTree* assert) {
|
161
164
|
FlushText();
|
162
|
-
terms_.Add(assert);
|
165
|
+
terms_.Add(assert, zone());
|
163
166
|
LAST(ADD_ASSERT);
|
164
167
|
}
|
165
168
|
|
@@ -178,9 +181,9 @@ void RegExpBuilder::FlushTerms() {
|
|
178
181
|
} else if (num_terms == 1) {
|
179
182
|
alternative = terms_.last();
|
180
183
|
} else {
|
181
|
-
alternative = new(zone()) RegExpAlternative(terms_.GetList());
|
184
|
+
alternative = new(zone()) RegExpAlternative(terms_.GetList(zone()));
|
182
185
|
}
|
183
|
-
alternatives_.Add(alternative);
|
186
|
+
alternatives_.Add(alternative, zone());
|
184
187
|
terms_.Clear();
|
185
188
|
LAST(ADD_NONE);
|
186
189
|
}
|
@@ -195,7 +198,7 @@ RegExpTree* RegExpBuilder::ToRegExp() {
|
|
195
198
|
if (num_alternatives == 1) {
|
196
199
|
return alternatives_.last();
|
197
200
|
}
|
198
|
-
return new(zone()) RegExpDisjunction(alternatives_.GetList());
|
201
|
+
return new(zone()) RegExpDisjunction(alternatives_.GetList(zone()));
|
199
202
|
}
|
200
203
|
|
201
204
|
|
@@ -214,7 +217,7 @@ void RegExpBuilder::AddQuantifierToAtom(int min,
|
|
214
217
|
int num_chars = char_vector.length();
|
215
218
|
if (num_chars > 1) {
|
216
219
|
Vector<const uc16> prefix = char_vector.SubVector(0, num_chars - 1);
|
217
|
-
text_.Add(new(zone()) RegExpAtom(prefix));
|
220
|
+
text_.Add(new(zone()) RegExpAtom(prefix), zone());
|
218
221
|
char_vector = char_vector.SubVector(num_chars - 1, num_chars);
|
219
222
|
}
|
220
223
|
characters_ = NULL;
|
@@ -233,7 +236,7 @@ void RegExpBuilder::AddQuantifierToAtom(int min,
|
|
233
236
|
if (min == 0) {
|
234
237
|
return;
|
235
238
|
}
|
236
|
-
terms_.Add(atom);
|
239
|
+
terms_.Add(atom, zone());
|
237
240
|
return;
|
238
241
|
}
|
239
242
|
} else {
|
@@ -241,7 +244,7 @@ void RegExpBuilder::AddQuantifierToAtom(int min,
|
|
241
244
|
UNREACHABLE();
|
242
245
|
return;
|
243
246
|
}
|
244
|
-
terms_.Add(new(zone()) RegExpQuantifier(min, max, type, atom));
|
247
|
+
terms_.Add(new(zone()) RegExpQuantifier(min, max, type, atom), zone());
|
245
248
|
LAST(ADD_TERM);
|
246
249
|
}
|
247
250
|
|
@@ -254,8 +257,8 @@ Handle<String> Parser::LookupSymbol(int symbol_id) {
|
|
254
257
|
if (static_cast<unsigned>(symbol_id)
|
255
258
|
>= static_cast<unsigned>(symbol_cache_.length())) {
|
256
259
|
if (scanner().is_literal_ascii()) {
|
257
|
-
return isolate()->factory()->
|
258
|
-
scanner().literal_ascii_string());
|
260
|
+
return isolate()->factory()->LookupOneByteSymbol(
|
261
|
+
Vector<const uint8_t>::cast(scanner().literal_ascii_string()));
|
259
262
|
} else {
|
260
263
|
return isolate()->factory()->LookupTwoByteSymbol(
|
261
264
|
scanner().literal_utf16_string());
|
@@ -270,13 +273,13 @@ Handle<String> Parser::LookupCachedSymbol(int symbol_id) {
|
|
270
273
|
if (symbol_cache_.length() <= symbol_id) {
|
271
274
|
// Increase length to index + 1.
|
272
275
|
symbol_cache_.AddBlock(Handle<String>::null(),
|
273
|
-
symbol_id + 1 - symbol_cache_.length());
|
276
|
+
symbol_id + 1 - symbol_cache_.length(), zone());
|
274
277
|
}
|
275
278
|
Handle<String> result = symbol_cache_.at(symbol_id);
|
276
279
|
if (result.is_null()) {
|
277
280
|
if (scanner().is_literal_ascii()) {
|
278
|
-
result = isolate()->factory()->
|
279
|
-
scanner().literal_ascii_string());
|
281
|
+
result = isolate()->factory()->LookupOneByteSymbol(
|
282
|
+
Vector<const uint8_t>::cast(scanner().literal_ascii_string()));
|
280
283
|
} else {
|
281
284
|
result = isolate()->factory()->LookupTwoByteSymbol(
|
282
285
|
scanner().literal_utf16_string());
|
@@ -408,7 +411,7 @@ unsigned* ScriptDataImpl::ReadAddress(int position) {
|
|
408
411
|
|
409
412
|
|
410
413
|
Scope* Parser::NewScope(Scope* parent, ScopeType type) {
|
411
|
-
Scope* result = new(zone()) Scope(parent, type);
|
414
|
+
Scope* result = new(zone()) Scope(parent, type, zone());
|
412
415
|
result->Initialize();
|
413
416
|
return result;
|
414
417
|
}
|
@@ -493,10 +496,10 @@ Parser::FunctionState::FunctionState(Parser* parser,
|
|
493
496
|
outer_function_state_(parser->current_function_state_),
|
494
497
|
outer_scope_(parser->top_scope_),
|
495
498
|
saved_ast_node_id_(isolate->ast_node_id()),
|
496
|
-
factory_(isolate) {
|
499
|
+
factory_(isolate, parser->zone()) {
|
497
500
|
parser->top_scope_ = scope;
|
498
501
|
parser->current_function_state_ = this;
|
499
|
-
isolate->set_ast_node_id(
|
502
|
+
isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt());
|
500
503
|
}
|
501
504
|
|
502
505
|
|
@@ -532,13 +535,13 @@ Parser::FunctionState::~FunctionState() {
|
|
532
535
|
// ----------------------------------------------------------------------------
|
533
536
|
// Implementation of Parser
|
534
537
|
|
535
|
-
Parser::Parser(
|
538
|
+
Parser::Parser(CompilationInfo* info,
|
536
539
|
int parser_flags,
|
537
540
|
v8::Extension* extension,
|
538
541
|
ScriptDataImpl* pre_data)
|
539
|
-
: isolate_(
|
540
|
-
symbol_cache_(pre_data ? pre_data->symbol_count() : 0),
|
541
|
-
script_(script),
|
542
|
+
: isolate_(info->isolate()),
|
543
|
+
symbol_cache_(pre_data ? pre_data->symbol_count() : 0, info->zone()),
|
544
|
+
script_(info->script()),
|
542
545
|
scanner_(isolate_->unicode_cache()),
|
543
546
|
reusable_preparser_(NULL),
|
544
547
|
top_scope_(NULL),
|
@@ -551,7 +554,10 @@ Parser::Parser(Handle<Script> script,
|
|
551
554
|
allow_lazy_((parser_flags & kAllowLazy) != 0),
|
552
555
|
allow_modules_((parser_flags & kAllowModules) != 0),
|
553
556
|
stack_overflow_(false),
|
554
|
-
parenthesized_function_(false)
|
557
|
+
parenthesized_function_(false),
|
558
|
+
zone_(info->zone()),
|
559
|
+
info_(info) {
|
560
|
+
ASSERT(!script_.is_null());
|
555
561
|
isolate_->set_ast_node_id(0);
|
556
562
|
if ((parser_flags & kLanguageModeMask) == EXTENDED_MODE) {
|
557
563
|
scanner().SetHarmonyScoping(true);
|
@@ -562,16 +568,17 @@ Parser::Parser(Handle<Script> script,
|
|
562
568
|
}
|
563
569
|
|
564
570
|
|
565
|
-
FunctionLiteral* Parser::ParseProgram(
|
566
|
-
ZoneScope zone_scope(
|
567
|
-
|
571
|
+
FunctionLiteral* Parser::ParseProgram() {
|
572
|
+
ZoneScope zone_scope(zone(), DONT_DELETE_ON_EXIT);
|
568
573
|
HistogramTimerScope timer(isolate()->counters()->parse());
|
569
574
|
Handle<String> source(String::cast(script_->source()));
|
570
575
|
isolate()->counters()->total_parse_size()->Increment(source->length());
|
571
|
-
|
576
|
+
int64_t start = FLAG_trace_parse ? OS::Ticks() : 0;
|
577
|
+
fni_ = new(zone()) FuncNameInferrer(isolate(), zone());
|
572
578
|
|
573
579
|
// Initialize parser state.
|
574
580
|
source->TryFlatten();
|
581
|
+
FunctionLiteral* result;
|
575
582
|
if (source->IsExternalTwoByteString()) {
|
576
583
|
// Notice that the stream is destroyed at the end of the branch block.
|
577
584
|
// The last line of the blocks can't be moved outside, even though they're
|
@@ -579,12 +586,27 @@ FunctionLiteral* Parser::ParseProgram(CompilationInfo* info) {
|
|
579
586
|
ExternalTwoByteStringUtf16CharacterStream stream(
|
580
587
|
Handle<ExternalTwoByteString>::cast(source), 0, source->length());
|
581
588
|
scanner_.Initialize(&stream);
|
582
|
-
|
589
|
+
result = DoParseProgram(info(), source, &zone_scope);
|
583
590
|
} else {
|
584
591
|
GenericStringUtf16CharacterStream stream(source, 0, source->length());
|
585
592
|
scanner_.Initialize(&stream);
|
586
|
-
|
593
|
+
result = DoParseProgram(info(), source, &zone_scope);
|
594
|
+
}
|
595
|
+
|
596
|
+
if (FLAG_trace_parse && result != NULL) {
|
597
|
+
double ms = static_cast<double>(OS::Ticks() - start) / 1000;
|
598
|
+
if (info()->is_eval()) {
|
599
|
+
PrintF("[parsing eval");
|
600
|
+
} else if (info()->script()->name()->IsString()) {
|
601
|
+
String* name = String::cast(info()->script()->name());
|
602
|
+
SmartArrayPointer<char> name_chars = name->ToCString();
|
603
|
+
PrintF("[parsing script: %s", *name_chars);
|
604
|
+
} else {
|
605
|
+
PrintF("[parsing script");
|
606
|
+
}
|
607
|
+
PrintF(" - took %0.3f ms]\n", ms);
|
587
608
|
}
|
609
|
+
return result;
|
588
610
|
}
|
589
611
|
|
590
612
|
|
@@ -595,32 +617,37 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
|
|
595
617
|
ASSERT(target_stack_ == NULL);
|
596
618
|
if (pre_data_ != NULL) pre_data_->Initialize();
|
597
619
|
|
598
|
-
// Compute the parsing mode.
|
599
|
-
mode_ = (FLAG_lazy && allow_lazy_) ? PARSE_LAZILY : PARSE_EAGERLY;
|
600
|
-
if (allow_natives_syntax_ || extension_ != NULL) mode_ = PARSE_EAGERLY;
|
601
|
-
|
602
620
|
Handle<String> no_name = isolate()->factory()->empty_symbol();
|
603
621
|
|
604
622
|
FunctionLiteral* result = NULL;
|
605
623
|
{ Scope* scope = NewScope(top_scope_, GLOBAL_SCOPE);
|
606
624
|
info->SetGlobalScope(scope);
|
625
|
+
if (!info->context().is_null()) {
|
626
|
+
scope = Scope::DeserializeScopeChain(*info->context(), scope, zone());
|
627
|
+
}
|
607
628
|
if (info->is_eval()) {
|
608
|
-
Handle<SharedFunctionInfo> shared = info->shared_info();
|
609
|
-
if (!info->is_global() && (shared.is_null() || shared->is_function())) {
|
610
|
-
scope = Scope::DeserializeScopeChain(*info->calling_context(), scope);
|
611
|
-
}
|
612
629
|
if (!scope->is_global_scope() || info->language_mode() != CLASSIC_MODE) {
|
613
630
|
scope = NewScope(scope, EVAL_SCOPE);
|
614
631
|
}
|
632
|
+
} else if (info->is_global()) {
|
633
|
+
scope = NewScope(scope, GLOBAL_SCOPE);
|
615
634
|
}
|
616
635
|
scope->set_start_position(0);
|
617
636
|
scope->set_end_position(source->length());
|
618
|
-
|
637
|
+
|
638
|
+
// Compute the parsing mode.
|
639
|
+
Mode mode = (FLAG_lazy && allow_lazy_) ? PARSE_LAZILY : PARSE_EAGERLY;
|
640
|
+
if (allow_natives_syntax_ || extension_ != NULL || scope->is_eval_scope()) {
|
641
|
+
mode = PARSE_EAGERLY;
|
642
|
+
}
|
643
|
+
ParsingModeScope parsing_mode(this, mode);
|
644
|
+
|
645
|
+
FunctionState function_state(this, scope, isolate()); // Enters 'scope'.
|
619
646
|
top_scope_->SetLanguageMode(info->language_mode());
|
620
|
-
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16);
|
647
|
+
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
|
621
648
|
bool ok = true;
|
622
649
|
int beg_loc = scanner().location().beg_pos;
|
623
|
-
ParseSourceElements(body, Token::EOS, info->is_eval(), &ok);
|
650
|
+
ParseSourceElements(body, Token::EOS, info->is_eval(), true, &ok);
|
624
651
|
if (ok && !top_scope_->is_classic_mode()) {
|
625
652
|
CheckOctalLiteral(beg_loc, scanner().location().end_pos, &ok);
|
626
653
|
}
|
@@ -642,7 +669,8 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
|
|
642
669
|
0,
|
643
670
|
FunctionLiteral::kNoDuplicateParameters,
|
644
671
|
FunctionLiteral::ANONYMOUS_EXPRESSION,
|
645
|
-
FunctionLiteral::kGlobalOrEval
|
672
|
+
FunctionLiteral::kGlobalOrEval,
|
673
|
+
FunctionLiteral::kNotParenthesized);
|
646
674
|
result->set_ast_properties(factory()->visitor()->ast_properties());
|
647
675
|
} else if (stack_overflow_) {
|
648
676
|
isolate()->StackOverflow();
|
@@ -659,45 +687,51 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
|
|
659
687
|
}
|
660
688
|
|
661
689
|
|
662
|
-
FunctionLiteral* Parser::ParseLazy(
|
663
|
-
ZoneScope zone_scope(
|
690
|
+
FunctionLiteral* Parser::ParseLazy() {
|
691
|
+
ZoneScope zone_scope(zone(), DONT_DELETE_ON_EXIT);
|
664
692
|
HistogramTimerScope timer(isolate()->counters()->parse_lazy());
|
665
693
|
Handle<String> source(String::cast(script_->source()));
|
666
694
|
isolate()->counters()->total_parse_size()->Increment(source->length());
|
695
|
+
int64_t start = FLAG_trace_parse ? OS::Ticks() : 0;
|
696
|
+
Handle<SharedFunctionInfo> shared_info = info()->shared_info();
|
667
697
|
|
668
|
-
Handle<SharedFunctionInfo> shared_info = info->shared_info();
|
669
698
|
// Initialize parser state.
|
670
699
|
source->TryFlatten();
|
700
|
+
FunctionLiteral* result;
|
671
701
|
if (source->IsExternalTwoByteString()) {
|
672
702
|
ExternalTwoByteStringUtf16CharacterStream stream(
|
673
703
|
Handle<ExternalTwoByteString>::cast(source),
|
674
704
|
shared_info->start_position(),
|
675
705
|
shared_info->end_position());
|
676
|
-
|
677
|
-
return result;
|
706
|
+
result = ParseLazy(&stream, &zone_scope);
|
678
707
|
} else {
|
679
708
|
GenericStringUtf16CharacterStream stream(source,
|
680
709
|
shared_info->start_position(),
|
681
710
|
shared_info->end_position());
|
682
|
-
|
683
|
-
return result;
|
711
|
+
result = ParseLazy(&stream, &zone_scope);
|
684
712
|
}
|
713
|
+
|
714
|
+
if (FLAG_trace_parse && result != NULL) {
|
715
|
+
double ms = static_cast<double>(OS::Ticks() - start) / 1000;
|
716
|
+
SmartArrayPointer<char> name_chars = result->debug_name()->ToCString();
|
717
|
+
PrintF("[parsing function: %s - took %0.3f ms]\n", *name_chars, ms);
|
718
|
+
}
|
719
|
+
return result;
|
685
720
|
}
|
686
721
|
|
687
722
|
|
688
|
-
FunctionLiteral* Parser::ParseLazy(
|
689
|
-
Utf16CharacterStream* source,
|
723
|
+
FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source,
|
690
724
|
ZoneScope* zone_scope) {
|
691
|
-
Handle<SharedFunctionInfo> shared_info = info->shared_info();
|
725
|
+
Handle<SharedFunctionInfo> shared_info = info()->shared_info();
|
692
726
|
scanner_.Initialize(source);
|
693
727
|
ASSERT(top_scope_ == NULL);
|
694
728
|
ASSERT(target_stack_ == NULL);
|
695
729
|
|
696
730
|
Handle<String> name(String::cast(shared_info->name()));
|
697
|
-
fni_ = new(zone()) FuncNameInferrer(isolate());
|
731
|
+
fni_ = new(zone()) FuncNameInferrer(isolate(), zone());
|
698
732
|
fni_->PushEnclosingName(name);
|
699
733
|
|
700
|
-
|
734
|
+
ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
|
701
735
|
|
702
736
|
// Place holder for the result.
|
703
737
|
FunctionLiteral* result = NULL;
|
@@ -705,15 +739,16 @@ FunctionLiteral* Parser::ParseLazy(CompilationInfo* info,
|
|
705
739
|
{
|
706
740
|
// Parse the function literal.
|
707
741
|
Scope* scope = NewScope(top_scope_, GLOBAL_SCOPE);
|
708
|
-
info->SetGlobalScope(scope);
|
709
|
-
if (!info->closure().is_null()) {
|
710
|
-
scope = Scope::DeserializeScopeChain(info->closure()->context(), scope
|
742
|
+
info()->SetGlobalScope(scope);
|
743
|
+
if (!info()->closure().is_null()) {
|
744
|
+
scope = Scope::DeserializeScopeChain(info()->closure()->context(), scope,
|
745
|
+
zone());
|
711
746
|
}
|
712
747
|
FunctionState function_state(this, scope, isolate());
|
713
|
-
ASSERT(scope->language_mode() != STRICT_MODE || !info->is_classic_mode());
|
748
|
+
ASSERT(scope->language_mode() != STRICT_MODE || !info()->is_classic_mode());
|
714
749
|
ASSERT(scope->language_mode() != EXTENDED_MODE ||
|
715
|
-
info->is_extended_mode());
|
716
|
-
ASSERT(info->language_mode() == shared_info->language_mode());
|
750
|
+
info()->is_extended_mode());
|
751
|
+
ASSERT(info()->language_mode() == shared_info->language_mode());
|
717
752
|
scope->SetLanguageMode(shared_info->language_mode());
|
718
753
|
FunctionLiteral::Type type = shared_info->is_expression()
|
719
754
|
? (shared_info->is_anonymous()
|
@@ -802,152 +837,25 @@ void Parser::ReportMessageAt(Scanner::Location source_location,
|
|
802
837
|
}
|
803
838
|
|
804
839
|
|
805
|
-
// Base class containing common code for the different finder classes used by
|
806
|
-
// the parser.
|
807
|
-
class ParserFinder {
|
808
|
-
protected:
|
809
|
-
ParserFinder() {}
|
810
|
-
static Assignment* AsAssignment(Statement* stat) {
|
811
|
-
if (stat == NULL) return NULL;
|
812
|
-
ExpressionStatement* exp_stat = stat->AsExpressionStatement();
|
813
|
-
if (exp_stat == NULL) return NULL;
|
814
|
-
return exp_stat->expression()->AsAssignment();
|
815
|
-
}
|
816
|
-
};
|
817
|
-
|
818
|
-
|
819
|
-
// An InitializationBlockFinder finds and marks sequences of statements of the
|
820
|
-
// form expr.a = ...; expr.b = ...; etc.
|
821
|
-
class InitializationBlockFinder : public ParserFinder {
|
822
|
-
public:
|
823
|
-
// We find and mark the initialization blocks in top level
|
824
|
-
// non-looping code only. This is because the optimization prevents
|
825
|
-
// reuse of the map transitions, so it should be used only for code
|
826
|
-
// that will only be run once.
|
827
|
-
InitializationBlockFinder(Scope* top_scope, Target* target)
|
828
|
-
: enabled_(top_scope->DeclarationScope()->is_global_scope() &&
|
829
|
-
!IsLoopTarget(target)),
|
830
|
-
first_in_block_(NULL),
|
831
|
-
last_in_block_(NULL),
|
832
|
-
block_size_(0) {}
|
833
|
-
|
834
|
-
~InitializationBlockFinder() {
|
835
|
-
if (!enabled_) return;
|
836
|
-
if (InBlock()) EndBlock();
|
837
|
-
}
|
838
|
-
|
839
|
-
void Update(Statement* stat) {
|
840
|
-
if (!enabled_) return;
|
841
|
-
Assignment* assignment = AsAssignment(stat);
|
842
|
-
if (InBlock()) {
|
843
|
-
if (BlockContinues(assignment)) {
|
844
|
-
UpdateBlock(assignment);
|
845
|
-
} else {
|
846
|
-
EndBlock();
|
847
|
-
}
|
848
|
-
}
|
849
|
-
if (!InBlock() && (assignment != NULL) &&
|
850
|
-
(assignment->op() == Token::ASSIGN)) {
|
851
|
-
StartBlock(assignment);
|
852
|
-
}
|
853
|
-
}
|
854
|
-
|
855
|
-
private:
|
856
|
-
// The minimum number of contiguous assignment that will
|
857
|
-
// be treated as an initialization block. Benchmarks show that
|
858
|
-
// the overhead exceeds the savings below this limit.
|
859
|
-
static const int kMinInitializationBlock = 3;
|
860
|
-
|
861
|
-
static bool IsLoopTarget(Target* target) {
|
862
|
-
while (target != NULL) {
|
863
|
-
if (target->node()->AsIterationStatement() != NULL) return true;
|
864
|
-
target = target->previous();
|
865
|
-
}
|
866
|
-
return false;
|
867
|
-
}
|
868
|
-
|
869
|
-
// Returns true if the expressions appear to denote the same object.
|
870
|
-
// In the context of initialization blocks, we only consider expressions
|
871
|
-
// of the form 'expr.x' or expr["x"].
|
872
|
-
static bool SameObject(Expression* e1, Expression* e2) {
|
873
|
-
VariableProxy* v1 = e1->AsVariableProxy();
|
874
|
-
VariableProxy* v2 = e2->AsVariableProxy();
|
875
|
-
if (v1 != NULL && v2 != NULL) {
|
876
|
-
return v1->name()->Equals(*v2->name());
|
877
|
-
}
|
878
|
-
Property* p1 = e1->AsProperty();
|
879
|
-
Property* p2 = e2->AsProperty();
|
880
|
-
if ((p1 == NULL) || (p2 == NULL)) return false;
|
881
|
-
Literal* key1 = p1->key()->AsLiteral();
|
882
|
-
Literal* key2 = p2->key()->AsLiteral();
|
883
|
-
if ((key1 == NULL) || (key2 == NULL)) return false;
|
884
|
-
if (!key1->handle()->IsString() || !key2->handle()->IsString()) {
|
885
|
-
return false;
|
886
|
-
}
|
887
|
-
String* name1 = String::cast(*key1->handle());
|
888
|
-
String* name2 = String::cast(*key2->handle());
|
889
|
-
if (!name1->Equals(name2)) return false;
|
890
|
-
return SameObject(p1->obj(), p2->obj());
|
891
|
-
}
|
892
|
-
|
893
|
-
// Returns true if the expressions appear to denote different properties
|
894
|
-
// of the same object.
|
895
|
-
static bool PropertyOfSameObject(Expression* e1, Expression* e2) {
|
896
|
-
Property* p1 = e1->AsProperty();
|
897
|
-
Property* p2 = e2->AsProperty();
|
898
|
-
if ((p1 == NULL) || (p2 == NULL)) return false;
|
899
|
-
return SameObject(p1->obj(), p2->obj());
|
900
|
-
}
|
901
|
-
|
902
|
-
bool BlockContinues(Assignment* assignment) {
|
903
|
-
if ((assignment == NULL) || (first_in_block_ == NULL)) return false;
|
904
|
-
if (assignment->op() != Token::ASSIGN) return false;
|
905
|
-
return PropertyOfSameObject(first_in_block_->target(),
|
906
|
-
assignment->target());
|
907
|
-
}
|
908
|
-
|
909
|
-
void StartBlock(Assignment* assignment) {
|
910
|
-
first_in_block_ = assignment;
|
911
|
-
last_in_block_ = assignment;
|
912
|
-
block_size_ = 1;
|
913
|
-
}
|
914
|
-
|
915
|
-
void UpdateBlock(Assignment* assignment) {
|
916
|
-
last_in_block_ = assignment;
|
917
|
-
++block_size_;
|
918
|
-
}
|
919
|
-
|
920
|
-
void EndBlock() {
|
921
|
-
if (block_size_ >= kMinInitializationBlock) {
|
922
|
-
first_in_block_->mark_block_start();
|
923
|
-
last_in_block_->mark_block_end();
|
924
|
-
}
|
925
|
-
last_in_block_ = first_in_block_ = NULL;
|
926
|
-
block_size_ = 0;
|
927
|
-
}
|
928
|
-
|
929
|
-
bool InBlock() { return first_in_block_ != NULL; }
|
930
|
-
|
931
|
-
const bool enabled_;
|
932
|
-
Assignment* first_in_block_;
|
933
|
-
Assignment* last_in_block_;
|
934
|
-
int block_size_;
|
935
|
-
|
936
|
-
DISALLOW_COPY_AND_ASSIGN(InitializationBlockFinder);
|
937
|
-
};
|
938
|
-
|
939
|
-
|
940
840
|
// A ThisNamedPropertyAssignmentFinder finds and marks statements of the form
|
941
841
|
// this.x = ...;, where x is a named property. It also determines whether a
|
942
842
|
// function contains only assignments of this type.
|
943
|
-
class ThisNamedPropertyAssignmentFinder
|
843
|
+
class ThisNamedPropertyAssignmentFinder {
|
944
844
|
public:
|
945
|
-
|
845
|
+
ThisNamedPropertyAssignmentFinder(Isolate* isolate, Zone* zone)
|
946
846
|
: isolate_(isolate),
|
947
847
|
only_simple_this_property_assignments_(true),
|
948
|
-
names_(0),
|
949
|
-
assigned_arguments_(0),
|
950
|
-
assigned_constants_(0)
|
848
|
+
names_(0, zone),
|
849
|
+
assigned_arguments_(0, zone),
|
850
|
+
assigned_constants_(0, zone),
|
851
|
+
zone_(zone) {
|
852
|
+
}
|
853
|
+
|
854
|
+
static Assignment* AsAssignment(Statement* stat) {
|
855
|
+
if (stat == NULL) return NULL;
|
856
|
+
ExpressionStatement* exp_stat = stat->AsExpressionStatement();
|
857
|
+
if (exp_stat == NULL) return NULL;
|
858
|
+
return exp_stat->expression()->AsAssignment();
|
951
859
|
}
|
952
860
|
|
953
861
|
void Update(Scope* scope, Statement* stat) {
|
@@ -1056,9 +964,9 @@ class ThisNamedPropertyAssignmentFinder : public ParserFinder {
|
|
1056
964
|
return;
|
1057
965
|
}
|
1058
966
|
}
|
1059
|
-
names_.Add(name);
|
1060
|
-
assigned_arguments_.Add(index);
|
1061
|
-
assigned_constants_.Add(isolate_->factory()->undefined_value());
|
967
|
+
names_.Add(name, zone());
|
968
|
+
assigned_arguments_.Add(index, zone());
|
969
|
+
assigned_constants_.Add(isolate_->factory()->undefined_value(), zone());
|
1062
970
|
}
|
1063
971
|
|
1064
972
|
void AssignmentFromConstant(Handle<String> name, Handle<Object> value) {
|
@@ -1070,9 +978,9 @@ class ThisNamedPropertyAssignmentFinder : public ParserFinder {
|
|
1070
978
|
return;
|
1071
979
|
}
|
1072
980
|
}
|
1073
|
-
names_.Add(name);
|
1074
|
-
assigned_arguments_.Add(-1);
|
1075
|
-
assigned_constants_.Add(value);
|
981
|
+
names_.Add(name, zone());
|
982
|
+
assigned_arguments_.Add(-1, zone());
|
983
|
+
assigned_constants_.Add(value, zone());
|
1076
984
|
}
|
1077
985
|
|
1078
986
|
void AssignmentFromSomethingElse() {
|
@@ -1084,23 +992,27 @@ class ThisNamedPropertyAssignmentFinder : public ParserFinder {
|
|
1084
992
|
if (names_.capacity() == 0) {
|
1085
993
|
ASSERT(assigned_arguments_.capacity() == 0);
|
1086
994
|
ASSERT(assigned_constants_.capacity() == 0);
|
1087
|
-
names_.Initialize(4);
|
1088
|
-
assigned_arguments_.Initialize(4);
|
1089
|
-
assigned_constants_.Initialize(4);
|
995
|
+
names_.Initialize(4, zone());
|
996
|
+
assigned_arguments_.Initialize(4, zone());
|
997
|
+
assigned_constants_.Initialize(4, zone());
|
1090
998
|
}
|
1091
999
|
}
|
1092
1000
|
|
1001
|
+
Zone* zone() const { return zone_; }
|
1002
|
+
|
1093
1003
|
Isolate* isolate_;
|
1094
1004
|
bool only_simple_this_property_assignments_;
|
1095
1005
|
ZoneStringList names_;
|
1096
1006
|
ZoneList<int> assigned_arguments_;
|
1097
1007
|
ZoneObjectList assigned_constants_;
|
1008
|
+
Zone* zone_;
|
1098
1009
|
};
|
1099
1010
|
|
1100
1011
|
|
1101
1012
|
void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
1102
1013
|
int end_token,
|
1103
1014
|
bool is_eval,
|
1015
|
+
bool is_global,
|
1104
1016
|
bool* ok) {
|
1105
1017
|
// SourceElements ::
|
1106
1018
|
// (ModuleElement)* <end_token>
|
@@ -1112,8 +1024,8 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
|
1112
1024
|
TargetScope scope(&this->target_stack_);
|
1113
1025
|
|
1114
1026
|
ASSERT(processor != NULL);
|
1115
|
-
|
1116
|
-
|
1027
|
+
ThisNamedPropertyAssignmentFinder this_property_assignment_finder(isolate(),
|
1028
|
+
zone());
|
1117
1029
|
bool directive_prologue = true; // Parsing directive prologue.
|
1118
1030
|
|
1119
1031
|
while (peek() != end_token) {
|
@@ -1122,7 +1034,12 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
|
1122
1034
|
}
|
1123
1035
|
|
1124
1036
|
Scanner::Location token_loc = scanner().peek_location();
|
1125
|
-
Statement* stat
|
1037
|
+
Statement* stat;
|
1038
|
+
if (is_global && !is_eval) {
|
1039
|
+
stat = ParseModuleElement(NULL, CHECK_OK);
|
1040
|
+
} else {
|
1041
|
+
stat = ParseBlockElement(NULL, CHECK_OK);
|
1042
|
+
}
|
1126
1043
|
if (stat == NULL || stat->IsEmpty()) {
|
1127
1044
|
directive_prologue = false; // End of directive prologue.
|
1128
1045
|
continue;
|
@@ -1147,12 +1064,14 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
|
1147
1064
|
// as specified in ES5 10.4.2(3). The correct fix would be to always
|
1148
1065
|
// add this scope in DoParseProgram(), but that requires adaptations
|
1149
1066
|
// all over the code base, so we go with a quick-fix for now.
|
1067
|
+
// In the same manner, we have to patch the parsing mode.
|
1150
1068
|
if (is_eval && !top_scope_->is_eval_scope()) {
|
1151
1069
|
ASSERT(top_scope_->is_global_scope());
|
1152
1070
|
Scope* scope = NewScope(top_scope_, EVAL_SCOPE);
|
1153
1071
|
scope->set_start_position(top_scope_->start_position());
|
1154
1072
|
scope->set_end_position(top_scope_->end_position());
|
1155
1073
|
top_scope_ = scope;
|
1074
|
+
mode_ = PARSE_EAGERLY;
|
1156
1075
|
}
|
1157
1076
|
// TODO(ES6): Fix entering extended mode, once it is specified.
|
1158
1077
|
top_scope_->SetLanguageMode(FLAG_harmony_scoping
|
@@ -1166,12 +1085,11 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
|
1166
1085
|
}
|
1167
1086
|
}
|
1168
1087
|
|
1169
|
-
block_finder.Update(stat);
|
1170
1088
|
// Find and mark all assignments to named properties in this (this.x =)
|
1171
1089
|
if (top_scope_->is_function_scope()) {
|
1172
1090
|
this_property_assignment_finder.Update(top_scope_, stat);
|
1173
1091
|
}
|
1174
|
-
processor->Add(stat);
|
1092
|
+
processor->Add(stat, zone());
|
1175
1093
|
}
|
1176
1094
|
|
1177
1095
|
// Propagate the collected information on this property assignments.
|
@@ -1237,12 +1155,10 @@ Statement* Parser::ParseModuleElement(ZoneStringList* labels,
|
|
1237
1155
|
}
|
1238
1156
|
|
1239
1157
|
|
1240
|
-
|
1158
|
+
Statement* Parser::ParseModuleDeclaration(ZoneStringList* names, bool* ok) {
|
1241
1159
|
// ModuleDeclaration:
|
1242
1160
|
// 'module' Identifier Module
|
1243
1161
|
|
1244
|
-
// Create new block with one expected declaration.
|
1245
|
-
Block* block = factory()->NewBlock(NULL, 1, true);
|
1246
1162
|
Handle<String> name = ParseIdentifier(CHECK_OK);
|
1247
1163
|
|
1248
1164
|
#ifdef DEBUG
|
@@ -1251,7 +1167,7 @@ Block* Parser::ParseModuleDeclaration(ZoneStringList* names, bool* ok) {
|
|
1251
1167
|
#endif
|
1252
1168
|
|
1253
1169
|
Module* module = ParseModule(CHECK_OK);
|
1254
|
-
VariableProxy* proxy = NewUnresolved(name,
|
1170
|
+
VariableProxy* proxy = NewUnresolved(name, MODULE, module->interface());
|
1255
1171
|
Declaration* declaration =
|
1256
1172
|
factory()->NewModuleDeclaration(proxy, module, top_scope_);
|
1257
1173
|
Declare(declaration, true, CHECK_OK);
|
@@ -1266,10 +1182,11 @@ Block* Parser::ParseModuleDeclaration(ZoneStringList* names, bool* ok) {
|
|
1266
1182
|
}
|
1267
1183
|
#endif
|
1268
1184
|
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1185
|
+
if (names) names->Add(name, zone());
|
1186
|
+
if (module->body() == NULL)
|
1187
|
+
return factory()->NewEmptyStatement();
|
1188
|
+
else
|
1189
|
+
return factory()->NewModuleStatement(proxy, module->body());
|
1273
1190
|
}
|
1274
1191
|
|
1275
1192
|
|
@@ -1317,16 +1234,14 @@ Module* Parser::ParseModuleLiteral(bool* ok) {
|
|
1317
1234
|
|
1318
1235
|
{
|
1319
1236
|
BlockState block_state(this, scope);
|
1320
|
-
TargetCollector collector;
|
1237
|
+
TargetCollector collector(zone());
|
1321
1238
|
Target target(&this->target_stack_, &collector);
|
1322
1239
|
Target target_body(&this->target_stack_, body);
|
1323
|
-
InitializationBlockFinder block_finder(top_scope_, target_stack_);
|
1324
1240
|
|
1325
1241
|
while (peek() != Token::RBRACE) {
|
1326
1242
|
Statement* stat = ParseModuleElement(NULL, CHECK_OK);
|
1327
1243
|
if (stat && !stat->IsEmpty()) {
|
1328
|
-
body->AddStatement(stat);
|
1329
|
-
block_finder.Update(stat);
|
1244
|
+
body->AddStatement(stat, zone());
|
1330
1245
|
}
|
1331
1246
|
}
|
1332
1247
|
}
|
@@ -1335,16 +1250,23 @@ Module* Parser::ParseModuleLiteral(bool* ok) {
|
|
1335
1250
|
scope->set_end_position(scanner().location().end_pos);
|
1336
1251
|
body->set_scope(scope);
|
1337
1252
|
|
1338
|
-
//
|
1339
|
-
// linking them) because of potentially cyclic references between them.
|
1340
|
-
// We create them here, to avoid another pass over the AST.
|
1253
|
+
// Check that all exports are bound.
|
1341
1254
|
Interface* interface = scope->interface();
|
1255
|
+
for (Interface::Iterator it = interface->iterator();
|
1256
|
+
!it.done(); it.Advance()) {
|
1257
|
+
if (scope->LocalLookup(it.name()) == NULL) {
|
1258
|
+
Handle<String> name(it.name());
|
1259
|
+
ReportMessage("module_export_undefined",
|
1260
|
+
Vector<Handle<String> >(&name, 1));
|
1261
|
+
*ok = false;
|
1262
|
+
return NULL;
|
1263
|
+
}
|
1264
|
+
}
|
1265
|
+
|
1342
1266
|
interface->MakeModule(ok);
|
1343
|
-
ASSERT(ok);
|
1344
|
-
interface->MakeSingleton(Isolate::Current()->factory()->NewJSModule(), ok);
|
1345
|
-
ASSERT(ok);
|
1267
|
+
ASSERT(*ok);
|
1346
1268
|
interface->Freeze(ok);
|
1347
|
-
ASSERT(ok);
|
1269
|
+
ASSERT(*ok);
|
1348
1270
|
return factory()->NewModuleLiteral(body, interface);
|
1349
1271
|
}
|
1350
1272
|
|
@@ -1362,7 +1284,7 @@ Module* Parser::ParseModulePath(bool* ok) {
|
|
1362
1284
|
PrintF("# Path .%s ", name->ToAsciiArray());
|
1363
1285
|
#endif
|
1364
1286
|
Module* member = factory()->NewModulePath(result, name);
|
1365
|
-
result->interface()->Add(name, member->interface(), ok);
|
1287
|
+
result->interface()->Add(name, member->interface(), zone(), ok);
|
1366
1288
|
if (!*ok) {
|
1367
1289
|
#ifdef DEBUG
|
1368
1290
|
if (FLAG_print_interfaces) {
|
@@ -1393,7 +1315,8 @@ Module* Parser::ParseModuleVariable(bool* ok) {
|
|
1393
1315
|
PrintF("# Module variable %s ", name->ToAsciiArray());
|
1394
1316
|
#endif
|
1395
1317
|
VariableProxy* proxy = top_scope_->NewUnresolved(
|
1396
|
-
factory(), name,
|
1318
|
+
factory(), name, Interface::NewModule(zone()),
|
1319
|
+
scanner().location().beg_pos);
|
1397
1320
|
|
1398
1321
|
return factory()->NewModuleVariable(proxy);
|
1399
1322
|
}
|
@@ -1412,12 +1335,17 @@ Module* Parser::ParseModuleUrl(bool* ok) {
|
|
1412
1335
|
if (FLAG_print_interface_details) PrintF("# Url ");
|
1413
1336
|
#endif
|
1414
1337
|
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1338
|
+
// Create an empty literal as long as the feature isn't finished.
|
1339
|
+
USE(symbol);
|
1340
|
+
Scope* scope = NewScope(top_scope_, MODULE_SCOPE);
|
1341
|
+
Block* body = factory()->NewBlock(NULL, 1, false);
|
1342
|
+
body->set_scope(scope);
|
1343
|
+
Interface* interface = scope->interface();
|
1344
|
+
Module* result = factory()->NewModuleLiteral(body, interface);
|
1419
1345
|
interface->Freeze(ok);
|
1420
|
-
ASSERT(ok);
|
1346
|
+
ASSERT(*ok);
|
1347
|
+
interface->Unify(scope->interface(), zone(), ok);
|
1348
|
+
ASSERT(*ok);
|
1421
1349
|
return result;
|
1422
1350
|
}
|
1423
1351
|
|
@@ -1442,14 +1370,14 @@ Block* Parser::ParseImportDeclaration(bool* ok) {
|
|
1442
1370
|
// TODO(ES6): implement destructuring ImportSpecifiers
|
1443
1371
|
|
1444
1372
|
Expect(Token::IMPORT, CHECK_OK);
|
1445
|
-
ZoneStringList names(1);
|
1373
|
+
ZoneStringList names(1, zone());
|
1446
1374
|
|
1447
1375
|
Handle<String> name = ParseIdentifierName(CHECK_OK);
|
1448
|
-
names.Add(name);
|
1376
|
+
names.Add(name, zone());
|
1449
1377
|
while (peek() == Token::COMMA) {
|
1450
1378
|
Consume(Token::COMMA);
|
1451
1379
|
name = ParseIdentifierName(CHECK_OK);
|
1452
|
-
names.Add(name);
|
1380
|
+
names.Add(name, zone());
|
1453
1381
|
}
|
1454
1382
|
|
1455
1383
|
ExpectContextualKeyword("from", CHECK_OK);
|
@@ -1464,8 +1392,8 @@ Block* Parser::ParseImportDeclaration(bool* ok) {
|
|
1464
1392
|
if (FLAG_print_interface_details)
|
1465
1393
|
PrintF("# Import %s ", names[i]->ToAsciiArray());
|
1466
1394
|
#endif
|
1467
|
-
Interface* interface = Interface::NewUnknown();
|
1468
|
-
module->interface()->Add(names[i], interface, ok);
|
1395
|
+
Interface* interface = Interface::NewUnknown(zone());
|
1396
|
+
module->interface()->Add(names[i], interface, zone(), ok);
|
1469
1397
|
if (!*ok) {
|
1470
1398
|
#ifdef DEBUG
|
1471
1399
|
if (FLAG_print_interfaces) {
|
@@ -1481,7 +1409,6 @@ Block* Parser::ParseImportDeclaration(bool* ok) {
|
|
1481
1409
|
Declaration* declaration =
|
1482
1410
|
factory()->NewImportDeclaration(proxy, module, top_scope_);
|
1483
1411
|
Declare(declaration, true, CHECK_OK);
|
1484
|
-
// TODO(rossberg): Add initialization statement to block.
|
1485
1412
|
}
|
1486
1413
|
|
1487
1414
|
return block;
|
@@ -1500,17 +1427,17 @@ Statement* Parser::ParseExportDeclaration(bool* ok) {
|
|
1500
1427
|
Expect(Token::EXPORT, CHECK_OK);
|
1501
1428
|
|
1502
1429
|
Statement* result = NULL;
|
1503
|
-
ZoneStringList names(1);
|
1430
|
+
ZoneStringList names(1, zone());
|
1504
1431
|
switch (peek()) {
|
1505
1432
|
case Token::IDENTIFIER: {
|
1506
1433
|
Handle<String> name = ParseIdentifier(CHECK_OK);
|
1507
1434
|
// Handle 'module' as a context-sensitive keyword.
|
1508
|
-
if (!name->
|
1509
|
-
names.Add(name);
|
1435
|
+
if (!name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("module"))) {
|
1436
|
+
names.Add(name, zone());
|
1510
1437
|
while (peek() == Token::COMMA) {
|
1511
1438
|
Consume(Token::COMMA);
|
1512
1439
|
name = ParseIdentifier(CHECK_OK);
|
1513
|
-
names.Add(name);
|
1440
|
+
names.Add(name, zone());
|
1514
1441
|
}
|
1515
1442
|
ExpectSemicolon(CHECK_OK);
|
1516
1443
|
result = factory()->NewEmptyStatement();
|
@@ -1543,8 +1470,10 @@ Statement* Parser::ParseExportDeclaration(bool* ok) {
|
|
1543
1470
|
if (FLAG_print_interface_details)
|
1544
1471
|
PrintF("# Export %s ", names[i]->ToAsciiArray());
|
1545
1472
|
#endif
|
1546
|
-
Interface* inner = Interface::NewUnknown();
|
1547
|
-
interface->Add(names[i], inner, CHECK_OK);
|
1473
|
+
Interface* inner = Interface::NewUnknown(zone());
|
1474
|
+
interface->Add(names[i], inner, zone(), CHECK_OK);
|
1475
|
+
if (!*ok)
|
1476
|
+
return NULL;
|
1548
1477
|
VariableProxy* proxy = NewUnresolved(names[i], LET, inner);
|
1549
1478
|
USE(proxy);
|
1550
1479
|
// TODO(rossberg): Rethink whether we actually need to store export
|
@@ -1677,7 +1606,7 @@ Statement* Parser::ParseStatement(ZoneStringList* labels, bool* ok) {
|
|
1677
1606
|
if (statement) {
|
1678
1607
|
statement->set_statement_pos(statement_pos);
|
1679
1608
|
}
|
1680
|
-
if (result) result->AddStatement(statement);
|
1609
|
+
if (result) result->AddStatement(statement, zone());
|
1681
1610
|
return result;
|
1682
1611
|
}
|
1683
1612
|
|
@@ -1720,7 +1649,7 @@ VariableProxy* Parser::NewUnresolved(
|
|
1720
1649
|
// Let/const variables in harmony mode are always added to the immediately
|
1721
1650
|
// enclosing scope.
|
1722
1651
|
return DeclarationScope(mode)->NewUnresolved(
|
1723
|
-
factory(), name, scanner().location().beg_pos
|
1652
|
+
factory(), name, interface, scanner().location().beg_pos);
|
1724
1653
|
}
|
1725
1654
|
|
1726
1655
|
|
@@ -1731,7 +1660,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
|
|
1731
1660
|
Scope* declaration_scope = DeclarationScope(mode);
|
1732
1661
|
Variable* var = NULL;
|
1733
1662
|
|
1734
|
-
// If a
|
1663
|
+
// If a suitable scope exists, then we can statically declare this
|
1735
1664
|
// variable and also set its mode. In any case, a Declaration node
|
1736
1665
|
// will be added to the scope so that the declaration can be added
|
1737
1666
|
// to the corresponding activation frame at runtime if necessary.
|
@@ -1739,56 +1668,57 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
|
|
1739
1668
|
// to the calling function context.
|
1740
1669
|
// Similarly, strict mode eval scope does not leak variable declarations to
|
1741
1670
|
// the caller's scope so we declare all locals, too.
|
1742
|
-
// Also for block scoped let/const bindings the variable can be
|
1743
|
-
// statically declared.
|
1744
1671
|
if (declaration_scope->is_function_scope() ||
|
1745
1672
|
declaration_scope->is_strict_or_extended_eval_scope() ||
|
1746
1673
|
declaration_scope->is_block_scope() ||
|
1747
1674
|
declaration_scope->is_module_scope() ||
|
1748
|
-
|
1749
|
-
// Declare the variable in the
|
1750
|
-
|
1675
|
+
declaration_scope->is_global_scope()) {
|
1676
|
+
// Declare the variable in the declaration scope.
|
1677
|
+
// For the global scope, we have to check for collisions with earlier
|
1678
|
+
// (i.e., enclosing) global scopes, to maintain the illusion of a single
|
1679
|
+
// global scope.
|
1680
|
+
var = declaration_scope->is_global_scope()
|
1681
|
+
? declaration_scope->Lookup(name)
|
1682
|
+
: declaration_scope->LocalLookup(name);
|
1751
1683
|
if (var == NULL) {
|
1752
1684
|
// Declare the name.
|
1753
1685
|
var = declaration_scope->DeclareLocal(
|
1754
1686
|
name, mode, declaration->initialization(), proxy->interface());
|
1755
|
-
} else
|
1687
|
+
} else if ((mode != VAR || var->mode() != VAR) &&
|
1688
|
+
(!declaration_scope->is_global_scope() ||
|
1689
|
+
IsLexicalVariableMode(mode) ||
|
1690
|
+
IsLexicalVariableMode(var->mode()))) {
|
1756
1691
|
// The name was declared in this scope before; check for conflicting
|
1757
1692
|
// re-declarations. We have a conflict if either of the declarations is
|
1758
|
-
// not a var
|
1693
|
+
// not a var (in the global scope, we also have to ignore legacy const for
|
1694
|
+
// compatibility). There is similar code in runtime.cc in the Declare
|
1759
1695
|
// functions. The function CheckNonConflictingScope checks for conflicting
|
1760
1696
|
// var and let bindings from different scopes whereas this is a check for
|
1761
1697
|
// conflicting declarations within the same scope. This check also covers
|
1698
|
+
// the special case
|
1762
1699
|
//
|
1763
1700
|
// function () { let x; { var x; } }
|
1764
1701
|
//
|
1765
1702
|
// because the var declaration is hoisted to the function scope where 'x'
|
1766
1703
|
// is already bound.
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
const char* elms[2] = { "Variable", *c_string };
|
1778
|
-
Vector<const char*> args(elms, 2);
|
1779
|
-
ReportMessage("redeclaration", args);
|
1780
|
-
*ok = false;
|
1781
|
-
return;
|
1782
|
-
}
|
1783
|
-
const char* type = (var->mode() == VAR)
|
1784
|
-
? "var" : var->is_const_mode() ? "const" : "let";
|
1785
|
-
Handle<String> type_string =
|
1786
|
-
isolate()->factory()->NewStringFromUtf8(CStrVector(type), TENURED);
|
1787
|
-
Expression* expression =
|
1788
|
-
NewThrowTypeError(isolate()->factory()->redeclaration_symbol(),
|
1789
|
-
type_string, name);
|
1790
|
-
declaration_scope->SetIllegalRedeclaration(expression);
|
1704
|
+
ASSERT(IsDeclaredVariableMode(var->mode()));
|
1705
|
+
if (is_extended_mode()) {
|
1706
|
+
// In harmony mode we treat re-declarations as early errors. See
|
1707
|
+
// ES5 16 for a definition of early errors.
|
1708
|
+
SmartArrayPointer<char> c_string = name->ToCString(DISALLOW_NULLS);
|
1709
|
+
const char* elms[2] = { "Variable", *c_string };
|
1710
|
+
Vector<const char*> args(elms, 2);
|
1711
|
+
ReportMessage("redeclaration", args);
|
1712
|
+
*ok = false;
|
1713
|
+
return;
|
1791
1714
|
}
|
1715
|
+
Handle<String> type_string =
|
1716
|
+
isolate()->factory()->NewStringFromUtf8(CStrVector("Variable"),
|
1717
|
+
TENURED);
|
1718
|
+
Expression* expression =
|
1719
|
+
NewThrowTypeError(isolate()->factory()->redeclaration_symbol(),
|
1720
|
+
type_string, name);
|
1721
|
+
declaration_scope->SetIllegalRedeclaration(expression);
|
1792
1722
|
}
|
1793
1723
|
}
|
1794
1724
|
|
@@ -1810,8 +1740,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
|
|
1810
1740
|
// Runtime::DeclareContextSlot() calls.
|
1811
1741
|
declaration_scope->AddDeclaration(declaration);
|
1812
1742
|
|
1813
|
-
if (
|
1814
|
-
declaration_scope->is_global_scope()) {
|
1743
|
+
if (mode == CONST && declaration_scope->is_global_scope()) {
|
1815
1744
|
// For global const variables we bind the proxy to a variable.
|
1816
1745
|
ASSERT(resolve); // should be set by all callers
|
1817
1746
|
Variable::Kind kind = Variable::NORMAL;
|
@@ -1870,7 +1799,7 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
|
|
1870
1799
|
if (FLAG_print_interface_details)
|
1871
1800
|
PrintF("# Declare %s\n", var->name()->ToAsciiArray());
|
1872
1801
|
#endif
|
1873
|
-
proxy->interface()->Unify(var->interface(), &ok);
|
1802
|
+
proxy->interface()->Unify(var->interface(), zone(), &ok);
|
1874
1803
|
if (!ok) {
|
1875
1804
|
#ifdef DEBUG
|
1876
1805
|
if (FLAG_print_interfaces) {
|
@@ -1936,7 +1865,7 @@ Statement* Parser::ParseNativeDeclaration(bool* ok) {
|
|
1936
1865
|
// TODO(1240846): It's weird that native function declarations are
|
1937
1866
|
// introduced dynamically when we meet their declarations, whereas
|
1938
1867
|
// other functions are set up when entering the surrounding scope.
|
1939
|
-
VariableProxy* proxy = NewUnresolved(name, VAR);
|
1868
|
+
VariableProxy* proxy = NewUnresolved(name, VAR, Interface::NewValue());
|
1940
1869
|
Declaration* declaration =
|
1941
1870
|
factory()->NewVariableDeclaration(proxy, VAR, top_scope_);
|
1942
1871
|
Declare(declaration, true, CHECK_OK);
|
@@ -1962,14 +1891,17 @@ Statement* Parser::ParseFunctionDeclaration(ZoneStringList* names, bool* ok) {
|
|
1962
1891
|
FunctionLiteral::DECLARATION,
|
1963
1892
|
CHECK_OK);
|
1964
1893
|
// Even if we're not at the top-level of the global or a function
|
1965
|
-
// scope, we treat
|
1894
|
+
// scope, we treat it as such and introduce the function with its
|
1966
1895
|
// initial value upon entering the corresponding scope.
|
1967
|
-
|
1968
|
-
|
1896
|
+
// In extended mode, a function behaves as a lexical binding, except in the
|
1897
|
+
// global scope.
|
1898
|
+
VariableMode mode =
|
1899
|
+
is_extended_mode() && !top_scope_->is_global_scope() ? LET : VAR;
|
1900
|
+
VariableProxy* proxy = NewUnresolved(name, mode, Interface::NewValue());
|
1969
1901
|
Declaration* declaration =
|
1970
1902
|
factory()->NewFunctionDeclaration(proxy, mode, fun, top_scope_);
|
1971
1903
|
Declare(declaration, true, CHECK_OK);
|
1972
|
-
if (names) names->Add(name);
|
1904
|
+
if (names) names->Add(name, zone());
|
1973
1905
|
return factory()->NewEmptyStatement();
|
1974
1906
|
}
|
1975
1907
|
|
@@ -1987,12 +1919,10 @@ Block* Parser::ParseBlock(ZoneStringList* labels, bool* ok) {
|
|
1987
1919
|
Block* result = factory()->NewBlock(labels, 16, false);
|
1988
1920
|
Target target(&this->target_stack_, result);
|
1989
1921
|
Expect(Token::LBRACE, CHECK_OK);
|
1990
|
-
InitializationBlockFinder block_finder(top_scope_, target_stack_);
|
1991
1922
|
while (peek() != Token::RBRACE) {
|
1992
1923
|
Statement* stat = ParseStatement(NULL, CHECK_OK);
|
1993
1924
|
if (stat && !stat->IsEmpty()) {
|
1994
|
-
result->AddStatement(stat);
|
1995
|
-
block_finder.Update(stat);
|
1925
|
+
result->AddStatement(stat, zone());
|
1996
1926
|
}
|
1997
1927
|
}
|
1998
1928
|
Expect(Token::RBRACE, CHECK_OK);
|
@@ -2014,16 +1944,14 @@ Block* Parser::ParseScopedBlock(ZoneStringList* labels, bool* ok) {
|
|
2014
1944
|
Expect(Token::LBRACE, CHECK_OK);
|
2015
1945
|
block_scope->set_start_position(scanner().location().beg_pos);
|
2016
1946
|
{ BlockState block_state(this, block_scope);
|
2017
|
-
TargetCollector collector;
|
1947
|
+
TargetCollector collector(zone());
|
2018
1948
|
Target target(&this->target_stack_, &collector);
|
2019
1949
|
Target target_body(&this->target_stack_, body);
|
2020
|
-
InitializationBlockFinder block_finder(top_scope_, target_stack_);
|
2021
1950
|
|
2022
1951
|
while (peek() != Token::RBRACE) {
|
2023
1952
|
Statement* stat = ParseBlockElement(NULL, CHECK_OK);
|
2024
1953
|
if (stat && !stat->IsEmpty()) {
|
2025
|
-
body->AddStatement(stat);
|
2026
|
-
block_finder.Update(stat);
|
1954
|
+
body->AddStatement(stat, zone());
|
2027
1955
|
}
|
2028
1956
|
}
|
2029
1957
|
}
|
@@ -2197,7 +2125,9 @@ Block* Parser::ParseVariableDeclarations(
|
|
2197
2125
|
// For let/const declarations in harmony mode, we can also immediately
|
2198
2126
|
// pre-resolve the proxy because it resides in the same scope as the
|
2199
2127
|
// declaration.
|
2200
|
-
|
2128
|
+
Interface* interface =
|
2129
|
+
is_const ? Interface::NewConst() : Interface::NewValue();
|
2130
|
+
VariableProxy* proxy = NewUnresolved(name, mode, interface);
|
2201
2131
|
Declaration* declaration =
|
2202
2132
|
factory()->NewVariableDeclaration(proxy, mode, top_scope_);
|
2203
2133
|
Declare(declaration, mode != VAR, CHECK_OK);
|
@@ -2208,7 +2138,7 @@ Block* Parser::ParseVariableDeclarations(
|
|
2208
2138
|
*ok = false;
|
2209
2139
|
return NULL;
|
2210
2140
|
}
|
2211
|
-
if (names) names->Add(name);
|
2141
|
+
if (names) names->Add(name, zone());
|
2212
2142
|
|
2213
2143
|
// Parse initialization expression if present and/or needed. A
|
2214
2144
|
// declaration of the form:
|
@@ -2285,15 +2215,17 @@ Block* Parser::ParseVariableDeclarations(
|
|
2285
2215
|
// declaration statement has been executed. This is important in
|
2286
2216
|
// browsers where the global object (window) has lots of
|
2287
2217
|
// properties defined in prototype objects.
|
2288
|
-
if (initialization_scope->is_global_scope()
|
2218
|
+
if (initialization_scope->is_global_scope() &&
|
2219
|
+
!IsLexicalVariableMode(mode)) {
|
2289
2220
|
// Compute the arguments for the runtime call.
|
2290
|
-
ZoneList<Expression*>* arguments =
|
2221
|
+
ZoneList<Expression*>* arguments =
|
2222
|
+
new(zone()) ZoneList<Expression*>(3, zone());
|
2291
2223
|
// We have at least 1 parameter.
|
2292
|
-
arguments->Add(factory()->NewLiteral(name));
|
2224
|
+
arguments->Add(factory()->NewLiteral(name), zone());
|
2293
2225
|
CallRuntime* initialize;
|
2294
2226
|
|
2295
2227
|
if (is_const) {
|
2296
|
-
arguments->Add(value);
|
2228
|
+
arguments->Add(value, zone());
|
2297
2229
|
value = NULL; // zap the value to avoid the unnecessary assignment
|
2298
2230
|
|
2299
2231
|
// Construct the call to Runtime_InitializeConstGlobal
|
@@ -2308,14 +2240,14 @@ Block* Parser::ParseVariableDeclarations(
|
|
2308
2240
|
// Add strict mode.
|
2309
2241
|
// We may want to pass singleton to avoid Literal allocations.
|
2310
2242
|
LanguageMode language_mode = initialization_scope->language_mode();
|
2311
|
-
arguments->Add(factory()->NewNumberLiteral(language_mode));
|
2243
|
+
arguments->Add(factory()->NewNumberLiteral(language_mode), zone());
|
2312
2244
|
|
2313
2245
|
// Be careful not to assign a value to the global variable if
|
2314
2246
|
// we're in a with. The initialization value should not
|
2315
2247
|
// necessarily be stored in the global object in that case,
|
2316
2248
|
// which is why we need to generate a separate assignment node.
|
2317
2249
|
if (value != NULL && !inside_with()) {
|
2318
|
-
arguments->Add(value);
|
2250
|
+
arguments->Add(value, zone());
|
2319
2251
|
value = NULL; // zap the value to avoid the unnecessary assignment
|
2320
2252
|
}
|
2321
2253
|
|
@@ -2329,7 +2261,8 @@ Block* Parser::ParseVariableDeclarations(
|
|
2329
2261
|
arguments);
|
2330
2262
|
}
|
2331
2263
|
|
2332
|
-
block->AddStatement(factory()->NewExpressionStatement(initialize)
|
2264
|
+
block->AddStatement(factory()->NewExpressionStatement(initialize),
|
2265
|
+
zone());
|
2333
2266
|
} else if (needs_init) {
|
2334
2267
|
// Constant initializations always assign to the declared constant which
|
2335
2268
|
// is always at the function scope level. This is only relevant for
|
@@ -2343,7 +2276,8 @@ Block* Parser::ParseVariableDeclarations(
|
|
2343
2276
|
ASSERT(value != NULL);
|
2344
2277
|
Assignment* assignment =
|
2345
2278
|
factory()->NewAssignment(init_op, proxy, value, position);
|
2346
|
-
block->AddStatement(factory()->NewExpressionStatement(assignment)
|
2279
|
+
block->AddStatement(factory()->NewExpressionStatement(assignment),
|
2280
|
+
zone());
|
2347
2281
|
value = NULL;
|
2348
2282
|
}
|
2349
2283
|
|
@@ -2355,10 +2289,11 @@ Block* Parser::ParseVariableDeclarations(
|
|
2355
2289
|
// if they are inside a 'with' statement - they may change a 'with' object
|
2356
2290
|
// property).
|
2357
2291
|
VariableProxy* proxy =
|
2358
|
-
initialization_scope->NewUnresolved(factory(), name);
|
2292
|
+
initialization_scope->NewUnresolved(factory(), name, interface);
|
2359
2293
|
Assignment* assignment =
|
2360
2294
|
factory()->NewAssignment(init_op, proxy, value, position);
|
2361
|
-
block->AddStatement(factory()->NewExpressionStatement(assignment)
|
2295
|
+
block->AddStatement(factory()->NewExpressionStatement(assignment),
|
2296
|
+
zone());
|
2362
2297
|
}
|
2363
2298
|
|
2364
2299
|
if (fni_ != NULL) fni_->Leave();
|
@@ -2412,8 +2347,10 @@ Statement* Parser::ParseExpressionOrLabelledStatement(ZoneStringList* labels,
|
|
2412
2347
|
*ok = false;
|
2413
2348
|
return NULL;
|
2414
2349
|
}
|
2415
|
-
if (labels == NULL)
|
2416
|
-
|
2350
|
+
if (labels == NULL) {
|
2351
|
+
labels = new(zone()) ZoneStringList(4, zone());
|
2352
|
+
}
|
2353
|
+
labels->Add(label, zone());
|
2417
2354
|
// Remove the "ghost" variable that turned out to be a label
|
2418
2355
|
// from the top scope. This way, we don't try to resolve it
|
2419
2356
|
// during the scope processing.
|
@@ -2625,12 +2562,13 @@ CaseClause* Parser::ParseCaseClause(bool* default_seen_ptr, bool* ok) {
|
|
2625
2562
|
}
|
2626
2563
|
Expect(Token::COLON, CHECK_OK);
|
2627
2564
|
int pos = scanner().location().beg_pos;
|
2628
|
-
ZoneList<Statement*>* statements =
|
2565
|
+
ZoneList<Statement*>* statements =
|
2566
|
+
new(zone()) ZoneList<Statement*>(5, zone());
|
2629
2567
|
while (peek() != Token::CASE &&
|
2630
2568
|
peek() != Token::DEFAULT &&
|
2631
2569
|
peek() != Token::RBRACE) {
|
2632
2570
|
Statement* stat = ParseStatement(NULL, CHECK_OK);
|
2633
|
-
statements->Add(stat);
|
2571
|
+
statements->Add(stat, zone());
|
2634
2572
|
}
|
2635
2573
|
|
2636
2574
|
return new(zone()) CaseClause(isolate(), label, statements, pos);
|
@@ -2651,11 +2589,11 @@ SwitchStatement* Parser::ParseSwitchStatement(ZoneStringList* labels,
|
|
2651
2589
|
Expect(Token::RPAREN, CHECK_OK);
|
2652
2590
|
|
2653
2591
|
bool default_seen = false;
|
2654
|
-
ZoneList<CaseClause*>* cases = new(zone()) ZoneList<CaseClause*>(4);
|
2592
|
+
ZoneList<CaseClause*>* cases = new(zone()) ZoneList<CaseClause*>(4, zone());
|
2655
2593
|
Expect(Token::LBRACE, CHECK_OK);
|
2656
2594
|
while (peek() != Token::RBRACE) {
|
2657
2595
|
CaseClause* clause = ParseCaseClause(&default_seen, CHECK_OK);
|
2658
|
-
cases->Add(clause);
|
2596
|
+
cases->Add(clause, zone());
|
2659
2597
|
}
|
2660
2598
|
Expect(Token::RBRACE, CHECK_OK);
|
2661
2599
|
|
@@ -2696,7 +2634,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
|
|
2696
2634
|
|
2697
2635
|
Expect(Token::TRY, CHECK_OK);
|
2698
2636
|
|
2699
|
-
TargetCollector try_collector;
|
2637
|
+
TargetCollector try_collector(zone());
|
2700
2638
|
Block* try_block;
|
2701
2639
|
|
2702
2640
|
{ Target target(&this->target_stack_, &try_collector);
|
@@ -2714,7 +2652,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
|
|
2714
2652
|
// then we will need to collect escaping targets from the catch
|
2715
2653
|
// block. Since we don't know yet if there will be a finally block, we
|
2716
2654
|
// always collect the targets.
|
2717
|
-
TargetCollector catch_collector;
|
2655
|
+
TargetCollector catch_collector(zone());
|
2718
2656
|
Scope* catch_scope = NULL;
|
2719
2657
|
Variable* catch_variable = NULL;
|
2720
2658
|
Block* catch_block = NULL;
|
@@ -2769,7 +2707,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
|
|
2769
2707
|
index, try_block, catch_scope, catch_variable, catch_block);
|
2770
2708
|
statement->set_escaping_targets(try_collector.targets());
|
2771
2709
|
try_block = factory()->NewBlock(NULL, 1, false);
|
2772
|
-
try_block->AddStatement(statement);
|
2710
|
+
try_block->AddStatement(statement, zone());
|
2773
2711
|
catch_block = NULL; // Clear to indicate it's been handled.
|
2774
2712
|
}
|
2775
2713
|
|
@@ -2785,7 +2723,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
|
|
2785
2723
|
int index = current_function_state_->NextHandlerIndex();
|
2786
2724
|
result = factory()->NewTryFinallyStatement(index, try_block, finally_block);
|
2787
2725
|
// Combine the jump targets of the try block and the possible catch block.
|
2788
|
-
try_collector.targets()->AddAll(*catch_collector.targets());
|
2726
|
+
try_collector.targets()->AddAll(*catch_collector.targets(), zone());
|
2789
2727
|
}
|
2790
2728
|
|
2791
2729
|
result->set_escaping_targets(try_collector.targets());
|
@@ -2859,12 +2797,14 @@ Statement* Parser::ParseForStatement(ZoneStringList* labels, bool* ok) {
|
|
2859
2797
|
for_scope->set_start_position(scanner().location().beg_pos);
|
2860
2798
|
if (peek() != Token::SEMICOLON) {
|
2861
2799
|
if (peek() == Token::VAR || peek() == Token::CONST) {
|
2800
|
+
bool is_const = peek() == Token::CONST;
|
2862
2801
|
Handle<String> name;
|
2863
2802
|
Block* variable_statement =
|
2864
2803
|
ParseVariableDeclarations(kForStatement, NULL, NULL, &name, CHECK_OK);
|
2865
2804
|
|
2866
2805
|
if (peek() == Token::IN && !name.is_null()) {
|
2867
|
-
|
2806
|
+
Interface* interface =
|
2807
|
+
is_const ? Interface::NewConst() : Interface::NewValue();
|
2868
2808
|
ForInStatement* loop = factory()->NewForInStatement(labels);
|
2869
2809
|
Target target(&this->target_stack_, loop);
|
2870
2810
|
|
@@ -2872,11 +2812,13 @@ Statement* Parser::ParseForStatement(ZoneStringList* labels, bool* ok) {
|
|
2872
2812
|
Expression* enumerable = ParseExpression(true, CHECK_OK);
|
2873
2813
|
Expect(Token::RPAREN, CHECK_OK);
|
2874
2814
|
|
2815
|
+
VariableProxy* each =
|
2816
|
+
top_scope_->NewUnresolved(factory(), name, interface);
|
2875
2817
|
Statement* body = ParseStatement(NULL, CHECK_OK);
|
2876
2818
|
loop->Initialize(each, enumerable, body);
|
2877
2819
|
Block* result = factory()->NewBlock(NULL, 2, false);
|
2878
|
-
result->AddStatement(variable_statement);
|
2879
|
-
result->AddStatement(loop);
|
2820
|
+
result->AddStatement(variable_statement, zone());
|
2821
|
+
result->AddStatement(loop, zone());
|
2880
2822
|
top_scope_ = saved_scope;
|
2881
2823
|
for_scope->set_end_position(scanner().location().end_pos);
|
2882
2824
|
for_scope = for_scope->FinalizeBlockScope();
|
@@ -2909,25 +2851,33 @@ Statement* Parser::ParseForStatement(ZoneStringList* labels, bool* ok) {
|
|
2909
2851
|
|
2910
2852
|
// TODO(keuchel): Move the temporary variable to the block scope, after
|
2911
2853
|
// implementing stack allocated block scoped variables.
|
2912
|
-
|
2854
|
+
Factory* heap_factory = isolate()->factory();
|
2855
|
+
Handle<String> tempstr =
|
2856
|
+
heap_factory->NewConsString(heap_factory->dot_for_symbol(), name);
|
2857
|
+
Handle<String> tempname = heap_factory->LookupSymbol(tempstr);
|
2858
|
+
Variable* temp = top_scope_->DeclarationScope()->NewTemporary(tempname);
|
2913
2859
|
VariableProxy* temp_proxy = factory()->NewVariableProxy(temp);
|
2914
|
-
VariableProxy* each = top_scope_->NewUnresolved(factory(), name);
|
2915
2860
|
ForInStatement* loop = factory()->NewForInStatement(labels);
|
2916
2861
|
Target target(&this->target_stack_, loop);
|
2917
2862
|
|
2863
|
+
// The expression does not see the loop variable.
|
2918
2864
|
Expect(Token::IN, CHECK_OK);
|
2865
|
+
top_scope_ = saved_scope;
|
2919
2866
|
Expression* enumerable = ParseExpression(true, CHECK_OK);
|
2867
|
+
top_scope_ = for_scope;
|
2920
2868
|
Expect(Token::RPAREN, CHECK_OK);
|
2921
2869
|
|
2870
|
+
VariableProxy* each =
|
2871
|
+
top_scope_->NewUnresolved(factory(), name, Interface::NewValue());
|
2922
2872
|
Statement* body = ParseStatement(NULL, CHECK_OK);
|
2923
2873
|
Block* body_block = factory()->NewBlock(NULL, 3, false);
|
2924
2874
|
Assignment* assignment = factory()->NewAssignment(
|
2925
2875
|
Token::ASSIGN, each, temp_proxy, RelocInfo::kNoPosition);
|
2926
2876
|
Statement* assignment_statement =
|
2927
2877
|
factory()->NewExpressionStatement(assignment);
|
2928
|
-
body_block->AddStatement(variable_statement);
|
2929
|
-
body_block->AddStatement(assignment_statement);
|
2930
|
-
body_block->AddStatement(body);
|
2878
|
+
body_block->AddStatement(variable_statement, zone());
|
2879
|
+
body_block->AddStatement(assignment_statement, zone());
|
2880
|
+
body_block->AddStatement(body, zone());
|
2931
2881
|
loop->Initialize(temp_proxy, enumerable, body_block);
|
2932
2882
|
top_scope_ = saved_scope;
|
2933
2883
|
for_scope->set_end_position(scanner().location().end_pos);
|
@@ -3010,8 +2960,8 @@ Statement* Parser::ParseForStatement(ZoneStringList* labels, bool* ok) {
|
|
3010
2960
|
// }
|
3011
2961
|
ASSERT(init != NULL);
|
3012
2962
|
Block* result = factory()->NewBlock(NULL, 2, false);
|
3013
|
-
result->AddStatement(init);
|
3014
|
-
result->AddStatement(loop);
|
2963
|
+
result->AddStatement(init, zone());
|
2964
|
+
result->AddStatement(loop, zone());
|
3015
2965
|
result->set_scope(for_scope);
|
3016
2966
|
if (loop) loop->Initialize(NULL, cond, next, body);
|
3017
2967
|
return result;
|
@@ -3059,6 +3009,7 @@ Expression* Parser::ParseAssignmentExpression(bool accept_IN, bool* ok) {
|
|
3059
3009
|
// side expression. We could report this as a syntax error here but
|
3060
3010
|
// for compatibility with JSC we choose to report the error at
|
3061
3011
|
// runtime.
|
3012
|
+
// TODO(ES5): Should change parsing for spec conformance.
|
3062
3013
|
if (expression == NULL || !expression->IsValidLeftHandSide()) {
|
3063
3014
|
Handle<String> type =
|
3064
3015
|
isolate()->factory()->invalid_lhs_in_assignment_symbol();
|
@@ -3262,7 +3213,8 @@ Expression* Parser::ParseUnaryExpression(bool* ok) {
|
|
3262
3213
|
if (op == Token::NOT) {
|
3263
3214
|
// Convert the literal to a boolean condition and negate it.
|
3264
3215
|
bool condition = literal->ToBoolean()->IsTrue();
|
3265
|
-
Handle<Object> result(isolate()->heap()->ToBoolean(!condition)
|
3216
|
+
Handle<Object> result(isolate()->heap()->ToBoolean(!condition),
|
3217
|
+
isolate());
|
3266
3218
|
return factory()->NewLiteral(result);
|
3267
3219
|
} else if (literal->IsNumber()) {
|
3268
3220
|
// Compute some expressions involving only number literals.
|
@@ -3393,6 +3345,12 @@ Expression* Parser::ParseLeftHandSideExpression(bool* ok) {
|
|
3393
3345
|
// should not point to the closing brace otherwise it will intersect
|
3394
3346
|
// with positions recorded for function literal and confuse debugger.
|
3395
3347
|
pos = scanner().peek_location().beg_pos;
|
3348
|
+
// Also the trailing parenthesis are a hint that the function will
|
3349
|
+
// be called immediately. If we happen to have parsed a preceding
|
3350
|
+
// function literal eagerly, we can also compile it eagerly.
|
3351
|
+
if (result->IsFunctionLiteral() && mode() == PARSE_EAGERLY) {
|
3352
|
+
result->AsFunctionLiteral()->set_parenthesized();
|
3353
|
+
}
|
3396
3354
|
}
|
3397
3355
|
ZoneList<Expression*>* args = ParseArguments(CHECK_OK);
|
3398
3356
|
|
@@ -3454,7 +3412,7 @@ Expression* Parser::ParseNewPrefix(PositionStack* stack, bool* ok) {
|
|
3454
3412
|
if (!stack->is_empty()) {
|
3455
3413
|
int last = stack->pop();
|
3456
3414
|
result = factory()->NewCallNew(
|
3457
|
-
result, new(zone()) ZoneList<Expression*>(0), last);
|
3415
|
+
result, new(zone()) ZoneList<Expression*>(0, zone()), last);
|
3458
3416
|
}
|
3459
3417
|
return result;
|
3460
3418
|
}
|
@@ -3644,9 +3602,9 @@ Expression* Parser::ParsePrimaryExpression(bool* ok) {
|
|
3644
3602
|
if (FLAG_print_interface_details)
|
3645
3603
|
PrintF("# Variable %s ", name->ToAsciiArray());
|
3646
3604
|
#endif
|
3647
|
-
Interface* interface = Interface::NewUnknown();
|
3605
|
+
Interface* interface = Interface::NewUnknown(zone());
|
3648
3606
|
result = top_scope_->NewUnresolved(
|
3649
|
-
factory(), name, scanner().location().beg_pos
|
3607
|
+
factory(), name, interface, scanner().location().beg_pos);
|
3650
3608
|
break;
|
3651
3609
|
}
|
3652
3610
|
|
@@ -3744,7 +3702,7 @@ Expression* Parser::ParseArrayLiteral(bool* ok) {
|
|
3744
3702
|
// ArrayLiteral ::
|
3745
3703
|
// '[' Expression? (',' Expression?)* ']'
|
3746
3704
|
|
3747
|
-
ZoneList<Expression*>* values = new(zone()) ZoneList<Expression*>(4);
|
3705
|
+
ZoneList<Expression*>* values = new(zone()) ZoneList<Expression*>(4, zone());
|
3748
3706
|
Expect(Token::LBRACK, CHECK_OK);
|
3749
3707
|
while (peek() != Token::RBRACK) {
|
3750
3708
|
Expression* elem;
|
@@ -3753,7 +3711,7 @@ Expression* Parser::ParseArrayLiteral(bool* ok) {
|
|
3753
3711
|
} else {
|
3754
3712
|
elem = ParseAssignmentExpression(true, CHECK_OK);
|
3755
3713
|
}
|
3756
|
-
values->Add(elem);
|
3714
|
+
values->Add(elem, zone());
|
3757
3715
|
if (peek() != Token::RBRACK) {
|
3758
3716
|
Expect(Token::COMMA, CHECK_OK);
|
3759
3717
|
}
|
@@ -3764,17 +3722,16 @@ Expression* Parser::ParseArrayLiteral(bool* ok) {
|
|
3764
3722
|
int literal_index = current_function_state_->NextMaterializedLiteralIndex();
|
3765
3723
|
|
3766
3724
|
// Allocate a fixed array to hold all the object literals.
|
3767
|
-
Handle<
|
3768
|
-
isolate()->factory()->
|
3769
|
-
|
3770
|
-
|
3771
|
-
bool has_only_undefined_values = true;
|
3772
|
-
bool has_hole_values = false;
|
3725
|
+
Handle<JSArray> array =
|
3726
|
+
isolate()->factory()->NewJSArray(0, FAST_HOLEY_SMI_ELEMENTS);
|
3727
|
+
isolate()->factory()->SetElementsCapacityAndLength(
|
3728
|
+
array, values->length(), values->length());
|
3773
3729
|
|
3774
3730
|
// Fill in the literals.
|
3775
3731
|
Heap* heap = isolate()->heap();
|
3776
3732
|
bool is_simple = true;
|
3777
3733
|
int depth = 1;
|
3734
|
+
bool is_holey = false;
|
3778
3735
|
for (int i = 0, n = values->length(); i < n; i++) {
|
3779
3736
|
MaterializedLiteral* m_literal = values->at(i)->AsMaterializedLiteral();
|
3780
3737
|
if (m_literal != NULL && m_literal->depth() + 1 > depth) {
|
@@ -3782,91 +3739,33 @@ Expression* Parser::ParseArrayLiteral(bool* ok) {
|
|
3782
3739
|
}
|
3783
3740
|
Handle<Object> boilerplate_value = GetBoilerplateValue(values->at(i));
|
3784
3741
|
if (boilerplate_value->IsTheHole()) {
|
3785
|
-
|
3786
|
-
object_literals->set_the_hole(i);
|
3787
|
-
if (elements_kind == FAST_DOUBLE_ELEMENTS) {
|
3788
|
-
double_literals->set_the_hole(i);
|
3789
|
-
}
|
3742
|
+
is_holey = true;
|
3790
3743
|
} else if (boilerplate_value->IsUndefined()) {
|
3791
3744
|
is_simple = false;
|
3792
|
-
|
3793
|
-
|
3794
|
-
double_literals->set(i, 0);
|
3795
|
-
}
|
3745
|
+
JSObject::SetOwnElement(
|
3746
|
+
array, i, handle(Smi::FromInt(0), isolate()), kNonStrictMode);
|
3796
3747
|
} else {
|
3797
|
-
|
3798
|
-
// literal element is not of a type that can be stored in the current
|
3799
|
-
// ElementsKind. Start with FAST_SMI_ONLY_ELEMENTS, and transition to
|
3800
|
-
// FAST_DOUBLE_ELEMENTS and FAST_ELEMENTS as necessary. Always remember
|
3801
|
-
// the tagged value, no matter what the ElementsKind is in case we
|
3802
|
-
// ultimately end up in FAST_ELEMENTS.
|
3803
|
-
has_only_undefined_values = false;
|
3804
|
-
object_literals->set(i, *boilerplate_value);
|
3805
|
-
if (elements_kind == FAST_SMI_ELEMENTS) {
|
3806
|
-
// Smi only elements. Notice if a transition to FAST_DOUBLE_ELEMENTS or
|
3807
|
-
// FAST_ELEMENTS is required.
|
3808
|
-
if (!boilerplate_value->IsSmi()) {
|
3809
|
-
if (boilerplate_value->IsNumber() && FLAG_smi_only_arrays) {
|
3810
|
-
// Allocate a double array on the FAST_DOUBLE_ELEMENTS transition to
|
3811
|
-
// avoid over-allocating in TENURED space.
|
3812
|
-
double_literals = isolate()->factory()->NewFixedDoubleArray(
|
3813
|
-
values->length(), TENURED);
|
3814
|
-
// Copy the contents of the FAST_SMI_ONLY_ELEMENT array to the
|
3815
|
-
// FAST_DOUBLE_ELEMENTS array so that they are in sync.
|
3816
|
-
for (int j = 0; j < i; ++j) {
|
3817
|
-
Object* smi_value = object_literals->get(j);
|
3818
|
-
if (smi_value->IsTheHole()) {
|
3819
|
-
double_literals->set_the_hole(j);
|
3820
|
-
} else {
|
3821
|
-
double_literals->set(j, Smi::cast(smi_value)->value());
|
3822
|
-
}
|
3823
|
-
}
|
3824
|
-
double_literals->set(i, boilerplate_value->Number());
|
3825
|
-
elements_kind = FAST_DOUBLE_ELEMENTS;
|
3826
|
-
} else {
|
3827
|
-
elements_kind = FAST_ELEMENTS;
|
3828
|
-
}
|
3829
|
-
}
|
3830
|
-
} else if (elements_kind == FAST_DOUBLE_ELEMENTS) {
|
3831
|
-
// Continue to store double values in to FAST_DOUBLE_ELEMENTS arrays
|
3832
|
-
// until the first value is seen that can't be stored as a double.
|
3833
|
-
if (boilerplate_value->IsNumber()) {
|
3834
|
-
double_literals->set(i, boilerplate_value->Number());
|
3835
|
-
} else {
|
3836
|
-
elements_kind = FAST_ELEMENTS;
|
3837
|
-
}
|
3838
|
-
}
|
3748
|
+
JSObject::SetOwnElement(array, i, boilerplate_value, kNonStrictMode);
|
3839
3749
|
}
|
3840
3750
|
}
|
3841
3751
|
|
3842
|
-
|
3843
|
-
// from a constant value should default to the slow case to avoid lots of
|
3844
|
-
// elements transitions on really small objects.
|
3845
|
-
if (has_only_undefined_values && values->length() <= 2) {
|
3846
|
-
elements_kind = FAST_ELEMENTS;
|
3847
|
-
}
|
3752
|
+
Handle<FixedArrayBase> element_values(array->elements());
|
3848
3753
|
|
3849
3754
|
// Simple and shallow arrays can be lazily copied, we transform the
|
3850
3755
|
// elements array to a copy-on-write array.
|
3851
3756
|
if (is_simple && depth == 1 && values->length() > 0 &&
|
3852
|
-
|
3853
|
-
|
3757
|
+
array->HasFastSmiOrObjectElements()) {
|
3758
|
+
element_values->set_map(heap->fixed_cow_array_map());
|
3854
3759
|
}
|
3855
3760
|
|
3856
|
-
Handle<FixedArrayBase> element_values = elements_kind == FAST_DOUBLE_ELEMENTS
|
3857
|
-
? Handle<FixedArrayBase>(double_literals)
|
3858
|
-
: Handle<FixedArrayBase>(object_literals);
|
3859
|
-
|
3860
3761
|
// Remember both the literal's constant values as well as the ElementsKind
|
3861
3762
|
// in a 2-element FixedArray.
|
3862
|
-
Handle<FixedArray> literals =
|
3863
|
-
isolate()->factory()->NewFixedArray(2, TENURED);
|
3763
|
+
Handle<FixedArray> literals = isolate()->factory()->NewFixedArray(2, TENURED);
|
3864
3764
|
|
3865
|
-
|
3866
|
-
|
3867
|
-
}
|
3765
|
+
ElementsKind kind = array->GetElementsKind();
|
3766
|
+
kind = is_holey ? GetHoleyElementsKind(kind) : GetPackedElementsKind(kind);
|
3868
3767
|
|
3869
|
-
literals->set(0, Smi::FromInt(
|
3768
|
+
literals->set(0, Smi::FromInt(kind));
|
3870
3769
|
literals->set(1, *element_values);
|
3871
3770
|
|
3872
3771
|
return factory()->NewArrayLiteral(
|
@@ -4093,7 +3992,7 @@ ObjectLiteral::Property* Parser::ParseObjectLiteralGetSet(bool is_getter,
|
|
4093
3992
|
next == Token::STRING || is_keyword) {
|
4094
3993
|
Handle<String> name;
|
4095
3994
|
if (is_keyword) {
|
4096
|
-
name = isolate_->factory()->
|
3995
|
+
name = isolate_->factory()->LookupUtf8Symbol(Token::String(next));
|
4097
3996
|
} else {
|
4098
3997
|
name = GetSymbol(CHECK_OK);
|
4099
3998
|
}
|
@@ -4122,7 +4021,7 @@ Expression* Parser::ParseObjectLiteral(bool* ok) {
|
|
4122
4021
|
// )*[','] '}'
|
4123
4022
|
|
4124
4023
|
ZoneList<ObjectLiteral::Property*>* properties =
|
4125
|
-
new(zone()) ZoneList<ObjectLiteral::Property*>(4);
|
4024
|
+
new(zone()) ZoneList<ObjectLiteral::Property*>(4, zone());
|
4126
4025
|
int number_of_boilerplate_properties = 0;
|
4127
4026
|
bool has_function = false;
|
4128
4027
|
|
@@ -4159,7 +4058,7 @@ Expression* Parser::ParseObjectLiteral(bool* ok) {
|
|
4159
4058
|
}
|
4160
4059
|
// Validate the property.
|
4161
4060
|
checker.CheckProperty(property, loc, CHECK_OK);
|
4162
|
-
properties->Add(property);
|
4061
|
+
properties->Add(property, zone());
|
4163
4062
|
if (peek() != Token::RBRACE) Expect(Token::COMMA, CHECK_OK);
|
4164
4063
|
|
4165
4064
|
if (fni_ != NULL) {
|
@@ -4227,7 +4126,7 @@ Expression* Parser::ParseObjectLiteral(bool* ok) {
|
|
4227
4126
|
if (IsBoilerplateProperty(property)) number_of_boilerplate_properties++;
|
4228
4127
|
// Validate the property
|
4229
4128
|
checker.CheckProperty(property, loc, CHECK_OK);
|
4230
|
-
properties->Add(property);
|
4129
|
+
properties->Add(property, zone());
|
4231
4130
|
|
4232
4131
|
// TODO(1240767): Consider allowing trailing comma.
|
4233
4132
|
if (peek() != Token::RBRACE) Expect(Token::COMMA, CHECK_OK);
|
@@ -4286,12 +4185,12 @@ ZoneList<Expression*>* Parser::ParseArguments(bool* ok) {
|
|
4286
4185
|
// Arguments ::
|
4287
4186
|
// '(' (AssignmentExpression)*[','] ')'
|
4288
4187
|
|
4289
|
-
ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4);
|
4188
|
+
ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4, zone());
|
4290
4189
|
Expect(Token::LPAREN, CHECK_OK);
|
4291
4190
|
bool done = (peek() == Token::RPAREN);
|
4292
4191
|
while (!done) {
|
4293
4192
|
Expression* argument = ParseAssignmentExpression(true, CHECK_OK);
|
4294
|
-
result->Add(argument);
|
4193
|
+
result->Add(argument, zone());
|
4295
4194
|
if (result->length() > kMaxNumFunctionParameters) {
|
4296
4195
|
ReportMessageAt(scanner().location(), "too_many_arguments",
|
4297
4196
|
Vector<const char*>::empty());
|
@@ -4337,6 +4236,7 @@ class SingletonLogger : public ParserRecorder {
|
|
4337
4236
|
int end,
|
4338
4237
|
const char* message,
|
4339
4238
|
const char* argument_opt) {
|
4239
|
+
if (has_error_) return;
|
4340
4240
|
has_error_ = true;
|
4341
4241
|
start_ = start;
|
4342
4242
|
end_ = end;
|
@@ -4431,6 +4331,9 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
|
4431
4331
|
Handle<FixedArray> this_property_assignments;
|
4432
4332
|
FunctionLiteral::ParameterFlag duplicate_parameters =
|
4433
4333
|
FunctionLiteral::kNoDuplicateParameters;
|
4334
|
+
FunctionLiteral::IsParenthesizedFlag parenthesized = parenthesized_function_
|
4335
|
+
? FunctionLiteral::kIsParenthesized
|
4336
|
+
: FunctionLiteral::kNotParenthesized;
|
4434
4337
|
AstProperties ast_properties;
|
4435
4338
|
// Parse function body.
|
4436
4339
|
{ FunctionState function_state(this, scope, isolate());
|
@@ -4491,7 +4394,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
|
4491
4394
|
VariableMode fvar_mode = is_extended_mode() ? CONST_HARMONY : CONST;
|
4492
4395
|
fvar = new(zone()) Variable(top_scope_,
|
4493
4396
|
function_name, fvar_mode, true /* is valid LHS */,
|
4494
|
-
Variable::NORMAL, kCreatedInitialized);
|
4397
|
+
Variable::NORMAL, kCreatedInitialized, Interface::NewConst());
|
4495
4398
|
VariableProxy* proxy = factory()->NewVariableProxy(fvar);
|
4496
4399
|
VariableDeclaration* fvar_declaration =
|
4497
4400
|
factory()->NewVariableDeclaration(proxy, fvar_mode, top_scope_);
|
@@ -4502,7 +4405,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
|
4502
4405
|
// The heuristics are:
|
4503
4406
|
// - It must not have been prohibited by the caller to Parse (some callers
|
4504
4407
|
// need a full AST).
|
4505
|
-
// - The outer scope must
|
4408
|
+
// - The outer scope must allow lazy compilation of inner functions.
|
4506
4409
|
// - The function mustn't be a function expression with an open parenthesis
|
4507
4410
|
// before; we consider that a hint that the function will be called
|
4508
4411
|
// immediately, and it would be a waste of time to make it lazily
|
@@ -4510,8 +4413,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
|
4510
4413
|
// These are all things we can know at this point, without looking at the
|
4511
4414
|
// function itself.
|
4512
4415
|
bool is_lazily_compiled = (mode() == PARSE_LAZILY &&
|
4513
|
-
top_scope_->
|
4514
|
-
top_scope_->HasTrivialOuterContext() &&
|
4416
|
+
top_scope_->AllowsLazyCompilation() &&
|
4515
4417
|
!parenthesized_function_);
|
4516
4418
|
parenthesized_function_ = false; // The bit was set for this function only.
|
4517
4419
|
|
@@ -4580,18 +4482,20 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
|
4580
4482
|
}
|
4581
4483
|
|
4582
4484
|
if (!is_lazily_compiled) {
|
4583
|
-
|
4485
|
+
ParsingModeScope parsing_mode(this, PARSE_EAGERLY);
|
4486
|
+
body = new(zone()) ZoneList<Statement*>(8, zone());
|
4584
4487
|
if (fvar != NULL) {
|
4585
|
-
VariableProxy* fproxy =
|
4586
|
-
|
4488
|
+
VariableProxy* fproxy = top_scope_->NewUnresolved(
|
4489
|
+
factory(), function_name, Interface::NewConst());
|
4587
4490
|
fproxy->BindTo(fvar);
|
4588
4491
|
body->Add(factory()->NewExpressionStatement(
|
4589
4492
|
factory()->NewAssignment(fvar_init_op,
|
4590
4493
|
fproxy,
|
4591
4494
|
factory()->NewThisFunction(),
|
4592
|
-
RelocInfo::kNoPosition))
|
4495
|
+
RelocInfo::kNoPosition)),
|
4496
|
+
zone());
|
4593
4497
|
}
|
4594
|
-
ParseSourceElements(body, Token::RBRACE, false, CHECK_OK);
|
4498
|
+
ParseSourceElements(body, Token::RBRACE, false, false, CHECK_OK);
|
4595
4499
|
|
4596
4500
|
materialized_literal_count = function_state.materialized_literal_count();
|
4597
4501
|
expected_property_count = function_state.expected_property_count();
|
@@ -4669,7 +4573,8 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> function_name,
|
|
4669
4573
|
num_parameters,
|
4670
4574
|
duplicate_parameters,
|
4671
4575
|
type,
|
4672
|
-
FunctionLiteral::kIsFunction
|
4576
|
+
FunctionLiteral::kIsFunction,
|
4577
|
+
parenthesized);
|
4673
4578
|
function_literal->set_function_token_position(function_token_position);
|
4674
4579
|
function_literal->set_ast_properties(&ast_properties);
|
4675
4580
|
|
@@ -4741,6 +4646,13 @@ Expression* Parser::ParseV8Intrinsic(bool* ok) {
|
|
4741
4646
|
return NULL;
|
4742
4647
|
}
|
4743
4648
|
|
4649
|
+
// Check that the function is defined if it's an inline runtime call.
|
4650
|
+
if (function == NULL && name->Get(0) == '_') {
|
4651
|
+
ReportMessage("not_defined", Vector<Handle<String> >(&name, 1));
|
4652
|
+
*ok = false;
|
4653
|
+
return NULL;
|
4654
|
+
}
|
4655
|
+
|
4744
4656
|
// We have a valid intrinsics call or a call to a builtin.
|
4745
4657
|
return factory()->NewCallRuntime(name, function, args);
|
4746
4658
|
}
|
@@ -4802,7 +4714,7 @@ void Parser::ExpectContextualKeyword(const char* keyword, bool* ok) {
|
|
4802
4714
|
if (!*ok) return;
|
4803
4715
|
Handle<String> symbol = GetSymbol(ok);
|
4804
4716
|
if (!*ok) return;
|
4805
|
-
if (!symbol->
|
4717
|
+
if (!symbol->IsUtf8EqualTo(CStrVector(keyword))) {
|
4806
4718
|
*ok = false;
|
4807
4719
|
ReportUnexpectedToken(scanner().current_token());
|
4808
4720
|
}
|
@@ -4988,7 +4900,7 @@ void Parser::RegisterTargetUse(Label* target, Target* stop) {
|
|
4988
4900
|
// the break target to any TargetCollectors passed on the stack.
|
4989
4901
|
for (Target* t = target_stack_; t != stop; t = t->previous()) {
|
4990
4902
|
TargetCollector* collector = t->node()->AsTargetCollector();
|
4991
|
-
if (collector != NULL) collector->AddTarget(target);
|
4903
|
+
if (collector != NULL) collector->AddTarget(target, zone());
|
4992
4904
|
}
|
4993
4905
|
}
|
4994
4906
|
|
@@ -5035,9 +4947,9 @@ Expression* Parser::NewThrowError(Handle<String> constructor,
|
|
5035
4947
|
Handle<JSArray> array = isolate()->factory()->NewJSArrayWithElements(
|
5036
4948
|
elements, FAST_ELEMENTS, TENURED);
|
5037
4949
|
|
5038
|
-
ZoneList<Expression*>* args = new(zone()) ZoneList<Expression*>(2);
|
5039
|
-
args->Add(factory()->NewLiteral(type));
|
5040
|
-
args->Add(factory()->NewLiteral(array));
|
4950
|
+
ZoneList<Expression*>* args = new(zone()) ZoneList<Expression*>(2, zone());
|
4951
|
+
args->Add(factory()->NewLiteral(type), zone());
|
4952
|
+
args->Add(factory()->NewLiteral(array), zone());
|
5041
4953
|
CallRuntime* call_constructor =
|
5042
4954
|
factory()->NewCallRuntime(constructor, NULL, args);
|
5043
4955
|
return factory()->NewThrow(call_constructor, scanner().location().beg_pos);
|
@@ -5049,8 +4961,10 @@ Expression* Parser::NewThrowError(Handle<String> constructor,
|
|
5049
4961
|
|
5050
4962
|
RegExpParser::RegExpParser(FlatStringReader* in,
|
5051
4963
|
Handle<String>* error,
|
5052
|
-
bool multiline
|
4964
|
+
bool multiline,
|
4965
|
+
Zone* zone)
|
5053
4966
|
: isolate_(Isolate::Current()),
|
4967
|
+
zone_(zone),
|
5054
4968
|
error_(error),
|
5055
4969
|
captures_(NULL),
|
5056
4970
|
in_(in),
|
@@ -5081,7 +4995,7 @@ void RegExpParser::Advance() {
|
|
5081
4995
|
StackLimitCheck check(isolate());
|
5082
4996
|
if (check.HasOverflowed()) {
|
5083
4997
|
ReportError(CStrVector(Isolate::kStackOverflowMessage));
|
5084
|
-
} else if (
|
4998
|
+
} else if (zone()->excess_allocation()) {
|
5085
4999
|
ReportError(CStrVector("Regular expression too large"));
|
5086
5000
|
} else {
|
5087
5001
|
current_ = in()->Get(next_pos_);
|
@@ -5146,7 +5060,7 @@ RegExpTree* RegExpParser::ParsePattern() {
|
|
5146
5060
|
// Atom Quantifier
|
5147
5061
|
RegExpTree* RegExpParser::ParseDisjunction() {
|
5148
5062
|
// Used to store current state while parsing subexpressions.
|
5149
|
-
RegExpParserState initial_state(NULL, INITIAL, 0);
|
5063
|
+
RegExpParserState initial_state(NULL, INITIAL, 0, zone());
|
5150
5064
|
RegExpParserState* stored_state = &initial_state;
|
5151
5065
|
// Cache the builder in a local variable for quick access.
|
5152
5066
|
RegExpBuilder* builder = initial_state.builder();
|
@@ -5231,8 +5145,8 @@ RegExpTree* RegExpParser::ParseDisjunction() {
|
|
5231
5145
|
Advance();
|
5232
5146
|
// everything except \x0a, \x0d, \u2028 and \u2029
|
5233
5147
|
ZoneList<CharacterRange>* ranges =
|
5234
|
-
new(zone()) ZoneList<CharacterRange>(2);
|
5235
|
-
CharacterRange::AddClassEscape('.', ranges);
|
5148
|
+
new(zone()) ZoneList<CharacterRange>(2, zone());
|
5149
|
+
CharacterRange::AddClassEscape('.', ranges, zone());
|
5236
5150
|
RegExpTree* atom = new(zone()) RegExpCharacterClass(ranges, false);
|
5237
5151
|
builder->AddAtom(atom);
|
5238
5152
|
break;
|
@@ -5258,17 +5172,16 @@ RegExpTree* RegExpParser::ParseDisjunction() {
|
|
5258
5172
|
Advance(2);
|
5259
5173
|
} else {
|
5260
5174
|
if (captures_ == NULL) {
|
5261
|
-
captures_ = new(zone()) ZoneList<RegExpCapture*>(2);
|
5175
|
+
captures_ = new(zone()) ZoneList<RegExpCapture*>(2, zone());
|
5262
5176
|
}
|
5263
5177
|
if (captures_started() >= kMaxCaptures) {
|
5264
5178
|
ReportError(CStrVector("Too many captures") CHECK_FAILED);
|
5265
5179
|
}
|
5266
|
-
captures_->Add(NULL);
|
5180
|
+
captures_->Add(NULL, zone());
|
5267
5181
|
}
|
5268
5182
|
// Store current state and begin new disjunction parsing.
|
5269
|
-
stored_state = new(zone()) RegExpParserState(stored_state,
|
5270
|
-
|
5271
|
-
captures_started());
|
5183
|
+
stored_state = new(zone()) RegExpParserState(stored_state, type,
|
5184
|
+
captures_started(), zone());
|
5272
5185
|
builder = stored_state->builder();
|
5273
5186
|
continue;
|
5274
5187
|
}
|
@@ -5302,8 +5215,8 @@ RegExpTree* RegExpParser::ParseDisjunction() {
|
|
5302
5215
|
uc32 c = Next();
|
5303
5216
|
Advance(2);
|
5304
5217
|
ZoneList<CharacterRange>* ranges =
|
5305
|
-
new(zone()) ZoneList<CharacterRange>(2);
|
5306
|
-
CharacterRange::AddClassEscape(c, ranges);
|
5218
|
+
new(zone()) ZoneList<CharacterRange>(2, zone());
|
5219
|
+
CharacterRange::AddClassEscape(c, ranges, zone());
|
5307
5220
|
RegExpTree* atom = new(zone()) RegExpCharacterClass(ranges, false);
|
5308
5221
|
builder->AddAtom(atom);
|
5309
5222
|
break;
|
@@ -5778,11 +5691,12 @@ static const uc16 kNoCharClass = 0;
|
|
5778
5691
|
// escape (i.e., 's' means whitespace, from '\s').
|
5779
5692
|
static inline void AddRangeOrEscape(ZoneList<CharacterRange>* ranges,
|
5780
5693
|
uc16 char_class,
|
5781
|
-
CharacterRange range
|
5694
|
+
CharacterRange range,
|
5695
|
+
Zone* zone) {
|
5782
5696
|
if (char_class != kNoCharClass) {
|
5783
|
-
CharacterRange::AddClassEscape(char_class, ranges);
|
5697
|
+
CharacterRange::AddClassEscape(char_class, ranges, zone);
|
5784
5698
|
} else {
|
5785
|
-
ranges->Add(range);
|
5699
|
+
ranges->Add(range, zone);
|
5786
5700
|
}
|
5787
5701
|
}
|
5788
5702
|
|
@@ -5798,7 +5712,8 @@ RegExpTree* RegExpParser::ParseCharacterClass() {
|
|
5798
5712
|
is_negated = true;
|
5799
5713
|
Advance();
|
5800
5714
|
}
|
5801
|
-
ZoneList<CharacterRange>* ranges =
|
5715
|
+
ZoneList<CharacterRange>* ranges =
|
5716
|
+
new(zone()) ZoneList<CharacterRange>(2, zone());
|
5802
5717
|
while (has_more() && current() != ']') {
|
5803
5718
|
uc16 char_class = kNoCharClass;
|
5804
5719
|
CharacterRange first = ParseClassAtom(&char_class CHECK_FAILED);
|
@@ -5809,25 +5724,25 @@ RegExpTree* RegExpParser::ParseCharacterClass() {
|
|
5809
5724
|
// following code report an error.
|
5810
5725
|
break;
|
5811
5726
|
} else if (current() == ']') {
|
5812
|
-
AddRangeOrEscape(ranges, char_class, first);
|
5813
|
-
ranges->Add(CharacterRange::Singleton('-'));
|
5727
|
+
AddRangeOrEscape(ranges, char_class, first, zone());
|
5728
|
+
ranges->Add(CharacterRange::Singleton('-'), zone());
|
5814
5729
|
break;
|
5815
5730
|
}
|
5816
5731
|
uc16 char_class_2 = kNoCharClass;
|
5817
5732
|
CharacterRange next = ParseClassAtom(&char_class_2 CHECK_FAILED);
|
5818
5733
|
if (char_class != kNoCharClass || char_class_2 != kNoCharClass) {
|
5819
5734
|
// Either end is an escaped character class. Treat the '-' verbatim.
|
5820
|
-
AddRangeOrEscape(ranges, char_class, first);
|
5821
|
-
ranges->Add(CharacterRange::Singleton('-'));
|
5822
|
-
AddRangeOrEscape(ranges, char_class_2, next);
|
5735
|
+
AddRangeOrEscape(ranges, char_class, first, zone());
|
5736
|
+
ranges->Add(CharacterRange::Singleton('-'), zone());
|
5737
|
+
AddRangeOrEscape(ranges, char_class_2, next, zone());
|
5823
5738
|
continue;
|
5824
5739
|
}
|
5825
5740
|
if (first.from() > next.to()) {
|
5826
5741
|
return ReportError(CStrVector(kRangeOutOfOrder) CHECK_FAILED);
|
5827
5742
|
}
|
5828
|
-
ranges->Add(CharacterRange::Range(first.from(), next.to()));
|
5743
|
+
ranges->Add(CharacterRange::Range(first.from(), next.to()), zone());
|
5829
5744
|
} else {
|
5830
|
-
AddRangeOrEscape(ranges, char_class, first);
|
5745
|
+
AddRangeOrEscape(ranges, char_class, first, zone());
|
5831
5746
|
}
|
5832
5747
|
}
|
5833
5748
|
if (!has_more()) {
|
@@ -5835,7 +5750,7 @@ RegExpTree* RegExpParser::ParseCharacterClass() {
|
|
5835
5750
|
}
|
5836
5751
|
Advance();
|
5837
5752
|
if (ranges->length() == 0) {
|
5838
|
-
ranges->Add(CharacterRange::Everything());
|
5753
|
+
ranges->Add(CharacterRange::Everything(), zone());
|
5839
5754
|
is_negated = !is_negated;
|
5840
5755
|
}
|
5841
5756
|
return new(zone()) RegExpCharacterClass(ranges, is_negated);
|
@@ -5943,31 +5858,6 @@ static ScriptDataImpl* DoPreParse(Utf16CharacterStream* source,
|
|
5943
5858
|
}
|
5944
5859
|
|
5945
5860
|
|
5946
|
-
// Preparse, but only collect data that is immediately useful,
|
5947
|
-
// even if the preparser data is only used once.
|
5948
|
-
ScriptDataImpl* ParserApi::PartialPreParse(Handle<String> source,
|
5949
|
-
v8::Extension* extension,
|
5950
|
-
int flags) {
|
5951
|
-
bool allow_lazy = FLAG_lazy && (extension == NULL);
|
5952
|
-
if (!allow_lazy) {
|
5953
|
-
// Partial preparsing is only about lazily compiled functions.
|
5954
|
-
// If we don't allow lazy compilation, the log data will be empty.
|
5955
|
-
return NULL;
|
5956
|
-
}
|
5957
|
-
flags |= kAllowLazy;
|
5958
|
-
PartialParserRecorder recorder;
|
5959
|
-
int source_length = source->length();
|
5960
|
-
if (source->IsExternalTwoByteString()) {
|
5961
|
-
ExternalTwoByteStringUtf16CharacterStream stream(
|
5962
|
-
Handle<ExternalTwoByteString>::cast(source), 0, source_length);
|
5963
|
-
return DoPreParse(&stream, flags, &recorder);
|
5964
|
-
} else {
|
5965
|
-
GenericStringUtf16CharacterStream stream(source, 0, source_length);
|
5966
|
-
return DoPreParse(&stream, flags, &recorder);
|
5967
|
-
}
|
5968
|
-
}
|
5969
|
-
|
5970
|
-
|
5971
5861
|
ScriptDataImpl* ParserApi::PreParse(Utf16CharacterStream* source,
|
5972
5862
|
v8::Extension* extension,
|
5973
5863
|
int flags) {
|
@@ -5982,9 +5872,10 @@ ScriptDataImpl* ParserApi::PreParse(Utf16CharacterStream* source,
|
|
5982
5872
|
|
5983
5873
|
bool RegExpParser::ParseRegExp(FlatStringReader* input,
|
5984
5874
|
bool multiline,
|
5985
|
-
RegExpCompileData* result
|
5875
|
+
RegExpCompileData* result,
|
5876
|
+
Zone* zone) {
|
5986
5877
|
ASSERT(result != NULL);
|
5987
|
-
RegExpParser parser(input, &result->error, multiline);
|
5878
|
+
RegExpParser parser(input, &result->error, multiline, zone);
|
5988
5879
|
RegExpTree* tree = parser.ParsePattern();
|
5989
5880
|
if (parser.failed()) {
|
5990
5881
|
ASSERT(tree == NULL);
|
@@ -6005,7 +5896,6 @@ bool RegExpParser::ParseRegExp(FlatStringReader* input,
|
|
6005
5896
|
bool ParserApi::Parse(CompilationInfo* info, int parsing_flags) {
|
6006
5897
|
ASSERT(info->function() == NULL);
|
6007
5898
|
FunctionLiteral* result = NULL;
|
6008
|
-
Handle<Script> script = info->script();
|
6009
5899
|
ASSERT((parsing_flags & kLanguageModeMask) == CLASSIC_MODE);
|
6010
5900
|
if (!info->is_native() && FLAG_harmony_scoping) {
|
6011
5901
|
// Harmony scoping is requested.
|
@@ -6020,15 +5910,15 @@ bool ParserApi::Parse(CompilationInfo* info, int parsing_flags) {
|
|
6020
5910
|
}
|
6021
5911
|
if (info->is_lazy()) {
|
6022
5912
|
ASSERT(!info->is_eval());
|
6023
|
-
Parser parser(
|
5913
|
+
Parser parser(info, parsing_flags, NULL, NULL);
|
6024
5914
|
if (info->shared_info()->is_function()) {
|
6025
|
-
result = parser.ParseLazy(
|
5915
|
+
result = parser.ParseLazy();
|
6026
5916
|
} else {
|
6027
|
-
result = parser.ParseProgram(
|
5917
|
+
result = parser.ParseProgram();
|
6028
5918
|
}
|
6029
5919
|
} else {
|
6030
5920
|
ScriptDataImpl* pre_data = info->pre_parse_data();
|
6031
|
-
Parser parser(
|
5921
|
+
Parser parser(info, parsing_flags, info->extension(), pre_data);
|
6032
5922
|
if (pre_data != NULL && pre_data->has_error()) {
|
6033
5923
|
Scanner::Location loc = pre_data->MessageLocation();
|
6034
5924
|
const char* message = pre_data->BuildMessage();
|
@@ -6041,7 +5931,7 @@ bool ParserApi::Parse(CompilationInfo* info, int parsing_flags) {
|
|
6041
5931
|
DeleteArray(args.start());
|
6042
5932
|
ASSERT(info->isolate()->has_pending_exception());
|
6043
5933
|
} else {
|
6044
|
-
result = parser.ParseProgram(
|
5934
|
+
result = parser.ParseProgram();
|
6045
5935
|
}
|
6046
5936
|
}
|
6047
5937
|
info->SetFunction(result);
|