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
@@ -188,7 +188,7 @@ class ProfilerEventsProcessor : public Thread {
|
|
188
188
|
|
189
189
|
|
190
190
|
#define PROFILE(isolate, Call) \
|
191
|
-
|
191
|
+
LOG_CODE_EVENT(isolate, Call); \
|
192
192
|
do { \
|
193
193
|
if (v8::internal::CpuProfiler::is_profiling(isolate)) { \
|
194
194
|
v8::internal::CpuProfiler::Call; \
|
data/vendor/v8/src/d8-debug.cc
CHANGED
@@ -273,7 +273,7 @@ RemoteDebuggerEvent* RemoteDebugger::GetEvent() {
|
|
273
273
|
|
274
274
|
|
275
275
|
void RemoteDebugger::HandleMessageReceived(char* message) {
|
276
|
-
Locker lock;
|
276
|
+
Locker lock(v8::Isolate::GetCurrent());
|
277
277
|
HandleScope scope;
|
278
278
|
|
279
279
|
// Print the event details.
|
@@ -302,7 +302,7 @@ void RemoteDebugger::HandleMessageReceived(char* message) {
|
|
302
302
|
|
303
303
|
|
304
304
|
void RemoteDebugger::HandleKeyboardCommand(char* command) {
|
305
|
-
Locker lock;
|
305
|
+
Locker lock(v8::Isolate::GetCurrent());
|
306
306
|
HandleScope scope;
|
307
307
|
|
308
308
|
// Convert the debugger command to a JSON debugger request.
|
@@ -25,8 +25,8 @@
|
|
25
25
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
26
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
|
-
|
29
28
|
#include <cstdio> // NOLINT
|
29
|
+
#include <string.h> // NOLINT
|
30
30
|
#include <readline/readline.h> // NOLINT
|
31
31
|
#include <readline/history.h> // NOLINT
|
32
32
|
|
@@ -35,7 +35,6 @@
|
|
35
35
|
|
36
36
|
#include "d8.h"
|
37
37
|
|
38
|
-
|
39
38
|
// There are incompatibilities between different versions and different
|
40
39
|
// implementations of readline. This smooths out one known incompatibility.
|
41
40
|
#if RL_READLINE_VERSION >= 0x0500
|
@@ -58,8 +57,10 @@ class ReadLineEditor: public LineEditor {
|
|
58
57
|
static const int kMaxHistoryEntries;
|
59
58
|
|
60
59
|
private:
|
60
|
+
#ifndef V8_SHARED
|
61
61
|
static char** AttemptedCompletion(const char* text, int start, int end);
|
62
62
|
static char* CompletionGenerator(const char* text, int state);
|
63
|
+
#endif // V8_SHARED
|
63
64
|
static char kWordBreakCharacters[];
|
64
65
|
};
|
65
66
|
|
@@ -76,7 +77,15 @@ const int ReadLineEditor::kMaxHistoryEntries = 1000;
|
|
76
77
|
|
77
78
|
bool ReadLineEditor::Open() {
|
78
79
|
rl_initialize();
|
80
|
+
|
81
|
+
#ifdef V8_SHARED
|
82
|
+
// Don't do completion on shared library mode
|
83
|
+
// http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC24
|
84
|
+
rl_bind_key('\t', rl_insert);
|
85
|
+
#else
|
79
86
|
rl_attempted_completion_function = AttemptedCompletion;
|
87
|
+
#endif // V8_SHARED
|
88
|
+
|
80
89
|
rl_completer_word_break_characters = kWordBreakCharacters;
|
81
90
|
rl_bind_key('\t', rl_complete);
|
82
91
|
using_history();
|
@@ -122,6 +131,7 @@ void ReadLineEditor::AddHistory(const char* str) {
|
|
122
131
|
}
|
123
132
|
|
124
133
|
|
134
|
+
#ifndef V8_SHARED
|
125
135
|
char** ReadLineEditor::AttemptedCompletion(const char* text,
|
126
136
|
int start,
|
127
137
|
int end) {
|
@@ -155,6 +165,7 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) {
|
|
155
165
|
return NULL;
|
156
166
|
}
|
157
167
|
}
|
168
|
+
#endif // V8_SHARED
|
158
169
|
|
159
170
|
|
160
171
|
} // namespace v8
|
data/vendor/v8/src/d8.cc
CHANGED
@@ -67,6 +67,62 @@
|
|
67
67
|
|
68
68
|
namespace v8 {
|
69
69
|
|
70
|
+
|
71
|
+
static Handle<Value> Throw(const char* message) {
|
72
|
+
return ThrowException(String::New(message));
|
73
|
+
}
|
74
|
+
|
75
|
+
|
76
|
+
// TODO(rossberg): should replace these by proper uses of HasInstance,
|
77
|
+
// once we figure out a good way to make the templates global.
|
78
|
+
const char kArrayBufferMarkerPropName[] = "d8::_is_array_buffer_";
|
79
|
+
const char kArrayMarkerPropName[] = "d8::_is_typed_array_";
|
80
|
+
|
81
|
+
|
82
|
+
#define FOR_EACH_SYMBOL(V) \
|
83
|
+
V(ArrayBuffer, "ArrayBuffer") \
|
84
|
+
V(ArrayBufferMarkerPropName, kArrayBufferMarkerPropName) \
|
85
|
+
V(ArrayMarkerPropName, kArrayMarkerPropName) \
|
86
|
+
V(buffer, "buffer") \
|
87
|
+
V(byteLength, "byteLength") \
|
88
|
+
V(byteOffset, "byteOffset") \
|
89
|
+
V(BYTES_PER_ELEMENT, "BYTES_PER_ELEMENT") \
|
90
|
+
V(length, "length")
|
91
|
+
|
92
|
+
|
93
|
+
class Symbols {
|
94
|
+
public:
|
95
|
+
explicit Symbols(Isolate* isolate) : isolate_(isolate) {
|
96
|
+
HandleScope scope;
|
97
|
+
#define INIT_SYMBOL(name, value) \
|
98
|
+
name##_ = Persistent<String>::New(isolate, String::NewSymbol(value));
|
99
|
+
FOR_EACH_SYMBOL(INIT_SYMBOL)
|
100
|
+
#undef INIT_SYMBOL
|
101
|
+
isolate->SetData(this);
|
102
|
+
}
|
103
|
+
|
104
|
+
~Symbols() {
|
105
|
+
#define DISPOSE_SYMBOL(name, value) name##_.Dispose(isolate_);
|
106
|
+
FOR_EACH_SYMBOL(DISPOSE_SYMBOL)
|
107
|
+
#undef DISPOSE_SYMBOL
|
108
|
+
isolate_->SetData(NULL); // Not really needed, just to be sure...
|
109
|
+
}
|
110
|
+
|
111
|
+
#define DEFINE_SYMBOL_GETTER(name, value) \
|
112
|
+
static Persistent<String> name(Isolate* isolate) { \
|
113
|
+
return reinterpret_cast<Symbols*>(isolate->GetData())->name##_; \
|
114
|
+
}
|
115
|
+
FOR_EACH_SYMBOL(DEFINE_SYMBOL_GETTER)
|
116
|
+
#undef DEFINE_SYMBOL_GETTER
|
117
|
+
|
118
|
+
private:
|
119
|
+
Isolate* isolate_;
|
120
|
+
#define DEFINE_MEMBER(name, value) Persistent<String> name##_;
|
121
|
+
FOR_EACH_SYMBOL(DEFINE_MEMBER)
|
122
|
+
#undef DEFINE_MEMBER
|
123
|
+
};
|
124
|
+
|
125
|
+
|
70
126
|
LineEditor *LineEditor::first_ = NULL;
|
71
127
|
|
72
128
|
|
@@ -92,17 +148,17 @@ LineEditor* LineEditor::Get() {
|
|
92
148
|
|
93
149
|
class DumbLineEditor: public LineEditor {
|
94
150
|
public:
|
95
|
-
DumbLineEditor(
|
151
|
+
explicit DumbLineEditor(Isolate* isolate)
|
152
|
+
: LineEditor(LineEditor::DUMB, "dumb"), isolate_(isolate) { }
|
96
153
|
virtual Handle<String> Prompt(const char* prompt);
|
154
|
+
private:
|
155
|
+
Isolate* isolate_;
|
97
156
|
};
|
98
157
|
|
99
158
|
|
100
|
-
static DumbLineEditor dumb_line_editor;
|
101
|
-
|
102
|
-
|
103
159
|
Handle<String> DumbLineEditor::Prompt(const char* prompt) {
|
104
160
|
printf("%s", prompt);
|
105
|
-
return Shell::ReadFromStdin();
|
161
|
+
return Shell::ReadFromStdin(isolate_);
|
106
162
|
}
|
107
163
|
|
108
164
|
|
@@ -115,7 +171,6 @@ i::Mutex* Shell::context_mutex_(i::OS::CreateMutex());
|
|
115
171
|
Persistent<Context> Shell::utility_context_;
|
116
172
|
#endif // V8_SHARED
|
117
173
|
|
118
|
-
LineEditor* Shell::console = NULL;
|
119
174
|
Persistent<Context> Shell::evaluation_context_;
|
120
175
|
ShellOptions Shell::options;
|
121
176
|
const char* Shell::kPrompt = "d8> ";
|
@@ -200,7 +255,13 @@ Handle<Value> Shell::Write(const Arguments& args) {
|
|
200
255
|
if (i != 0) {
|
201
256
|
printf(" ");
|
202
257
|
}
|
203
|
-
|
258
|
+
|
259
|
+
// Explicitly catch potential exceptions in toString().
|
260
|
+
v8::TryCatch try_catch;
|
261
|
+
Handle<String> str_obj = args[i]->ToString();
|
262
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
263
|
+
|
264
|
+
v8::String::Utf8Value str(str_obj);
|
204
265
|
int n = static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout));
|
205
266
|
if (n != str.length()) {
|
206
267
|
printf("Error in fwrite\n");
|
@@ -226,17 +287,17 @@ Handle<Value> Shell::DisableProfiler(const Arguments& args) {
|
|
226
287
|
Handle<Value> Shell::Read(const Arguments& args) {
|
227
288
|
String::Utf8Value file(args[0]);
|
228
289
|
if (*file == NULL) {
|
229
|
-
return
|
290
|
+
return Throw("Error loading file");
|
230
291
|
}
|
231
|
-
Handle<String> source = ReadFile(*file);
|
292
|
+
Handle<String> source = ReadFile(args.GetIsolate(), *file);
|
232
293
|
if (source.IsEmpty()) {
|
233
|
-
return
|
294
|
+
return Throw("Error loading file");
|
234
295
|
}
|
235
296
|
return source;
|
236
297
|
}
|
237
298
|
|
238
299
|
|
239
|
-
Handle<String> Shell::ReadFromStdin() {
|
300
|
+
Handle<String> Shell::ReadFromStdin(Isolate* isolate) {
|
240
301
|
static const int kBufferSize = 256;
|
241
302
|
char buffer[kBufferSize];
|
242
303
|
Handle<String> accumulator = String::New("");
|
@@ -247,7 +308,7 @@ Handle<String> Shell::ReadFromStdin() {
|
|
247
308
|
// If fgets gets an error, just give up.
|
248
309
|
char* input = NULL;
|
249
310
|
{ // Release lock for blocking input.
|
250
|
-
Unlocker unlock(
|
311
|
+
Unlocker unlock(isolate);
|
251
312
|
input = fgets(buffer, kBufferSize, stdin);
|
252
313
|
}
|
253
314
|
if (input == NULL) return Handle<String>();
|
@@ -271,22 +332,22 @@ Handle<Value> Shell::Load(const Arguments& args) {
|
|
271
332
|
HandleScope handle_scope;
|
272
333
|
String::Utf8Value file(args[i]);
|
273
334
|
if (*file == NULL) {
|
274
|
-
return
|
335
|
+
return Throw("Error loading file");
|
275
336
|
}
|
276
|
-
Handle<String> source = ReadFile(*file);
|
337
|
+
Handle<String> source = ReadFile(args.GetIsolate(), *file);
|
277
338
|
if (source.IsEmpty()) {
|
278
|
-
return
|
339
|
+
return Throw("Error loading file");
|
279
340
|
}
|
280
341
|
if (!ExecuteString(source, String::New(*file), false, true)) {
|
281
|
-
return
|
342
|
+
return Throw("Error executing file");
|
282
343
|
}
|
283
344
|
}
|
284
345
|
return Undefined();
|
285
346
|
}
|
286
347
|
|
287
|
-
static
|
288
|
-
if (value_in->
|
289
|
-
return value_in->
|
348
|
+
static int32_t convertToInt(Local<Value> value_in, TryCatch* try_catch) {
|
349
|
+
if (value_in->IsInt32()) {
|
350
|
+
return value_in->Int32Value();
|
290
351
|
}
|
291
352
|
|
292
353
|
Local<Value> number = value_in->ToNumber();
|
@@ -296,11 +357,19 @@ static size_t convertToUint(Local<Value> value_in, TryCatch* try_catch) {
|
|
296
357
|
Local<Int32> int32 = number->ToInt32();
|
297
358
|
if (try_catch->HasCaught() || int32.IsEmpty()) return 0;
|
298
359
|
|
299
|
-
int32_t
|
360
|
+
int32_t value = int32->Int32Value();
|
361
|
+
if (try_catch->HasCaught()) return 0;
|
362
|
+
|
363
|
+
return value;
|
364
|
+
}
|
365
|
+
|
366
|
+
|
367
|
+
static int32_t convertToUint(Local<Value> value_in, TryCatch* try_catch) {
|
368
|
+
int32_t raw_value = convertToInt(value_in, try_catch);
|
300
369
|
if (try_catch->HasCaught()) return 0;
|
301
370
|
|
302
371
|
if (raw_value < 0) {
|
303
|
-
|
372
|
+
Throw("Array length must not be negative.");
|
304
373
|
return 0;
|
305
374
|
}
|
306
375
|
|
@@ -309,165 +378,464 @@ static size_t convertToUint(Local<Value> value_in, TryCatch* try_catch) {
|
|
309
378
|
ASSERT(kMaxLength == i::ExternalArray::kMaxLength);
|
310
379
|
#endif // V8_SHARED
|
311
380
|
if (raw_value > static_cast<int32_t>(kMaxLength)) {
|
312
|
-
|
313
|
-
String::New("Array length exceeds maximum length."));
|
381
|
+
Throw("Array length exceeds maximum length.");
|
314
382
|
}
|
315
|
-
return
|
383
|
+
return raw_value;
|
316
384
|
}
|
317
385
|
|
318
386
|
|
319
|
-
|
320
|
-
|
387
|
+
Handle<Value> Shell::CreateExternalArrayBuffer(Isolate* isolate,
|
388
|
+
Handle<Object> buffer,
|
389
|
+
int32_t length) {
|
390
|
+
static const int32_t kMaxSize = 0x7fffffff;
|
391
|
+
// Make sure the total size fits into a (signed) int.
|
392
|
+
if (length < 0 || length > kMaxSize) {
|
393
|
+
return Throw("ArrayBuffer exceeds maximum size (2G)");
|
394
|
+
}
|
395
|
+
uint8_t* data = new uint8_t[length];
|
396
|
+
if (data == NULL) {
|
397
|
+
return Throw("Memory allocation failed");
|
398
|
+
}
|
399
|
+
memset(data, 0, length);
|
321
400
|
|
322
|
-
|
401
|
+
buffer->SetHiddenValue(Symbols::ArrayBufferMarkerPropName(isolate), True());
|
402
|
+
Persistent<Object> persistent_array =
|
403
|
+
Persistent<Object>::New(isolate, buffer);
|
404
|
+
persistent_array.MakeWeak(isolate, data, ExternalArrayWeakCallback);
|
405
|
+
persistent_array.MarkIndependent(isolate);
|
406
|
+
V8::AdjustAmountOfExternalAllocatedMemory(length);
|
323
407
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
408
|
+
buffer->SetIndexedPropertiesToExternalArrayData(
|
409
|
+
data, v8::kExternalByteArray, length);
|
410
|
+
buffer->Set(Symbols::byteLength(isolate), Int32::New(length), ReadOnly);
|
411
|
+
|
412
|
+
return buffer;
|
413
|
+
}
|
414
|
+
|
415
|
+
|
416
|
+
Handle<Value> Shell::ArrayBuffer(const Arguments& args) {
|
417
|
+
if (!args.IsConstructCall()) {
|
418
|
+
Handle<Value>* rec_args = new Handle<Value>[args.Length()];
|
419
|
+
for (int i = 0; i < args.Length(); ++i) rec_args[i] = args[i];
|
420
|
+
Handle<Value> result = args.Callee()->NewInstance(args.Length(), rec_args);
|
421
|
+
delete[] rec_args;
|
422
|
+
return result;
|
332
423
|
}
|
333
|
-
|
334
|
-
element_size == 8);
|
424
|
+
|
335
425
|
if (args.Length() == 0) {
|
336
|
-
return
|
337
|
-
String::New("Array constructor must have at least one parameter."));
|
426
|
+
return Throw("ArrayBuffer constructor must have one argument");
|
338
427
|
}
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
428
|
+
TryCatch try_catch;
|
429
|
+
int32_t length = convertToUint(args[0], &try_catch);
|
430
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
431
|
+
|
432
|
+
return CreateExternalArrayBuffer(args.GetIsolate(), args.This(), length);
|
433
|
+
}
|
434
|
+
|
435
|
+
|
436
|
+
Handle<Object> Shell::CreateExternalArray(Isolate* isolate,
|
437
|
+
Handle<Object> array,
|
438
|
+
Handle<Object> buffer,
|
439
|
+
ExternalArrayType type,
|
440
|
+
int32_t length,
|
441
|
+
int32_t byteLength,
|
442
|
+
int32_t byteOffset,
|
443
|
+
int32_t element_size) {
|
444
|
+
ASSERT(element_size == 1 || element_size == 2 ||
|
445
|
+
element_size == 4 || element_size == 8);
|
446
|
+
ASSERT(byteLength == length * element_size);
|
447
|
+
|
448
|
+
void* data = buffer->GetIndexedPropertiesExternalArrayData();
|
449
|
+
ASSERT(data != NULL);
|
450
|
+
|
451
|
+
array->SetIndexedPropertiesToExternalArrayData(
|
452
|
+
static_cast<uint8_t*>(data) + byteOffset, type, length);
|
453
|
+
array->SetHiddenValue(Symbols::ArrayMarkerPropName(isolate),
|
454
|
+
Int32::New(type));
|
455
|
+
array->Set(Symbols::byteLength(isolate), Int32::New(byteLength), ReadOnly);
|
456
|
+
array->Set(Symbols::byteOffset(isolate), Int32::New(byteOffset), ReadOnly);
|
457
|
+
array->Set(Symbols::length(isolate), Int32::New(length), ReadOnly);
|
458
|
+
array->Set(Symbols::BYTES_PER_ELEMENT(isolate), Int32::New(element_size));
|
459
|
+
array->Set(Symbols::buffer(isolate), buffer, ReadOnly);
|
460
|
+
|
461
|
+
return array;
|
462
|
+
}
|
463
|
+
|
464
|
+
|
465
|
+
Handle<Value> Shell::CreateExternalArray(const Arguments& args,
|
466
|
+
ExternalArrayType type,
|
467
|
+
int32_t element_size) {
|
468
|
+
Isolate* isolate = args.GetIsolate();
|
469
|
+
if (!args.IsConstructCall()) {
|
470
|
+
Handle<Value>* rec_args = new Handle<Value>[args.Length()];
|
471
|
+
for (int i = 0; i < args.Length(); ++i) rec_args[i] = args[i];
|
472
|
+
Handle<Value> result = args.Callee()->NewInstance(args.Length(), rec_args);
|
473
|
+
delete[] rec_args;
|
474
|
+
return result;
|
475
|
+
}
|
476
|
+
|
477
|
+
TryCatch try_catch;
|
478
|
+
ASSERT(element_size == 1 || element_size == 2 ||
|
479
|
+
element_size == 4 || element_size == 8);
|
480
|
+
|
481
|
+
// All of the following constructors are supported:
|
345
482
|
// TypedArray(unsigned long length)
|
483
|
+
// TypedArray(type[] array)
|
484
|
+
// TypedArray(TypedArray array)
|
346
485
|
// TypedArray(ArrayBuffer buffer,
|
347
486
|
// optional unsigned long byteOffset,
|
348
487
|
// optional unsigned long length)
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
if (
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
convertToUint(buffer->Get(String::New("byteLength")), &try_catch);
|
366
|
-
if (try_catch.HasCaught()) return try_catch.Exception();
|
367
|
-
if (data == NULL && byteLength != 0) {
|
368
|
-
return ThrowException(String::New("ArrayBuffer does not have data"));
|
369
|
-
}
|
488
|
+
Handle<Object> buffer;
|
489
|
+
int32_t length;
|
490
|
+
int32_t byteLength;
|
491
|
+
int32_t byteOffset;
|
492
|
+
bool init_from_array = false;
|
493
|
+
if (args.Length() == 0) {
|
494
|
+
return Throw("Array constructor must have at least one argument");
|
495
|
+
}
|
496
|
+
if (args[0]->IsObject() &&
|
497
|
+
!args[0]->ToObject()->GetHiddenValue(
|
498
|
+
Symbols::ArrayBufferMarkerPropName(isolate)).IsEmpty()) {
|
499
|
+
// Construct from ArrayBuffer.
|
500
|
+
buffer = args[0]->ToObject();
|
501
|
+
int32_t bufferLength =
|
502
|
+
convertToUint(buffer->Get(Symbols::byteLength(isolate)), &try_catch);
|
503
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
370
504
|
|
371
505
|
if (args.Length() < 2 || args[1]->IsUndefined()) {
|
372
506
|
byteOffset = 0;
|
373
507
|
} else {
|
374
508
|
byteOffset = convertToUint(args[1], &try_catch);
|
375
|
-
if (try_catch.HasCaught()) return try_catch.
|
376
|
-
if (byteOffset >
|
377
|
-
return
|
509
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
510
|
+
if (byteOffset > bufferLength) {
|
511
|
+
return Throw("byteOffset out of bounds");
|
378
512
|
}
|
379
513
|
if (byteOffset % element_size != 0) {
|
380
|
-
return
|
381
|
-
String::New("byteOffset must be multiple of element_size"));
|
514
|
+
return Throw("byteOffset must be multiple of element size");
|
382
515
|
}
|
383
516
|
}
|
384
517
|
|
385
518
|
if (args.Length() < 3 || args[2]->IsUndefined()) {
|
519
|
+
byteLength = bufferLength - byteOffset;
|
520
|
+
length = byteLength / element_size;
|
386
521
|
if (byteLength % element_size != 0) {
|
387
|
-
return
|
388
|
-
String::New("buffer size must be multiple of element_size"));
|
522
|
+
return Throw("buffer size must be multiple of element size");
|
389
523
|
}
|
390
|
-
length = (byteLength - byteOffset) / element_size;
|
391
524
|
} else {
|
392
525
|
length = convertToUint(args[2], &try_catch);
|
393
|
-
if (try_catch.HasCaught()) return try_catch.
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
526
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
527
|
+
byteLength = length * element_size;
|
528
|
+
if (byteOffset + byteLength > bufferLength) {
|
529
|
+
return Throw("length out of bounds");
|
530
|
+
}
|
398
531
|
}
|
399
|
-
byteLength = byteOffset + length * element_size;
|
400
|
-
|
401
|
-
// Hold a reference to the ArrayBuffer so its buffer doesn't get collected.
|
402
|
-
array->SetHiddenValue(
|
403
|
-
String::New(kArrayBufferReferencePropName), args[0]);
|
404
532
|
} else {
|
405
|
-
|
533
|
+
if (args[0]->IsObject() &&
|
534
|
+
args[0]->ToObject()->Has(Symbols::length(isolate))) {
|
535
|
+
// Construct from array.
|
536
|
+
Local<Value> value = args[0]->ToObject()->Get(Symbols::length(isolate));
|
537
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
538
|
+
length = convertToUint(value, &try_catch);
|
539
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
540
|
+
init_from_array = true;
|
541
|
+
} else {
|
542
|
+
// Construct from size.
|
543
|
+
length = convertToUint(args[0], &try_catch);
|
544
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
545
|
+
}
|
406
546
|
byteLength = length * element_size;
|
407
547
|
byteOffset = 0;
|
408
|
-
}
|
409
548
|
|
410
|
-
|
411
|
-
|
412
|
-
ASSERT(
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
if (total_size > kMaxSize) {
|
419
|
-
return ThrowException(String::New("Array exceeds maximum size (2G)"));
|
420
|
-
}
|
421
|
-
data = malloc(total_size);
|
422
|
-
if (data == NULL) {
|
423
|
-
return ThrowException(String::New("Memory allocation failed."));
|
424
|
-
}
|
425
|
-
*reinterpret_cast<size_t*>(data) = total_size;
|
426
|
-
data = reinterpret_cast<size_t*>(data) + kExternalArrayAllocationHeaderSize;
|
427
|
-
memset(data, 0, byteLength);
|
428
|
-
V8::AdjustAmountOfExternalAllocatedMemory(total_size);
|
549
|
+
Handle<Object> global = Context::GetCurrent()->Global();
|
550
|
+
Handle<Value> array_buffer = global->Get(Symbols::ArrayBuffer(isolate));
|
551
|
+
ASSERT(!try_catch.HasCaught() && array_buffer->IsFunction());
|
552
|
+
Handle<Value> buffer_args[] = { Uint32::New(byteLength) };
|
553
|
+
Handle<Value> result = Handle<Function>::Cast(array_buffer)->NewInstance(
|
554
|
+
1, buffer_args);
|
555
|
+
if (try_catch.HasCaught()) return result;
|
556
|
+
buffer = result->ToObject();
|
429
557
|
}
|
430
|
-
persistent_array.MakeWeak(data, ExternalArrayWeakCallback);
|
431
|
-
persistent_array.MarkIndependent();
|
432
558
|
|
433
|
-
array
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
array->Set(String::New("BYTES_PER_ELEMENT"),
|
444
|
-
Int32::New(static_cast<int32_t>(element_size)));
|
445
|
-
// We currently support 'buffer' property only if constructed from a buffer.
|
446
|
-
if (first_arg_is_array_buffer) {
|
447
|
-
array->Set(String::New("buffer"), args[0], ReadOnly);
|
559
|
+
Handle<Object> array =
|
560
|
+
CreateExternalArray(isolate, args.This(), buffer, type, length,
|
561
|
+
byteLength, byteOffset, element_size);
|
562
|
+
|
563
|
+
if (init_from_array) {
|
564
|
+
Handle<Object> init = args[0]->ToObject();
|
565
|
+
for (int i = 0; i < length; ++i) {
|
566
|
+
Local<Value> value = init->Get(i);
|
567
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
568
|
+
array->Set(i, value);
|
448
569
|
}
|
449
570
|
}
|
571
|
+
|
450
572
|
return array;
|
451
573
|
}
|
452
574
|
|
453
575
|
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
576
|
+
Handle<Value> Shell::ArrayBufferSlice(const Arguments& args) {
|
577
|
+
TryCatch try_catch;
|
578
|
+
|
579
|
+
if (!args.This()->IsObject()) {
|
580
|
+
return Throw("'slice' invoked on non-object receiver");
|
581
|
+
}
|
582
|
+
|
583
|
+
Isolate* isolate = args.GetIsolate();
|
584
|
+
Local<Object> self = args.This();
|
585
|
+
Local<Value> marker =
|
586
|
+
self->GetHiddenValue(Symbols::ArrayBufferMarkerPropName(isolate));
|
587
|
+
if (marker.IsEmpty()) {
|
588
|
+
return Throw("'slice' invoked on wrong receiver type");
|
589
|
+
}
|
590
|
+
|
591
|
+
int32_t length =
|
592
|
+
convertToUint(self->Get(Symbols::byteLength(isolate)), &try_catch);
|
593
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
594
|
+
|
595
|
+
if (args.Length() == 0) {
|
596
|
+
return Throw("'slice' must have at least one argument");
|
597
|
+
}
|
598
|
+
int32_t begin = convertToInt(args[0], &try_catch);
|
599
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
600
|
+
if (begin < 0) begin += length;
|
601
|
+
if (begin < 0) begin = 0;
|
602
|
+
if (begin > length) begin = length;
|
603
|
+
|
604
|
+
int32_t end;
|
605
|
+
if (args.Length() < 2 || args[1]->IsUndefined()) {
|
606
|
+
end = length;
|
607
|
+
} else {
|
608
|
+
end = convertToInt(args[1], &try_catch);
|
609
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
610
|
+
if (end < 0) end += length;
|
611
|
+
if (end < 0) end = 0;
|
612
|
+
if (end > length) end = length;
|
613
|
+
if (end < begin) end = begin;
|
464
614
|
}
|
465
|
-
|
615
|
+
|
616
|
+
Local<Function> constructor = Local<Function>::Cast(self->GetConstructor());
|
617
|
+
Handle<Value> new_args[] = { Uint32::New(end - begin) };
|
618
|
+
Handle<Value> result = constructor->NewInstance(1, new_args);
|
619
|
+
if (try_catch.HasCaught()) return result;
|
620
|
+
Handle<Object> buffer = result->ToObject();
|
621
|
+
uint8_t* dest =
|
622
|
+
static_cast<uint8_t*>(buffer->GetIndexedPropertiesExternalArrayData());
|
623
|
+
uint8_t* src = begin + static_cast<uint8_t*>(
|
624
|
+
self->GetIndexedPropertiesExternalArrayData());
|
625
|
+
memcpy(dest, src, end - begin);
|
626
|
+
|
627
|
+
return buffer;
|
466
628
|
}
|
467
629
|
|
468
630
|
|
469
|
-
Handle<Value> Shell::
|
470
|
-
|
631
|
+
Handle<Value> Shell::ArraySubArray(const Arguments& args) {
|
632
|
+
TryCatch try_catch;
|
633
|
+
|
634
|
+
if (!args.This()->IsObject()) {
|
635
|
+
return Throw("'subarray' invoked on non-object receiver");
|
636
|
+
}
|
637
|
+
|
638
|
+
Isolate* isolate = args.GetIsolate();
|
639
|
+
Local<Object> self = args.This();
|
640
|
+
Local<Value> marker =
|
641
|
+
self->GetHiddenValue(Symbols::ArrayMarkerPropName(isolate));
|
642
|
+
if (marker.IsEmpty()) {
|
643
|
+
return Throw("'subarray' invoked on wrong receiver type");
|
644
|
+
}
|
645
|
+
|
646
|
+
Handle<Object> buffer = self->Get(Symbols::buffer(isolate))->ToObject();
|
647
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
648
|
+
int32_t length =
|
649
|
+
convertToUint(self->Get(Symbols::length(isolate)), &try_catch);
|
650
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
651
|
+
int32_t byteOffset =
|
652
|
+
convertToUint(self->Get(Symbols::byteOffset(isolate)), &try_catch);
|
653
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
654
|
+
int32_t element_size =
|
655
|
+
convertToUint(self->Get(Symbols::BYTES_PER_ELEMENT(isolate)), &try_catch);
|
656
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
657
|
+
|
658
|
+
if (args.Length() == 0) {
|
659
|
+
return Throw("'subarray' must have at least one argument");
|
660
|
+
}
|
661
|
+
int32_t begin = convertToInt(args[0], &try_catch);
|
662
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
663
|
+
if (begin < 0) begin += length;
|
664
|
+
if (begin < 0) begin = 0;
|
665
|
+
if (begin > length) begin = length;
|
666
|
+
|
667
|
+
int32_t end;
|
668
|
+
if (args.Length() < 2 || args[1]->IsUndefined()) {
|
669
|
+
end = length;
|
670
|
+
} else {
|
671
|
+
end = convertToInt(args[1], &try_catch);
|
672
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
673
|
+
if (end < 0) end += length;
|
674
|
+
if (end < 0) end = 0;
|
675
|
+
if (end > length) end = length;
|
676
|
+
if (end < begin) end = begin;
|
677
|
+
}
|
678
|
+
|
679
|
+
length = end - begin;
|
680
|
+
byteOffset += begin * element_size;
|
681
|
+
|
682
|
+
Local<Function> constructor = Local<Function>::Cast(self->GetConstructor());
|
683
|
+
Handle<Value> construct_args[] = {
|
684
|
+
buffer, Uint32::New(byteOffset), Uint32::New(length)
|
685
|
+
};
|
686
|
+
return constructor->NewInstance(3, construct_args);
|
687
|
+
}
|
688
|
+
|
689
|
+
|
690
|
+
Handle<Value> Shell::ArraySet(const Arguments& args) {
|
691
|
+
TryCatch try_catch;
|
692
|
+
|
693
|
+
if (!args.This()->IsObject()) {
|
694
|
+
return Throw("'set' invoked on non-object receiver");
|
695
|
+
}
|
696
|
+
|
697
|
+
Isolate* isolate = args.GetIsolate();
|
698
|
+
Local<Object> self = args.This();
|
699
|
+
Local<Value> marker =
|
700
|
+
self->GetHiddenValue(Symbols::ArrayMarkerPropName(isolate));
|
701
|
+
if (marker.IsEmpty()) {
|
702
|
+
return Throw("'set' invoked on wrong receiver type");
|
703
|
+
}
|
704
|
+
int32_t length =
|
705
|
+
convertToUint(self->Get(Symbols::length(isolate)), &try_catch);
|
706
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
707
|
+
int32_t element_size =
|
708
|
+
convertToUint(self->Get(Symbols::BYTES_PER_ELEMENT(isolate)), &try_catch);
|
709
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
710
|
+
|
711
|
+
if (args.Length() == 0) {
|
712
|
+
return Throw("'set' must have at least one argument");
|
713
|
+
}
|
714
|
+
if (!args[0]->IsObject() ||
|
715
|
+
!args[0]->ToObject()->Has(Symbols::length(isolate))) {
|
716
|
+
return Throw("'set' invoked with non-array argument");
|
717
|
+
}
|
718
|
+
Handle<Object> source = args[0]->ToObject();
|
719
|
+
int32_t source_length =
|
720
|
+
convertToUint(source->Get(Symbols::length(isolate)), &try_catch);
|
721
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
722
|
+
|
723
|
+
int32_t offset;
|
724
|
+
if (args.Length() < 2 || args[1]->IsUndefined()) {
|
725
|
+
offset = 0;
|
726
|
+
} else {
|
727
|
+
offset = convertToUint(args[1], &try_catch);
|
728
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
729
|
+
}
|
730
|
+
if (offset + source_length > length) {
|
731
|
+
return Throw("offset or source length out of bounds");
|
732
|
+
}
|
733
|
+
|
734
|
+
int32_t source_element_size;
|
735
|
+
if (source->GetHiddenValue(Symbols::ArrayMarkerPropName(isolate)).IsEmpty()) {
|
736
|
+
source_element_size = 0;
|
737
|
+
} else {
|
738
|
+
source_element_size =
|
739
|
+
convertToUint(source->Get(Symbols::BYTES_PER_ELEMENT(isolate)),
|
740
|
+
&try_catch);
|
741
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
742
|
+
}
|
743
|
+
|
744
|
+
if (element_size == source_element_size &&
|
745
|
+
self->GetConstructor()->StrictEquals(source->GetConstructor())) {
|
746
|
+
// Use memmove on the array buffers.
|
747
|
+
Handle<Object> buffer = self->Get(Symbols::buffer(isolate))->ToObject();
|
748
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
749
|
+
Handle<Object> source_buffer =
|
750
|
+
source->Get(Symbols::buffer(isolate))->ToObject();
|
751
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
752
|
+
int32_t byteOffset =
|
753
|
+
convertToUint(self->Get(Symbols::byteOffset(isolate)), &try_catch);
|
754
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
755
|
+
int32_t source_byteOffset =
|
756
|
+
convertToUint(source->Get(Symbols::byteOffset(isolate)), &try_catch);
|
757
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
758
|
+
|
759
|
+
uint8_t* dest = byteOffset + offset * element_size + static_cast<uint8_t*>(
|
760
|
+
buffer->GetIndexedPropertiesExternalArrayData());
|
761
|
+
uint8_t* src = source_byteOffset + static_cast<uint8_t*>(
|
762
|
+
source_buffer->GetIndexedPropertiesExternalArrayData());
|
763
|
+
memmove(dest, src, source_length * element_size);
|
764
|
+
} else if (source_element_size == 0) {
|
765
|
+
// Source is not a typed array, copy element-wise sequentially.
|
766
|
+
for (int i = 0; i < source_length; ++i) {
|
767
|
+
self->Set(offset + i, source->Get(i));
|
768
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
769
|
+
}
|
770
|
+
} else {
|
771
|
+
// Need to copy element-wise to make the right conversions.
|
772
|
+
Handle<Object> buffer = self->Get(Symbols::buffer(isolate))->ToObject();
|
773
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
774
|
+
Handle<Object> source_buffer =
|
775
|
+
source->Get(Symbols::buffer(isolate))->ToObject();
|
776
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
777
|
+
|
778
|
+
if (buffer->StrictEquals(source_buffer)) {
|
779
|
+
// Same backing store, need to handle overlap correctly.
|
780
|
+
// This gets a bit tricky in the case of different element sizes
|
781
|
+
// (which, of course, is extremely unlikely to ever occur in practice).
|
782
|
+
int32_t byteOffset =
|
783
|
+
convertToUint(self->Get(Symbols::byteOffset(isolate)), &try_catch);
|
784
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
785
|
+
int32_t source_byteOffset =
|
786
|
+
convertToUint(source->Get(Symbols::byteOffset(isolate)), &try_catch);
|
787
|
+
if (try_catch.HasCaught()) return try_catch.ReThrow();
|
788
|
+
|
789
|
+
// Copy as much as we can from left to right.
|
790
|
+
int i = 0;
|
791
|
+
int32_t next_dest_offset = byteOffset + (offset + 1) * element_size;
|
792
|
+
int32_t next_src_offset = source_byteOffset + source_element_size;
|
793
|
+
while (i < length && next_dest_offset <= next_src_offset) {
|
794
|
+
self->Set(offset + i, source->Get(i));
|
795
|
+
++i;
|
796
|
+
next_dest_offset += element_size;
|
797
|
+
next_src_offset += source_element_size;
|
798
|
+
}
|
799
|
+
// Of what's left, copy as much as we can from right to left.
|
800
|
+
int j = length - 1;
|
801
|
+
int32_t dest_offset = byteOffset + (offset + j) * element_size;
|
802
|
+
int32_t src_offset = source_byteOffset + j * source_element_size;
|
803
|
+
while (j >= i && dest_offset >= src_offset) {
|
804
|
+
self->Set(offset + j, source->Get(j));
|
805
|
+
--j;
|
806
|
+
dest_offset -= element_size;
|
807
|
+
src_offset -= source_element_size;
|
808
|
+
}
|
809
|
+
// There can be at most 8 entries left in the middle that need buffering
|
810
|
+
// (because the largest element_size is 8 times the smallest).
|
811
|
+
ASSERT(j+1 - i <= 8);
|
812
|
+
Handle<Value> temp[8];
|
813
|
+
for (int k = i; k <= j; ++k) {
|
814
|
+
temp[k - i] = source->Get(k);
|
815
|
+
}
|
816
|
+
for (int k = i; k <= j; ++k) {
|
817
|
+
self->Set(offset + k, temp[k - i]);
|
818
|
+
}
|
819
|
+
} else {
|
820
|
+
// Different backing stores, safe to copy element-wise sequentially.
|
821
|
+
for (int i = 0; i < source_length; ++i)
|
822
|
+
self->Set(offset + i, source->Get(i));
|
823
|
+
}
|
824
|
+
}
|
825
|
+
|
826
|
+
return Undefined();
|
827
|
+
}
|
828
|
+
|
829
|
+
|
830
|
+
void Shell::ExternalArrayWeakCallback(v8::Isolate* isolate,
|
831
|
+
Persistent<Value> object,
|
832
|
+
void* data) {
|
833
|
+
HandleScope scope;
|
834
|
+
int32_t length =
|
835
|
+
object->ToObject()->Get(Symbols::byteLength(isolate))->Uint32Value();
|
836
|
+
V8::AdjustAmountOfExternalAllocatedMemory(-length);
|
837
|
+
delete[] static_cast<uint8_t*>(data);
|
838
|
+
object.Dispose(isolate);
|
471
839
|
}
|
472
840
|
|
473
841
|
|
@@ -487,8 +855,8 @@ Handle<Value> Shell::Int16Array(const Arguments& args) {
|
|
487
855
|
|
488
856
|
|
489
857
|
Handle<Value> Shell::Uint16Array(const Arguments& args) {
|
490
|
-
return CreateExternalArray(
|
491
|
-
|
858
|
+
return CreateExternalArray(
|
859
|
+
args, kExternalUnsignedShortArray, sizeof(uint16_t));
|
492
860
|
}
|
493
861
|
|
494
862
|
|
@@ -503,33 +871,31 @@ Handle<Value> Shell::Uint32Array(const Arguments& args) {
|
|
503
871
|
|
504
872
|
|
505
873
|
Handle<Value> Shell::Float32Array(const Arguments& args) {
|
506
|
-
return CreateExternalArray(
|
507
|
-
|
874
|
+
return CreateExternalArray(
|
875
|
+
args, kExternalFloatArray, sizeof(float)); // NOLINT
|
508
876
|
}
|
509
877
|
|
510
878
|
|
511
879
|
Handle<Value> Shell::Float64Array(const Arguments& args) {
|
512
|
-
return CreateExternalArray(
|
513
|
-
|
880
|
+
return CreateExternalArray(
|
881
|
+
args, kExternalDoubleArray, sizeof(double)); // NOLINT
|
514
882
|
}
|
515
883
|
|
516
884
|
|
517
|
-
Handle<Value> Shell::
|
885
|
+
Handle<Value> Shell::Uint8ClampedArray(const Arguments& args) {
|
518
886
|
return CreateExternalArray(args, kExternalPixelArray, sizeof(uint8_t));
|
519
887
|
}
|
520
888
|
|
521
889
|
|
522
890
|
Handle<Value> Shell::Yield(const Arguments& args) {
|
523
|
-
v8::Unlocker unlocker;
|
891
|
+
v8::Unlocker unlocker(args.GetIsolate());
|
524
892
|
return Undefined();
|
525
893
|
}
|
526
894
|
|
527
895
|
|
528
896
|
Handle<Value> Shell::Quit(const Arguments& args) {
|
529
897
|
int exit_code = args[0]->Int32Value();
|
530
|
-
#ifndef V8_SHARED
|
531
898
|
OnExit();
|
532
|
-
#endif // V8_SHARED
|
533
899
|
exit(exit_code);
|
534
900
|
return Undefined();
|
535
901
|
}
|
@@ -729,8 +1095,8 @@ void Shell::AddHistogramSample(void* histogram, int sample) {
|
|
729
1095
|
}
|
730
1096
|
|
731
1097
|
|
732
|
-
void Shell::InstallUtilityScript() {
|
733
|
-
Locker lock;
|
1098
|
+
void Shell::InstallUtilityScript(Isolate* isolate) {
|
1099
|
+
Locker lock(isolate);
|
734
1100
|
HandleScope scope;
|
735
1101
|
// If we use the utility context, we have to set the security tokens so that
|
736
1102
|
// utility, evaluation and debug context can all access each other.
|
@@ -744,7 +1110,7 @@ void Shell::InstallUtilityScript() {
|
|
744
1110
|
i::Debug* debug = i::Isolate::Current()->debug();
|
745
1111
|
debug->Load();
|
746
1112
|
i::Handle<i::JSObject> js_debug
|
747
|
-
= i::Handle<i::JSObject>(debug->debug_context()->
|
1113
|
+
= i::Handle<i::JSObject>(debug->debug_context()->global_object());
|
748
1114
|
utility_context_->Global()->Set(String::New("$debug"),
|
749
1115
|
Utils::ToLocal(js_debug));
|
750
1116
|
debug->debug_context()->set_security_token(HEAP->undefined_value());
|
@@ -809,7 +1175,28 @@ class BZip2Decompressor : public v8::StartupDataDecompressor {
|
|
809
1175
|
};
|
810
1176
|
#endif
|
811
1177
|
|
812
|
-
|
1178
|
+
|
1179
|
+
Handle<FunctionTemplate> Shell::CreateArrayBufferTemplate(
|
1180
|
+
InvocationCallback fun) {
|
1181
|
+
Handle<FunctionTemplate> buffer_template = FunctionTemplate::New(fun);
|
1182
|
+
Local<Template> proto_template = buffer_template->PrototypeTemplate();
|
1183
|
+
proto_template->Set(String::New("slice"),
|
1184
|
+
FunctionTemplate::New(ArrayBufferSlice));
|
1185
|
+
return buffer_template;
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
|
1189
|
+
Handle<FunctionTemplate> Shell::CreateArrayTemplate(InvocationCallback fun) {
|
1190
|
+
Handle<FunctionTemplate> array_template = FunctionTemplate::New(fun);
|
1191
|
+
Local<Template> proto_template = array_template->PrototypeTemplate();
|
1192
|
+
proto_template->Set(String::New("set"), FunctionTemplate::New(ArraySet));
|
1193
|
+
proto_template->Set(String::New("subarray"),
|
1194
|
+
FunctionTemplate::New(ArraySubArray));
|
1195
|
+
return array_template;
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
|
1199
|
+
Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
|
813
1200
|
Handle<ObjectTemplate> global_template = ObjectTemplate::New();
|
814
1201
|
global_template->Set(String::New("print"), FunctionTemplate::New(Print));
|
815
1202
|
global_template->Set(String::New("write"), FunctionTemplate::New(Write));
|
@@ -827,32 +1214,28 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate() {
|
|
827
1214
|
FunctionTemplate::New(DisableProfiler));
|
828
1215
|
|
829
1216
|
// Bind the handlers for external arrays.
|
830
|
-
|
831
|
-
|
1217
|
+
PropertyAttribute attr =
|
1218
|
+
static_cast<PropertyAttribute>(ReadOnly | DontDelete);
|
1219
|
+
global_template->Set(Symbols::ArrayBuffer(isolate),
|
1220
|
+
CreateArrayBufferTemplate(ArrayBuffer), attr);
|
832
1221
|
global_template->Set(String::New("Int8Array"),
|
833
|
-
|
1222
|
+
CreateArrayTemplate(Int8Array), attr);
|
834
1223
|
global_template->Set(String::New("Uint8Array"),
|
835
|
-
|
1224
|
+
CreateArrayTemplate(Uint8Array), attr);
|
836
1225
|
global_template->Set(String::New("Int16Array"),
|
837
|
-
|
1226
|
+
CreateArrayTemplate(Int16Array), attr);
|
838
1227
|
global_template->Set(String::New("Uint16Array"),
|
839
|
-
|
1228
|
+
CreateArrayTemplate(Uint16Array), attr);
|
840
1229
|
global_template->Set(String::New("Int32Array"),
|
841
|
-
|
1230
|
+
CreateArrayTemplate(Int32Array), attr);
|
842
1231
|
global_template->Set(String::New("Uint32Array"),
|
843
|
-
|
1232
|
+
CreateArrayTemplate(Uint32Array), attr);
|
844
1233
|
global_template->Set(String::New("Float32Array"),
|
845
|
-
|
1234
|
+
CreateArrayTemplate(Float32Array), attr);
|
846
1235
|
global_template->Set(String::New("Float64Array"),
|
847
|
-
|
848
|
-
global_template->Set(String::New("
|
849
|
-
|
850
|
-
|
851
|
-
#ifdef LIVE_OBJECT_LIST
|
852
|
-
global_template->Set(String::New("lol_is_enabled"), True());
|
853
|
-
#else
|
854
|
-
global_template->Set(String::New("lol_is_enabled"), False());
|
855
|
-
#endif
|
1236
|
+
CreateArrayTemplate(Float64Array), attr);
|
1237
|
+
global_template->Set(String::New("Uint8ClampedArray"),
|
1238
|
+
CreateArrayTemplate(Uint8ClampedArray), attr);
|
856
1239
|
|
857
1240
|
#if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64)
|
858
1241
|
Handle<ObjectTemplate> os_templ = ObjectTemplate::New();
|
@@ -864,7 +1247,7 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate() {
|
|
864
1247
|
}
|
865
1248
|
|
866
1249
|
|
867
|
-
void Shell::Initialize() {
|
1250
|
+
void Shell::Initialize(Isolate* isolate) {
|
868
1251
|
#ifdef COMPRESS_STARTUP_DATA_BZ2
|
869
1252
|
BZip2Decompressor startup_data_decompressor;
|
870
1253
|
int bz2_result = startup_data_decompressor.Decompress();
|
@@ -879,18 +1262,21 @@ void Shell::Initialize() {
|
|
879
1262
|
// Set up counters
|
880
1263
|
if (i::StrLength(i::FLAG_map_counters) != 0)
|
881
1264
|
MapCounters(i::FLAG_map_counters);
|
882
|
-
if (i::FLAG_dump_counters) {
|
1265
|
+
if (i::FLAG_dump_counters || i::FLAG_track_gc_object_stats) {
|
883
1266
|
V8::SetCounterFunction(LookupCounter);
|
884
1267
|
V8::SetCreateHistogramFunction(CreateHistogram);
|
885
1268
|
V8::SetAddHistogramSampleFunction(AddHistogramSample);
|
886
1269
|
}
|
887
1270
|
#endif // V8_SHARED
|
888
|
-
|
1271
|
+
}
|
1272
|
+
|
889
1273
|
|
1274
|
+
void Shell::InitializeDebugger(Isolate* isolate) {
|
1275
|
+
if (options.test_shell) return;
|
890
1276
|
#ifndef V8_SHARED
|
891
|
-
Locker lock;
|
1277
|
+
Locker lock(isolate);
|
892
1278
|
HandleScope scope;
|
893
|
-
Handle<ObjectTemplate> global_template = CreateGlobalTemplate();
|
1279
|
+
Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
|
894
1280
|
utility_context_ = Context::New(NULL, global_template);
|
895
1281
|
|
896
1282
|
#ifdef ENABLE_DEBUGGER_SUPPORT
|
@@ -904,13 +1290,13 @@ void Shell::Initialize() {
|
|
904
1290
|
}
|
905
1291
|
|
906
1292
|
|
907
|
-
Persistent<Context> Shell::CreateEvaluationContext() {
|
1293
|
+
Persistent<Context> Shell::CreateEvaluationContext(Isolate* isolate) {
|
908
1294
|
#ifndef V8_SHARED
|
909
1295
|
// This needs to be a critical section since this is not thread-safe
|
910
1296
|
i::ScopedLock lock(context_mutex_);
|
911
1297
|
#endif // V8_SHARED
|
912
1298
|
// Initialize the global objects
|
913
|
-
Handle<ObjectTemplate> global_template = CreateGlobalTemplate();
|
1299
|
+
Handle<ObjectTemplate> global_template = CreateGlobalTemplate(isolate);
|
914
1300
|
Persistent<Context> context = Context::New(NULL, global_template);
|
915
1301
|
ASSERT(!context.IsEmpty());
|
916
1302
|
Context::Scope scope(context);
|
@@ -953,10 +1339,13 @@ int CompareKeys(const void* a, const void* b) {
|
|
953
1339
|
return strcmp(static_cast<const CounterAndKey*>(a)->key,
|
954
1340
|
static_cast<const CounterAndKey*>(b)->key);
|
955
1341
|
}
|
1342
|
+
#endif // V8_SHARED
|
956
1343
|
|
957
1344
|
|
958
1345
|
void Shell::OnExit() {
|
959
|
-
|
1346
|
+
LineEditor* line_editor = LineEditor::Get();
|
1347
|
+
if (line_editor) line_editor->Close();
|
1348
|
+
#ifndef V8_SHARED
|
960
1349
|
if (i::FLAG_dump_counters) {
|
961
1350
|
int number_of_counters = 0;
|
962
1351
|
for (CounterMap::Iterator i(counter_map_); i.More(); i.Next()) {
|
@@ -969,26 +1358,31 @@ void Shell::OnExit() {
|
|
969
1358
|
counters[j].key = i.CurrentKey();
|
970
1359
|
}
|
971
1360
|
qsort(counters, number_of_counters, sizeof(counters[0]), CompareKeys);
|
972
|
-
printf("
|
973
|
-
|
974
|
-
printf("
|
1361
|
+
printf("+----------------------------------------------------------------+"
|
1362
|
+
"-------------+\n");
|
1363
|
+
printf("| Name |"
|
1364
|
+
" Value |\n");
|
1365
|
+
printf("+----------------------------------------------------------------+"
|
1366
|
+
"-------------+\n");
|
975
1367
|
for (j = 0; j < number_of_counters; j++) {
|
976
1368
|
Counter* counter = counters[j].counter;
|
977
1369
|
const char* key = counters[j].key;
|
978
1370
|
if (counter->is_histogram()) {
|
979
|
-
printf("| c:%-
|
980
|
-
printf("| t:%-
|
1371
|
+
printf("| c:%-60s | %11i |\n", key, counter->count());
|
1372
|
+
printf("| t:%-60s | %11i |\n", key, counter->sample_total());
|
981
1373
|
} else {
|
982
|
-
printf("| %-
|
1374
|
+
printf("| %-62s | %11i |\n", key, counter->count());
|
983
1375
|
}
|
984
1376
|
}
|
985
|
-
printf("
|
1377
|
+
printf("+----------------------------------------------------------------+"
|
1378
|
+
"-------------+\n");
|
986
1379
|
delete [] counters;
|
987
1380
|
}
|
988
1381
|
delete counters_file_;
|
989
1382
|
delete counter_map_;
|
990
|
-
}
|
991
1383
|
#endif // V8_SHARED
|
1384
|
+
}
|
1385
|
+
|
992
1386
|
|
993
1387
|
|
994
1388
|
static FILE* FOpen(const char* path, const char* mode) {
|
@@ -1012,9 +1406,9 @@ static FILE* FOpen(const char* path, const char* mode) {
|
|
1012
1406
|
}
|
1013
1407
|
|
1014
1408
|
|
1015
|
-
static char* ReadChars(const char* name, int* size_out) {
|
1409
|
+
static char* ReadChars(Isolate* isolate, const char* name, int* size_out) {
|
1016
1410
|
// Release the V8 lock while reading files.
|
1017
|
-
v8::Unlocker unlocker(
|
1411
|
+
v8::Unlocker unlocker(isolate);
|
1018
1412
|
FILE* file = FOpen(name, "rb");
|
1019
1413
|
if (file == NULL) return NULL;
|
1020
1414
|
|
@@ -1035,27 +1429,31 @@ static char* ReadChars(const char* name, int* size_out) {
|
|
1035
1429
|
|
1036
1430
|
|
1037
1431
|
Handle<Value> Shell::ReadBuffer(const Arguments& args) {
|
1432
|
+
ASSERT(sizeof(char) == sizeof(uint8_t)); // NOLINT
|
1038
1433
|
String::Utf8Value filename(args[0]);
|
1039
1434
|
int length;
|
1040
1435
|
if (*filename == NULL) {
|
1041
|
-
return
|
1436
|
+
return Throw("Error loading file");
|
1042
1437
|
}
|
1043
|
-
|
1438
|
+
|
1439
|
+
uint8_t* data = reinterpret_cast<uint8_t*>(
|
1440
|
+
ReadChars(args.GetIsolate(), *filename, &length));
|
1044
1441
|
if (data == NULL) {
|
1045
|
-
return
|
1442
|
+
return Throw("Error reading file");
|
1046
1443
|
}
|
1047
|
-
|
1444
|
+
Isolate* isolate = args.GetIsolate();
|
1048
1445
|
Handle<Object> buffer = Object::New();
|
1049
|
-
buffer->SetHiddenValue(
|
1050
|
-
|
1051
|
-
|
1052
|
-
persistent_buffer.MakeWeak(data, ExternalArrayWeakCallback);
|
1053
|
-
persistent_buffer.MarkIndependent();
|
1446
|
+
buffer->SetHiddenValue(Symbols::ArrayBufferMarkerPropName(isolate), True());
|
1447
|
+
Persistent<Object> persistent_buffer =
|
1448
|
+
Persistent<Object>::New(isolate, buffer);
|
1449
|
+
persistent_buffer.MakeWeak(isolate, data, ExternalArrayWeakCallback);
|
1450
|
+
persistent_buffer.MarkIndependent(isolate);
|
1451
|
+
V8::AdjustAmountOfExternalAllocatedMemory(length);
|
1054
1452
|
|
1055
1453
|
buffer->SetIndexedPropertiesToExternalArrayData(
|
1056
|
-
|
1057
|
-
buffer->Set(
|
1058
|
-
|
1454
|
+
data, kExternalUnsignedByteArray, length);
|
1455
|
+
buffer->Set(Symbols::byteLength(isolate),
|
1456
|
+
Int32::New(static_cast<int32_t>(length)), ReadOnly);
|
1059
1457
|
return buffer;
|
1060
1458
|
}
|
1061
1459
|
|
@@ -1084,22 +1482,23 @@ static char* ReadWord(char* data) {
|
|
1084
1482
|
|
1085
1483
|
|
1086
1484
|
// Reads a file into a v8 string.
|
1087
|
-
Handle<String> Shell::ReadFile(const char* name) {
|
1485
|
+
Handle<String> Shell::ReadFile(Isolate* isolate, const char* name) {
|
1088
1486
|
int size = 0;
|
1089
|
-
char* chars = ReadChars(name, &size);
|
1487
|
+
char* chars = ReadChars(isolate, name, &size);
|
1090
1488
|
if (chars == NULL) return Handle<String>();
|
1091
|
-
Handle<String> result = String::New(chars);
|
1489
|
+
Handle<String> result = String::New(chars, size);
|
1092
1490
|
delete[] chars;
|
1093
1491
|
return result;
|
1094
1492
|
}
|
1095
1493
|
|
1096
1494
|
|
1097
|
-
void Shell::RunShell() {
|
1098
|
-
Locker locker;
|
1495
|
+
void Shell::RunShell(Isolate* isolate) {
|
1496
|
+
Locker locker(isolate);
|
1099
1497
|
Context::Scope context_scope(evaluation_context_);
|
1100
1498
|
HandleScope outer_scope;
|
1101
1499
|
Handle<String> name = String::New("(d8)");
|
1102
|
-
|
1500
|
+
DumbLineEditor dumb_line_editor(isolate);
|
1501
|
+
LineEditor* console = LineEditor::Get();
|
1103
1502
|
printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name());
|
1104
1503
|
console->Open();
|
1105
1504
|
while (true) {
|
@@ -1116,9 +1515,9 @@ void Shell::RunShell() {
|
|
1116
1515
|
class ShellThread : public i::Thread {
|
1117
1516
|
public:
|
1118
1517
|
// Takes ownership of the underlying char array of |files|.
|
1119
|
-
ShellThread(
|
1518
|
+
ShellThread(Isolate* isolate, char* files)
|
1120
1519
|
: Thread("d8:ShellThread"),
|
1121
|
-
|
1520
|
+
isolate_(isolate), files_(files) { }
|
1122
1521
|
|
1123
1522
|
~ShellThread() {
|
1124
1523
|
delete[] files_;
|
@@ -1126,7 +1525,7 @@ class ShellThread : public i::Thread {
|
|
1126
1525
|
|
1127
1526
|
virtual void Run();
|
1128
1527
|
private:
|
1129
|
-
|
1528
|
+
Isolate* isolate_;
|
1130
1529
|
char* files_;
|
1131
1530
|
};
|
1132
1531
|
|
@@ -1144,9 +1543,10 @@ void ShellThread::Run() {
|
|
1144
1543
|
}
|
1145
1544
|
|
1146
1545
|
// Prepare the context for this thread.
|
1147
|
-
Locker locker;
|
1546
|
+
Locker locker(isolate_);
|
1148
1547
|
HandleScope outer_scope;
|
1149
|
-
Persistent<Context> thread_context =
|
1548
|
+
Persistent<Context> thread_context =
|
1549
|
+
Shell::CreateEvaluationContext(isolate_);
|
1150
1550
|
Context::Scope context_scope(thread_context);
|
1151
1551
|
|
1152
1552
|
while ((ptr != NULL) && (*ptr != '\0')) {
|
@@ -1159,7 +1559,7 @@ void ShellThread::Run() {
|
|
1159
1559
|
continue;
|
1160
1560
|
}
|
1161
1561
|
|
1162
|
-
Handle<String> str = Shell::ReadFile(filename);
|
1562
|
+
Handle<String> str = Shell::ReadFile(isolate_, filename);
|
1163
1563
|
if (str.IsEmpty()) {
|
1164
1564
|
printf("File '%s' not found\n", filename);
|
1165
1565
|
Shell::Exit(1);
|
@@ -1168,7 +1568,7 @@ void ShellThread::Run() {
|
|
1168
1568
|
Shell::ExecuteString(str, String::New(filename), false, false);
|
1169
1569
|
}
|
1170
1570
|
|
1171
|
-
thread_context.Dispose();
|
1571
|
+
thread_context.Dispose(thread_context->GetIsolate());
|
1172
1572
|
ptr = next_line;
|
1173
1573
|
}
|
1174
1574
|
}
|
@@ -1187,7 +1587,7 @@ SourceGroup::~SourceGroup() {
|
|
1187
1587
|
}
|
1188
1588
|
|
1189
1589
|
|
1190
|
-
void SourceGroup::Execute() {
|
1590
|
+
void SourceGroup::Execute(Isolate* isolate) {
|
1191
1591
|
for (int i = begin_offset_; i < end_offset_; ++i) {
|
1192
1592
|
const char* arg = argv_[i];
|
1193
1593
|
if (strcmp(arg, "-e") == 0 && i + 1 < end_offset_) {
|
@@ -1205,7 +1605,7 @@ void SourceGroup::Execute() {
|
|
1205
1605
|
// Use all other arguments as names of files to load and run.
|
1206
1606
|
HandleScope handle_scope;
|
1207
1607
|
Handle<String> file_name = String::New(arg);
|
1208
|
-
Handle<String> source = ReadFile(arg);
|
1608
|
+
Handle<String> source = ReadFile(isolate, arg);
|
1209
1609
|
if (source.IsEmpty()) {
|
1210
1610
|
printf("Error reading '%s'\n", arg);
|
1211
1611
|
Shell::Exit(1);
|
@@ -1218,9 +1618,9 @@ void SourceGroup::Execute() {
|
|
1218
1618
|
}
|
1219
1619
|
|
1220
1620
|
|
1221
|
-
Handle<String> SourceGroup::ReadFile(const char* name) {
|
1621
|
+
Handle<String> SourceGroup::ReadFile(Isolate* isolate, const char* name) {
|
1222
1622
|
int size;
|
1223
|
-
|
1623
|
+
char* chars = ReadChars(isolate, name, &size);
|
1224
1624
|
if (chars == NULL) return Handle<String>();
|
1225
1625
|
Handle<String> result = String::New(chars, size);
|
1226
1626
|
delete[] chars;
|
@@ -1246,12 +1646,18 @@ void SourceGroup::ExecuteInThread() {
|
|
1246
1646
|
Isolate::Scope iscope(isolate);
|
1247
1647
|
Locker lock(isolate);
|
1248
1648
|
HandleScope scope;
|
1249
|
-
|
1649
|
+
Symbols symbols(isolate);
|
1650
|
+
Persistent<Context> context = Shell::CreateEvaluationContext(isolate);
|
1250
1651
|
{
|
1251
1652
|
Context::Scope cscope(context);
|
1252
|
-
Execute();
|
1653
|
+
Execute(isolate);
|
1654
|
+
}
|
1655
|
+
context.Dispose(isolate);
|
1656
|
+
if (Shell::options.send_idle_notification) {
|
1657
|
+
const int kLongIdlePauseInMs = 1000;
|
1658
|
+
V8::ContextDisposedNotification();
|
1659
|
+
V8::IdleNotification(kLongIdlePauseInMs);
|
1253
1660
|
}
|
1254
|
-
context.Dispose();
|
1255
1661
|
}
|
1256
1662
|
if (done_semaphore_ != NULL) done_semaphore_->Signal();
|
1257
1663
|
} while (!Shell::options.last_run);
|
@@ -1297,6 +1703,9 @@ bool Shell::SetOptions(int argc, char* argv[]) {
|
|
1297
1703
|
} else if (strcmp(argv[i], "--test") == 0) {
|
1298
1704
|
options.test_shell = true;
|
1299
1705
|
argv[i] = NULL;
|
1706
|
+
} else if (strcmp(argv[i], "--send-idle-notification") == 0) {
|
1707
|
+
options.send_idle_notification = true;
|
1708
|
+
argv[i] = NULL;
|
1300
1709
|
} else if (strcmp(argv[i], "--preemption") == 0) {
|
1301
1710
|
#ifdef V8_SHARED
|
1302
1711
|
printf("D8 with shared library does not support multi-threading\n");
|
@@ -1409,21 +1818,21 @@ bool Shell::SetOptions(int argc, char* argv[]) {
|
|
1409
1818
|
}
|
1410
1819
|
|
1411
1820
|
|
1412
|
-
int Shell::RunMain(int argc, char* argv[]) {
|
1821
|
+
int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
|
1413
1822
|
#ifndef V8_SHARED
|
1414
1823
|
i::List<i::Thread*> threads(1);
|
1415
1824
|
if (options.parallel_files != NULL) {
|
1416
1825
|
for (int i = 0; i < options.num_parallel_files; i++) {
|
1417
1826
|
char* files = NULL;
|
1418
|
-
{ Locker lock(
|
1827
|
+
{ Locker lock(isolate);
|
1419
1828
|
int size = 0;
|
1420
|
-
files = ReadChars(options.parallel_files[i], &size);
|
1829
|
+
files = ReadChars(isolate, options.parallel_files[i], &size);
|
1421
1830
|
}
|
1422
1831
|
if (files == NULL) {
|
1423
1832
|
printf("File list '%s' not found\n", options.parallel_files[i]);
|
1424
1833
|
Exit(1);
|
1425
1834
|
}
|
1426
|
-
ShellThread* thread = new ShellThread(
|
1835
|
+
ShellThread* thread = new ShellThread(isolate, files);
|
1427
1836
|
thread->Start();
|
1428
1837
|
threads.Add(thread);
|
1429
1838
|
}
|
@@ -1433,9 +1842,9 @@ int Shell::RunMain(int argc, char* argv[]) {
|
|
1433
1842
|
}
|
1434
1843
|
#endif // V8_SHARED
|
1435
1844
|
{ // NOLINT
|
1436
|
-
Locker lock;
|
1845
|
+
Locker lock(isolate);
|
1437
1846
|
HandleScope scope;
|
1438
|
-
Persistent<Context> context = CreateEvaluationContext();
|
1847
|
+
Persistent<Context> context = CreateEvaluationContext(isolate);
|
1439
1848
|
if (options.last_run) {
|
1440
1849
|
// Keep using the same context in the interactive shell.
|
1441
1850
|
evaluation_context_ = context;
|
@@ -1443,23 +1852,21 @@ int Shell::RunMain(int argc, char* argv[]) {
|
|
1443
1852
|
// If the interactive debugger is enabled make sure to activate
|
1444
1853
|
// it before running the files passed on the command line.
|
1445
1854
|
if (i::FLAG_debugger) {
|
1446
|
-
InstallUtilityScript();
|
1855
|
+
InstallUtilityScript(isolate);
|
1447
1856
|
}
|
1448
1857
|
#endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT
|
1449
1858
|
}
|
1450
1859
|
{
|
1451
1860
|
Context::Scope cscope(context);
|
1452
|
-
options.isolate_sources[0].Execute();
|
1861
|
+
options.isolate_sources[0].Execute(isolate);
|
1453
1862
|
}
|
1454
1863
|
if (!options.last_run) {
|
1455
|
-
context.Dispose();
|
1456
|
-
|
1457
|
-
if (i::FLAG_send_idle_notification) {
|
1864
|
+
context.Dispose(isolate);
|
1865
|
+
if (options.send_idle_notification) {
|
1458
1866
|
const int kLongIdlePauseInMs = 1000;
|
1459
1867
|
V8::ContextDisposedNotification();
|
1460
1868
|
V8::IdleNotification(kLongIdlePauseInMs);
|
1461
1869
|
}
|
1462
|
-
#endif // !V8_SHARED
|
1463
1870
|
}
|
1464
1871
|
|
1465
1872
|
#ifndef V8_SHARED
|
@@ -1483,7 +1890,7 @@ int Shell::RunMain(int argc, char* argv[]) {
|
|
1483
1890
|
}
|
1484
1891
|
|
1485
1892
|
if (threads.length() > 0 && options.use_preemption) {
|
1486
|
-
Locker lock;
|
1893
|
+
Locker lock(isolate);
|
1487
1894
|
Locker::StopPreemption();
|
1488
1895
|
}
|
1489
1896
|
#endif // V8_SHARED
|
@@ -1493,64 +1900,65 @@ int Shell::RunMain(int argc, char* argv[]) {
|
|
1493
1900
|
|
1494
1901
|
int Shell::Main(int argc, char* argv[]) {
|
1495
1902
|
if (!SetOptions(argc, argv)) return 1;
|
1496
|
-
Initialize();
|
1497
|
-
|
1498
1903
|
int result = 0;
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
Testing::
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1904
|
+
Isolate* isolate = Isolate::GetCurrent();
|
1905
|
+
{
|
1906
|
+
Initialize(isolate);
|
1907
|
+
Symbols symbols(isolate);
|
1908
|
+
InitializeDebugger(isolate);
|
1909
|
+
|
1910
|
+
if (options.stress_opt || options.stress_deopt) {
|
1911
|
+
Testing::SetStressRunType(options.stress_opt
|
1912
|
+
? Testing::kStressTypeOpt
|
1913
|
+
: Testing::kStressTypeDeopt);
|
1914
|
+
int stress_runs = Testing::GetStressRuns();
|
1915
|
+
for (int i = 0; i < stress_runs && result == 0; i++) {
|
1916
|
+
printf("============ Stress %d/%d ============\n", i + 1, stress_runs);
|
1917
|
+
Testing::PrepareStressRun(i);
|
1918
|
+
options.last_run = (i == stress_runs - 1);
|
1919
|
+
result = RunMain(isolate, argc, argv);
|
1920
|
+
}
|
1921
|
+
printf("======== Full Deoptimization =======\n");
|
1922
|
+
Testing::DeoptimizeAll();
|
1512
1923
|
#if !defined(V8_SHARED)
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1924
|
+
} else if (i::FLAG_stress_runs > 0) {
|
1925
|
+
int stress_runs = i::FLAG_stress_runs;
|
1926
|
+
for (int i = 0; i < stress_runs && result == 0; i++) {
|
1927
|
+
printf("============ Run %d/%d ============\n", i + 1, stress_runs);
|
1928
|
+
options.last_run = (i == stress_runs - 1);
|
1929
|
+
result = RunMain(isolate, argc, argv);
|
1930
|
+
}
|
1520
1931
|
#endif
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1932
|
+
} else {
|
1933
|
+
result = RunMain(isolate, argc, argv);
|
1934
|
+
}
|
1524
1935
|
|
1525
1936
|
|
1526
1937
|
#if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT)
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1938
|
+
// Run remote debugger if requested, but never on --test
|
1939
|
+
if (i::FLAG_remote_debugger && !options.test_shell) {
|
1940
|
+
InstallUtilityScript(isolate);
|
1941
|
+
RunRemoteDebugger(i::FLAG_debugger_port);
|
1942
|
+
return 0;
|
1943
|
+
}
|
1533
1944
|
#endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT
|
1534
1945
|
|
1535
|
-
|
1536
|
-
|
1946
|
+
// Run interactive shell if explicitly requested or if no script has been
|
1947
|
+
// executed, but never on --test
|
1537
1948
|
|
1538
|
-
|
1539
|
-
|
1540
|
-
&& !options.test_shell ) {
|
1949
|
+
if (( options.interactive_shell || !options.script_executed )
|
1950
|
+
&& !options.test_shell ) {
|
1541
1951
|
#if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT)
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1952
|
+
if (!i::FLAG_debugger) {
|
1953
|
+
InstallUtilityScript(isolate);
|
1954
|
+
}
|
1545
1955
|
#endif // !V8_SHARED && ENABLE_DEBUGGER_SUPPORT
|
1546
|
-
|
1956
|
+
RunShell(isolate);
|
1957
|
+
}
|
1547
1958
|
}
|
1548
|
-
|
1549
1959
|
V8::Dispose();
|
1550
1960
|
|
1551
|
-
#ifndef V8_SHARED
|
1552
1961
|
OnExit();
|
1553
|
-
#endif // V8_SHARED
|
1554
1962
|
|
1555
1963
|
return result;
|
1556
1964
|
}
|