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
@@ -453,3 +453,29 @@ THREADED_TEST(HandleScopeSegment) {
|
|
453
453
|
"result;"))->Run();
|
454
454
|
CHECK_EQ(100, result->Int32Value());
|
455
455
|
}
|
456
|
+
|
457
|
+
|
458
|
+
v8::Handle<v8::Array> JSONStringifyEnumerator(const AccessorInfo& info) {
|
459
|
+
v8::Handle<v8::Array> array = v8::Array::New(1);
|
460
|
+
array->Set(0, v8_str("regress"));
|
461
|
+
return array;
|
462
|
+
}
|
463
|
+
|
464
|
+
|
465
|
+
v8::Handle<v8::Value> JSONStringifyGetter(Local<String> name,
|
466
|
+
const AccessorInfo& info) {
|
467
|
+
return v8_str("crbug-161028");
|
468
|
+
}
|
469
|
+
|
470
|
+
|
471
|
+
THREADED_TEST(JSONStringifyNamedInterceptorObject) {
|
472
|
+
v8::HandleScope scope;
|
473
|
+
LocalContext env;
|
474
|
+
|
475
|
+
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
|
476
|
+
obj->SetNamedPropertyHandler(
|
477
|
+
JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator);
|
478
|
+
env->Global()->Set(v8_str("obj"), obj->NewInstance());
|
479
|
+
v8::Handle<v8::String> expected = v8_str("{\"regress\":\"crbug-161028\"}");
|
480
|
+
CHECK(CompileRun("JSON.stringify(obj)")->Equals(expected));
|
481
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright
|
1
|
+
// Copyright 2012 the V8 project authors. All rights reserved.
|
2
2
|
// Redistribution and use in source and binary forms, with or without
|
3
3
|
// modification, are permitted provided that the following conditions are
|
4
4
|
// met:
|
@@ -34,33 +34,13 @@
|
|
34
34
|
using namespace v8::internal;
|
35
35
|
|
36
36
|
|
37
|
-
static inline void SimulateFullSpace(PagedSpace* space) {
|
38
|
-
int old_linear_size = static_cast<int>(space->limit() - space->top());
|
39
|
-
space->Free(space->top(), old_linear_size);
|
40
|
-
space->SetTop(space->limit(), space->limit());
|
41
|
-
space->ResetFreeList();
|
42
|
-
space->ClearStats();
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
37
|
static MaybeObject* AllocateAfterFailures() {
|
47
38
|
static int attempts = 0;
|
48
39
|
if (++attempts < 3) return Failure::RetryAfterGC();
|
49
40
|
Heap* heap = Isolate::Current()->heap();
|
50
41
|
|
51
42
|
// New space.
|
52
|
-
|
53
|
-
static const int kNewSpaceFillerSize = ByteArray::SizeFor(0);
|
54
|
-
while (new_space->Available() > kNewSpaceFillerSize) {
|
55
|
-
int available_before = static_cast<int>(new_space->Available());
|
56
|
-
CHECK(!heap->AllocateByteArray(0)->IsFailure());
|
57
|
-
if (available_before == new_space->Available()) {
|
58
|
-
// It seems that we are avoiding new space allocations when
|
59
|
-
// allocation is forced, so no need to fill up new space
|
60
|
-
// in order to make the test harder.
|
61
|
-
break;
|
62
|
-
}
|
63
|
-
}
|
43
|
+
SimulateFullSpace(heap->new_space());
|
64
44
|
CHECK(!heap->AllocateByteArray(100)->IsFailure());
|
65
45
|
CHECK(!heap->AllocateFixedArray(100, NOT_TENURED)->IsFailure());
|
66
46
|
|
@@ -75,7 +55,7 @@ static MaybeObject* AllocateAfterFailures() {
|
|
75
55
|
|
76
56
|
// Old data space.
|
77
57
|
SimulateFullSpace(heap->old_data_space());
|
78
|
-
CHECK(!heap->
|
58
|
+
CHECK(!heap->AllocateRawOneByteString(100, TENURED)->IsFailure());
|
79
59
|
|
80
60
|
// Old pointer space.
|
81
61
|
SimulateFullSpace(heap->old_pointer_space());
|
@@ -99,6 +79,7 @@ static MaybeObject* AllocateAfterFailures() {
|
|
99
79
|
CHECK(!heap->AllocateMap(JS_OBJECT_TYPE, instance_size)->IsFailure());
|
100
80
|
|
101
81
|
// Test that we can allocate in old pointer space and code space.
|
82
|
+
SimulateFullSpace(heap->code_space());
|
102
83
|
CHECK(!heap->AllocateFixedArray(100, TENURED)->IsFailure());
|
103
84
|
CHECK(!heap->CopyCode(Isolate::Current()->builtins()->builtin(
|
104
85
|
Builtins::kIllegal))->IsFailure());
|
@@ -150,12 +131,21 @@ TEST(StressJS) {
|
|
150
131
|
Handle<Map> map(function->initial_map());
|
151
132
|
Handle<DescriptorArray> instance_descriptors(map->instance_descriptors());
|
152
133
|
Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor);
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
134
|
+
Handle<String> name =
|
135
|
+
FACTORY->NewStringFromAscii(Vector<const char>("get", 3));
|
136
|
+
ASSERT(instance_descriptors->IsEmpty());
|
137
|
+
|
138
|
+
Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(0, 1);
|
139
|
+
|
140
|
+
v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors);
|
141
|
+
map->set_instance_descriptors(*new_descriptors);
|
142
|
+
|
143
|
+
CallbacksDescriptor d(*name,
|
144
|
+
*foreign,
|
145
|
+
static_cast<PropertyAttributes>(0),
|
146
|
+
v8::internal::PropertyDetails::kInitialIndex);
|
147
|
+
map->AppendDescriptor(&d, witness);
|
148
|
+
|
159
149
|
// Add the Foo constructor the global object.
|
160
150
|
env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function));
|
161
151
|
// Call the accessor through JavaScript.
|
@@ -214,7 +204,9 @@ TEST(CodeRange) {
|
|
214
204
|
(Page::kMaxNonCodeHeapObjectSize << (Pseudorandom() % 3)) +
|
215
205
|
Pseudorandom() % 5000 + 1;
|
216
206
|
size_t allocated = 0;
|
217
|
-
Address base = code_range->AllocateRawMemory(requested,
|
207
|
+
Address base = code_range->AllocateRawMemory(requested,
|
208
|
+
requested,
|
209
|
+
&allocated);
|
218
210
|
CHECK(base != NULL);
|
219
211
|
blocks.Add(Block(base, static_cast<int>(allocated)));
|
220
212
|
current_allocated += static_cast<int>(allocated);
|
@@ -27,12 +27,18 @@
|
|
27
27
|
|
28
28
|
#include <limits.h>
|
29
29
|
|
30
|
+
#ifndef WIN32
|
31
|
+
#include <signal.h> // kill
|
32
|
+
#include <unistd.h> // getpid
|
33
|
+
#endif // WIN32
|
34
|
+
|
30
35
|
#include "v8.h"
|
31
36
|
|
32
37
|
#include "api.h"
|
33
38
|
#include "isolate.h"
|
34
39
|
#include "compilation-cache.h"
|
35
40
|
#include "execution.h"
|
41
|
+
#include "objects.h"
|
36
42
|
#include "snapshot.h"
|
37
43
|
#include "platform.h"
|
38
44
|
#include "utils.h"
|
@@ -162,6 +168,23 @@ THREADED_TEST(Handles) {
|
|
162
168
|
}
|
163
169
|
|
164
170
|
|
171
|
+
THREADED_TEST(IsolateOfContext) {
|
172
|
+
v8::HandleScope scope;
|
173
|
+
v8::Persistent<Context> env = Context::New();
|
174
|
+
|
175
|
+
CHECK(!env->InContext());
|
176
|
+
CHECK(env->GetIsolate() == v8::Isolate::GetCurrent());
|
177
|
+
env->Enter();
|
178
|
+
CHECK(env->InContext());
|
179
|
+
CHECK(env->GetIsolate() == v8::Isolate::GetCurrent());
|
180
|
+
env->Exit();
|
181
|
+
CHECK(!env->InContext());
|
182
|
+
CHECK(env->GetIsolate() == v8::Isolate::GetCurrent());
|
183
|
+
|
184
|
+
env.Dispose(env->GetIsolate());
|
185
|
+
}
|
186
|
+
|
187
|
+
|
165
188
|
THREADED_TEST(ReceiverSignature) {
|
166
189
|
v8::HandleScope scope;
|
167
190
|
LocalContext env;
|
@@ -398,6 +421,10 @@ THREADED_TEST(ScriptUsingStringResource) {
|
|
398
421
|
CHECK(source->IsExternal());
|
399
422
|
CHECK_EQ(resource,
|
400
423
|
static_cast<TestResource*>(source->GetExternalStringResource()));
|
424
|
+
String::Encoding encoding = String::UNKNOWN_ENCODING;
|
425
|
+
CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
|
426
|
+
source->GetExternalStringResourceBase(&encoding));
|
427
|
+
CHECK_EQ(String::TWO_BYTE_ENCODING, encoding);
|
401
428
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
402
429
|
CHECK_EQ(0, dispose_count);
|
403
430
|
}
|
@@ -413,9 +440,16 @@ THREADED_TEST(ScriptUsingAsciiStringResource) {
|
|
413
440
|
{
|
414
441
|
v8::HandleScope scope;
|
415
442
|
LocalContext env;
|
416
|
-
|
417
|
-
|
418
|
-
|
443
|
+
TestAsciiResource* resource = new TestAsciiResource(i::StrDup(c_source),
|
444
|
+
&dispose_count);
|
445
|
+
Local<String> source = String::NewExternal(resource);
|
446
|
+
CHECK(source->IsExternalAscii());
|
447
|
+
CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
|
448
|
+
source->GetExternalAsciiStringResource());
|
449
|
+
String::Encoding encoding = String::UNKNOWN_ENCODING;
|
450
|
+
CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource),
|
451
|
+
source->GetExternalStringResourceBase(&encoding));
|
452
|
+
CHECK_EQ(String::ASCII_ENCODING, encoding);
|
419
453
|
Local<Script> script = Script::Compile(source);
|
420
454
|
Local<Value> value = script->Run();
|
421
455
|
CHECK(value->IsNumber());
|
@@ -439,6 +473,11 @@ THREADED_TEST(ScriptMakingExternalString) {
|
|
439
473
|
// Trigger GCs so that the newly allocated string moves to old gen.
|
440
474
|
HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now
|
441
475
|
HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now
|
476
|
+
CHECK_EQ(source->IsExternal(), false);
|
477
|
+
CHECK_EQ(source->IsExternalAscii(), false);
|
478
|
+
String::Encoding encoding = String::UNKNOWN_ENCODING;
|
479
|
+
CHECK_EQ(NULL, source->GetExternalStringResourceBase(&encoding));
|
480
|
+
CHECK_EQ(String::ASCII_ENCODING, encoding);
|
442
481
|
bool success = source->MakeExternal(new TestResource(two_byte_source,
|
443
482
|
&dispose_count));
|
444
483
|
CHECK(success);
|
@@ -601,6 +640,8 @@ THREADED_TEST(UsingExternalAsciiString) {
|
|
601
640
|
|
602
641
|
|
603
642
|
THREADED_TEST(ScavengeExternalString) {
|
643
|
+
i::FLAG_stress_compaction = false;
|
644
|
+
i::FLAG_gc_global = false;
|
604
645
|
int dispose_count = 0;
|
605
646
|
bool in_new_space = false;
|
606
647
|
{
|
@@ -621,6 +662,8 @@ THREADED_TEST(ScavengeExternalString) {
|
|
621
662
|
|
622
663
|
|
623
664
|
THREADED_TEST(ScavengeExternalAsciiString) {
|
665
|
+
i::FLAG_stress_compaction = false;
|
666
|
+
i::FLAG_gc_global = false;
|
624
667
|
int dispose_count = 0;
|
625
668
|
bool in_new_space = false;
|
626
669
|
{
|
@@ -824,9 +867,41 @@ THREADED_TEST(FunctionTemplate) {
|
|
824
867
|
}
|
825
868
|
|
826
869
|
|
870
|
+
THREADED_TEST(FunctionTemplateSetLength) {
|
871
|
+
v8::HandleScope scope;
|
872
|
+
LocalContext env;
|
873
|
+
{
|
874
|
+
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(
|
875
|
+
handle_call, Handle<v8::Value>(), Handle<v8::Signature>(), 23);
|
876
|
+
Local<Function> fun = fun_templ->GetFunction();
|
877
|
+
env->Global()->Set(v8_str("obj"), fun);
|
878
|
+
Local<Script> script = v8_compile("obj.length");
|
879
|
+
CHECK_EQ(23, script->Run()->Int32Value());
|
880
|
+
}
|
881
|
+
{
|
882
|
+
Local<v8::FunctionTemplate> fun_templ =
|
883
|
+
v8::FunctionTemplate::New(handle_call);
|
884
|
+
fun_templ->SetLength(22);
|
885
|
+
Local<Function> fun = fun_templ->GetFunction();
|
886
|
+
env->Global()->Set(v8_str("obj"), fun);
|
887
|
+
Local<Script> script = v8_compile("obj.length");
|
888
|
+
CHECK_EQ(22, script->Run()->Int32Value());
|
889
|
+
}
|
890
|
+
{
|
891
|
+
// Without setting length it defaults to 0.
|
892
|
+
Local<v8::FunctionTemplate> fun_templ =
|
893
|
+
v8::FunctionTemplate::New(handle_call);
|
894
|
+
Local<Function> fun = fun_templ->GetFunction();
|
895
|
+
env->Global()->Set(v8_str("obj"), fun);
|
896
|
+
Local<Script> script = v8_compile("obj.length");
|
897
|
+
CHECK_EQ(0, script->Run()->Int32Value());
|
898
|
+
}
|
899
|
+
}
|
900
|
+
|
901
|
+
|
827
902
|
static void* expected_ptr;
|
828
903
|
static v8::Handle<v8::Value> callback(const v8::Arguments& args) {
|
829
|
-
void* ptr = v8::External::
|
904
|
+
void* ptr = v8::External::Cast(*args.Data())->Value();
|
830
905
|
CHECK_EQ(expected_ptr, ptr);
|
831
906
|
return v8::True();
|
832
907
|
}
|
@@ -836,7 +911,7 @@ static void TestExternalPointerWrapping() {
|
|
836
911
|
v8::HandleScope scope;
|
837
912
|
LocalContext env;
|
838
913
|
|
839
|
-
v8::Handle<v8::Value> data = v8::External::
|
914
|
+
v8::Handle<v8::Value> data = v8::External::New(expected_ptr);
|
840
915
|
|
841
916
|
v8::Handle<v8::Object> obj = v8::Object::New();
|
842
917
|
obj->Set(v8_str("func"),
|
@@ -947,22 +1022,33 @@ THREADED_TEST(FindInstanceInPrototypeChain) {
|
|
947
1022
|
THREADED_TEST(TinyInteger) {
|
948
1023
|
v8::HandleScope scope;
|
949
1024
|
LocalContext env;
|
1025
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1026
|
+
|
950
1027
|
int32_t value = 239;
|
951
1028
|
Local<v8::Integer> value_obj = v8::Integer::New(value);
|
952
1029
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1030
|
+
|
1031
|
+
value_obj = v8::Integer::New(value, isolate);
|
1032
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
953
1033
|
}
|
954
1034
|
|
955
1035
|
|
956
1036
|
THREADED_TEST(BigSmiInteger) {
|
957
1037
|
v8::HandleScope scope;
|
958
1038
|
LocalContext env;
|
1039
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1040
|
+
|
959
1041
|
int32_t value = i::Smi::kMaxValue;
|
960
1042
|
// We cannot add one to a Smi::kMaxValue without wrapping.
|
961
1043
|
if (i::kSmiValueSize < 32) {
|
962
1044
|
CHECK(i::Smi::IsValid(value));
|
963
1045
|
CHECK(!i::Smi::IsValid(value + 1));
|
1046
|
+
|
964
1047
|
Local<v8::Integer> value_obj = v8::Integer::New(value);
|
965
1048
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1049
|
+
|
1050
|
+
value_obj = v8::Integer::New(value, isolate);
|
1051
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
966
1052
|
}
|
967
1053
|
}
|
968
1054
|
|
@@ -970,6 +1056,8 @@ THREADED_TEST(BigSmiInteger) {
|
|
970
1056
|
THREADED_TEST(BigInteger) {
|
971
1057
|
v8::HandleScope scope;
|
972
1058
|
LocalContext env;
|
1059
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1060
|
+
|
973
1061
|
// We cannot add one to a Smi::kMaxValue without wrapping.
|
974
1062
|
if (i::kSmiValueSize < 32) {
|
975
1063
|
// The casts allow this to compile, even if Smi::kMaxValue is 2^31-1.
|
@@ -978,8 +1066,12 @@ THREADED_TEST(BigInteger) {
|
|
978
1066
|
static_cast<int32_t>(static_cast<uint32_t>(i::Smi::kMaxValue) + 1);
|
979
1067
|
CHECK(value > i::Smi::kMaxValue);
|
980
1068
|
CHECK(!i::Smi::IsValid(value));
|
1069
|
+
|
981
1070
|
Local<v8::Integer> value_obj = v8::Integer::New(value);
|
982
1071
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1072
|
+
|
1073
|
+
value_obj = v8::Integer::New(value, isolate);
|
1074
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
983
1075
|
}
|
984
1076
|
}
|
985
1077
|
|
@@ -987,42 +1079,66 @@ THREADED_TEST(BigInteger) {
|
|
987
1079
|
THREADED_TEST(TinyUnsignedInteger) {
|
988
1080
|
v8::HandleScope scope;
|
989
1081
|
LocalContext env;
|
1082
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1083
|
+
|
990
1084
|
uint32_t value = 239;
|
1085
|
+
|
991
1086
|
Local<v8::Integer> value_obj = v8::Integer::NewFromUnsigned(value);
|
992
1087
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1088
|
+
|
1089
|
+
value_obj = v8::Integer::NewFromUnsigned(value, isolate);
|
1090
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
993
1091
|
}
|
994
1092
|
|
995
1093
|
|
996
1094
|
THREADED_TEST(BigUnsignedSmiInteger) {
|
997
1095
|
v8::HandleScope scope;
|
998
1096
|
LocalContext env;
|
1097
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1098
|
+
|
999
1099
|
uint32_t value = static_cast<uint32_t>(i::Smi::kMaxValue);
|
1000
1100
|
CHECK(i::Smi::IsValid(value));
|
1001
1101
|
CHECK(!i::Smi::IsValid(value + 1));
|
1102
|
+
|
1002
1103
|
Local<v8::Integer> value_obj = v8::Integer::NewFromUnsigned(value);
|
1003
1104
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1105
|
+
|
1106
|
+
value_obj = v8::Integer::NewFromUnsigned(value, isolate);
|
1107
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1004
1108
|
}
|
1005
1109
|
|
1006
1110
|
|
1007
1111
|
THREADED_TEST(BigUnsignedInteger) {
|
1008
1112
|
v8::HandleScope scope;
|
1009
1113
|
LocalContext env;
|
1114
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1115
|
+
|
1010
1116
|
uint32_t value = static_cast<uint32_t>(i::Smi::kMaxValue) + 1;
|
1011
1117
|
CHECK(value > static_cast<uint32_t>(i::Smi::kMaxValue));
|
1012
1118
|
CHECK(!i::Smi::IsValid(value));
|
1119
|
+
|
1013
1120
|
Local<v8::Integer> value_obj = v8::Integer::NewFromUnsigned(value);
|
1014
1121
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1122
|
+
|
1123
|
+
value_obj = v8::Integer::NewFromUnsigned(value, isolate);
|
1124
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1015
1125
|
}
|
1016
1126
|
|
1017
1127
|
|
1018
1128
|
THREADED_TEST(OutOfSignedRangeUnsignedInteger) {
|
1019
1129
|
v8::HandleScope scope;
|
1020
1130
|
LocalContext env;
|
1131
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
1132
|
+
|
1021
1133
|
uint32_t INT32_MAX_AS_UINT = (1U << 31) - 1;
|
1022
1134
|
uint32_t value = INT32_MAX_AS_UINT + 1;
|
1023
1135
|
CHECK(value > INT32_MAX_AS_UINT); // No overflow.
|
1136
|
+
|
1024
1137
|
Local<v8::Integer> value_obj = v8::Integer::NewFromUnsigned(value);
|
1025
1138
|
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1139
|
+
|
1140
|
+
value_obj = v8::Integer::NewFromUnsigned(value, isolate);
|
1141
|
+
CHECK_EQ(static_cast<int64_t>(value), value_obj->Value());
|
1026
1142
|
}
|
1027
1143
|
|
1028
1144
|
|
@@ -1923,7 +2039,16 @@ THREADED_TEST(GlobalObjectInternalFields) {
|
|
1923
2039
|
}
|
1924
2040
|
|
1925
2041
|
|
1926
|
-
|
2042
|
+
static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj,
|
2043
|
+
void* value) {
|
2044
|
+
CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
|
2045
|
+
obj->SetAlignedPointerInInternalField(0, value);
|
2046
|
+
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
2047
|
+
CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0));
|
2048
|
+
}
|
2049
|
+
|
2050
|
+
|
2051
|
+
THREADED_TEST(InternalFieldsAlignedPointers) {
|
1927
2052
|
v8::HandleScope scope;
|
1928
2053
|
LocalContext env;
|
1929
2054
|
|
@@ -1932,64 +2057,78 @@ THREADED_TEST(InternalFieldsNativePointers) {
|
|
1932
2057
|
instance_templ->SetInternalFieldCount(1);
|
1933
2058
|
Local<v8::Object> obj = templ->GetFunction()->NewInstance();
|
1934
2059
|
CHECK_EQ(1, obj->InternalFieldCount());
|
1935
|
-
CHECK(obj->GetPointerFromInternalField(0) == NULL);
|
1936
2060
|
|
1937
|
-
|
2061
|
+
CheckAlignedPointerInInternalField(obj, NULL);
|
1938
2062
|
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
2063
|
+
int* heap_allocated = new int[100];
|
2064
|
+
CheckAlignedPointerInInternalField(obj, heap_allocated);
|
2065
|
+
delete[] heap_allocated;
|
2066
|
+
|
2067
|
+
int stack_allocated[100];
|
2068
|
+
CheckAlignedPointerInInternalField(obj, stack_allocated);
|
2069
|
+
|
2070
|
+
void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1));
|
2071
|
+
CheckAlignedPointerInInternalField(obj, huge);
|
2072
|
+
}
|
1943
2073
|
|
1944
|
-
// Check reading and writing aligned pointers.
|
1945
|
-
obj->SetPointerInInternalField(0, aligned);
|
1946
|
-
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
1947
|
-
CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
|
1948
2074
|
|
1949
|
-
|
1950
|
-
|
2075
|
+
static void CheckAlignedPointerInEmbedderData(LocalContext* env,
|
2076
|
+
int index,
|
2077
|
+
void* value) {
|
2078
|
+
CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1));
|
2079
|
+
(*env)->SetAlignedPointerInEmbedderData(index, value);
|
1951
2080
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
1952
|
-
CHECK_EQ(
|
2081
|
+
CHECK_EQ(value, (*env)->GetAlignedPointerFromEmbedderData(index));
|
2082
|
+
}
|
2083
|
+
|
1953
2084
|
|
1954
|
-
|
2085
|
+
static void* AlignedTestPointer(int i) {
|
2086
|
+
return reinterpret_cast<void*>(i * 1234);
|
1955
2087
|
}
|
1956
2088
|
|
1957
2089
|
|
1958
|
-
THREADED_TEST(
|
2090
|
+
THREADED_TEST(EmbedderDataAlignedPointers) {
|
1959
2091
|
v8::HandleScope scope;
|
1960
2092
|
LocalContext env;
|
1961
2093
|
|
1962
|
-
|
1963
|
-
Local<v8::ObjectTemplate> instance_templ = templ->InstanceTemplate();
|
1964
|
-
instance_templ->SetInternalFieldCount(1);
|
1965
|
-
Local<v8::Object> obj = templ->GetFunction()->NewInstance();
|
1966
|
-
CHECK_EQ(1, obj->InternalFieldCount());
|
1967
|
-
CHECK(obj->GetPointerFromInternalField(0) == NULL);
|
2094
|
+
CheckAlignedPointerInEmbedderData(&env, 0, NULL);
|
1968
2095
|
|
1969
|
-
|
2096
|
+
int* heap_allocated = new int[100];
|
2097
|
+
CheckAlignedPointerInEmbedderData(&env, 1, heap_allocated);
|
2098
|
+
delete[] heap_allocated;
|
1970
2099
|
|
1971
|
-
|
1972
|
-
|
1973
|
-
void* unaligned = data + 1;
|
1974
|
-
CHECK_EQ(1, static_cast<int>(reinterpret_cast<uintptr_t>(unaligned) & 0x1));
|
2100
|
+
int stack_allocated[100];
|
2101
|
+
CheckAlignedPointerInEmbedderData(&env, 2, stack_allocated);
|
1975
2102
|
|
1976
|
-
|
1977
|
-
|
1978
|
-
CHECK_EQ(aligned, v8::External::Unwrap(obj->GetInternalField(0)));
|
2103
|
+
void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1));
|
2104
|
+
CheckAlignedPointerInEmbedderData(&env, 3, huge);
|
1979
2105
|
|
1980
|
-
|
2106
|
+
// Test growing of the embedder data's backing store.
|
2107
|
+
for (int i = 0; i < 100; i++) {
|
2108
|
+
env->SetAlignedPointerInEmbedderData(i, AlignedTestPointer(i));
|
2109
|
+
}
|
1981
2110
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
1982
|
-
|
2111
|
+
for (int i = 0; i < 100; i++) {
|
2112
|
+
CHECK_EQ(AlignedTestPointer(i), env->GetAlignedPointerFromEmbedderData(i));
|
2113
|
+
}
|
2114
|
+
}
|
1983
2115
|
|
1984
|
-
obj->SetInternalField(0, v8::External::Wrap(aligned));
|
1985
|
-
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
1986
|
-
CHECK_EQ(aligned, obj->GetPointerFromInternalField(0));
|
1987
2116
|
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
2117
|
+
static void CheckEmbedderData(LocalContext* env,
|
2118
|
+
int index,
|
2119
|
+
v8::Handle<Value> data) {
|
2120
|
+
(*env)->SetEmbedderData(index, data);
|
2121
|
+
CHECK((*env)->GetEmbedderData(index)->StrictEquals(data));
|
2122
|
+
}
|
2123
|
+
|
2124
|
+
THREADED_TEST(EmbedderData) {
|
2125
|
+
v8::HandleScope scope;
|
2126
|
+
LocalContext env;
|
1991
2127
|
|
1992
|
-
|
2128
|
+
CheckEmbedderData(&env, 3, v8::String::New("The quick brown fox jumps"));
|
2129
|
+
CheckEmbedderData(&env, 2, v8::String::New("over the lazy dog."));
|
2130
|
+
CheckEmbedderData(&env, 1, v8::Number::New(1.2345));
|
2131
|
+
CheckEmbedderData(&env, 0, v8::Boolean::New(true));
|
1993
2132
|
}
|
1994
2133
|
|
1995
2134
|
|
@@ -2080,6 +2219,10 @@ THREADED_TEST(HiddenProperties) {
|
|
2080
2219
|
|
2081
2220
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
2082
2221
|
|
2222
|
+
CHECK(obj->SetHiddenValue(key, Handle<Value>()));
|
2223
|
+
CHECK(obj->GetHiddenValue(key).IsEmpty());
|
2224
|
+
|
2225
|
+
CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002)));
|
2083
2226
|
CHECK(obj->DeleteHiddenValue(key));
|
2084
2227
|
CHECK(obj->GetHiddenValue(key).IsEmpty());
|
2085
2228
|
}
|
@@ -2156,32 +2299,51 @@ THREADED_TEST(External) {
|
|
2156
2299
|
|
2157
2300
|
// Make sure unaligned pointers are wrapped properly.
|
2158
2301
|
char* data = i::StrDup("0123456789");
|
2159
|
-
Local<v8::Value> zero = v8::External::
|
2160
|
-
Local<v8::Value> one = v8::External::
|
2161
|
-
Local<v8::Value> two = v8::External::
|
2162
|
-
Local<v8::Value> three = v8::External::
|
2302
|
+
Local<v8::Value> zero = v8::External::New(&data[0]);
|
2303
|
+
Local<v8::Value> one = v8::External::New(&data[1]);
|
2304
|
+
Local<v8::Value> two = v8::External::New(&data[2]);
|
2305
|
+
Local<v8::Value> three = v8::External::New(&data[3]);
|
2163
2306
|
|
2164
|
-
char* char_ptr = reinterpret_cast<char*>(v8::External::
|
2307
|
+
char* char_ptr = reinterpret_cast<char*>(v8::External::Cast(*zero)->Value());
|
2165
2308
|
CHECK_EQ('0', *char_ptr);
|
2166
|
-
char_ptr = reinterpret_cast<char*>(v8::External::
|
2309
|
+
char_ptr = reinterpret_cast<char*>(v8::External::Cast(*one)->Value());
|
2167
2310
|
CHECK_EQ('1', *char_ptr);
|
2168
|
-
char_ptr = reinterpret_cast<char*>(v8::External::
|
2311
|
+
char_ptr = reinterpret_cast<char*>(v8::External::Cast(*two)->Value());
|
2169
2312
|
CHECK_EQ('2', *char_ptr);
|
2170
|
-
char_ptr = reinterpret_cast<char*>(v8::External::
|
2313
|
+
char_ptr = reinterpret_cast<char*>(v8::External::Cast(*three)->Value());
|
2171
2314
|
CHECK_EQ('3', *char_ptr);
|
2172
2315
|
i::DeleteArray(data);
|
2173
2316
|
}
|
2174
2317
|
|
2175
2318
|
|
2176
2319
|
THREADED_TEST(GlobalHandle) {
|
2320
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
2177
2321
|
v8::Persistent<String> global;
|
2178
2322
|
{
|
2179
2323
|
v8::HandleScope scope;
|
2180
2324
|
Local<String> str = v8_str("str");
|
2181
|
-
global = v8::Persistent<String>::New(str);
|
2325
|
+
global = v8::Persistent<String>::New(isolate, str);
|
2326
|
+
}
|
2327
|
+
CHECK_EQ(global->Length(), 3);
|
2328
|
+
global.Dispose(isolate);
|
2329
|
+
|
2330
|
+
{
|
2331
|
+
v8::HandleScope scope;
|
2332
|
+
Local<String> str = v8_str("str");
|
2333
|
+
global = v8::Persistent<String>::New(isolate, str);
|
2182
2334
|
}
|
2183
2335
|
CHECK_EQ(global->Length(), 3);
|
2184
|
-
global.Dispose();
|
2336
|
+
global.Dispose(isolate);
|
2337
|
+
}
|
2338
|
+
|
2339
|
+
|
2340
|
+
THREADED_TEST(LocalHandle) {
|
2341
|
+
v8::HandleScope scope;
|
2342
|
+
v8::Local<String> local = v8::Local<String>::New(v8_str("str"));
|
2343
|
+
CHECK_EQ(local->Length(), 3);
|
2344
|
+
|
2345
|
+
local = v8::Local<String>::New(v8::Isolate::GetCurrent(), v8_str("str"));
|
2346
|
+
CHECK_EQ(local->Length(), 3);
|
2185
2347
|
}
|
2186
2348
|
|
2187
2349
|
|
@@ -2197,17 +2359,20 @@ class WeakCallCounter {
|
|
2197
2359
|
};
|
2198
2360
|
|
2199
2361
|
|
2200
|
-
static void WeakPointerCallback(
|
2362
|
+
static void WeakPointerCallback(v8::Isolate* isolate,
|
2363
|
+
Persistent<Value> handle,
|
2364
|
+
void* id) {
|
2201
2365
|
WeakCallCounter* counter = reinterpret_cast<WeakCallCounter*>(id);
|
2202
2366
|
CHECK_EQ(1234, counter->id());
|
2203
2367
|
counter->increment();
|
2204
|
-
handle.Dispose();
|
2368
|
+
handle.Dispose(isolate);
|
2205
2369
|
}
|
2206
2370
|
|
2207
2371
|
|
2208
2372
|
THREADED_TEST(ApiObjectGroups) {
|
2209
2373
|
HandleScope scope;
|
2210
2374
|
LocalContext env;
|
2375
|
+
v8::Isolate* iso = env->GetIsolate();
|
2211
2376
|
|
2212
2377
|
Persistent<Object> g1s1;
|
2213
2378
|
Persistent<Object> g1s2;
|
@@ -2220,22 +2385,22 @@ THREADED_TEST(ApiObjectGroups) {
|
|
2220
2385
|
|
2221
2386
|
{
|
2222
2387
|
HandleScope scope;
|
2223
|
-
g1s1 = Persistent<Object>::New(Object::New());
|
2224
|
-
g1s2 = Persistent<Object>::New(Object::New());
|
2225
|
-
g1c1 = Persistent<Object>::New(Object::New());
|
2226
|
-
g1s1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2227
|
-
g1s2.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2228
|
-
g1c1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2388
|
+
g1s1 = Persistent<Object>::New(iso, Object::New());
|
2389
|
+
g1s2 = Persistent<Object>::New(iso, Object::New());
|
2390
|
+
g1c1 = Persistent<Object>::New(iso, Object::New());
|
2391
|
+
g1s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2392
|
+
g1s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2393
|
+
g1c1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2229
2394
|
|
2230
|
-
g2s1 = Persistent<Object>::New(Object::New());
|
2231
|
-
g2s2 = Persistent<Object>::New(Object::New());
|
2232
|
-
g2c1 = Persistent<Object>::New(Object::New());
|
2233
|
-
g2s1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2234
|
-
g2s2.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2235
|
-
g2c1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2395
|
+
g2s1 = Persistent<Object>::New(iso, Object::New());
|
2396
|
+
g2s2 = Persistent<Object>::New(iso, Object::New());
|
2397
|
+
g2c1 = Persistent<Object>::New(iso, Object::New());
|
2398
|
+
g2s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2399
|
+
g2s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2400
|
+
g2c1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2236
2401
|
}
|
2237
2402
|
|
2238
|
-
Persistent<Object> root = Persistent<Object>::New(g1s1); // make a root.
|
2403
|
+
Persistent<Object> root = Persistent<Object>::New(iso, g1s1); // make a root.
|
2239
2404
|
|
2240
2405
|
// Connect group 1 and 2, make a cycle.
|
2241
2406
|
CHECK(g1s2->Set(0, g2s2));
|
@@ -2258,11 +2423,11 @@ THREADED_TEST(ApiObjectGroups) {
|
|
2258
2423
|
CHECK_EQ(0, counter.NumberOfWeakCalls());
|
2259
2424
|
|
2260
2425
|
// Weaken the root.
|
2261
|
-
root.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2426
|
+
root.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2262
2427
|
// But make children strong roots---all the objects (except for children)
|
2263
2428
|
// should be collectable now.
|
2264
|
-
g1c1.ClearWeak();
|
2265
|
-
g2c1.ClearWeak();
|
2429
|
+
g1c1.ClearWeak(iso);
|
2430
|
+
g2c1.ClearWeak(iso);
|
2266
2431
|
|
2267
2432
|
// Groups are deleted, rebuild groups.
|
2268
2433
|
{
|
@@ -2282,8 +2447,8 @@ THREADED_TEST(ApiObjectGroups) {
|
|
2282
2447
|
CHECK_EQ(5, counter.NumberOfWeakCalls());
|
2283
2448
|
|
2284
2449
|
// And now make children weak again and collect them.
|
2285
|
-
g1c1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2286
|
-
g2c1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2450
|
+
g1c1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2451
|
+
g2c1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2287
2452
|
|
2288
2453
|
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
2289
2454
|
CHECK_EQ(7, counter.NumberOfWeakCalls());
|
@@ -2293,6 +2458,7 @@ THREADED_TEST(ApiObjectGroups) {
|
|
2293
2458
|
THREADED_TEST(ApiObjectGroupsCycle) {
|
2294
2459
|
HandleScope scope;
|
2295
2460
|
LocalContext env;
|
2461
|
+
v8::Isolate* iso = env->GetIsolate();
|
2296
2462
|
|
2297
2463
|
WeakCallCounter counter(1234);
|
2298
2464
|
|
@@ -2302,26 +2468,41 @@ THREADED_TEST(ApiObjectGroupsCycle) {
|
|
2302
2468
|
Persistent<Object> g2s2;
|
2303
2469
|
Persistent<Object> g3s1;
|
2304
2470
|
Persistent<Object> g3s2;
|
2471
|
+
Persistent<Object> g4s1;
|
2472
|
+
Persistent<Object> g4s2;
|
2305
2473
|
|
2306
2474
|
{
|
2307
2475
|
HandleScope scope;
|
2308
|
-
g1s1 = Persistent<Object>::New(Object::New());
|
2309
|
-
g1s2 = Persistent<Object>::New(Object::New());
|
2310
|
-
g1s1.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2311
|
-
g1s2.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
g2s1
|
2316
|
-
g2s2
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2476
|
+
g1s1 = Persistent<Object>::New(iso, Object::New());
|
2477
|
+
g1s2 = Persistent<Object>::New(iso, Object::New());
|
2478
|
+
g1s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2479
|
+
g1s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2480
|
+
CHECK(g1s1.IsWeak(iso));
|
2481
|
+
CHECK(g1s2.IsWeak(iso));
|
2482
|
+
|
2483
|
+
g2s1 = Persistent<Object>::New(iso, Object::New());
|
2484
|
+
g2s2 = Persistent<Object>::New(iso, Object::New());
|
2485
|
+
g2s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2486
|
+
g2s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2487
|
+
CHECK(g2s1.IsWeak(iso));
|
2488
|
+
CHECK(g2s2.IsWeak(iso));
|
2489
|
+
|
2490
|
+
g3s1 = Persistent<Object>::New(iso, Object::New());
|
2491
|
+
g3s2 = Persistent<Object>::New(iso, Object::New());
|
2492
|
+
g3s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2493
|
+
g3s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2494
|
+
CHECK(g3s1.IsWeak(iso));
|
2495
|
+
CHECK(g3s2.IsWeak(iso));
|
2496
|
+
|
2497
|
+
g4s1 = Persistent<Object>::New(iso, Object::New());
|
2498
|
+
g4s2 = Persistent<Object>::New(iso, Object::New());
|
2499
|
+
g4s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2500
|
+
g4s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2501
|
+
CHECK(g4s1.IsWeak(iso));
|
2502
|
+
CHECK(g4s2.IsWeak(iso));
|
2503
|
+
}
|
2504
|
+
|
2505
|
+
Persistent<Object> root = Persistent<Object>::New(iso, g1s1); // make a root.
|
2325
2506
|
|
2326
2507
|
// Connect groups. We're building the following cycle:
|
2327
2508
|
// G1: { g1s1, g2s1 }, g1s1 implicitly references g2s1, ditto for other
|
@@ -2332,13 +2513,17 @@ THREADED_TEST(ApiObjectGroupsCycle) {
|
|
2332
2513
|
Persistent<Value> g2_objects[] = { g2s1, g2s2 };
|
2333
2514
|
Persistent<Value> g2_children[] = { g3s1 };
|
2334
2515
|
Persistent<Value> g3_objects[] = { g3s1, g3s2 };
|
2335
|
-
Persistent<Value> g3_children[] = {
|
2516
|
+
Persistent<Value> g3_children[] = { g4s1 };
|
2517
|
+
Persistent<Value> g4_objects[] = { g4s1, g4s2 };
|
2518
|
+
Persistent<Value> g4_children[] = { g1s1 };
|
2336
2519
|
V8::AddObjectGroup(g1_objects, 2);
|
2337
2520
|
V8::AddImplicitReferences(g1s1, g1_children, 1);
|
2338
2521
|
V8::AddObjectGroup(g2_objects, 2);
|
2339
2522
|
V8::AddImplicitReferences(g2s1, g2_children, 1);
|
2340
2523
|
V8::AddObjectGroup(g3_objects, 2);
|
2341
2524
|
V8::AddImplicitReferences(g3s1, g3_children, 1);
|
2525
|
+
V8::AddObjectGroup(iso, g4_objects, 2);
|
2526
|
+
V8::AddImplicitReferences(g4s1, g4_children, 1);
|
2342
2527
|
}
|
2343
2528
|
// Do a single full GC
|
2344
2529
|
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
@@ -2347,7 +2532,7 @@ THREADED_TEST(ApiObjectGroupsCycle) {
|
|
2347
2532
|
CHECK_EQ(0, counter.NumberOfWeakCalls());
|
2348
2533
|
|
2349
2534
|
// Weaken the root.
|
2350
|
-
root.MakeWeak(reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2535
|
+
root.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2351
2536
|
|
2352
2537
|
// Groups are deleted, rebuild groups.
|
2353
2538
|
{
|
@@ -2356,17 +2541,118 @@ THREADED_TEST(ApiObjectGroupsCycle) {
|
|
2356
2541
|
Persistent<Value> g2_objects[] = { g2s1, g2s2 };
|
2357
2542
|
Persistent<Value> g2_children[] = { g3s1 };
|
2358
2543
|
Persistent<Value> g3_objects[] = { g3s1, g3s2 };
|
2359
|
-
Persistent<Value> g3_children[] = {
|
2544
|
+
Persistent<Value> g3_children[] = { g4s1 };
|
2545
|
+
Persistent<Value> g4_objects[] = { g4s1, g4s2 };
|
2546
|
+
Persistent<Value> g4_children[] = { g1s1 };
|
2360
2547
|
V8::AddObjectGroup(g1_objects, 2);
|
2361
2548
|
V8::AddImplicitReferences(g1s1, g1_children, 1);
|
2362
2549
|
V8::AddObjectGroup(g2_objects, 2);
|
2363
2550
|
V8::AddImplicitReferences(g2s1, g2_children, 1);
|
2364
2551
|
V8::AddObjectGroup(g3_objects, 2);
|
2365
2552
|
V8::AddImplicitReferences(g3s1, g3_children, 1);
|
2553
|
+
V8::AddObjectGroup(g4_objects, 2);
|
2554
|
+
V8::AddImplicitReferences(g4s1, g4_children, 1);
|
2366
2555
|
}
|
2367
2556
|
|
2368
2557
|
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
2369
2558
|
|
2559
|
+
// All objects should be gone. 9 global handles in total.
|
2560
|
+
CHECK_EQ(9, counter.NumberOfWeakCalls());
|
2561
|
+
}
|
2562
|
+
|
2563
|
+
|
2564
|
+
// TODO(mstarzinger): This should be a THREADED_TEST but causes failures
|
2565
|
+
// on the buildbots, so was made non-threaded for the time being.
|
2566
|
+
TEST(ApiObjectGroupsCycleForScavenger) {
|
2567
|
+
i::FLAG_stress_compaction = false;
|
2568
|
+
i::FLAG_gc_global = false;
|
2569
|
+
HandleScope scope;
|
2570
|
+
LocalContext env;
|
2571
|
+
v8::Isolate* iso = env->GetIsolate();
|
2572
|
+
|
2573
|
+
WeakCallCounter counter(1234);
|
2574
|
+
|
2575
|
+
Persistent<Object> g1s1;
|
2576
|
+
Persistent<Object> g1s2;
|
2577
|
+
Persistent<Object> g2s1;
|
2578
|
+
Persistent<Object> g2s2;
|
2579
|
+
Persistent<Object> g3s1;
|
2580
|
+
Persistent<Object> g3s2;
|
2581
|
+
|
2582
|
+
{
|
2583
|
+
HandleScope scope;
|
2584
|
+
g1s1 = Persistent<Object>::New(iso, Object::New());
|
2585
|
+
g1s2 = Persistent<Object>::New(iso, Object::New());
|
2586
|
+
g1s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2587
|
+
g1s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2588
|
+
|
2589
|
+
g2s1 = Persistent<Object>::New(iso, Object::New());
|
2590
|
+
g2s2 = Persistent<Object>::New(iso, Object::New());
|
2591
|
+
g2s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2592
|
+
g2s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2593
|
+
|
2594
|
+
g3s1 = Persistent<Object>::New(iso, Object::New());
|
2595
|
+
g3s2 = Persistent<Object>::New(iso, Object::New());
|
2596
|
+
g3s1.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2597
|
+
g3s2.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2598
|
+
}
|
2599
|
+
|
2600
|
+
// Make a root.
|
2601
|
+
Persistent<Object> root = Persistent<Object>::New(iso, g1s1);
|
2602
|
+
root.MarkPartiallyDependent(iso);
|
2603
|
+
|
2604
|
+
// Connect groups. We're building the following cycle:
|
2605
|
+
// G1: { g1s1, g2s1 }, g1s1 implicitly references g2s1, ditto for other
|
2606
|
+
// groups.
|
2607
|
+
{
|
2608
|
+
g1s1.MarkPartiallyDependent(iso);
|
2609
|
+
g1s2.MarkPartiallyDependent(iso);
|
2610
|
+
g2s1.MarkPartiallyDependent(iso);
|
2611
|
+
g2s2.MarkPartiallyDependent(iso);
|
2612
|
+
g3s1.MarkPartiallyDependent(iso);
|
2613
|
+
g3s2.MarkPartiallyDependent(iso);
|
2614
|
+
Persistent<Value> g1_objects[] = { g1s1, g1s2 };
|
2615
|
+
Persistent<Value> g2_objects[] = { g2s1, g2s2 };
|
2616
|
+
Persistent<Value> g3_objects[] = { g3s1, g3s2 };
|
2617
|
+
V8::AddObjectGroup(g1_objects, 2);
|
2618
|
+
g1s1->Set(v8_str("x"), g2s1);
|
2619
|
+
V8::AddObjectGroup(g2_objects, 2);
|
2620
|
+
g2s1->Set(v8_str("x"), g3s1);
|
2621
|
+
V8::AddObjectGroup(g3_objects, 2);
|
2622
|
+
g3s1->Set(v8_str("x"), g1s1);
|
2623
|
+
}
|
2624
|
+
|
2625
|
+
HEAP->CollectGarbage(i::NEW_SPACE);
|
2626
|
+
|
2627
|
+
// All objects should be alive.
|
2628
|
+
CHECK_EQ(0, counter.NumberOfWeakCalls());
|
2629
|
+
|
2630
|
+
// Weaken the root.
|
2631
|
+
root.MakeWeak(iso, reinterpret_cast<void*>(&counter), &WeakPointerCallback);
|
2632
|
+
root.MarkPartiallyDependent(iso);
|
2633
|
+
|
2634
|
+
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
2635
|
+
// Groups are deleted, rebuild groups.
|
2636
|
+
{
|
2637
|
+
g1s1.MarkPartiallyDependent(isolate);
|
2638
|
+
g1s2.MarkPartiallyDependent(isolate);
|
2639
|
+
g2s1.MarkPartiallyDependent(isolate);
|
2640
|
+
g2s2.MarkPartiallyDependent(isolate);
|
2641
|
+
g3s1.MarkPartiallyDependent(isolate);
|
2642
|
+
g3s2.MarkPartiallyDependent(isolate);
|
2643
|
+
Persistent<Value> g1_objects[] = { g1s1, g1s2 };
|
2644
|
+
Persistent<Value> g2_objects[] = { g2s1, g2s2 };
|
2645
|
+
Persistent<Value> g3_objects[] = { g3s1, g3s2 };
|
2646
|
+
V8::AddObjectGroup(g1_objects, 2);
|
2647
|
+
g1s1->Set(v8_str("x"), g2s1);
|
2648
|
+
V8::AddObjectGroup(g2_objects, 2);
|
2649
|
+
g2s1->Set(v8_str("x"), g3s1);
|
2650
|
+
V8::AddObjectGroup(g3_objects, 2);
|
2651
|
+
g3s1->Set(v8_str("x"), g1s1);
|
2652
|
+
}
|
2653
|
+
|
2654
|
+
HEAP->CollectGarbage(i::NEW_SPACE);
|
2655
|
+
|
2370
2656
|
// All objects should be gone. 7 global handles in total.
|
2371
2657
|
CHECK_EQ(7, counter.NumberOfWeakCalls());
|
2372
2658
|
}
|
@@ -2385,23 +2671,34 @@ THREADED_TEST(ScriptException) {
|
|
2385
2671
|
}
|
2386
2672
|
|
2387
2673
|
|
2674
|
+
TEST(TryCatchCustomException) {
|
2675
|
+
v8::HandleScope scope;
|
2676
|
+
LocalContext env;
|
2677
|
+
v8::TryCatch try_catch;
|
2678
|
+
CompileRun("function CustomError() { this.a = 'b'; }"
|
2679
|
+
"(function f() { throw new CustomError(); })();");
|
2680
|
+
CHECK(try_catch.HasCaught());
|
2681
|
+
CHECK(try_catch.Exception()->ToObject()->
|
2682
|
+
Get(v8_str("a"))->Equals(v8_str("b")));
|
2683
|
+
}
|
2684
|
+
|
2685
|
+
|
2388
2686
|
bool message_received;
|
2389
2687
|
|
2390
2688
|
|
2391
|
-
static void
|
2392
|
-
|
2393
|
-
CHECK_EQ(5.76, data->NumberValue());
|
2689
|
+
static void check_message_0(v8::Handle<v8::Message> message,
|
2690
|
+
v8::Handle<Value> data) {
|
2394
2691
|
CHECK_EQ(6.75, message->GetScriptResourceName()->NumberValue());
|
2395
2692
|
CHECK_EQ(7.56, message->GetScriptData()->NumberValue());
|
2396
2693
|
message_received = true;
|
2397
2694
|
}
|
2398
2695
|
|
2399
2696
|
|
2400
|
-
THREADED_TEST(
|
2697
|
+
THREADED_TEST(MessageHandler0) {
|
2401
2698
|
message_received = false;
|
2402
2699
|
v8::HandleScope scope;
|
2403
2700
|
CHECK(!message_received);
|
2404
|
-
v8::V8::AddMessageListener(
|
2701
|
+
v8::V8::AddMessageListener(check_message_0);
|
2405
2702
|
LocalContext context;
|
2406
2703
|
v8::ScriptOrigin origin =
|
2407
2704
|
v8::ScriptOrigin(v8_str("6.75"));
|
@@ -2411,7 +2708,56 @@ THREADED_TEST(MessageHandlerData) {
|
|
2411
2708
|
script->Run();
|
2412
2709
|
CHECK(message_received);
|
2413
2710
|
// clear out the message listener
|
2414
|
-
v8::V8::RemoveMessageListeners(
|
2711
|
+
v8::V8::RemoveMessageListeners(check_message_0);
|
2712
|
+
}
|
2713
|
+
|
2714
|
+
|
2715
|
+
static void check_message_1(v8::Handle<v8::Message> message,
|
2716
|
+
v8::Handle<Value> data) {
|
2717
|
+
CHECK(data->IsNumber());
|
2718
|
+
CHECK_EQ(1337, data->Int32Value());
|
2719
|
+
message_received = true;
|
2720
|
+
}
|
2721
|
+
|
2722
|
+
|
2723
|
+
TEST(MessageHandler1) {
|
2724
|
+
message_received = false;
|
2725
|
+
v8::HandleScope scope;
|
2726
|
+
CHECK(!message_received);
|
2727
|
+
v8::V8::AddMessageListener(check_message_1);
|
2728
|
+
LocalContext context;
|
2729
|
+
CompileRun("throw 1337;");
|
2730
|
+
CHECK(message_received);
|
2731
|
+
// clear out the message listener
|
2732
|
+
v8::V8::RemoveMessageListeners(check_message_1);
|
2733
|
+
}
|
2734
|
+
|
2735
|
+
|
2736
|
+
static void check_message_2(v8::Handle<v8::Message> message,
|
2737
|
+
v8::Handle<Value> data) {
|
2738
|
+
LocalContext context;
|
2739
|
+
CHECK(data->IsObject());
|
2740
|
+
v8::Local<v8::Value> hidden_property =
|
2741
|
+
v8::Object::Cast(*data)->GetHiddenValue(v8_str("hidden key"));
|
2742
|
+
CHECK(v8_str("hidden value")->Equals(hidden_property));
|
2743
|
+
message_received = true;
|
2744
|
+
}
|
2745
|
+
|
2746
|
+
|
2747
|
+
TEST(MessageHandler2) {
|
2748
|
+
message_received = false;
|
2749
|
+
v8::HandleScope scope;
|
2750
|
+
CHECK(!message_received);
|
2751
|
+
v8::V8::AddMessageListener(check_message_2);
|
2752
|
+
LocalContext context;
|
2753
|
+
v8::Local<v8::Value> error = v8::Exception::Error(v8_str("custom error"));
|
2754
|
+
v8::Object::Cast(*error)->SetHiddenValue(v8_str("hidden key"),
|
2755
|
+
v8_str("hidden value"));
|
2756
|
+
context->Global()->Set(v8_str("error"), error);
|
2757
|
+
CompileRun("throw error;");
|
2758
|
+
CHECK(message_received);
|
2759
|
+
// clear out the message listener
|
2760
|
+
v8::V8::RemoveMessageListeners(check_message_2);
|
2415
2761
|
}
|
2416
2762
|
|
2417
2763
|
|
@@ -2697,7 +3043,7 @@ TEST(HugeConsStringOutOfMemory) {
|
|
2697
3043
|
static const int K = 1024;
|
2698
3044
|
v8::ResourceConstraints constraints;
|
2699
3045
|
constraints.set_max_young_space_size(256 * K);
|
2700
|
-
constraints.set_max_old_space_size(
|
3046
|
+
constraints.set_max_old_space_size(3 * K * K);
|
2701
3047
|
v8::SetResourceConstraints(&constraints);
|
2702
3048
|
|
2703
3049
|
// Execute a script that causes out of memory.
|
@@ -3052,7 +3398,33 @@ TEST(APIThrowMessageOverwrittenToString) {
|
|
3052
3398
|
"Number.prototype.toString = function() { return 'Whoops'; };"
|
3053
3399
|
"ReferenceError.prototype.toString = Object.prototype.toString;");
|
3054
3400
|
CompileRun("asdf;");
|
3055
|
-
v8::V8::RemoveMessageListeners(
|
3401
|
+
v8::V8::RemoveMessageListeners(check_reference_error_message);
|
3402
|
+
}
|
3403
|
+
|
3404
|
+
|
3405
|
+
static void check_custom_error_message(
|
3406
|
+
v8::Handle<v8::Message> message,
|
3407
|
+
v8::Handle<v8::Value> data) {
|
3408
|
+
const char* uncaught_error = "Uncaught MyError toString";
|
3409
|
+
CHECK(message->Get()->Equals(v8_str(uncaught_error)));
|
3410
|
+
}
|
3411
|
+
|
3412
|
+
|
3413
|
+
TEST(CustomErrorToString) {
|
3414
|
+
v8::HandleScope scope;
|
3415
|
+
v8::V8::AddMessageListener(check_custom_error_message);
|
3416
|
+
LocalContext context;
|
3417
|
+
CompileRun(
|
3418
|
+
"function MyError(name, message) { "
|
3419
|
+
" this.name = name; "
|
3420
|
+
" this.message = message; "
|
3421
|
+
"} "
|
3422
|
+
"MyError.prototype = Object.create(Error.prototype); "
|
3423
|
+
"MyError.prototype.toString = function() { "
|
3424
|
+
" return 'MyError toString'; "
|
3425
|
+
"}; "
|
3426
|
+
"throw new MyError('my name', 'my message'); ");
|
3427
|
+
v8::V8::RemoveMessageListeners(check_custom_error_message);
|
3056
3428
|
}
|
3057
3429
|
|
3058
3430
|
|
@@ -3073,7 +3445,7 @@ TEST(APIThrowMessage) {
|
|
3073
3445
|
LocalContext context(0, templ);
|
3074
3446
|
CompileRun("ThrowFromC();");
|
3075
3447
|
CHECK(message_received);
|
3076
|
-
v8::V8::RemoveMessageListeners(
|
3448
|
+
v8::V8::RemoveMessageListeners(receive_message);
|
3077
3449
|
}
|
3078
3450
|
|
3079
3451
|
|
@@ -3091,7 +3463,7 @@ TEST(APIThrowMessageAndVerboseTryCatch) {
|
|
3091
3463
|
CHECK(try_catch.HasCaught());
|
3092
3464
|
CHECK(result.IsEmpty());
|
3093
3465
|
CHECK(message_received);
|
3094
|
-
v8::V8::RemoveMessageListeners(
|
3466
|
+
v8::V8::RemoveMessageListeners(receive_message);
|
3095
3467
|
}
|
3096
3468
|
|
3097
3469
|
|
@@ -3363,9 +3735,34 @@ THREADED_TEST(TryCatchAndFinally) {
|
|
3363
3735
|
}
|
3364
3736
|
|
3365
3737
|
|
3738
|
+
static void TryCatchNestedHelper(int depth) {
|
3739
|
+
if (depth > 0) {
|
3740
|
+
v8::TryCatch try_catch;
|
3741
|
+
try_catch.SetVerbose(true);
|
3742
|
+
TryCatchNestedHelper(depth - 1);
|
3743
|
+
CHECK(try_catch.HasCaught());
|
3744
|
+
try_catch.ReThrow();
|
3745
|
+
} else {
|
3746
|
+
v8::ThrowException(v8_str("back"));
|
3747
|
+
}
|
3748
|
+
}
|
3749
|
+
|
3750
|
+
|
3751
|
+
TEST(TryCatchNested) {
|
3752
|
+
v8::V8::Initialize();
|
3753
|
+
v8::HandleScope scope;
|
3754
|
+
LocalContext context;
|
3755
|
+
v8::TryCatch try_catch;
|
3756
|
+
TryCatchNestedHelper(5);
|
3757
|
+
CHECK(try_catch.HasCaught());
|
3758
|
+
CHECK_EQ(0, strcmp(*v8::String::Utf8Value(try_catch.Exception()), "back"));
|
3759
|
+
}
|
3760
|
+
|
3761
|
+
|
3366
3762
|
THREADED_TEST(Equality) {
|
3367
3763
|
v8::HandleScope scope;
|
3368
3764
|
LocalContext context;
|
3765
|
+
v8::Isolate* isolate = context->GetIsolate();
|
3369
3766
|
// Check that equality works at all before relying on CHECK_EQ
|
3370
3767
|
CHECK(v8_str("a")->Equals(v8_str("a")));
|
3371
3768
|
CHECK(!v8_str("a")->Equals(v8_str("b")));
|
@@ -3389,9 +3786,10 @@ THREADED_TEST(Equality) {
|
|
3389
3786
|
CHECK(!v8::False()->StrictEquals(v8::Undefined()));
|
3390
3787
|
|
3391
3788
|
v8::Handle<v8::Object> obj = v8::Object::New();
|
3392
|
-
v8::Persistent<v8::Object> alias =
|
3789
|
+
v8::Persistent<v8::Object> alias =
|
3790
|
+
v8::Persistent<v8::Object>::New(isolate, obj);
|
3393
3791
|
CHECK(alias->StrictEquals(obj));
|
3394
|
-
alias.Dispose();
|
3792
|
+
alias.Dispose(isolate);
|
3395
3793
|
}
|
3396
3794
|
|
3397
3795
|
|
@@ -3689,7 +4087,7 @@ static void SetXValue(Local<String> name,
|
|
3689
4087
|
CHECK_EQ(info.Data(), v8_str("donut"));
|
3690
4088
|
CHECK_EQ(name, v8_str("x"));
|
3691
4089
|
CHECK(xValue.IsEmpty());
|
3692
|
-
xValue = v8::Persistent<Value>::New(value);
|
4090
|
+
xValue = v8::Persistent<Value>::New(info.GetIsolate(), value);
|
3693
4091
|
}
|
3694
4092
|
|
3695
4093
|
|
@@ -3704,12 +4102,42 @@ THREADED_TEST(SimplePropertyWrite) {
|
|
3704
4102
|
CHECK(xValue.IsEmpty());
|
3705
4103
|
script->Run();
|
3706
4104
|
CHECK_EQ(v8_num(4), xValue);
|
3707
|
-
xValue.Dispose();
|
4105
|
+
xValue.Dispose(context->GetIsolate());
|
4106
|
+
xValue = v8::Persistent<Value>();
|
4107
|
+
}
|
4108
|
+
}
|
4109
|
+
|
4110
|
+
|
4111
|
+
THREADED_TEST(SetterOnly) {
|
4112
|
+
v8::HandleScope scope;
|
4113
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
4114
|
+
templ->SetAccessor(v8_str("x"), NULL, SetXValue, v8_str("donut"));
|
4115
|
+
LocalContext context;
|
4116
|
+
context->Global()->Set(v8_str("obj"), templ->NewInstance());
|
4117
|
+
Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x"));
|
4118
|
+
for (int i = 0; i < 10; i++) {
|
4119
|
+
CHECK(xValue.IsEmpty());
|
4120
|
+
script->Run();
|
4121
|
+
CHECK_EQ(v8_num(4), xValue);
|
4122
|
+
xValue.Dispose(context->GetIsolate());
|
3708
4123
|
xValue = v8::Persistent<Value>();
|
3709
4124
|
}
|
3710
4125
|
}
|
3711
4126
|
|
3712
4127
|
|
4128
|
+
THREADED_TEST(NoAccessors) {
|
4129
|
+
v8::HandleScope scope;
|
4130
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
4131
|
+
templ->SetAccessor(v8_str("x"), NULL, NULL, v8_str("donut"));
|
4132
|
+
LocalContext context;
|
4133
|
+
context->Global()->Set(v8_str("obj"), templ->NewInstance());
|
4134
|
+
Local<Script> script = Script::Compile(v8_str("obj.x = 4; obj.x"));
|
4135
|
+
for (int i = 0; i < 10; i++) {
|
4136
|
+
script->Run();
|
4137
|
+
}
|
4138
|
+
}
|
4139
|
+
|
4140
|
+
|
3713
4141
|
static v8::Handle<Value> XPropertyGetter(Local<String> property,
|
3714
4142
|
const AccessorInfo& info) {
|
3715
4143
|
ApiTestFuzzer::Fuzz();
|
@@ -3801,7 +4229,7 @@ THREADED_TEST(NamedInterceptorDictionaryICMultipleContext) {
|
|
3801
4229
|
CompileRun("var obj = { x : 0 }; delete obj.x;");
|
3802
4230
|
context1->Exit();
|
3803
4231
|
|
3804
|
-
context1.Dispose();
|
4232
|
+
context1.Dispose(context1->GetIsolate());
|
3805
4233
|
}
|
3806
4234
|
|
3807
4235
|
|
@@ -4554,17 +4982,17 @@ template <typename T> static void USE(T) { }
|
|
4554
4982
|
|
4555
4983
|
|
4556
4984
|
// This test is not intended to be run, just type checked.
|
4557
|
-
static inline void PersistentHandles() {
|
4985
|
+
static inline void PersistentHandles(v8::Isolate* isolate) {
|
4558
4986
|
USE(PersistentHandles);
|
4559
4987
|
Local<String> str = v8_str("foo");
|
4560
|
-
v8::Persistent<String> p_str = v8::Persistent<String>::New(str);
|
4988
|
+
v8::Persistent<String> p_str = v8::Persistent<String>::New(isolate, str);
|
4561
4989
|
USE(p_str);
|
4562
4990
|
Local<Script> scr = Script::Compile(v8_str(""));
|
4563
|
-
v8::Persistent<Script> p_scr = v8::Persistent<Script>::New(scr);
|
4991
|
+
v8::Persistent<Script> p_scr = v8::Persistent<Script>::New(isolate, scr);
|
4564
4992
|
USE(p_scr);
|
4565
4993
|
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
4566
4994
|
v8::Persistent<ObjectTemplate> p_templ =
|
4567
|
-
v8::Persistent<ObjectTemplate>::New(templ);
|
4995
|
+
v8::Persistent<ObjectTemplate>::New(isolate, templ);
|
4568
4996
|
USE(p_templ);
|
4569
4997
|
}
|
4570
4998
|
|
@@ -4583,7 +5011,7 @@ THREADED_TEST(GlobalObjectTemplate) {
|
|
4583
5011
|
v8::Persistent<Context> context = Context::New(0, global_template);
|
4584
5012
|
Context::Scope context_scope(context);
|
4585
5013
|
Script::Compile(v8_str("JSNI_Log('LOG')"))->Run();
|
4586
|
-
context.Dispose();
|
5014
|
+
context.Dispose(context->GetIsolate());
|
4587
5015
|
}
|
4588
5016
|
|
4589
5017
|
|
@@ -4605,12 +5033,24 @@ THREADED_TEST(SimpleExtensions) {
|
|
4605
5033
|
}
|
4606
5034
|
|
4607
5035
|
|
4608
|
-
|
4609
|
-
|
4610
|
-
|
4611
|
-
|
4612
|
-
|
4613
|
-
|
5036
|
+
THREADED_TEST(NullExtensions) {
|
5037
|
+
v8::HandleScope handle_scope;
|
5038
|
+
v8::RegisterExtension(new Extension("nulltest", NULL));
|
5039
|
+
const char* extension_names[] = { "nulltest" };
|
5040
|
+
v8::ExtensionConfiguration extensions(1, extension_names);
|
5041
|
+
v8::Handle<Context> context = Context::New(&extensions);
|
5042
|
+
Context::Scope lock(context);
|
5043
|
+
v8::Handle<Value> result = Script::Compile(v8_str("1+3"))->Run();
|
5044
|
+
CHECK_EQ(result, v8::Integer::New(4));
|
5045
|
+
}
|
5046
|
+
|
5047
|
+
|
5048
|
+
static const char* kEmbeddedExtensionSource =
|
5049
|
+
"function Ret54321(){return 54321;}~~@@$"
|
5050
|
+
"$%% THIS IS A SERIES OF NON-NULL-TERMINATED STRINGS.";
|
5051
|
+
static const int kEmbeddedExtensionSourceValidLen = 34;
|
5052
|
+
|
5053
|
+
|
4614
5054
|
THREADED_TEST(ExtensionMissingSourceLength) {
|
4615
5055
|
v8::HandleScope handle_scope;
|
4616
5056
|
v8::RegisterExtension(new Extension("srclentest_fail",
|
@@ -5014,7 +5454,6 @@ TEST(RegexpOutOfMemory) {
|
|
5014
5454
|
|
5015
5455
|
static void MissingScriptInfoMessageListener(v8::Handle<v8::Message> message,
|
5016
5456
|
v8::Handle<Value> data) {
|
5017
|
-
CHECK_EQ(v8::Undefined(), data);
|
5018
5457
|
CHECK(message->GetScriptResourceName()->IsUndefined());
|
5019
5458
|
CHECK_EQ(v8::Undefined(), message->GetScriptResourceName());
|
5020
5459
|
message->GetLineNumber();
|
@@ -5041,29 +5480,30 @@ class Snorkel {
|
|
5041
5480
|
|
5042
5481
|
class Whammy {
|
5043
5482
|
public:
|
5044
|
-
Whammy() {
|
5045
|
-
|
5046
|
-
}
|
5047
|
-
~Whammy() {
|
5048
|
-
script_.Dispose();
|
5049
|
-
}
|
5483
|
+
explicit Whammy(v8::Isolate* isolate) : cursor_(0), isolate_(isolate) { }
|
5484
|
+
~Whammy() { script_.Dispose(isolate_); }
|
5050
5485
|
v8::Handle<Script> getScript() {
|
5051
|
-
if (script_.IsEmpty())
|
5052
|
-
script_ = v8::Persistent<Script>::New(
|
5486
|
+
if (script_.IsEmpty()) {
|
5487
|
+
script_ = v8::Persistent<Script>::New(isolate_,
|
5488
|
+
v8_compile("({}).blammo"));
|
5489
|
+
}
|
5053
5490
|
return Local<Script>(*script_);
|
5054
5491
|
}
|
5055
5492
|
|
5056
5493
|
public:
|
5057
5494
|
static const int kObjectCount = 256;
|
5058
5495
|
int cursor_;
|
5496
|
+
v8::Isolate* isolate_;
|
5059
5497
|
v8::Persistent<v8::Object> objects_[kObjectCount];
|
5060
5498
|
v8::Persistent<Script> script_;
|
5061
5499
|
};
|
5062
5500
|
|
5063
|
-
static void HandleWeakReference(v8::
|
5501
|
+
static void HandleWeakReference(v8::Isolate* isolate,
|
5502
|
+
v8::Persistent<v8::Value> obj,
|
5503
|
+
void* data) {
|
5064
5504
|
Snorkel* snorkel = reinterpret_cast<Snorkel*>(data);
|
5065
5505
|
delete snorkel;
|
5066
|
-
obj.ClearWeak();
|
5506
|
+
obj.ClearWeak(isolate);
|
5067
5507
|
}
|
5068
5508
|
|
5069
5509
|
v8::Handle<Value> WhammyPropertyGetter(Local<String> name,
|
@@ -5074,10 +5514,11 @@ v8::Handle<Value> WhammyPropertyGetter(Local<String> name,
|
|
5074
5514
|
v8::Persistent<v8::Object> prev = whammy->objects_[whammy->cursor_];
|
5075
5515
|
|
5076
5516
|
v8::Handle<v8::Object> obj = v8::Object::New();
|
5077
|
-
v8::Persistent<v8::Object> global =
|
5517
|
+
v8::Persistent<v8::Object> global =
|
5518
|
+
v8::Persistent<v8::Object>::New(info.GetIsolate(), obj);
|
5078
5519
|
if (!prev.IsEmpty()) {
|
5079
5520
|
prev->Set(v8_str("next"), obj);
|
5080
|
-
prev.MakeWeak(new Snorkel(), &HandleWeakReference);
|
5521
|
+
prev.MakeWeak(info.GetIsolate(), new Snorkel(), &HandleWeakReference);
|
5081
5522
|
whammy->objects_[whammy->cursor_].Clear();
|
5082
5523
|
}
|
5083
5524
|
whammy->objects_[whammy->cursor_] = global;
|
@@ -5088,7 +5529,7 @@ v8::Handle<Value> WhammyPropertyGetter(Local<String> name,
|
|
5088
5529
|
THREADED_TEST(WeakReference) {
|
5089
5530
|
v8::HandleScope handle_scope;
|
5090
5531
|
v8::Handle<v8::ObjectTemplate> templ= v8::ObjectTemplate::New();
|
5091
|
-
Whammy* whammy = new Whammy();
|
5532
|
+
Whammy* whammy = new Whammy(v8::Isolate::GetCurrent());
|
5092
5533
|
templ->SetNamedPropertyHandler(WhammyPropertyGetter,
|
5093
5534
|
0, 0, 0, 0,
|
5094
5535
|
v8::External::New(whammy));
|
@@ -5111,12 +5552,14 @@ THREADED_TEST(WeakReference) {
|
|
5111
5552
|
v8::Handle<Value> result = CompileRun(code);
|
5112
5553
|
CHECK_EQ(4.0, result->NumberValue());
|
5113
5554
|
delete whammy;
|
5114
|
-
context.Dispose();
|
5555
|
+
context.Dispose(context->GetIsolate());
|
5115
5556
|
}
|
5116
5557
|
|
5117
5558
|
|
5118
|
-
static void DisposeAndSetFlag(v8::
|
5119
|
-
|
5559
|
+
static void DisposeAndSetFlag(v8::Isolate* isolate,
|
5560
|
+
v8::Persistent<v8::Value> obj,
|
5561
|
+
void* data) {
|
5562
|
+
obj.Dispose(isolate);
|
5120
5563
|
obj.Clear();
|
5121
5564
|
*(reinterpret_cast<bool*>(data)) = true;
|
5122
5565
|
}
|
@@ -5124,20 +5567,28 @@ static void DisposeAndSetFlag(v8::Persistent<v8::Value> obj, void* data) {
|
|
5124
5567
|
|
5125
5568
|
THREADED_TEST(IndependentWeakHandle) {
|
5126
5569
|
v8::Persistent<Context> context = Context::New();
|
5570
|
+
v8::Isolate* iso = context->GetIsolate();
|
5127
5571
|
Context::Scope context_scope(context);
|
5128
5572
|
|
5129
|
-
v8::Persistent<v8::Object> object_a;
|
5573
|
+
v8::Persistent<v8::Object> object_a, object_b;
|
5130
5574
|
|
5131
5575
|
{
|
5132
5576
|
v8::HandleScope handle_scope;
|
5133
|
-
object_a = v8::Persistent<v8::Object>::New(v8::Object::New());
|
5577
|
+
object_a = v8::Persistent<v8::Object>::New(iso, v8::Object::New());
|
5578
|
+
object_b = v8::Persistent<v8::Object>::New(iso, v8::Object::New());
|
5134
5579
|
}
|
5135
5580
|
|
5136
5581
|
bool object_a_disposed = false;
|
5137
|
-
|
5138
|
-
object_a.
|
5582
|
+
bool object_b_disposed = false;
|
5583
|
+
object_a.MakeWeak(iso, &object_a_disposed, &DisposeAndSetFlag);
|
5584
|
+
object_b.MakeWeak(iso, &object_b_disposed, &DisposeAndSetFlag);
|
5585
|
+
CHECK(!object_b.IsIndependent(iso));
|
5586
|
+
object_a.MarkIndependent(iso);
|
5587
|
+
object_b.MarkIndependent(iso);
|
5588
|
+
CHECK(object_b.IsIndependent(iso));
|
5139
5589
|
HEAP->PerformScavenge();
|
5140
5590
|
CHECK(object_a_disposed);
|
5591
|
+
CHECK(object_b_disposed);
|
5141
5592
|
}
|
5142
5593
|
|
5143
5594
|
|
@@ -5151,16 +5602,20 @@ static void InvokeMarkSweep() {
|
|
5151
5602
|
}
|
5152
5603
|
|
5153
5604
|
|
5154
|
-
static void ForceScavenge(v8::
|
5155
|
-
|
5605
|
+
static void ForceScavenge(v8::Isolate* isolate,
|
5606
|
+
v8::Persistent<v8::Value> obj,
|
5607
|
+
void* data) {
|
5608
|
+
obj.Dispose(isolate);
|
5156
5609
|
obj.Clear();
|
5157
5610
|
*(reinterpret_cast<bool*>(data)) = true;
|
5158
5611
|
InvokeScavenge();
|
5159
5612
|
}
|
5160
5613
|
|
5161
5614
|
|
5162
|
-
static void ForceMarkSweep(v8::
|
5163
|
-
|
5615
|
+
static void ForceMarkSweep(v8::Isolate* isolate,
|
5616
|
+
v8::Persistent<v8::Value> obj,
|
5617
|
+
void* data) {
|
5618
|
+
obj.Dispose(isolate);
|
5164
5619
|
obj.Clear();
|
5165
5620
|
*(reinterpret_cast<bool*>(data)) = true;
|
5166
5621
|
InvokeMarkSweep();
|
@@ -5169,10 +5624,11 @@ static void ForceMarkSweep(v8::Persistent<v8::Value> obj, void* data) {
|
|
5169
5624
|
|
5170
5625
|
THREADED_TEST(GCFromWeakCallbacks) {
|
5171
5626
|
v8::Persistent<Context> context = Context::New();
|
5627
|
+
v8::Isolate* isolate = context->GetIsolate();
|
5172
5628
|
Context::Scope context_scope(context);
|
5173
5629
|
|
5174
5630
|
static const int kNumberOfGCTypes = 2;
|
5175
|
-
v8::
|
5631
|
+
v8::NearDeathCallback gc_forcing_callback[kNumberOfGCTypes] =
|
5176
5632
|
{&ForceScavenge, &ForceMarkSweep};
|
5177
5633
|
|
5178
5634
|
typedef void (*GCInvoker)();
|
@@ -5183,11 +5639,11 @@ THREADED_TEST(GCFromWeakCallbacks) {
|
|
5183
5639
|
v8::Persistent<v8::Object> object;
|
5184
5640
|
{
|
5185
5641
|
v8::HandleScope handle_scope;
|
5186
|
-
object = v8::Persistent<v8::Object>::New(v8::Object::New());
|
5642
|
+
object = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
5187
5643
|
}
|
5188
5644
|
bool disposed = false;
|
5189
|
-
object.MakeWeak(&disposed, gc_forcing_callback[inner_gc]);
|
5190
|
-
object.MarkIndependent();
|
5645
|
+
object.MakeWeak(isolate, &disposed, gc_forcing_callback[inner_gc]);
|
5646
|
+
object.MarkIndependent(isolate);
|
5191
5647
|
invoke_gc[outer_gc]();
|
5192
5648
|
CHECK(disposed);
|
5193
5649
|
}
|
@@ -5195,8 +5651,10 @@ THREADED_TEST(GCFromWeakCallbacks) {
|
|
5195
5651
|
}
|
5196
5652
|
|
5197
5653
|
|
5198
|
-
static void RevivingCallback(v8::
|
5199
|
-
|
5654
|
+
static void RevivingCallback(v8::Isolate* isolate,
|
5655
|
+
v8::Persistent<v8::Value> obj,
|
5656
|
+
void* data) {
|
5657
|
+
obj.ClearWeak(isolate);
|
5200
5658
|
*(reinterpret_cast<bool*>(data)) = true;
|
5201
5659
|
}
|
5202
5660
|
|
@@ -5204,21 +5662,22 @@ static void RevivingCallback(v8::Persistent<v8::Value> obj, void* data) {
|
|
5204
5662
|
THREADED_TEST(IndependentHandleRevival) {
|
5205
5663
|
v8::Persistent<Context> context = Context::New();
|
5206
5664
|
Context::Scope context_scope(context);
|
5665
|
+
v8::Isolate* isolate = context->GetIsolate();
|
5207
5666
|
|
5208
5667
|
v8::Persistent<v8::Object> object;
|
5209
5668
|
{
|
5210
5669
|
v8::HandleScope handle_scope;
|
5211
|
-
object = v8::Persistent<v8::Object>::New(v8::Object::New());
|
5670
|
+
object = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
5212
5671
|
object->Set(v8_str("x"), v8::Integer::New(1));
|
5213
5672
|
v8::Local<String> y_str = v8_str("y");
|
5214
5673
|
object->Set(y_str, y_str);
|
5215
5674
|
}
|
5216
5675
|
bool revived = false;
|
5217
|
-
object.MakeWeak(&revived, &RevivingCallback);
|
5218
|
-
object.MarkIndependent();
|
5676
|
+
object.MakeWeak(isolate, &revived, &RevivingCallback);
|
5677
|
+
object.MarkIndependent(isolate);
|
5219
5678
|
HEAP->PerformScavenge();
|
5220
5679
|
CHECK(revived);
|
5221
|
-
HEAP->CollectAllGarbage(
|
5680
|
+
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
5222
5681
|
{
|
5223
5682
|
v8::HandleScope handle_scope;
|
5224
5683
|
v8::Local<String> y_str = v8_str("y");
|
@@ -5543,6 +6002,7 @@ THREADED_TEST(StringWrite) {
|
|
5543
6002
|
v8::Handle<String> str = v8_str("abcde");
|
5544
6003
|
// abc<Icelandic eth><Unicode snowman>.
|
5545
6004
|
v8::Handle<String> str2 = v8_str("abc\303\260\342\230\203");
|
6005
|
+
v8::Handle<String> str3 = v8::String::New("abc\0def", 7);
|
5546
6006
|
const int kStride = 4; // Must match stride in for loops in JS below.
|
5547
6007
|
CompileRun(
|
5548
6008
|
"var left = '';"
|
@@ -5753,6 +6213,32 @@ THREADED_TEST(StringWrite) {
|
|
5753
6213
|
CHECK_NE(0, strcmp(utf8buf, "abc\303\260\342\230\203"));
|
5754
6214
|
utf8buf[8] = '\0';
|
5755
6215
|
CHECK_EQ(0, strcmp(utf8buf, "abc\303\260\342\230\203"));
|
6216
|
+
|
6217
|
+
memset(utf8buf, 0x1, sizeof(utf8buf));
|
6218
|
+
utf8buf[5] = 'X';
|
6219
|
+
len = str->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen,
|
6220
|
+
String::NO_NULL_TERMINATION);
|
6221
|
+
CHECK_EQ(5, len);
|
6222
|
+
CHECK_EQ('X', utf8buf[5]); // Test that the sixth character is untouched.
|
6223
|
+
CHECK_EQ(5, charlen);
|
6224
|
+
utf8buf[5] = '\0';
|
6225
|
+
CHECK_EQ(0, strcmp(utf8buf, "abcde"));
|
6226
|
+
|
6227
|
+
memset(buf, 0x1, sizeof(buf));
|
6228
|
+
len = str3->WriteAscii(buf);
|
6229
|
+
CHECK_EQ(7, len);
|
6230
|
+
CHECK_EQ(0, strcmp("abc def", buf));
|
6231
|
+
|
6232
|
+
memset(buf, 0x1, sizeof(buf));
|
6233
|
+
len = str3->WriteAscii(buf, 0, -1, String::PRESERVE_ASCII_NULL);
|
6234
|
+
CHECK_EQ(7, len);
|
6235
|
+
CHECK_EQ(0, strcmp("abc", buf));
|
6236
|
+
CHECK_EQ(0, buf[3]);
|
6237
|
+
CHECK_EQ(0, strcmp("def", buf + 4));
|
6238
|
+
|
6239
|
+
CHECK_EQ(0, str->WriteAscii(NULL, 0, 0, String::NO_NULL_TERMINATION));
|
6240
|
+
CHECK_EQ(0, str->WriteUtf8(NULL, 0, 0, String::NO_NULL_TERMINATION));
|
6241
|
+
CHECK_EQ(0, str->Write(NULL, 0, 0, String::NO_NULL_TERMINATION));
|
5756
6242
|
}
|
5757
6243
|
|
5758
6244
|
|
@@ -5770,8 +6256,10 @@ static void Utf16Helper(
|
|
5770
6256
|
Local<v8::String>::Cast(a->Get(i));
|
5771
6257
|
Local<v8::Number> expected_len =
|
5772
6258
|
Local<v8::Number>::Cast(alens->Get(i));
|
6259
|
+
#ifndef ENABLE_LATIN_1
|
5773
6260
|
CHECK_EQ(expected_len->Value() != string->Length(),
|
5774
6261
|
string->MayContainNonAscii());
|
6262
|
+
#endif
|
5775
6263
|
int length = GetUtf8Length(string);
|
5776
6264
|
CHECK_EQ(static_cast<int>(expected_len->Value()), length);
|
5777
6265
|
}
|
@@ -6282,10 +6770,10 @@ TEST(SecurityHandler) {
|
|
6282
6770
|
}
|
6283
6771
|
|
6284
6772
|
context1->Exit();
|
6285
|
-
context1.Dispose();
|
6773
|
+
context1.Dispose(context1->GetIsolate());
|
6286
6774
|
|
6287
6775
|
context0->Exit();
|
6288
|
-
context0.Dispose();
|
6776
|
+
context0.Dispose(context0->GetIsolate());
|
6289
6777
|
}
|
6290
6778
|
|
6291
6779
|
|
@@ -6329,7 +6817,7 @@ THREADED_TEST(SecurityChecks) {
|
|
6329
6817
|
CHECK(try_catch.HasCaught());
|
6330
6818
|
}
|
6331
6819
|
|
6332
|
-
env2.Dispose();
|
6820
|
+
env2.Dispose(env2->GetIsolate());
|
6333
6821
|
}
|
6334
6822
|
|
6335
6823
|
|
@@ -6398,7 +6886,7 @@ THREADED_TEST(SecurityChecksForPrototypeChain) {
|
|
6398
6886
|
CHECK(!access_f3->Run()->Equals(v8_num(101)));
|
6399
6887
|
CHECK(access_f3->Run()->IsUndefined());
|
6400
6888
|
}
|
6401
|
-
other.Dispose();
|
6889
|
+
other.Dispose(other->GetIsolate());
|
6402
6890
|
}
|
6403
6891
|
|
6404
6892
|
|
@@ -6431,7 +6919,7 @@ THREADED_TEST(CrossDomainDelete) {
|
|
6431
6919
|
CHECK(v->IsNumber());
|
6432
6920
|
CHECK_EQ(3, v->Int32Value());
|
6433
6921
|
|
6434
|
-
env2.Dispose();
|
6922
|
+
env2.Dispose(env2->GetIsolate());
|
6435
6923
|
}
|
6436
6924
|
|
6437
6925
|
|
@@ -6466,7 +6954,7 @@ THREADED_TEST(CrossDomainIsPropertyEnumerable) {
|
|
6466
6954
|
CHECK(result->IsFalse());
|
6467
6955
|
}
|
6468
6956
|
|
6469
|
-
env2.Dispose();
|
6957
|
+
env2.Dispose(env2->GetIsolate());
|
6470
6958
|
}
|
6471
6959
|
|
6472
6960
|
|
@@ -6499,7 +6987,7 @@ THREADED_TEST(CrossDomainForIn) {
|
|
6499
6987
|
"return true;})()");
|
6500
6988
|
CHECK(result->IsTrue());
|
6501
6989
|
}
|
6502
|
-
env2.Dispose();
|
6990
|
+
env2.Dispose(env2->GetIsolate());
|
6503
6991
|
}
|
6504
6992
|
|
6505
6993
|
|
@@ -6562,8 +7050,8 @@ TEST(ContextDetachGlobal) {
|
|
6562
7050
|
CHECK(r->IsUndefined());
|
6563
7051
|
}
|
6564
7052
|
|
6565
|
-
env2.Dispose();
|
6566
|
-
env3.Dispose();
|
7053
|
+
env2.Dispose(env2->GetIsolate());
|
7054
|
+
env3.Dispose(env3->GetIsolate());
|
6567
7055
|
}
|
6568
7056
|
|
6569
7057
|
|
@@ -6641,8 +7129,8 @@ TEST(DetachAndReattachGlobal) {
|
|
6641
7129
|
CHECK(result->IsInt32());
|
6642
7130
|
CHECK_EQ(42, result->Int32Value());
|
6643
7131
|
|
6644
|
-
env2.Dispose();
|
6645
|
-
env3.Dispose();
|
7132
|
+
env2.Dispose(env2->GetIsolate());
|
7133
|
+
env3.Dispose(env3->GetIsolate());
|
6646
7134
|
}
|
6647
7135
|
|
6648
7136
|
|
@@ -6932,8 +7420,8 @@ TEST(AccessControl) {
|
|
6932
7420
|
|
6933
7421
|
context1->Exit();
|
6934
7422
|
context0->Exit();
|
6935
|
-
context1.Dispose();
|
6936
|
-
context0.Dispose();
|
7423
|
+
context1.Dispose(context1->GetIsolate());
|
7424
|
+
context0.Dispose(context0->GetIsolate());
|
6937
7425
|
}
|
6938
7426
|
|
6939
7427
|
|
@@ -7061,8 +7549,8 @@ THREADED_TEST(AccessControlGetOwnPropertyNames) {
|
|
7061
7549
|
|
7062
7550
|
context1->Exit();
|
7063
7551
|
context0->Exit();
|
7064
|
-
context1.Dispose();
|
7065
|
-
context0.Dispose();
|
7552
|
+
context1.Dispose(context1->GetIsolate());
|
7553
|
+
context0.Dispose(context0->GetIsolate());
|
7066
7554
|
}
|
7067
7555
|
|
7068
7556
|
|
@@ -7145,8 +7633,8 @@ THREADED_TEST(CrossDomainAccessors) {
|
|
7145
7633
|
|
7146
7634
|
context1->Exit();
|
7147
7635
|
context0->Exit();
|
7148
|
-
context1.Dispose();
|
7149
|
-
context0.Dispose();
|
7636
|
+
context1.Dispose(context1->GetIsolate());
|
7637
|
+
context0.Dispose(context0->GetIsolate());
|
7150
7638
|
}
|
7151
7639
|
|
7152
7640
|
|
@@ -7280,8 +7768,8 @@ TEST(AccessControlIC) {
|
|
7280
7768
|
|
7281
7769
|
context1->Exit();
|
7282
7770
|
context0->Exit();
|
7283
|
-
context1.Dispose();
|
7284
|
-
context0.Dispose();
|
7771
|
+
context1.Dispose(context1->GetIsolate());
|
7772
|
+
context0.Dispose(context0->GetIsolate());
|
7285
7773
|
}
|
7286
7774
|
|
7287
7775
|
|
@@ -7355,8 +7843,8 @@ THREADED_TEST(AccessControlFlatten) {
|
|
7355
7843
|
|
7356
7844
|
context1->Exit();
|
7357
7845
|
context0->Exit();
|
7358
|
-
context1.Dispose();
|
7359
|
-
context0.Dispose();
|
7846
|
+
context1.Dispose(context1->GetIsolate());
|
7847
|
+
context0.Dispose(context0->GetIsolate());
|
7360
7848
|
}
|
7361
7849
|
|
7362
7850
|
|
@@ -7447,8 +7935,8 @@ THREADED_TEST(AccessControlInterceptorIC) {
|
|
7447
7935
|
|
7448
7936
|
context1->Exit();
|
7449
7937
|
context0->Exit();
|
7450
|
-
context1.Dispose();
|
7451
|
-
context0.Dispose();
|
7938
|
+
context1.Dispose(context1->GetIsolate());
|
7939
|
+
context0.Dispose(context0->GetIsolate());
|
7452
7940
|
}
|
7453
7941
|
|
7454
7942
|
|
@@ -7638,12 +8126,8 @@ THREADED_TEST(ShadowObject) {
|
|
7638
8126
|
Local<ObjectTemplate> proto = t->PrototypeTemplate();
|
7639
8127
|
Local<ObjectTemplate> instance = t->InstanceTemplate();
|
7640
8128
|
|
7641
|
-
// Only allow calls of f on instances of t.
|
7642
|
-
Local<v8::Signature> signature = v8::Signature::New(t);
|
7643
8129
|
proto->Set(v8_str("f"),
|
7644
|
-
v8::FunctionTemplate::New(ShadowFunctionCallback,
|
7645
|
-
Local<Value>(),
|
7646
|
-
signature));
|
8130
|
+
v8::FunctionTemplate::New(ShadowFunctionCallback, Local<Value>()));
|
7647
8131
|
proto->Set(v8_str("x"), v8_num(12));
|
7648
8132
|
|
7649
8133
|
instance->SetAccessor(v8_str("y"), ShadowYGetter, ShadowYSetter);
|
@@ -7662,7 +8146,7 @@ THREADED_TEST(ShadowObject) {
|
|
7662
8146
|
value = Script::Compile(v8_str("f()"))->Run();
|
7663
8147
|
CHECK_EQ(42, value->Int32Value());
|
7664
8148
|
|
7665
|
-
Script::Compile(v8_str("y =
|
8149
|
+
Script::Compile(v8_str("y = 43"))->Run();
|
7666
8150
|
CHECK_EQ(1, shadow_y_setter_call_count);
|
7667
8151
|
value = Script::Compile(v8_str("y"))->Run();
|
7668
8152
|
CHECK_EQ(1, shadow_y_getter_call_count);
|
@@ -7714,6 +8198,66 @@ THREADED_TEST(HiddenPrototype) {
|
|
7714
8198
|
}
|
7715
8199
|
|
7716
8200
|
|
8201
|
+
THREADED_TEST(HiddenPrototypeSet) {
|
8202
|
+
v8::HandleScope handle_scope;
|
8203
|
+
LocalContext context;
|
8204
|
+
|
8205
|
+
Local<v8::FunctionTemplate> ot = v8::FunctionTemplate::New();
|
8206
|
+
Local<v8::FunctionTemplate> ht = v8::FunctionTemplate::New();
|
8207
|
+
ht->SetHiddenPrototype(true);
|
8208
|
+
Local<v8::FunctionTemplate> pt = v8::FunctionTemplate::New();
|
8209
|
+
ht->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
|
8210
|
+
|
8211
|
+
Local<v8::Object> o = ot->GetFunction()->NewInstance();
|
8212
|
+
Local<v8::Object> h = ht->GetFunction()->NewInstance();
|
8213
|
+
Local<v8::Object> p = pt->GetFunction()->NewInstance();
|
8214
|
+
o->Set(v8_str("__proto__"), h);
|
8215
|
+
h->Set(v8_str("__proto__"), p);
|
8216
|
+
|
8217
|
+
// Setting a property that exists on the hidden prototype goes there.
|
8218
|
+
o->Set(v8_str("x"), v8_num(7));
|
8219
|
+
CHECK_EQ(7, o->Get(v8_str("x"))->Int32Value());
|
8220
|
+
CHECK_EQ(7, h->Get(v8_str("x"))->Int32Value());
|
8221
|
+
CHECK(p->Get(v8_str("x"))->IsUndefined());
|
8222
|
+
|
8223
|
+
// Setting a new property should not be forwarded to the hidden prototype.
|
8224
|
+
o->Set(v8_str("y"), v8_num(6));
|
8225
|
+
CHECK_EQ(6, o->Get(v8_str("y"))->Int32Value());
|
8226
|
+
CHECK(h->Get(v8_str("y"))->IsUndefined());
|
8227
|
+
CHECK(p->Get(v8_str("y"))->IsUndefined());
|
8228
|
+
|
8229
|
+
// Setting a property that only exists on a prototype of the hidden prototype
|
8230
|
+
// is treated normally again.
|
8231
|
+
p->Set(v8_str("z"), v8_num(8));
|
8232
|
+
CHECK_EQ(8, o->Get(v8_str("z"))->Int32Value());
|
8233
|
+
CHECK_EQ(8, h->Get(v8_str("z"))->Int32Value());
|
8234
|
+
CHECK_EQ(8, p->Get(v8_str("z"))->Int32Value());
|
8235
|
+
o->Set(v8_str("z"), v8_num(9));
|
8236
|
+
CHECK_EQ(9, o->Get(v8_str("z"))->Int32Value());
|
8237
|
+
CHECK_EQ(8, h->Get(v8_str("z"))->Int32Value());
|
8238
|
+
CHECK_EQ(8, p->Get(v8_str("z"))->Int32Value());
|
8239
|
+
}
|
8240
|
+
|
8241
|
+
|
8242
|
+
// Regression test for issue 2457.
|
8243
|
+
THREADED_TEST(HiddenPrototypeIdentityHash) {
|
8244
|
+
v8::HandleScope handle_scope;
|
8245
|
+
LocalContext context;
|
8246
|
+
|
8247
|
+
Handle<FunctionTemplate> t = FunctionTemplate::New();
|
8248
|
+
t->SetHiddenPrototype(true);
|
8249
|
+
t->InstanceTemplate()->Set(v8_str("foo"), v8_num(75));
|
8250
|
+
Handle<Object> p = t->GetFunction()->NewInstance();
|
8251
|
+
Handle<Object> o = Object::New();
|
8252
|
+
o->SetPrototype(p);
|
8253
|
+
|
8254
|
+
int hash = o->GetIdentityHash();
|
8255
|
+
USE(hash);
|
8256
|
+
o->Set(v8_str("foo"), v8_num(42));
|
8257
|
+
ASSERT_EQ(hash, o->GetIdentityHash());
|
8258
|
+
}
|
8259
|
+
|
8260
|
+
|
7717
8261
|
THREADED_TEST(SetPrototype) {
|
7718
8262
|
v8::HandleScope handle_scope;
|
7719
8263
|
LocalContext context;
|
@@ -8282,8 +8826,8 @@ THREADED_TEST(EvalInDetachedGlobal) {
|
|
8282
8826
|
CHECK(catcher.HasCaught());
|
8283
8827
|
context1->Exit();
|
8284
8828
|
|
8285
|
-
context1.Dispose();
|
8286
|
-
context0.Dispose();
|
8829
|
+
context1.Dispose(context1->GetIsolate());
|
8830
|
+
context0.Dispose(context0->GetIsolate());
|
8287
8831
|
}
|
8288
8832
|
|
8289
8833
|
|
@@ -9325,7 +9869,8 @@ THREADED_TEST(InterceptorCallICCachedFromGlobal) {
|
|
9325
9869
|
static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name,
|
9326
9870
|
const AccessorInfo& info) {
|
9327
9871
|
ApiTestFuzzer::Fuzz();
|
9328
|
-
int* call_count =
|
9872
|
+
int* call_count =
|
9873
|
+
reinterpret_cast<int*>(v8::External::Cast(*info.Data())->Value());
|
9329
9874
|
++(*call_count);
|
9330
9875
|
if ((*call_count) % 20 == 0) {
|
9331
9876
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
@@ -9370,7 +9915,8 @@ static void GenerateSomeGarbage() {
|
|
9370
9915
|
v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) {
|
9371
9916
|
static int count = 0;
|
9372
9917
|
if (count++ % 3 == 0) {
|
9373
|
-
HEAP->
|
9918
|
+
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
9919
|
+
// This should move the stub
|
9374
9920
|
GenerateSomeGarbage(); // This should ensure the old stub memory is flushed
|
9375
9921
|
}
|
9376
9922
|
return v8::Handle<v8::Value>();
|
@@ -9425,7 +9971,7 @@ THREADED_TEST(CallICFastApi_DirectCall_Throw) {
|
|
9425
9971
|
v8::Handle<v8::Value> DirectGetterCallback(Local<String> name,
|
9426
9972
|
const v8::AccessorInfo& info) {
|
9427
9973
|
if (++p_getter_count % 3 == 0) {
|
9428
|
-
HEAP->CollectAllGarbage(
|
9974
|
+
HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
9429
9975
|
GenerateSomeGarbage();
|
9430
9976
|
}
|
9431
9977
|
return v8::Handle<v8::Value>();
|
@@ -9483,7 +10029,7 @@ THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
|
|
9483
10029
|
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
|
9484
10030
|
templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
|
9485
10031
|
NULL, NULL, NULL, NULL,
|
9486
|
-
v8::External::
|
10032
|
+
v8::External::New(&interceptor_call_count));
|
9487
10033
|
LocalContext context;
|
9488
10034
|
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
9489
10035
|
GenerateSomeGarbage();
|
@@ -9507,10 +10053,11 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) {
|
|
9507
10053
|
v8::Signature::New(fun_templ));
|
9508
10054
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9509
10055
|
proto_templ->Set(v8_str("method"), method_templ);
|
10056
|
+
fun_templ->SetHiddenPrototype(true);
|
9510
10057
|
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
|
9511
10058
|
templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
|
9512
10059
|
NULL, NULL, NULL, NULL,
|
9513
|
-
v8::External::
|
10060
|
+
v8::External::New(&interceptor_call_count));
|
9514
10061
|
LocalContext context;
|
9515
10062
|
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
9516
10063
|
GenerateSomeGarbage();
|
@@ -9537,10 +10084,11 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
|
|
9537
10084
|
v8::Signature::New(fun_templ));
|
9538
10085
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9539
10086
|
proto_templ->Set(v8_str("method"), method_templ);
|
10087
|
+
fun_templ->SetHiddenPrototype(true);
|
9540
10088
|
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
|
9541
10089
|
templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
|
9542
10090
|
NULL, NULL, NULL, NULL,
|
9543
|
-
v8::External::
|
10091
|
+
v8::External::New(&interceptor_call_count));
|
9544
10092
|
LocalContext context;
|
9545
10093
|
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
9546
10094
|
GenerateSomeGarbage();
|
@@ -9573,10 +10121,11 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
|
|
9573
10121
|
v8::Signature::New(fun_templ));
|
9574
10122
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9575
10123
|
proto_templ->Set(v8_str("method"), method_templ);
|
10124
|
+
fun_templ->SetHiddenPrototype(true);
|
9576
10125
|
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
|
9577
10126
|
templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
|
9578
10127
|
NULL, NULL, NULL, NULL,
|
9579
|
-
v8::External::
|
10128
|
+
v8::External::New(&interceptor_call_count));
|
9580
10129
|
LocalContext context;
|
9581
10130
|
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
9582
10131
|
GenerateSomeGarbage();
|
@@ -9609,10 +10158,11 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
|
|
9609
10158
|
v8::Signature::New(fun_templ));
|
9610
10159
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9611
10160
|
proto_templ->Set(v8_str("method"), method_templ);
|
10161
|
+
fun_templ->SetHiddenPrototype(true);
|
9612
10162
|
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
|
9613
10163
|
templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
|
9614
10164
|
NULL, NULL, NULL, NULL,
|
9615
|
-
v8::External::
|
10165
|
+
v8::External::New(&interceptor_call_count));
|
9616
10166
|
LocalContext context;
|
9617
10167
|
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
9618
10168
|
GenerateSomeGarbage();
|
@@ -9648,10 +10198,11 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
|
|
9648
10198
|
v8::Signature::New(fun_templ));
|
9649
10199
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9650
10200
|
proto_templ->Set(v8_str("method"), method_templ);
|
10201
|
+
fun_templ->SetHiddenPrototype(true);
|
9651
10202
|
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
|
9652
10203
|
templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
|
9653
10204
|
NULL, NULL, NULL, NULL,
|
9654
|
-
v8::External::
|
10205
|
+
v8::External::New(&interceptor_call_count));
|
9655
10206
|
LocalContext context;
|
9656
10207
|
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
9657
10208
|
GenerateSomeGarbage();
|
@@ -9710,6 +10261,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature) {
|
|
9710
10261
|
v8::Signature::New(fun_templ));
|
9711
10262
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9712
10263
|
proto_templ->Set(v8_str("method"), method_templ);
|
10264
|
+
fun_templ->SetHiddenPrototype(true);
|
9713
10265
|
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
|
9714
10266
|
CHECK(!templ.IsEmpty());
|
9715
10267
|
LocalContext context;
|
@@ -9737,6 +10289,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) {
|
|
9737
10289
|
v8::Signature::New(fun_templ));
|
9738
10290
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9739
10291
|
proto_templ->Set(v8_str("method"), method_templ);
|
10292
|
+
fun_templ->SetHiddenPrototype(true);
|
9740
10293
|
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
|
9741
10294
|
CHECK(!templ.IsEmpty());
|
9742
10295
|
LocalContext context;
|
@@ -9769,6 +10322,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
|
|
9769
10322
|
v8::Signature::New(fun_templ));
|
9770
10323
|
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
9771
10324
|
proto_templ->Set(v8_str("method"), method_templ);
|
10325
|
+
fun_templ->SetHiddenPrototype(true);
|
9772
10326
|
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
|
9773
10327
|
CHECK(!templ.IsEmpty());
|
9774
10328
|
LocalContext context;
|
@@ -9795,6 +10349,42 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
|
|
9795
10349
|
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
|
9796
10350
|
}
|
9797
10351
|
|
10352
|
+
THREADED_TEST(CallICFastApi_SimpleSignature_TypeError) {
|
10353
|
+
v8::HandleScope scope;
|
10354
|
+
v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
10355
|
+
v8::Handle<v8::FunctionTemplate> method_templ =
|
10356
|
+
v8::FunctionTemplate::New(FastApiCallback_SimpleSignature,
|
10357
|
+
v8_str("method_data"),
|
10358
|
+
v8::Signature::New(fun_templ));
|
10359
|
+
v8::Handle<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
|
10360
|
+
proto_templ->Set(v8_str("method"), method_templ);
|
10361
|
+
fun_templ->SetHiddenPrototype(true);
|
10362
|
+
v8::Handle<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
|
10363
|
+
CHECK(!templ.IsEmpty());
|
10364
|
+
LocalContext context;
|
10365
|
+
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
|
10366
|
+
GenerateSomeGarbage();
|
10367
|
+
context->Global()->Set(v8_str("o"), fun->NewInstance());
|
10368
|
+
v8::TryCatch try_catch;
|
10369
|
+
CompileRun(
|
10370
|
+
"o.foo = 17;"
|
10371
|
+
"var receiver = {};"
|
10372
|
+
"receiver.__proto__ = o;"
|
10373
|
+
"var result = 0;"
|
10374
|
+
"var saved_result = 0;"
|
10375
|
+
"for (var i = 0; i < 100; i++) {"
|
10376
|
+
" result = receiver.method(41);"
|
10377
|
+
" if (i == 50) {"
|
10378
|
+
" saved_result = result;"
|
10379
|
+
" receiver = Object.create(receiver);"
|
10380
|
+
" }"
|
10381
|
+
"}");
|
10382
|
+
CHECK(try_catch.HasCaught());
|
10383
|
+
CHECK_EQ(v8_str("TypeError: Illegal invocation"),
|
10384
|
+
try_catch.Exception()->ToString());
|
10385
|
+
CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
|
10386
|
+
}
|
10387
|
+
|
9798
10388
|
|
9799
10389
|
v8::Handle<Value> keyed_call_ic_function;
|
9800
10390
|
|
@@ -10260,6 +10850,7 @@ static v8::Handle<Value> ChildGetter(Local<String> name,
|
|
10260
10850
|
|
10261
10851
|
|
10262
10852
|
THREADED_TEST(Overriding) {
|
10853
|
+
i::FLAG_es5_readonly = true;
|
10263
10854
|
v8::HandleScope scope;
|
10264
10855
|
LocalContext context;
|
10265
10856
|
|
@@ -10306,11 +10897,11 @@ THREADED_TEST(Overriding) {
|
|
10306
10897
|
value = v8_compile("o.g")->Run();
|
10307
10898
|
CHECK_EQ(42, value->Int32Value());
|
10308
10899
|
|
10309
|
-
// Check 'h'
|
10900
|
+
// Check that 'h' cannot be shadowed.
|
10310
10901
|
value = v8_compile("o.h = 3; o.h")->Run();
|
10311
|
-
CHECK_EQ(
|
10902
|
+
CHECK_EQ(1, value->Int32Value());
|
10312
10903
|
|
10313
|
-
// Check 'i'
|
10904
|
+
// Check that 'i' cannot be shadowed or changed.
|
10314
10905
|
value = v8_compile("o.i = 3; o.i")->Run();
|
10315
10906
|
CHECK_EQ(42, value->Int32Value());
|
10316
10907
|
}
|
@@ -10441,7 +11032,7 @@ void ApiTestFuzzer::Run() {
|
|
10441
11032
|
gate_->Wait();
|
10442
11033
|
{
|
10443
11034
|
// ... get the V8 lock and start running the test.
|
10444
|
-
v8::Locker locker;
|
11035
|
+
v8::Locker locker(CcTest::default_isolate());
|
10445
11036
|
CallTest();
|
10446
11037
|
}
|
10447
11038
|
// This test finished.
|
@@ -10505,7 +11096,7 @@ void ApiTestFuzzer::ContextSwitch() {
|
|
10505
11096
|
// If the new thread is the same as the current thread there is nothing to do.
|
10506
11097
|
if (NextThread()) {
|
10507
11098
|
// Now it can start.
|
10508
|
-
v8::Unlocker unlocker;
|
11099
|
+
v8::Unlocker unlocker(CcTest::default_isolate());
|
10509
11100
|
// Wait till someone starts us again.
|
10510
11101
|
gate_->Wait();
|
10511
11102
|
// And we're off.
|
@@ -10523,7 +11114,10 @@ void ApiTestFuzzer::TearDown() {
|
|
10523
11114
|
|
10524
11115
|
|
10525
11116
|
// Lets not be needlessly self-referential.
|
10526
|
-
TEST(
|
11117
|
+
TEST(Threading1) {
|
11118
|
+
// TODO(mstarzinger): Disabled in GC stress mode for now, we should find the
|
11119
|
+
// correct timeout for this an re-enable this test again
|
11120
|
+
if (i::FLAG_stress_compaction) return;
|
10527
11121
|
ApiTestFuzzer::SetUp(ApiTestFuzzer::FIRST_PART);
|
10528
11122
|
ApiTestFuzzer::RunAllTests();
|
10529
11123
|
ApiTestFuzzer::TearDown();
|
@@ -10557,12 +11151,12 @@ void ApiTestFuzzer::CallTest() {
|
|
10557
11151
|
|
10558
11152
|
|
10559
11153
|
static v8::Handle<Value> ThrowInJS(const v8::Arguments& args) {
|
10560
|
-
CHECK(v8::Locker::IsLocked());
|
11154
|
+
CHECK(v8::Locker::IsLocked(CcTest::default_isolate()));
|
10561
11155
|
ApiTestFuzzer::Fuzz();
|
10562
|
-
v8::Unlocker unlocker;
|
11156
|
+
v8::Unlocker unlocker(CcTest::default_isolate());
|
10563
11157
|
const char* code = "throw 7;";
|
10564
11158
|
{
|
10565
|
-
v8::Locker nested_locker;
|
11159
|
+
v8::Locker nested_locker(CcTest::default_isolate());
|
10566
11160
|
v8::HandleScope scope;
|
10567
11161
|
v8::Handle<Value> exception;
|
10568
11162
|
{ v8::TryCatch try_catch;
|
@@ -10580,12 +11174,12 @@ static v8::Handle<Value> ThrowInJS(const v8::Arguments& args) {
|
|
10580
11174
|
|
10581
11175
|
|
10582
11176
|
static v8::Handle<Value> ThrowInJSNoCatch(const v8::Arguments& args) {
|
10583
|
-
CHECK(v8::Locker::IsLocked());
|
11177
|
+
CHECK(v8::Locker::IsLocked(CcTest::default_isolate()));
|
10584
11178
|
ApiTestFuzzer::Fuzz();
|
10585
|
-
v8::Unlocker unlocker;
|
11179
|
+
v8::Unlocker unlocker(CcTest::default_isolate());
|
10586
11180
|
const char* code = "throw 7;";
|
10587
11181
|
{
|
10588
|
-
v8::Locker nested_locker;
|
11182
|
+
v8::Locker nested_locker(CcTest::default_isolate());
|
10589
11183
|
v8::HandleScope scope;
|
10590
11184
|
v8::Handle<Value> value = CompileRun(code);
|
10591
11185
|
CHECK(value.IsEmpty());
|
@@ -10597,8 +11191,8 @@ static v8::Handle<Value> ThrowInJSNoCatch(const v8::Arguments& args) {
|
|
10597
11191
|
// These are locking tests that don't need to be run again
|
10598
11192
|
// as part of the locking aggregation tests.
|
10599
11193
|
TEST(NestedLockers) {
|
10600
|
-
v8::Locker locker;
|
10601
|
-
CHECK(v8::Locker::IsLocked());
|
11194
|
+
v8::Locker locker(CcTest::default_isolate());
|
11195
|
+
CHECK(v8::Locker::IsLocked(CcTest::default_isolate()));
|
10602
11196
|
v8::HandleScope scope;
|
10603
11197
|
LocalContext env;
|
10604
11198
|
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(ThrowInJS);
|
@@ -10619,7 +11213,7 @@ TEST(NestedLockers) {
|
|
10619
11213
|
// These are locking tests that don't need to be run again
|
10620
11214
|
// as part of the locking aggregation tests.
|
10621
11215
|
TEST(NestedLockersNoTryCatch) {
|
10622
|
-
v8::Locker locker;
|
11216
|
+
v8::Locker locker(CcTest::default_isolate());
|
10623
11217
|
v8::HandleScope scope;
|
10624
11218
|
LocalContext env;
|
10625
11219
|
Local<v8::FunctionTemplate> fun_templ =
|
@@ -10639,24 +11233,24 @@ TEST(NestedLockersNoTryCatch) {
|
|
10639
11233
|
|
10640
11234
|
|
10641
11235
|
THREADED_TEST(RecursiveLocking) {
|
10642
|
-
v8::Locker locker;
|
11236
|
+
v8::Locker locker(CcTest::default_isolate());
|
10643
11237
|
{
|
10644
|
-
v8::Locker locker2;
|
10645
|
-
CHECK(v8::Locker::IsLocked());
|
11238
|
+
v8::Locker locker2(CcTest::default_isolate());
|
11239
|
+
CHECK(v8::Locker::IsLocked(CcTest::default_isolate()));
|
10646
11240
|
}
|
10647
11241
|
}
|
10648
11242
|
|
10649
11243
|
|
10650
11244
|
static v8::Handle<Value> UnlockForAMoment(const v8::Arguments& args) {
|
10651
11245
|
ApiTestFuzzer::Fuzz();
|
10652
|
-
v8::Unlocker unlocker;
|
11246
|
+
v8::Unlocker unlocker(CcTest::default_isolate());
|
10653
11247
|
return v8::Undefined();
|
10654
11248
|
}
|
10655
11249
|
|
10656
11250
|
|
10657
11251
|
THREADED_TEST(LockUnlockLock) {
|
10658
11252
|
{
|
10659
|
-
v8::Locker locker;
|
11253
|
+
v8::Locker locker(CcTest::default_isolate());
|
10660
11254
|
v8::HandleScope scope;
|
10661
11255
|
LocalContext env;
|
10662
11256
|
Local<v8::FunctionTemplate> fun_templ =
|
@@ -10670,7 +11264,7 @@ THREADED_TEST(LockUnlockLock) {
|
|
10670
11264
|
CHECK_EQ(42, script->Run()->Int32Value());
|
10671
11265
|
}
|
10672
11266
|
{
|
10673
|
-
v8::Locker locker;
|
11267
|
+
v8::Locker locker(CcTest::default_isolate());
|
10674
11268
|
v8::HandleScope scope;
|
10675
11269
|
LocalContext env;
|
10676
11270
|
Local<v8::FunctionTemplate> fun_templ =
|
@@ -10721,18 +11315,21 @@ TEST(DontLeakGlobalObjects) {
|
|
10721
11315
|
{ v8::HandleScope scope;
|
10722
11316
|
LocalContext context;
|
10723
11317
|
}
|
11318
|
+
v8::V8::ContextDisposedNotification();
|
10724
11319
|
CheckSurvivingGlobalObjectsCount(0);
|
10725
11320
|
|
10726
11321
|
{ v8::HandleScope scope;
|
10727
11322
|
LocalContext context;
|
10728
11323
|
v8_compile("Date")->Run();
|
10729
11324
|
}
|
11325
|
+
v8::V8::ContextDisposedNotification();
|
10730
11326
|
CheckSurvivingGlobalObjectsCount(0);
|
10731
11327
|
|
10732
11328
|
{ v8::HandleScope scope;
|
10733
11329
|
LocalContext context;
|
10734
11330
|
v8_compile("/aaa/")->Run();
|
10735
11331
|
}
|
11332
|
+
v8::V8::ContextDisposedNotification();
|
10736
11333
|
CheckSurvivingGlobalObjectsCount(0);
|
10737
11334
|
|
10738
11335
|
{ v8::HandleScope scope;
|
@@ -10741,6 +11338,7 @@ TEST(DontLeakGlobalObjects) {
|
|
10741
11338
|
LocalContext context(&extensions);
|
10742
11339
|
v8_compile("gc();")->Run();
|
10743
11340
|
}
|
11341
|
+
v8::V8::ContextDisposedNotification();
|
10744
11342
|
CheckSurvivingGlobalObjectsCount(0);
|
10745
11343
|
}
|
10746
11344
|
}
|
@@ -10749,79 +11347,90 @@ TEST(DontLeakGlobalObjects) {
|
|
10749
11347
|
v8::Persistent<v8::Object> some_object;
|
10750
11348
|
v8::Persistent<v8::Object> bad_handle;
|
10751
11349
|
|
10752
|
-
void NewPersistentHandleCallback(v8::
|
11350
|
+
void NewPersistentHandleCallback(v8::Isolate* isolate,
|
11351
|
+
v8::Persistent<v8::Value> handle,
|
11352
|
+
void*) {
|
10753
11353
|
v8::HandleScope scope;
|
10754
|
-
bad_handle = v8::Persistent<v8::Object>::New(some_object);
|
10755
|
-
handle.Dispose();
|
11354
|
+
bad_handle = v8::Persistent<v8::Object>::New(isolate, some_object);
|
11355
|
+
handle.Dispose(isolate);
|
10756
11356
|
}
|
10757
11357
|
|
10758
11358
|
|
10759
11359
|
THREADED_TEST(NewPersistentHandleFromWeakCallback) {
|
10760
11360
|
LocalContext context;
|
11361
|
+
v8::Isolate* isolate = context->GetIsolate();
|
10761
11362
|
|
10762
11363
|
v8::Persistent<v8::Object> handle1, handle2;
|
10763
11364
|
{
|
10764
11365
|
v8::HandleScope scope;
|
10765
|
-
some_object = v8::Persistent<v8::Object>::New(v8::Object::New());
|
10766
|
-
handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
10767
|
-
handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
11366
|
+
some_object = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
11367
|
+
handle1 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
11368
|
+
handle2 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
10768
11369
|
}
|
10769
11370
|
// Note: order is implementation dependent alas: currently
|
10770
11371
|
// global handle nodes are processed by PostGarbageCollectionProcessing
|
10771
11372
|
// in reverse allocation order, so if second allocated handle is deleted,
|
10772
11373
|
// weak callback of the first handle would be able to 'reallocate' it.
|
10773
|
-
handle1.MakeWeak(NULL, NewPersistentHandleCallback);
|
10774
|
-
handle2.Dispose();
|
11374
|
+
handle1.MakeWeak(isolate, NULL, NewPersistentHandleCallback);
|
11375
|
+
handle2.Dispose(isolate);
|
10775
11376
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
10776
11377
|
}
|
10777
11378
|
|
10778
11379
|
|
10779
11380
|
v8::Persistent<v8::Object> to_be_disposed;
|
10780
11381
|
|
10781
|
-
void DisposeAndForceGcCallback(v8::
|
10782
|
-
|
11382
|
+
void DisposeAndForceGcCallback(v8::Isolate* isolate,
|
11383
|
+
v8::Persistent<v8::Value> handle,
|
11384
|
+
void*) {
|
11385
|
+
to_be_disposed.Dispose(isolate);
|
10783
11386
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
10784
|
-
handle.Dispose();
|
11387
|
+
handle.Dispose(isolate);
|
10785
11388
|
}
|
10786
11389
|
|
10787
11390
|
|
10788
11391
|
THREADED_TEST(DoNotUseDeletedNodesInSecondLevelGc) {
|
10789
11392
|
LocalContext context;
|
11393
|
+
v8::Isolate* isolate = context->GetIsolate();
|
10790
11394
|
|
10791
11395
|
v8::Persistent<v8::Object> handle1, handle2;
|
10792
11396
|
{
|
10793
11397
|
v8::HandleScope scope;
|
10794
|
-
handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
10795
|
-
handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
11398
|
+
handle1 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
11399
|
+
handle2 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
10796
11400
|
}
|
10797
|
-
handle1.MakeWeak(NULL, DisposeAndForceGcCallback);
|
11401
|
+
handle1.MakeWeak(isolate, NULL, DisposeAndForceGcCallback);
|
10798
11402
|
to_be_disposed = handle2;
|
10799
11403
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
10800
11404
|
}
|
10801
11405
|
|
10802
|
-
void DisposingCallback(v8::
|
10803
|
-
|
11406
|
+
void DisposingCallback(v8::Isolate* isolate,
|
11407
|
+
v8::Persistent<v8::Value> handle,
|
11408
|
+
void*) {
|
11409
|
+
handle.Dispose(isolate);
|
10804
11410
|
}
|
10805
11411
|
|
10806
|
-
void HandleCreatingCallback(v8::
|
11412
|
+
void HandleCreatingCallback(v8::Isolate* isolate,
|
11413
|
+
v8::Persistent<v8::Value> handle,
|
11414
|
+
void*) {
|
10807
11415
|
v8::HandleScope scope;
|
10808
|
-
v8::Persistent<v8::Object>::New(v8::Object::New());
|
10809
|
-
handle.Dispose();
|
11416
|
+
v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
11417
|
+
handle.Dispose(isolate);
|
10810
11418
|
}
|
10811
11419
|
|
10812
11420
|
|
10813
11421
|
THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) {
|
10814
11422
|
LocalContext context;
|
11423
|
+
v8::Isolate* isolate = context->GetIsolate();
|
10815
11424
|
|
10816
11425
|
v8::Persistent<v8::Object> handle1, handle2, handle3;
|
10817
11426
|
{
|
10818
11427
|
v8::HandleScope scope;
|
10819
|
-
handle3 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
10820
|
-
handle2 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
10821
|
-
handle1 = v8::Persistent<v8::Object>::New(v8::Object::New());
|
11428
|
+
handle3 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
11429
|
+
handle2 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
11430
|
+
handle1 = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
10822
11431
|
}
|
10823
|
-
handle2.MakeWeak(NULL, DisposingCallback);
|
10824
|
-
handle3.MakeWeak(NULL, HandleCreatingCallback);
|
11432
|
+
handle2.MakeWeak(isolate, NULL, DisposingCallback);
|
11433
|
+
handle3.MakeWeak(isolate, NULL, HandleCreatingCallback);
|
10825
11434
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
10826
11435
|
}
|
10827
11436
|
|
@@ -10867,7 +11476,305 @@ THREADED_TEST(NestedHandleScopeAndContexts) {
|
|
10867
11476
|
v8::Handle<String> str(value->ToString());
|
10868
11477
|
CHECK(!str.IsEmpty());
|
10869
11478
|
env->Exit();
|
10870
|
-
env.Dispose();
|
11479
|
+
env.Dispose(env->GetIsolate());
|
11480
|
+
}
|
11481
|
+
|
11482
|
+
|
11483
|
+
static i::Handle<i::JSFunction>* foo_ptr = NULL;
|
11484
|
+
static int foo_count = 0;
|
11485
|
+
static i::Handle<i::JSFunction>* bar_ptr = NULL;
|
11486
|
+
static int bar_count = 0;
|
11487
|
+
|
11488
|
+
|
11489
|
+
static void entry_hook(uintptr_t function,
|
11490
|
+
uintptr_t return_addr_location) {
|
11491
|
+
i::Code* code = i::Code::GetCodeFromTargetAddress(
|
11492
|
+
reinterpret_cast<i::Address>(function));
|
11493
|
+
CHECK(code != NULL);
|
11494
|
+
|
11495
|
+
if (bar_ptr != NULL && code == (*bar_ptr)->code())
|
11496
|
+
++bar_count;
|
11497
|
+
|
11498
|
+
if (foo_ptr != NULL && code == (*foo_ptr)->code())
|
11499
|
+
++foo_count;
|
11500
|
+
|
11501
|
+
// TODO(siggi): Verify return_addr_location.
|
11502
|
+
// This can be done by capturing JitCodeEvents, but requires an ordered
|
11503
|
+
// collection.
|
11504
|
+
}
|
11505
|
+
|
11506
|
+
|
11507
|
+
static void RunLoopInNewEnv() {
|
11508
|
+
bar_ptr = NULL;
|
11509
|
+
foo_ptr = NULL;
|
11510
|
+
|
11511
|
+
v8::HandleScope outer;
|
11512
|
+
v8::Persistent<Context> env = Context::New();
|
11513
|
+
env->Enter();
|
11514
|
+
|
11515
|
+
const char* script =
|
11516
|
+
"function bar() {"
|
11517
|
+
" var sum = 0;"
|
11518
|
+
" for (i = 0; i < 100; ++i)"
|
11519
|
+
" sum = foo(i);"
|
11520
|
+
" return sum;"
|
11521
|
+
"}"
|
11522
|
+
"function foo(i) { return i * i; }";
|
11523
|
+
CompileRun(script);
|
11524
|
+
i::Handle<i::JSFunction> bar =
|
11525
|
+
i::Handle<i::JSFunction>::cast(
|
11526
|
+
v8::Utils::OpenHandle(*env->Global()->Get(v8_str("bar"))));
|
11527
|
+
ASSERT(*bar);
|
11528
|
+
|
11529
|
+
i::Handle<i::JSFunction> foo =
|
11530
|
+
i::Handle<i::JSFunction>::cast(
|
11531
|
+
v8::Utils::OpenHandle(*env->Global()->Get(v8_str("foo"))));
|
11532
|
+
ASSERT(*foo);
|
11533
|
+
|
11534
|
+
bar_ptr = &bar;
|
11535
|
+
foo_ptr = &foo;
|
11536
|
+
|
11537
|
+
v8::Handle<v8::Value> value = CompileRun("bar();");
|
11538
|
+
CHECK(value->IsNumber());
|
11539
|
+
CHECK_EQ(9801.0, v8::Number::Cast(*value)->Value());
|
11540
|
+
|
11541
|
+
// Test the optimized codegen path.
|
11542
|
+
value = CompileRun("%OptimizeFunctionOnNextCall(foo);"
|
11543
|
+
"bar();");
|
11544
|
+
CHECK(value->IsNumber());
|
11545
|
+
CHECK_EQ(9801.0, v8::Number::Cast(*value)->Value());
|
11546
|
+
|
11547
|
+
env->Exit();
|
11548
|
+
}
|
11549
|
+
|
11550
|
+
|
11551
|
+
TEST(SetFunctionEntryHook) {
|
11552
|
+
i::FLAG_allow_natives_syntax = true;
|
11553
|
+
i::FLAG_use_inlining = false;
|
11554
|
+
|
11555
|
+
// Test setting and resetting the entry hook.
|
11556
|
+
// Nulling it should always succeed.
|
11557
|
+
CHECK(v8::V8::SetFunctionEntryHook(NULL));
|
11558
|
+
|
11559
|
+
CHECK(v8::V8::SetFunctionEntryHook(entry_hook));
|
11560
|
+
// Setting a hook while one's active should fail.
|
11561
|
+
CHECK_EQ(false, v8::V8::SetFunctionEntryHook(entry_hook));
|
11562
|
+
|
11563
|
+
CHECK(v8::V8::SetFunctionEntryHook(NULL));
|
11564
|
+
|
11565
|
+
// Reset the entry count to zero and set the entry hook.
|
11566
|
+
bar_count = 0;
|
11567
|
+
foo_count = 0;
|
11568
|
+
CHECK(v8::V8::SetFunctionEntryHook(entry_hook));
|
11569
|
+
RunLoopInNewEnv();
|
11570
|
+
|
11571
|
+
CHECK_EQ(2, bar_count);
|
11572
|
+
CHECK_EQ(200, foo_count);
|
11573
|
+
|
11574
|
+
// Clear the entry hook and count.
|
11575
|
+
bar_count = 0;
|
11576
|
+
foo_count = 0;
|
11577
|
+
v8::V8::SetFunctionEntryHook(NULL);
|
11578
|
+
|
11579
|
+
// Clear the compilation cache to make sure we don't reuse the
|
11580
|
+
// functions from the previous invocation.
|
11581
|
+
v8::internal::Isolate::Current()->compilation_cache()->Clear();
|
11582
|
+
|
11583
|
+
// Verify that entry hooking is now disabled.
|
11584
|
+
RunLoopInNewEnv();
|
11585
|
+
CHECK_EQ(0u, bar_count);
|
11586
|
+
CHECK_EQ(0u, foo_count);
|
11587
|
+
}
|
11588
|
+
|
11589
|
+
|
11590
|
+
static i::HashMap* code_map = NULL;
|
11591
|
+
static int saw_bar = 0;
|
11592
|
+
static int move_events = 0;
|
11593
|
+
|
11594
|
+
|
11595
|
+
static bool FunctionNameIs(const char* expected,
|
11596
|
+
const v8::JitCodeEvent* event) {
|
11597
|
+
// Log lines for functions are of the general form:
|
11598
|
+
// "LazyCompile:<type><function_name>", where the type is one of
|
11599
|
+
// "*", "~" or "".
|
11600
|
+
static const char kPreamble[] = "LazyCompile:";
|
11601
|
+
static size_t kPreambleLen = sizeof(kPreamble) - 1;
|
11602
|
+
|
11603
|
+
if (event->name.len < sizeof(kPreamble) - 1 ||
|
11604
|
+
strncmp(kPreamble, event->name.str, kPreambleLen) != 0) {
|
11605
|
+
return false;
|
11606
|
+
}
|
11607
|
+
|
11608
|
+
const char* tail = event->name.str + kPreambleLen;
|
11609
|
+
size_t tail_len = event->name.len - kPreambleLen;
|
11610
|
+
size_t expected_len = strlen(expected);
|
11611
|
+
if (tail_len == expected_len + 1) {
|
11612
|
+
if (*tail == '*' || *tail == '~') {
|
11613
|
+
--tail_len;
|
11614
|
+
++tail;
|
11615
|
+
} else {
|
11616
|
+
return false;
|
11617
|
+
}
|
11618
|
+
}
|
11619
|
+
|
11620
|
+
if (tail_len != expected_len)
|
11621
|
+
return false;
|
11622
|
+
|
11623
|
+
return strncmp(tail, expected, expected_len) == 0;
|
11624
|
+
}
|
11625
|
+
|
11626
|
+
|
11627
|
+
static void event_handler(const v8::JitCodeEvent* event) {
|
11628
|
+
CHECK(event != NULL);
|
11629
|
+
CHECK(code_map != NULL);
|
11630
|
+
|
11631
|
+
switch (event->type) {
|
11632
|
+
case v8::JitCodeEvent::CODE_ADDED: {
|
11633
|
+
CHECK(event->code_start != NULL);
|
11634
|
+
CHECK_NE(0, static_cast<int>(event->code_len));
|
11635
|
+
CHECK(event->name.str != NULL);
|
11636
|
+
i::HashMap::Entry* entry =
|
11637
|
+
code_map->Lookup(event->code_start,
|
11638
|
+
i::ComputePointerHash(event->code_start),
|
11639
|
+
true);
|
11640
|
+
entry->value = reinterpret_cast<void*>(event->code_len);
|
11641
|
+
|
11642
|
+
if (FunctionNameIs("bar", event)) {
|
11643
|
+
++saw_bar;
|
11644
|
+
}
|
11645
|
+
}
|
11646
|
+
break;
|
11647
|
+
|
11648
|
+
case v8::JitCodeEvent::CODE_MOVED: {
|
11649
|
+
uint32_t hash = i::ComputePointerHash(event->code_start);
|
11650
|
+
// We would like to never see code move that we haven't seen before,
|
11651
|
+
// but the code creation event does not happen until the line endings
|
11652
|
+
// have been calculated (this is so that we can report the line in the
|
11653
|
+
// script at which the function source is found, see
|
11654
|
+
// Compiler::RecordFunctionCompilation) and the line endings
|
11655
|
+
// calculations can cause a GC, which can move the newly created code
|
11656
|
+
// before its existence can be logged.
|
11657
|
+
i::HashMap::Entry* entry =
|
11658
|
+
code_map->Lookup(event->code_start, hash, false);
|
11659
|
+
if (entry != NULL) {
|
11660
|
+
++move_events;
|
11661
|
+
|
11662
|
+
CHECK_EQ(reinterpret_cast<void*>(event->code_len), entry->value);
|
11663
|
+
code_map->Remove(event->code_start, hash);
|
11664
|
+
|
11665
|
+
entry = code_map->Lookup(event->new_code_start,
|
11666
|
+
i::ComputePointerHash(event->new_code_start),
|
11667
|
+
true);
|
11668
|
+
CHECK(entry != NULL);
|
11669
|
+
entry->value = reinterpret_cast<void*>(event->code_len);
|
11670
|
+
}
|
11671
|
+
}
|
11672
|
+
break;
|
11673
|
+
|
11674
|
+
case v8::JitCodeEvent::CODE_REMOVED:
|
11675
|
+
// Object/code removal events are currently not dispatched from the GC.
|
11676
|
+
CHECK(false);
|
11677
|
+
break;
|
11678
|
+
default:
|
11679
|
+
// Impossible event.
|
11680
|
+
CHECK(false);
|
11681
|
+
break;
|
11682
|
+
}
|
11683
|
+
}
|
11684
|
+
|
11685
|
+
|
11686
|
+
static bool MatchPointers(void* key1, void* key2) {
|
11687
|
+
return key1 == key2;
|
11688
|
+
}
|
11689
|
+
|
11690
|
+
|
11691
|
+
TEST(SetJitCodeEventHandler) {
|
11692
|
+
const char* script =
|
11693
|
+
"function bar() {"
|
11694
|
+
" var sum = 0;"
|
11695
|
+
" for (i = 0; i < 100; ++i)"
|
11696
|
+
" sum = foo(i);"
|
11697
|
+
" return sum;"
|
11698
|
+
"}"
|
11699
|
+
"function foo(i) { return i * i; };"
|
11700
|
+
"bar();";
|
11701
|
+
|
11702
|
+
// Run this test in a new isolate to make sure we don't
|
11703
|
+
// have remnants of state from other code.
|
11704
|
+
v8::Isolate* isolate = v8::Isolate::New();
|
11705
|
+
isolate->Enter();
|
11706
|
+
|
11707
|
+
{
|
11708
|
+
i::HashMap code(MatchPointers);
|
11709
|
+
code_map = &code;
|
11710
|
+
|
11711
|
+
saw_bar = 0;
|
11712
|
+
move_events = 0;
|
11713
|
+
|
11714
|
+
i::FLAG_stress_compaction = true;
|
11715
|
+
V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, event_handler);
|
11716
|
+
|
11717
|
+
v8::HandleScope scope;
|
11718
|
+
// Generate new code objects sparsely distributed across several
|
11719
|
+
// different fragmented code-space pages.
|
11720
|
+
const int kIterations = 10;
|
11721
|
+
for (int i = 0; i < kIterations; ++i) {
|
11722
|
+
LocalContext env;
|
11723
|
+
|
11724
|
+
v8::Handle<v8::Script> compiled_script;
|
11725
|
+
{
|
11726
|
+
i::AlwaysAllocateScope always_allocate;
|
11727
|
+
SimulateFullSpace(HEAP->code_space());
|
11728
|
+
compiled_script = v8_compile(script);
|
11729
|
+
}
|
11730
|
+
compiled_script->Run();
|
11731
|
+
|
11732
|
+
// Clear the compilation cache to get more wastage.
|
11733
|
+
ISOLATE->compilation_cache()->Clear();
|
11734
|
+
}
|
11735
|
+
|
11736
|
+
// Force code movement.
|
11737
|
+
HEAP->CollectAllAvailableGarbage("TestSetJitCodeEventHandler");
|
11738
|
+
|
11739
|
+
CHECK_LE(kIterations, saw_bar);
|
11740
|
+
CHECK_NE(0, move_events);
|
11741
|
+
|
11742
|
+
code_map = NULL;
|
11743
|
+
V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL);
|
11744
|
+
}
|
11745
|
+
|
11746
|
+
isolate->Exit();
|
11747
|
+
isolate->Dispose();
|
11748
|
+
|
11749
|
+
// Do this in a new isolate.
|
11750
|
+
isolate = v8::Isolate::New();
|
11751
|
+
isolate->Enter();
|
11752
|
+
|
11753
|
+
// Verify that we get callbacks for existing code objects when we
|
11754
|
+
// request enumeration of existing code.
|
11755
|
+
{
|
11756
|
+
v8::HandleScope scope;
|
11757
|
+
LocalContext env;
|
11758
|
+
CompileRun(script);
|
11759
|
+
|
11760
|
+
// Now get code through initial iteration.
|
11761
|
+
i::HashMap code(MatchPointers);
|
11762
|
+
code_map = &code;
|
11763
|
+
|
11764
|
+
V8::SetJitCodeEventHandler(v8::kJitCodeEventEnumExisting, event_handler);
|
11765
|
+
V8::SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL);
|
11766
|
+
|
11767
|
+
code_map = NULL;
|
11768
|
+
|
11769
|
+
// We expect that we got some events. Note that if we could get code removal
|
11770
|
+
// notifications, we could compare two collections, one created by listening
|
11771
|
+
// from the time of creation of an isolate, and the other by subscribing
|
11772
|
+
// with EnumExisting.
|
11773
|
+
CHECK_NE(0, code.occupancy());
|
11774
|
+
}
|
11775
|
+
|
11776
|
+
isolate->Exit();
|
11777
|
+
isolate->Dispose();
|
10871
11778
|
}
|
10872
11779
|
|
10873
11780
|
|
@@ -10891,7 +11798,7 @@ THREADED_TEST(DisposeEnteredContext) {
|
|
10891
11798
|
LocalContext outer;
|
10892
11799
|
{ v8::Persistent<v8::Context> inner = v8::Context::New();
|
10893
11800
|
inner->Enter();
|
10894
|
-
inner.Dispose();
|
11801
|
+
inner.Dispose(inner->GetIsolate());
|
10895
11802
|
inner.Clear();
|
10896
11803
|
inner->Exit();
|
10897
11804
|
}
|
@@ -10904,12 +11811,14 @@ THREADED_TEST(DisposeEnteredContext) {
|
|
10904
11811
|
THREADED_TEST(Regress54) {
|
10905
11812
|
v8::HandleScope outer;
|
10906
11813
|
LocalContext context;
|
11814
|
+
v8::Isolate* isolate = context->GetIsolate();
|
10907
11815
|
static v8::Persistent<v8::ObjectTemplate> templ;
|
10908
11816
|
if (templ.IsEmpty()) {
|
10909
11817
|
v8::HandleScope inner;
|
10910
11818
|
v8::Handle<v8::ObjectTemplate> local = v8::ObjectTemplate::New();
|
10911
11819
|
local->SetInternalFieldCount(1);
|
10912
|
-
templ =
|
11820
|
+
templ =
|
11821
|
+
v8::Persistent<v8::ObjectTemplate>::New(isolate, inner.Close(local));
|
10913
11822
|
}
|
10914
11823
|
v8::Handle<v8::Object> result = templ->NewInstance();
|
10915
11824
|
CHECK_EQ(1, result->InternalFieldCount());
|
@@ -11298,8 +12207,8 @@ static bool NamedGetAccessBlockAandH(Local<v8::Object> obj,
|
|
11298
12207
|
if (!name->IsString()) return false;
|
11299
12208
|
i::Handle<i::String> name_handle =
|
11300
12209
|
v8::Utils::OpenHandle(String::Cast(*name));
|
11301
|
-
return !name_handle->
|
11302
|
-
&& !name_handle->
|
12210
|
+
return !name_handle->IsUtf8EqualTo(i::CStrVector(kPropertyA))
|
12211
|
+
&& !name_handle->IsUtf8EqualTo(i::CStrVector(kPropertyH));
|
11303
12212
|
}
|
11304
12213
|
|
11305
12214
|
|
@@ -11598,8 +12507,8 @@ THREADED_TEST(CrossContextNew) {
|
|
11598
12507
|
context1->Exit();
|
11599
12508
|
|
11600
12509
|
// Dispose the contexts to allow them to be garbage collected.
|
11601
|
-
context0.Dispose();
|
11602
|
-
context1.Dispose();
|
12510
|
+
context0.Dispose(context0->GetIsolate());
|
12511
|
+
context1.Dispose(context1->GetIsolate());
|
11603
12512
|
}
|
11604
12513
|
|
11605
12514
|
|
@@ -11619,7 +12528,7 @@ class RegExpInterruptTest {
|
|
11619
12528
|
|
11620
12529
|
LongRunningRegExp();
|
11621
12530
|
{
|
11622
|
-
v8::Unlocker unlock;
|
12531
|
+
v8::Unlocker unlock(CcTest::default_isolate());
|
11623
12532
|
gc_thread.Join();
|
11624
12533
|
}
|
11625
12534
|
v8::Locker::StopPreemption();
|
@@ -11646,7 +12555,7 @@ class RegExpInterruptTest {
|
|
11646
12555
|
block_->Wait();
|
11647
12556
|
while (gc_during_regexp_ < kRequiredGCs) {
|
11648
12557
|
{
|
11649
|
-
v8::Locker lock;
|
12558
|
+
v8::Locker lock(CcTest::default_isolate());
|
11650
12559
|
// TODO(lrn): Perhaps create some garbage before collecting.
|
11651
12560
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
11652
12561
|
gc_count_++;
|
@@ -11706,7 +12615,7 @@ class RegExpInterruptTest {
|
|
11706
12615
|
// Test that a regular expression execution can be interrupted and
|
11707
12616
|
// survive a garbage collection.
|
11708
12617
|
TEST(RegExpInterruption) {
|
11709
|
-
v8::Locker lock;
|
12618
|
+
v8::Locker lock(CcTest::default_isolate());
|
11710
12619
|
v8::V8::Initialize();
|
11711
12620
|
v8::HandleScope scope;
|
11712
12621
|
Local<Context> local_env;
|
@@ -11742,7 +12651,7 @@ class ApplyInterruptTest {
|
|
11742
12651
|
|
11743
12652
|
LongRunningApply();
|
11744
12653
|
{
|
11745
|
-
v8::Unlocker unlock;
|
12654
|
+
v8::Unlocker unlock(CcTest::default_isolate());
|
11746
12655
|
gc_thread.Join();
|
11747
12656
|
}
|
11748
12657
|
v8::Locker::StopPreemption();
|
@@ -11769,7 +12678,7 @@ class ApplyInterruptTest {
|
|
11769
12678
|
block_->Wait();
|
11770
12679
|
while (gc_during_apply_ < kRequiredGCs) {
|
11771
12680
|
{
|
11772
|
-
v8::Locker lock;
|
12681
|
+
v8::Locker lock(CcTest::default_isolate());
|
11773
12682
|
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
11774
12683
|
gc_count_++;
|
11775
12684
|
}
|
@@ -11815,7 +12724,7 @@ class ApplyInterruptTest {
|
|
11815
12724
|
// Test that nothing bad happens if we get a preemption just when we were
|
11816
12725
|
// about to do an apply().
|
11817
12726
|
TEST(ApplyInterruption) {
|
11818
|
-
v8::Locker lock;
|
12727
|
+
v8::Locker lock(CcTest::default_isolate());
|
11819
12728
|
v8::V8::Initialize();
|
11820
12729
|
v8::HandleScope scope;
|
11821
12730
|
Local<Context> local_env;
|
@@ -11897,7 +12806,7 @@ static void MorphAString(i::String* string,
|
|
11897
12806
|
AsciiVectorResource* ascii_resource,
|
11898
12807
|
UC16VectorResource* uc16_resource) {
|
11899
12808
|
CHECK(i::StringShape(string).IsExternal());
|
11900
|
-
if (string->
|
12809
|
+
if (string->IsOneByteRepresentation()) {
|
11901
12810
|
// Check old map is not symbol or long.
|
11902
12811
|
CHECK(string->map() == HEAP->external_ascii_string_map());
|
11903
12812
|
// Morph external string to be TwoByte string.
|
@@ -11946,8 +12855,10 @@ THREADED_TEST(MorphCompositeStringTest) {
|
|
11946
12855
|
"var slice = lhs.substring(1, lhs.length - 1);"
|
11947
12856
|
"var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);");
|
11948
12857
|
|
12858
|
+
#ifndef ENABLE_LATIN_1
|
11949
12859
|
CHECK(!lhs->MayContainNonAscii());
|
11950
12860
|
CHECK(!rhs->MayContainNonAscii());
|
12861
|
+
#endif
|
11951
12862
|
|
11952
12863
|
MorphAString(*v8::Utils::OpenHandle(*lhs), &ascii_resource, &uc16_resource);
|
11953
12864
|
MorphAString(*v8::Utils::OpenHandle(*rhs), &ascii_resource, &uc16_resource);
|
@@ -12040,7 +12951,7 @@ class RegExpStringModificationTest {
|
|
12040
12951
|
// Inject the input as a global variable.
|
12041
12952
|
i::Handle<i::String> input_name =
|
12042
12953
|
FACTORY->NewStringFromAscii(i::Vector<const char>("input", 5));
|
12043
|
-
i::Isolate::Current()->
|
12954
|
+
i::Isolate::Current()->native_context()->global_object()->SetProperty(
|
12044
12955
|
*input_name,
|
12045
12956
|
*input_,
|
12046
12957
|
NONE,
|
@@ -12051,7 +12962,7 @@ class RegExpStringModificationTest {
|
|
12051
12962
|
v8::Locker::StartPreemption(1);
|
12052
12963
|
LongRunningRegExp();
|
12053
12964
|
{
|
12054
|
-
v8::Unlocker unlock;
|
12965
|
+
v8::Unlocker unlock(CcTest::default_isolate());
|
12055
12966
|
morph_thread.Join();
|
12056
12967
|
}
|
12057
12968
|
v8::Locker::StopPreemption();
|
@@ -12080,7 +12991,7 @@ class RegExpStringModificationTest {
|
|
12080
12991
|
while (morphs_during_regexp_ < kRequiredModifications &&
|
12081
12992
|
morphs_ < kMaxModifications) {
|
12082
12993
|
{
|
12083
|
-
v8::Locker lock;
|
12994
|
+
v8::Locker lock(CcTest::default_isolate());
|
12084
12995
|
// Swap string between ascii and two-byte representation.
|
12085
12996
|
i::String* string = *input_;
|
12086
12997
|
MorphAString(string, &ascii_resource_, &uc16_resource_);
|
@@ -12128,7 +13039,7 @@ class RegExpStringModificationTest {
|
|
12128
13039
|
// Test that a regular expression execution can be interrupted and
|
12129
13040
|
// the string changed without failing.
|
12130
13041
|
TEST(RegExpStringModification) {
|
12131
|
-
v8::Locker lock;
|
13042
|
+
v8::Locker lock(CcTest::default_isolate());
|
12132
13043
|
v8::V8::Initialize();
|
12133
13044
|
v8::HandleScope scope;
|
12134
13045
|
Local<Context> local_env;
|
@@ -12148,9 +13059,10 @@ TEST(RegExpStringModification) {
|
|
12148
13059
|
}
|
12149
13060
|
|
12150
13061
|
|
12151
|
-
// Test that we
|
13062
|
+
// Test that we cannot set a property on the global object if there
|
12152
13063
|
// is a read-only property in the prototype chain.
|
12153
13064
|
TEST(ReadOnlyPropertyInGlobalProto) {
|
13065
|
+
i::FLAG_es5_readonly = true;
|
12154
13066
|
v8::HandleScope scope;
|
12155
13067
|
v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New();
|
12156
13068
|
LocalContext context(0, templ);
|
@@ -12162,12 +13074,13 @@ TEST(ReadOnlyPropertyInGlobalProto) {
|
|
12162
13074
|
// Check without 'eval' or 'with'.
|
12163
13075
|
v8::Handle<v8::Value> res =
|
12164
13076
|
CompileRun("function f() { x = 42; return x; }; f()");
|
13077
|
+
CHECK_EQ(v8::Integer::New(0), res);
|
12165
13078
|
// Check with 'eval'.
|
12166
|
-
res = CompileRun("function f() { eval('1'); y =
|
12167
|
-
CHECK_EQ(v8::Integer::New(
|
13079
|
+
res = CompileRun("function f() { eval('1'); y = 43; return y; }; f()");
|
13080
|
+
CHECK_EQ(v8::Integer::New(0), res);
|
12168
13081
|
// Check with 'with'.
|
12169
|
-
res = CompileRun("function f() { with (this) { y =
|
12170
|
-
CHECK_EQ(v8::Integer::New(
|
13082
|
+
res = CompileRun("function f() { with (this) { y = 44 }; return y; }; f()");
|
13083
|
+
CHECK_EQ(v8::Integer::New(0), res);
|
12171
13084
|
}
|
12172
13085
|
|
12173
13086
|
static int force_set_set_count = 0;
|
@@ -12410,9 +13323,9 @@ TEST(InlinedFunctionAcrossContexts) {
|
|
12410
13323
|
"ReferenceError: G is not defined");
|
12411
13324
|
ctx2->Exit();
|
12412
13325
|
ctx1->Exit();
|
12413
|
-
ctx1.Dispose();
|
13326
|
+
ctx1.Dispose(ctx1->GetIsolate());
|
12414
13327
|
}
|
12415
|
-
ctx2.Dispose();
|
13328
|
+
ctx2.Dispose(ctx2->GetIsolate());
|
12416
13329
|
}
|
12417
13330
|
|
12418
13331
|
|
@@ -12471,9 +13384,9 @@ THREADED_TEST(GetCallingContext) {
|
|
12471
13384
|
calling_context2->Exit();
|
12472
13385
|
|
12473
13386
|
// Dispose the contexts to allow them to be garbage collected.
|
12474
|
-
calling_context0.Dispose();
|
12475
|
-
calling_context1.Dispose();
|
12476
|
-
calling_context2.Dispose();
|
13387
|
+
calling_context0.Dispose(calling_context0->GetIsolate());
|
13388
|
+
calling_context1.Dispose(calling_context1->GetIsolate());
|
13389
|
+
calling_context2.Dispose(calling_context2->GetIsolate());
|
12477
13390
|
calling_context0.Clear();
|
12478
13391
|
calling_context1.Clear();
|
12479
13392
|
calling_context2.Clear();
|
@@ -13617,6 +14530,41 @@ THREADED_TEST(ExternalArrayInfo) {
|
|
13617
14530
|
}
|
13618
14531
|
|
13619
14532
|
|
14533
|
+
void ExternalArrayLimitTestHelper(v8::ExternalArrayType array_type, int size) {
|
14534
|
+
v8::Handle<v8::Object> obj = v8::Object::New();
|
14535
|
+
v8::V8::SetFatalErrorHandler(StoringErrorCallback);
|
14536
|
+
last_location = last_message = NULL;
|
14537
|
+
obj->SetIndexedPropertiesToExternalArrayData(NULL, array_type, size);
|
14538
|
+
CHECK(!obj->HasIndexedPropertiesInExternalArrayData());
|
14539
|
+
CHECK_NE(NULL, last_location);
|
14540
|
+
CHECK_NE(NULL, last_message);
|
14541
|
+
}
|
14542
|
+
|
14543
|
+
|
14544
|
+
TEST(ExternalArrayLimits) {
|
14545
|
+
v8::HandleScope scope;
|
14546
|
+
LocalContext context;
|
14547
|
+
ExternalArrayLimitTestHelper(v8::kExternalByteArray, 0x40000000);
|
14548
|
+
ExternalArrayLimitTestHelper(v8::kExternalByteArray, 0xffffffff);
|
14549
|
+
ExternalArrayLimitTestHelper(v8::kExternalUnsignedByteArray, 0x40000000);
|
14550
|
+
ExternalArrayLimitTestHelper(v8::kExternalUnsignedByteArray, 0xffffffff);
|
14551
|
+
ExternalArrayLimitTestHelper(v8::kExternalShortArray, 0x40000000);
|
14552
|
+
ExternalArrayLimitTestHelper(v8::kExternalShortArray, 0xffffffff);
|
14553
|
+
ExternalArrayLimitTestHelper(v8::kExternalUnsignedShortArray, 0x40000000);
|
14554
|
+
ExternalArrayLimitTestHelper(v8::kExternalUnsignedShortArray, 0xffffffff);
|
14555
|
+
ExternalArrayLimitTestHelper(v8::kExternalIntArray, 0x40000000);
|
14556
|
+
ExternalArrayLimitTestHelper(v8::kExternalIntArray, 0xffffffff);
|
14557
|
+
ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0x40000000);
|
14558
|
+
ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0xffffffff);
|
14559
|
+
ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0x40000000);
|
14560
|
+
ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0xffffffff);
|
14561
|
+
ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0x40000000);
|
14562
|
+
ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0xffffffff);
|
14563
|
+
ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000);
|
14564
|
+
ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff);
|
14565
|
+
}
|
14566
|
+
|
14567
|
+
|
13620
14568
|
THREADED_TEST(ScriptContextDependence) {
|
13621
14569
|
v8::HandleScope scope;
|
13622
14570
|
LocalContext c1;
|
@@ -13995,6 +14943,89 @@ TEST(SourceURLInStackTrace) {
|
|
13995
14943
|
}
|
13996
14944
|
|
13997
14945
|
|
14946
|
+
v8::Handle<Value> AnalyzeStackOfInlineScriptWithSourceURL(
|
14947
|
+
const v8::Arguments& args) {
|
14948
|
+
v8::HandleScope scope;
|
14949
|
+
v8::Handle<v8::StackTrace> stackTrace =
|
14950
|
+
v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
|
14951
|
+
CHECK_EQ(4, stackTrace->GetFrameCount());
|
14952
|
+
v8::Handle<v8::String> url = v8_str("url");
|
14953
|
+
for (int i = 0; i < 3; i++) {
|
14954
|
+
v8::Handle<v8::String> name =
|
14955
|
+
stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
|
14956
|
+
CHECK(!name.IsEmpty());
|
14957
|
+
CHECK_EQ(url, name);
|
14958
|
+
}
|
14959
|
+
return v8::Undefined();
|
14960
|
+
}
|
14961
|
+
|
14962
|
+
|
14963
|
+
TEST(InlineScriptWithSourceURLInStackTrace) {
|
14964
|
+
v8::HandleScope scope;
|
14965
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
14966
|
+
templ->Set(v8_str("AnalyzeStackOfInlineScriptWithSourceURL"),
|
14967
|
+
v8::FunctionTemplate::New(
|
14968
|
+
AnalyzeStackOfInlineScriptWithSourceURL));
|
14969
|
+
LocalContext context(0, templ);
|
14970
|
+
|
14971
|
+
const char *source =
|
14972
|
+
"function outer() {\n"
|
14973
|
+
"function bar() {\n"
|
14974
|
+
" AnalyzeStackOfInlineScriptWithSourceURL();\n"
|
14975
|
+
"}\n"
|
14976
|
+
"function foo() {\n"
|
14977
|
+
"\n"
|
14978
|
+
" bar();\n"
|
14979
|
+
"}\n"
|
14980
|
+
"foo();\n"
|
14981
|
+
"}\n"
|
14982
|
+
"outer()\n"
|
14983
|
+
"//@ sourceURL=source_url";
|
14984
|
+
CHECK(CompileRunWithOrigin(source, "url", 0, 1)->IsUndefined());
|
14985
|
+
}
|
14986
|
+
|
14987
|
+
|
14988
|
+
v8::Handle<Value> AnalyzeStackOfDynamicScriptWithSourceURL(
|
14989
|
+
const v8::Arguments& args) {
|
14990
|
+
v8::HandleScope scope;
|
14991
|
+
v8::Handle<v8::StackTrace> stackTrace =
|
14992
|
+
v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
|
14993
|
+
CHECK_EQ(4, stackTrace->GetFrameCount());
|
14994
|
+
v8::Handle<v8::String> url = v8_str("source_url");
|
14995
|
+
for (int i = 0; i < 3; i++) {
|
14996
|
+
v8::Handle<v8::String> name =
|
14997
|
+
stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
|
14998
|
+
CHECK(!name.IsEmpty());
|
14999
|
+
CHECK_EQ(url, name);
|
15000
|
+
}
|
15001
|
+
return v8::Undefined();
|
15002
|
+
}
|
15003
|
+
|
15004
|
+
|
15005
|
+
TEST(DynamicWithSourceURLInStackTrace) {
|
15006
|
+
v8::HandleScope scope;
|
15007
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
15008
|
+
templ->Set(v8_str("AnalyzeStackOfDynamicScriptWithSourceURL"),
|
15009
|
+
v8::FunctionTemplate::New(
|
15010
|
+
AnalyzeStackOfDynamicScriptWithSourceURL));
|
15011
|
+
LocalContext context(0, templ);
|
15012
|
+
|
15013
|
+
const char *source =
|
15014
|
+
"function outer() {\n"
|
15015
|
+
"function bar() {\n"
|
15016
|
+
" AnalyzeStackOfDynamicScriptWithSourceURL();\n"
|
15017
|
+
"}\n"
|
15018
|
+
"function foo() {\n"
|
15019
|
+
"\n"
|
15020
|
+
" bar();\n"
|
15021
|
+
"}\n"
|
15022
|
+
"foo();\n"
|
15023
|
+
"}\n"
|
15024
|
+
"outer()\n"
|
15025
|
+
"//@ sourceURL=source_url";
|
15026
|
+
CHECK(CompileRunWithOrigin(source, "url", 0, 0)->IsUndefined());
|
15027
|
+
}
|
15028
|
+
|
13998
15029
|
static void CreateGarbageInOldSpace() {
|
13999
15030
|
v8::HandleScope scope;
|
14000
15031
|
i::AlwaysAllocateScope always_allocate;
|
@@ -14077,7 +15108,7 @@ TEST(Regress2107) {
|
|
14077
15108
|
ctx->Enter();
|
14078
15109
|
CreateGarbageInOldSpace();
|
14079
15110
|
ctx->Exit();
|
14080
|
-
ctx.Dispose();
|
15111
|
+
ctx.Dispose(ctx->GetIsolate());
|
14081
15112
|
v8::V8::ContextDisposedNotification();
|
14082
15113
|
v8::V8::IdleNotification(kLongIdlePauseInMs);
|
14083
15114
|
}
|
@@ -14141,7 +15172,7 @@ TEST(SetResourceConstraints) {
|
|
14141
15172
|
TEST(SetResourceConstraintsInThread) {
|
14142
15173
|
uint32_t* set_limit;
|
14143
15174
|
{
|
14144
|
-
v8::Locker locker;
|
15175
|
+
v8::Locker locker(CcTest::default_isolate());
|
14145
15176
|
static const int K = 1024;
|
14146
15177
|
set_limit = ComputeStackLimit(128 * K);
|
14147
15178
|
|
@@ -14162,7 +15193,7 @@ TEST(SetResourceConstraintsInThread) {
|
|
14162
15193
|
CHECK(stack_limit == set_limit);
|
14163
15194
|
}
|
14164
15195
|
{
|
14165
|
-
v8::Locker locker;
|
15196
|
+
v8::Locker locker(CcTest::default_isolate());
|
14166
15197
|
CHECK(stack_limit == set_limit);
|
14167
15198
|
}
|
14168
15199
|
}
|
@@ -14182,11 +15213,12 @@ THREADED_TEST(GetHeapStatistics) {
|
|
14182
15213
|
|
14183
15214
|
class VisitorImpl : public v8::ExternalResourceVisitor {
|
14184
15215
|
public:
|
14185
|
-
VisitorImpl(TestResource
|
14186
|
-
|
14187
|
-
|
14188
|
-
|
14189
|
-
|
15216
|
+
explicit VisitorImpl(TestResource** resource) {
|
15217
|
+
for (int i = 0; i < 4; i++) {
|
15218
|
+
resource_[i] = resource[i];
|
15219
|
+
found_resource_[i] = false;
|
15220
|
+
}
|
15221
|
+
}
|
14190
15222
|
virtual ~VisitorImpl() {}
|
14191
15223
|
virtual void VisitExternalString(v8::Handle<v8::String> string) {
|
14192
15224
|
if (!string->IsExternal()) {
|
@@ -14196,25 +15228,22 @@ class VisitorImpl : public v8::ExternalResourceVisitor {
|
|
14196
15228
|
v8::String::ExternalStringResource* resource =
|
14197
15229
|
string->GetExternalStringResource();
|
14198
15230
|
CHECK(resource);
|
14199
|
-
|
14200
|
-
|
14201
|
-
|
14202
|
-
|
14203
|
-
|
14204
|
-
CHECK(!found_resource2_);
|
14205
|
-
found_resource2_ = true;
|
15231
|
+
for (int i = 0; i < 4; i++) {
|
15232
|
+
if (resource_[i] == resource) {
|
15233
|
+
CHECK(!found_resource_[i]);
|
15234
|
+
found_resource_[i] = true;
|
15235
|
+
}
|
14206
15236
|
}
|
14207
15237
|
}
|
14208
15238
|
void CheckVisitedResources() {
|
14209
|
-
|
14210
|
-
|
15239
|
+
for (int i = 0; i < 4; i++) {
|
15240
|
+
CHECK(found_resource_[i]);
|
15241
|
+
}
|
14211
15242
|
}
|
14212
15243
|
|
14213
15244
|
private:
|
14214
|
-
v8::String::ExternalStringResource*
|
14215
|
-
|
14216
|
-
bool found_resource1_;
|
14217
|
-
bool found_resource2_;
|
15245
|
+
v8::String::ExternalStringResource* resource_[4];
|
15246
|
+
bool found_resource_[4];
|
14218
15247
|
};
|
14219
15248
|
|
14220
15249
|
TEST(VisitExternalStrings) {
|
@@ -14222,16 +15251,33 @@ TEST(VisitExternalStrings) {
|
|
14222
15251
|
LocalContext env;
|
14223
15252
|
const char* string = "Some string";
|
14224
15253
|
uint16_t* two_byte_string = AsciiToTwoByteString(string);
|
14225
|
-
TestResource*
|
14226
|
-
|
14227
|
-
|
14228
|
-
|
14229
|
-
|
14230
|
-
|
15254
|
+
TestResource* resource[4];
|
15255
|
+
resource[0] = new TestResource(two_byte_string);
|
15256
|
+
v8::Local<v8::String> string0 = v8::String::NewExternal(resource[0]);
|
15257
|
+
resource[1] = new TestResource(two_byte_string);
|
15258
|
+
v8::Local<v8::String> string1 = v8::String::NewExternal(resource[1]);
|
15259
|
+
|
15260
|
+
// Externalized symbol.
|
15261
|
+
resource[2] = new TestResource(two_byte_string);
|
15262
|
+
v8::Local<v8::String> string2 = v8::String::NewSymbol(string);
|
15263
|
+
CHECK(string2->MakeExternal(resource[2]));
|
15264
|
+
|
15265
|
+
// Symbolized External.
|
15266
|
+
resource[3] = new TestResource(AsciiToTwoByteString("Some other string"));
|
15267
|
+
v8::Local<v8::String> string3 = v8::String::NewExternal(resource[3]);
|
15268
|
+
HEAP->CollectAllAvailableGarbage(); // Tenure string.
|
15269
|
+
// Turn into a symbol.
|
15270
|
+
i::Handle<i::String> string3_i = v8::Utils::OpenHandle(*string3);
|
15271
|
+
CHECK(!HEAP->LookupSymbol(*string3_i)->IsFailure());
|
15272
|
+
CHECK(string3_i->IsSymbol());
|
15273
|
+
|
15274
|
+
// We need to add usages for string* to avoid warnings in GCC 4.7
|
15275
|
+
CHECK(string0->IsExternal());
|
14231
15276
|
CHECK(string1->IsExternal());
|
14232
15277
|
CHECK(string2->IsExternal());
|
15278
|
+
CHECK(string3->IsExternal());
|
14233
15279
|
|
14234
|
-
VisitorImpl visitor(
|
15280
|
+
VisitorImpl visitor(resource);
|
14235
15281
|
v8::V8::VisitExternalResources(&visitor);
|
14236
15282
|
visitor.CheckVisitedResources();
|
14237
15283
|
}
|
@@ -14410,11 +15456,12 @@ TEST(Regress528) {
|
|
14410
15456
|
|
14411
15457
|
context->Enter();
|
14412
15458
|
Local<v8::String> obj = v8::String::New("");
|
14413
|
-
context->
|
15459
|
+
context->SetEmbedderData(0, obj);
|
14414
15460
|
CompileRun(source_simple);
|
14415
15461
|
context->Exit();
|
14416
15462
|
}
|
14417
|
-
context.Dispose();
|
15463
|
+
context.Dispose(context->GetIsolate());
|
15464
|
+
v8::V8::ContextDisposedNotification();
|
14418
15465
|
for (gc_count = 1; gc_count < 10; gc_count++) {
|
14419
15466
|
other_context->Enter();
|
14420
15467
|
CompileRun(source_simple);
|
@@ -14436,7 +15483,8 @@ TEST(Regress528) {
|
|
14436
15483
|
CompileRun(source_eval);
|
14437
15484
|
context->Exit();
|
14438
15485
|
}
|
14439
|
-
context.Dispose();
|
15486
|
+
context.Dispose(context->GetIsolate());
|
15487
|
+
v8::V8::ContextDisposedNotification();
|
14440
15488
|
for (gc_count = 1; gc_count < 10; gc_count++) {
|
14441
15489
|
other_context->Enter();
|
14442
15490
|
CompileRun(source_eval);
|
@@ -14463,7 +15511,8 @@ TEST(Regress528) {
|
|
14463
15511
|
CHECK_EQ(1, message->GetLineNumber());
|
14464
15512
|
context->Exit();
|
14465
15513
|
}
|
14466
|
-
context.Dispose();
|
15514
|
+
context.Dispose(context->GetIsolate());
|
15515
|
+
v8::V8::ContextDisposedNotification();
|
14467
15516
|
for (gc_count = 1; gc_count < 10; gc_count++) {
|
14468
15517
|
other_context->Enter();
|
14469
15518
|
CompileRun(source_exception);
|
@@ -14474,7 +15523,8 @@ TEST(Regress528) {
|
|
14474
15523
|
CHECK_GE(2, gc_count);
|
14475
15524
|
CHECK_EQ(1, GetGlobalObjectsCount());
|
14476
15525
|
|
14477
|
-
other_context.Dispose();
|
15526
|
+
other_context.Dispose(other_context->GetIsolate());
|
15527
|
+
v8::V8::ContextDisposedNotification();
|
14478
15528
|
}
|
14479
15529
|
|
14480
15530
|
|
@@ -14564,6 +15614,8 @@ THREADED_TEST(FunctionGetScriptId) {
|
|
14564
15614
|
|
14565
15615
|
static v8::Handle<Value> GetterWhichReturns42(Local<String> name,
|
14566
15616
|
const AccessorInfo& info) {
|
15617
|
+
CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
15618
|
+
CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
14567
15619
|
return v8_num(42);
|
14568
15620
|
}
|
14569
15621
|
|
@@ -14571,10 +15623,32 @@ static v8::Handle<Value> GetterWhichReturns42(Local<String> name,
|
|
14571
15623
|
static void SetterWhichSetsYOnThisTo23(Local<String> name,
|
14572
15624
|
Local<Value> value,
|
14573
15625
|
const AccessorInfo& info) {
|
15626
|
+
CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
15627
|
+
CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
14574
15628
|
info.This()->Set(v8_str("y"), v8_num(23));
|
14575
15629
|
}
|
14576
15630
|
|
14577
15631
|
|
15632
|
+
Handle<Value> FooGetInterceptor(Local<String> name,
|
15633
|
+
const AccessorInfo& info) {
|
15634
|
+
CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
15635
|
+
CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
15636
|
+
if (!name->Equals(v8_str("foo"))) return Handle<Value>();
|
15637
|
+
return v8_num(42);
|
15638
|
+
}
|
15639
|
+
|
15640
|
+
|
15641
|
+
Handle<Value> FooSetInterceptor(Local<String> name,
|
15642
|
+
Local<Value> value,
|
15643
|
+
const AccessorInfo& info) {
|
15644
|
+
CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
15645
|
+
CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
15646
|
+
if (!name->Equals(v8_str("foo"))) return Handle<Value>();
|
15647
|
+
info.This()->Set(v8_str("y"), v8_num(23));
|
15648
|
+
return v8_num(23);
|
15649
|
+
}
|
15650
|
+
|
15651
|
+
|
14578
15652
|
TEST(SetterOnConstructorPrototype) {
|
14579
15653
|
v8::HandleScope scope;
|
14580
15654
|
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
@@ -14893,13 +15967,13 @@ THREADED_TEST(TwoByteStringInAsciiCons) {
|
|
14893
15967
|
CHECK(result->IsString());
|
14894
15968
|
i::Handle<i::String> string = v8::Utils::OpenHandle(String::Cast(*result));
|
14895
15969
|
int length = string->length();
|
14896
|
-
CHECK(string->
|
15970
|
+
CHECK(string->IsOneByteRepresentation());
|
14897
15971
|
|
14898
15972
|
FlattenString(string);
|
14899
15973
|
i::Handle<i::String> flat_string = FlattenGetString(string);
|
14900
15974
|
|
14901
|
-
CHECK(string->
|
14902
|
-
CHECK(flat_string->
|
15975
|
+
CHECK(string->IsOneByteRepresentation());
|
15976
|
+
CHECK(flat_string->IsOneByteRepresentation());
|
14903
15977
|
|
14904
15978
|
// Create external resource.
|
14905
15979
|
uint16_t* uc16_buffer = new uint16_t[length + 1];
|
@@ -14918,7 +15992,7 @@ THREADED_TEST(TwoByteStringInAsciiCons) {
|
|
14918
15992
|
// ASCII characters). This is a valid sequence of steps, and it can happen
|
14919
15993
|
// in real pages.
|
14920
15994
|
|
14921
|
-
CHECK(string->
|
15995
|
+
CHECK(string->IsOneByteRepresentation());
|
14922
15996
|
i::ConsString* cons = i::ConsString::cast(*string);
|
14923
15997
|
CHECK_EQ(0, cons->second()->length());
|
14924
15998
|
CHECK(cons->first()->IsTwoByteRepresentation());
|
@@ -15239,10 +16313,10 @@ TEST(RunTwoIsolatesOnSingleThread) {
|
|
15239
16313
|
|
15240
16314
|
{
|
15241
16315
|
v8::Isolate::Scope iscope(isolate2);
|
15242
|
-
context2.Dispose();
|
16316
|
+
context2.Dispose(context2->GetIsolate());
|
15243
16317
|
}
|
15244
16318
|
|
15245
|
-
context1.Dispose();
|
16319
|
+
context1.Dispose(context1->GetIsolate());
|
15246
16320
|
isolate1->Exit();
|
15247
16321
|
|
15248
16322
|
v8::V8::SetFatalErrorHandler(StoringErrorCallback);
|
@@ -15605,6 +16679,86 @@ TEST(DontDeleteCellLoadICAPI) {
|
|
15605
16679
|
}
|
15606
16680
|
|
15607
16681
|
|
16682
|
+
class Visitor42 : public v8::PersistentHandleVisitor {
|
16683
|
+
public:
|
16684
|
+
explicit Visitor42(v8::Persistent<v8::Object> object)
|
16685
|
+
: counter_(0), object_(object) { }
|
16686
|
+
|
16687
|
+
virtual void VisitPersistentHandle(Persistent<Value> value,
|
16688
|
+
uint16_t class_id) {
|
16689
|
+
if (class_id == 42) {
|
16690
|
+
CHECK(value->IsObject());
|
16691
|
+
v8::Persistent<v8::Object> visited =
|
16692
|
+
v8::Persistent<v8::Object>::Cast(value);
|
16693
|
+
CHECK_EQ(42, visited.WrapperClassId(v8::Isolate::GetCurrent()));
|
16694
|
+
CHECK_EQ(object_, visited);
|
16695
|
+
++counter_;
|
16696
|
+
}
|
16697
|
+
}
|
16698
|
+
|
16699
|
+
int counter_;
|
16700
|
+
v8::Persistent<v8::Object> object_;
|
16701
|
+
};
|
16702
|
+
|
16703
|
+
|
16704
|
+
TEST(PersistentHandleVisitor) {
|
16705
|
+
v8::HandleScope scope;
|
16706
|
+
LocalContext context;
|
16707
|
+
v8::Isolate* isolate = context->GetIsolate();
|
16708
|
+
v8::Persistent<v8::Object> object =
|
16709
|
+
v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
16710
|
+
CHECK_EQ(0, object.WrapperClassId(isolate));
|
16711
|
+
object.SetWrapperClassId(isolate, 42);
|
16712
|
+
CHECK_EQ(42, object.WrapperClassId(isolate));
|
16713
|
+
|
16714
|
+
Visitor42 visitor(object);
|
16715
|
+
v8::V8::VisitHandlesWithClassIds(&visitor);
|
16716
|
+
CHECK_EQ(1, visitor.counter_);
|
16717
|
+
|
16718
|
+
object.Dispose(isolate);
|
16719
|
+
}
|
16720
|
+
|
16721
|
+
|
16722
|
+
TEST(WrapperClassId) {
|
16723
|
+
v8::HandleScope scope;
|
16724
|
+
LocalContext context;
|
16725
|
+
v8::Isolate* isolate = context->GetIsolate();
|
16726
|
+
v8::Persistent<v8::Object> object =
|
16727
|
+
v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
16728
|
+
CHECK_EQ(0, object.WrapperClassId(isolate));
|
16729
|
+
object.SetWrapperClassId(isolate, 65535);
|
16730
|
+
CHECK_EQ(65535, object.WrapperClassId(isolate));
|
16731
|
+
object.Dispose(isolate);
|
16732
|
+
}
|
16733
|
+
|
16734
|
+
|
16735
|
+
TEST(PersistentHandleInNewSpaceVisitor) {
|
16736
|
+
v8::HandleScope scope;
|
16737
|
+
LocalContext context;
|
16738
|
+
v8::Isolate* isolate = context->GetIsolate();
|
16739
|
+
v8::Persistent<v8::Object> object1 =
|
16740
|
+
v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
16741
|
+
CHECK_EQ(0, object1.WrapperClassId(isolate));
|
16742
|
+
object1.SetWrapperClassId(isolate, 42);
|
16743
|
+
CHECK_EQ(42, object1.WrapperClassId(isolate));
|
16744
|
+
|
16745
|
+
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
16746
|
+
|
16747
|
+
v8::Persistent<v8::Object> object2 =
|
16748
|
+
v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
|
16749
|
+
CHECK_EQ(0, object2.WrapperClassId(isolate));
|
16750
|
+
object2.SetWrapperClassId(isolate, 42);
|
16751
|
+
CHECK_EQ(42, object2.WrapperClassId(isolate));
|
16752
|
+
|
16753
|
+
Visitor42 visitor(object2);
|
16754
|
+
v8::V8::VisitHandlesForPartialDependence(isolate, &visitor);
|
16755
|
+
CHECK_EQ(1, visitor.counter_);
|
16756
|
+
|
16757
|
+
object1.Dispose(isolate);
|
16758
|
+
object2.Dispose(isolate);
|
16759
|
+
}
|
16760
|
+
|
16761
|
+
|
15608
16762
|
TEST(RegExp) {
|
15609
16763
|
v8::HandleScope scope;
|
15610
16764
|
LocalContext context;
|
@@ -15831,9 +16985,9 @@ THREADED_TEST(CreationContext) {
|
|
15831
16985
|
CheckContextId(instance2, 2);
|
15832
16986
|
}
|
15833
16987
|
|
15834
|
-
context1.Dispose();
|
15835
|
-
context2.Dispose();
|
15836
|
-
context3.Dispose();
|
16988
|
+
context1.Dispose(context1->GetIsolate());
|
16989
|
+
context2.Dispose(context2->GetIsolate());
|
16990
|
+
context3.Dispose(context3->GetIsolate());
|
15837
16991
|
}
|
15838
16992
|
|
15839
16993
|
|
@@ -15851,7 +17005,7 @@ THREADED_TEST(CreationContextOfJsFunction) {
|
|
15851
17005
|
CHECK(function->CreationContext() == context);
|
15852
17006
|
CheckContextId(function, 1);
|
15853
17007
|
|
15854
|
-
context.Dispose();
|
17008
|
+
context.Dispose(context->GetIsolate());
|
15855
17009
|
}
|
15856
17010
|
|
15857
17011
|
|
@@ -16040,6 +17194,24 @@ THREADED_TEST(AllowCodeGenFromStrings) {
|
|
16040
17194
|
}
|
16041
17195
|
|
16042
17196
|
|
17197
|
+
TEST(SetErrorMessageForCodeGenFromStrings) {
|
17198
|
+
v8::HandleScope scope;
|
17199
|
+
LocalContext context;
|
17200
|
+
TryCatch try_catch;
|
17201
|
+
|
17202
|
+
Handle<String> message = v8_str("Message") ;
|
17203
|
+
Handle<String> expected_message = v8_str("Uncaught EvalError: Message");
|
17204
|
+
V8::SetAllowCodeGenerationFromStringsCallback(&CodeGenerationDisallowed);
|
17205
|
+
context->AllowCodeGenerationFromStrings(false);
|
17206
|
+
context->SetErrorMessageForCodeGenerationFromStrings(message);
|
17207
|
+
Handle<Value> result = CompileRun("eval('42')");
|
17208
|
+
CHECK(result.IsEmpty());
|
17209
|
+
CHECK(try_catch.HasCaught());
|
17210
|
+
Handle<String> actual_message = try_catch.Message()->Get();
|
17211
|
+
CHECK(expected_message->Equals(actual_message));
|
17212
|
+
}
|
17213
|
+
|
17214
|
+
|
16043
17215
|
static v8::Handle<Value> NonObjectThis(const v8::Arguments& args) {
|
16044
17216
|
return v8::Undefined();
|
16045
17217
|
}
|
@@ -16093,7 +17265,8 @@ THREADED_TEST(Regress1516) {
|
|
16093
17265
|
CHECK_LE(1, elements);
|
16094
17266
|
}
|
16095
17267
|
|
16096
|
-
i::Isolate::Current()->heap()->CollectAllGarbage(
|
17268
|
+
i::Isolate::Current()->heap()->CollectAllGarbage(
|
17269
|
+
i::Heap::kAbortIncrementalMarkingMask);
|
16097
17270
|
{ i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache();
|
16098
17271
|
if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) {
|
16099
17272
|
i::MapCache* map_cache = i::MapCache::cast(raw_map_cache);
|
@@ -16208,7 +17381,7 @@ THREADED_TEST(Regress93759) {
|
|
16208
17381
|
Local<Value> result6 = CompileRun("Object.getPrototypeOf(phidden)");
|
16209
17382
|
CHECK(result6->Equals(Undefined()));
|
16210
17383
|
|
16211
|
-
context.Dispose();
|
17384
|
+
context.Dispose(context->GetIsolate());
|
16212
17385
|
}
|
16213
17386
|
|
16214
17387
|
|
@@ -16336,7 +17509,7 @@ THREADED_TEST(ForeignFunctionReceiver) {
|
|
16336
17509
|
// Calling with no base.
|
16337
17510
|
TestReceiver(o, context->Global(), "(1,func)()");
|
16338
17511
|
|
16339
|
-
foreign_context.Dispose();
|
17512
|
+
foreign_context.Dispose(foreign_context->GetIsolate());
|
16340
17513
|
}
|
16341
17514
|
|
16342
17515
|
|
@@ -16593,3 +17766,459 @@ TEST(StringEmpty) {
|
|
16593
17766
|
CHECK(v8::String::Empty(isolate).IsEmpty());
|
16594
17767
|
CHECK_EQ(3, fatal_error_callback_counter);
|
16595
17768
|
}
|
17769
|
+
|
17770
|
+
|
17771
|
+
static int instance_checked_getter_count = 0;
|
17772
|
+
static Handle<Value> InstanceCheckedGetter(Local<String> name,
|
17773
|
+
const AccessorInfo& info) {
|
17774
|
+
CHECK_EQ(name, v8_str("foo"));
|
17775
|
+
instance_checked_getter_count++;
|
17776
|
+
return v8_num(11);
|
17777
|
+
}
|
17778
|
+
|
17779
|
+
|
17780
|
+
static int instance_checked_setter_count = 0;
|
17781
|
+
static void InstanceCheckedSetter(Local<String> name,
|
17782
|
+
Local<Value> value,
|
17783
|
+
const AccessorInfo& info) {
|
17784
|
+
CHECK_EQ(name, v8_str("foo"));
|
17785
|
+
CHECK_EQ(value, v8_num(23));
|
17786
|
+
instance_checked_setter_count++;
|
17787
|
+
}
|
17788
|
+
|
17789
|
+
|
17790
|
+
static void CheckInstanceCheckedResult(int getters,
|
17791
|
+
int setters,
|
17792
|
+
bool expects_callbacks,
|
17793
|
+
TryCatch* try_catch) {
|
17794
|
+
if (expects_callbacks) {
|
17795
|
+
CHECK(!try_catch->HasCaught());
|
17796
|
+
CHECK_EQ(getters, instance_checked_getter_count);
|
17797
|
+
CHECK_EQ(setters, instance_checked_setter_count);
|
17798
|
+
} else {
|
17799
|
+
CHECK(try_catch->HasCaught());
|
17800
|
+
CHECK_EQ(0, instance_checked_getter_count);
|
17801
|
+
CHECK_EQ(0, instance_checked_setter_count);
|
17802
|
+
}
|
17803
|
+
try_catch->Reset();
|
17804
|
+
}
|
17805
|
+
|
17806
|
+
|
17807
|
+
static void CheckInstanceCheckedAccessors(bool expects_callbacks) {
|
17808
|
+
instance_checked_getter_count = 0;
|
17809
|
+
instance_checked_setter_count = 0;
|
17810
|
+
TryCatch try_catch;
|
17811
|
+
|
17812
|
+
// Test path through generic runtime code.
|
17813
|
+
CompileRun("obj.foo");
|
17814
|
+
CheckInstanceCheckedResult(1, 0, expects_callbacks, &try_catch);
|
17815
|
+
CompileRun("obj.foo = 23");
|
17816
|
+
CheckInstanceCheckedResult(1, 1, expects_callbacks, &try_catch);
|
17817
|
+
|
17818
|
+
// Test path through generated LoadIC and StoredIC.
|
17819
|
+
CompileRun("function test_get(o) { o.foo; }"
|
17820
|
+
"test_get(obj);");
|
17821
|
+
CheckInstanceCheckedResult(2, 1, expects_callbacks, &try_catch);
|
17822
|
+
CompileRun("test_get(obj);");
|
17823
|
+
CheckInstanceCheckedResult(3, 1, expects_callbacks, &try_catch);
|
17824
|
+
CompileRun("test_get(obj);");
|
17825
|
+
CheckInstanceCheckedResult(4, 1, expects_callbacks, &try_catch);
|
17826
|
+
CompileRun("function test_set(o) { o.foo = 23; }"
|
17827
|
+
"test_set(obj);");
|
17828
|
+
CheckInstanceCheckedResult(4, 2, expects_callbacks, &try_catch);
|
17829
|
+
CompileRun("test_set(obj);");
|
17830
|
+
CheckInstanceCheckedResult(4, 3, expects_callbacks, &try_catch);
|
17831
|
+
CompileRun("test_set(obj);");
|
17832
|
+
CheckInstanceCheckedResult(4, 4, expects_callbacks, &try_catch);
|
17833
|
+
|
17834
|
+
// Test path through optimized code.
|
17835
|
+
CompileRun("%OptimizeFunctionOnNextCall(test_get);"
|
17836
|
+
"test_get(obj);");
|
17837
|
+
CheckInstanceCheckedResult(5, 4, expects_callbacks, &try_catch);
|
17838
|
+
CompileRun("%OptimizeFunctionOnNextCall(test_set);"
|
17839
|
+
"test_set(obj);");
|
17840
|
+
CheckInstanceCheckedResult(5, 5, expects_callbacks, &try_catch);
|
17841
|
+
|
17842
|
+
// Cleanup so that closures start out fresh in next check.
|
17843
|
+
CompileRun("%DeoptimizeFunction(test_get);"
|
17844
|
+
"%ClearFunctionTypeFeedback(test_get);"
|
17845
|
+
"%DeoptimizeFunction(test_set);"
|
17846
|
+
"%ClearFunctionTypeFeedback(test_set);");
|
17847
|
+
}
|
17848
|
+
|
17849
|
+
|
17850
|
+
THREADED_TEST(InstanceCheckOnInstanceAccessor) {
|
17851
|
+
v8::internal::FLAG_allow_natives_syntax = true;
|
17852
|
+
v8::HandleScope scope;
|
17853
|
+
LocalContext context;
|
17854
|
+
|
17855
|
+
Local<FunctionTemplate> templ = FunctionTemplate::New();
|
17856
|
+
Local<ObjectTemplate> inst = templ->InstanceTemplate();
|
17857
|
+
inst->SetAccessor(v8_str("foo"),
|
17858
|
+
InstanceCheckedGetter, InstanceCheckedSetter,
|
17859
|
+
Handle<Value>(),
|
17860
|
+
v8::DEFAULT,
|
17861
|
+
v8::None,
|
17862
|
+
v8::AccessorSignature::New(templ));
|
17863
|
+
context->Global()->Set(v8_str("f"), templ->GetFunction());
|
17864
|
+
|
17865
|
+
printf("Testing positive ...\n");
|
17866
|
+
CompileRun("var obj = new f();");
|
17867
|
+
CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17868
|
+
CheckInstanceCheckedAccessors(true);
|
17869
|
+
|
17870
|
+
printf("Testing negative ...\n");
|
17871
|
+
CompileRun("var obj = {};"
|
17872
|
+
"obj.__proto__ = new f();");
|
17873
|
+
CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17874
|
+
CheckInstanceCheckedAccessors(false);
|
17875
|
+
}
|
17876
|
+
|
17877
|
+
|
17878
|
+
THREADED_TEST(InstanceCheckOnInstanceAccessorWithInterceptor) {
|
17879
|
+
v8::internal::FLAG_allow_natives_syntax = true;
|
17880
|
+
v8::HandleScope scope;
|
17881
|
+
LocalContext context;
|
17882
|
+
|
17883
|
+
Local<FunctionTemplate> templ = FunctionTemplate::New();
|
17884
|
+
Local<ObjectTemplate> inst = templ->InstanceTemplate();
|
17885
|
+
AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
|
17886
|
+
inst->SetAccessor(v8_str("foo"),
|
17887
|
+
InstanceCheckedGetter, InstanceCheckedSetter,
|
17888
|
+
Handle<Value>(),
|
17889
|
+
v8::DEFAULT,
|
17890
|
+
v8::None,
|
17891
|
+
v8::AccessorSignature::New(templ));
|
17892
|
+
context->Global()->Set(v8_str("f"), templ->GetFunction());
|
17893
|
+
|
17894
|
+
printf("Testing positive ...\n");
|
17895
|
+
CompileRun("var obj = new f();");
|
17896
|
+
CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17897
|
+
CheckInstanceCheckedAccessors(true);
|
17898
|
+
|
17899
|
+
printf("Testing negative ...\n");
|
17900
|
+
CompileRun("var obj = {};"
|
17901
|
+
"obj.__proto__ = new f();");
|
17902
|
+
CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17903
|
+
CheckInstanceCheckedAccessors(false);
|
17904
|
+
}
|
17905
|
+
|
17906
|
+
|
17907
|
+
THREADED_TEST(InstanceCheckOnPrototypeAccessor) {
|
17908
|
+
v8::internal::FLAG_allow_natives_syntax = true;
|
17909
|
+
v8::HandleScope scope;
|
17910
|
+
LocalContext context;
|
17911
|
+
|
17912
|
+
Local<FunctionTemplate> templ = FunctionTemplate::New();
|
17913
|
+
Local<ObjectTemplate> proto = templ->PrototypeTemplate();
|
17914
|
+
proto->SetAccessor(v8_str("foo"),
|
17915
|
+
InstanceCheckedGetter, InstanceCheckedSetter,
|
17916
|
+
Handle<Value>(),
|
17917
|
+
v8::DEFAULT,
|
17918
|
+
v8::None,
|
17919
|
+
v8::AccessorSignature::New(templ));
|
17920
|
+
context->Global()->Set(v8_str("f"), templ->GetFunction());
|
17921
|
+
|
17922
|
+
printf("Testing positive ...\n");
|
17923
|
+
CompileRun("var obj = new f();");
|
17924
|
+
CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17925
|
+
CheckInstanceCheckedAccessors(true);
|
17926
|
+
|
17927
|
+
printf("Testing negative ...\n");
|
17928
|
+
CompileRun("var obj = {};"
|
17929
|
+
"obj.__proto__ = new f();");
|
17930
|
+
CHECK(!templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17931
|
+
CheckInstanceCheckedAccessors(false);
|
17932
|
+
|
17933
|
+
printf("Testing positive with modified prototype chain ...\n");
|
17934
|
+
CompileRun("var obj = new f();"
|
17935
|
+
"var pro = {};"
|
17936
|
+
"pro.__proto__ = obj.__proto__;"
|
17937
|
+
"obj.__proto__ = pro;");
|
17938
|
+
CHECK(templ->HasInstance(context->Global()->Get(v8_str("obj"))));
|
17939
|
+
CheckInstanceCheckedAccessors(true);
|
17940
|
+
}
|
17941
|
+
|
17942
|
+
|
17943
|
+
TEST(TryFinallyMessage) {
|
17944
|
+
v8::HandleScope scope;
|
17945
|
+
LocalContext context;
|
17946
|
+
{
|
17947
|
+
// Test that the original error message is not lost if there is a
|
17948
|
+
// recursive call into Javascript is done in the finally block, e.g. to
|
17949
|
+
// initialize an IC. (crbug.com/129171)
|
17950
|
+
TryCatch try_catch;
|
17951
|
+
const char* trigger_ic =
|
17952
|
+
"try { \n"
|
17953
|
+
" throw new Error('test'); \n"
|
17954
|
+
"} finally { \n"
|
17955
|
+
" var x = 0; \n"
|
17956
|
+
" x++; \n" // Trigger an IC initialization here.
|
17957
|
+
"} \n";
|
17958
|
+
CompileRun(trigger_ic);
|
17959
|
+
CHECK(try_catch.HasCaught());
|
17960
|
+
Local<Message> message = try_catch.Message();
|
17961
|
+
CHECK(!message.IsEmpty());
|
17962
|
+
CHECK_EQ(2, message->GetLineNumber());
|
17963
|
+
}
|
17964
|
+
|
17965
|
+
{
|
17966
|
+
// Test that the original exception message is indeed overwritten if
|
17967
|
+
// a new error is thrown in the finally block.
|
17968
|
+
TryCatch try_catch;
|
17969
|
+
const char* throw_again =
|
17970
|
+
"try { \n"
|
17971
|
+
" throw new Error('test'); \n"
|
17972
|
+
"} finally { \n"
|
17973
|
+
" var x = 0; \n"
|
17974
|
+
" x++; \n"
|
17975
|
+
" throw new Error('again'); \n" // This is the new uncaught error.
|
17976
|
+
"} \n";
|
17977
|
+
CompileRun(throw_again);
|
17978
|
+
CHECK(try_catch.HasCaught());
|
17979
|
+
Local<Message> message = try_catch.Message();
|
17980
|
+
CHECK(!message.IsEmpty());
|
17981
|
+
CHECK_EQ(6, message->GetLineNumber());
|
17982
|
+
}
|
17983
|
+
}
|
17984
|
+
|
17985
|
+
|
17986
|
+
static void Helper137002(bool do_store,
|
17987
|
+
bool polymorphic,
|
17988
|
+
bool remove_accessor,
|
17989
|
+
bool interceptor) {
|
17990
|
+
LocalContext context;
|
17991
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
17992
|
+
if (interceptor) {
|
17993
|
+
templ->SetNamedPropertyHandler(FooGetInterceptor, FooSetInterceptor);
|
17994
|
+
} else {
|
17995
|
+
templ->SetAccessor(v8_str("foo"),
|
17996
|
+
GetterWhichReturns42,
|
17997
|
+
SetterWhichSetsYOnThisTo23);
|
17998
|
+
}
|
17999
|
+
context->Global()->Set(v8_str("obj"), templ->NewInstance());
|
18000
|
+
|
18001
|
+
// Turn monomorphic on slow object with native accessor, then turn
|
18002
|
+
// polymorphic, finally optimize to create negative lookup and fail.
|
18003
|
+
CompileRun(do_store ?
|
18004
|
+
"function f(x) { x.foo = void 0; }" :
|
18005
|
+
"function f(x) { return x.foo; }");
|
18006
|
+
CompileRun("obj.y = void 0;");
|
18007
|
+
if (!interceptor) {
|
18008
|
+
CompileRun("%OptimizeObjectForAddingMultipleProperties(obj, 1);");
|
18009
|
+
}
|
18010
|
+
CompileRun("obj.__proto__ = null;"
|
18011
|
+
"f(obj); f(obj); f(obj);");
|
18012
|
+
if (polymorphic) {
|
18013
|
+
CompileRun("f({});");
|
18014
|
+
}
|
18015
|
+
CompileRun("obj.y = void 0;"
|
18016
|
+
"%OptimizeFunctionOnNextCall(f);");
|
18017
|
+
if (remove_accessor) {
|
18018
|
+
CompileRun("delete obj.foo;");
|
18019
|
+
}
|
18020
|
+
CompileRun("var result = f(obj);");
|
18021
|
+
if (do_store) {
|
18022
|
+
CompileRun("result = obj.y;");
|
18023
|
+
}
|
18024
|
+
if (remove_accessor && !interceptor) {
|
18025
|
+
CHECK(context->Global()->Get(v8_str("result"))->IsUndefined());
|
18026
|
+
} else {
|
18027
|
+
CHECK_EQ(do_store ? 23 : 42,
|
18028
|
+
context->Global()->Get(v8_str("result"))->Int32Value());
|
18029
|
+
}
|
18030
|
+
}
|
18031
|
+
|
18032
|
+
|
18033
|
+
THREADED_TEST(Regress137002a) {
|
18034
|
+
i::FLAG_allow_natives_syntax = true;
|
18035
|
+
i::FLAG_compilation_cache = false;
|
18036
|
+
v8::HandleScope scope;
|
18037
|
+
for (int i = 0; i < 16; i++) {
|
18038
|
+
Helper137002(i & 8, i & 4, i & 2, i & 1);
|
18039
|
+
}
|
18040
|
+
}
|
18041
|
+
|
18042
|
+
|
18043
|
+
THREADED_TEST(Regress137002b) {
|
18044
|
+
i::FLAG_allow_natives_syntax = true;
|
18045
|
+
v8::HandleScope scope;
|
18046
|
+
LocalContext context;
|
18047
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
18048
|
+
templ->SetAccessor(v8_str("foo"),
|
18049
|
+
GetterWhichReturns42,
|
18050
|
+
SetterWhichSetsYOnThisTo23);
|
18051
|
+
context->Global()->Set(v8_str("obj"), templ->NewInstance());
|
18052
|
+
|
18053
|
+
// Turn monomorphic on slow object with native accessor, then just
|
18054
|
+
// delete the property and fail.
|
18055
|
+
CompileRun("function load(x) { return x.foo; }"
|
18056
|
+
"function store(x) { x.foo = void 0; }"
|
18057
|
+
"function keyed_load(x, key) { return x[key]; }"
|
18058
|
+
// Second version of function has a different source (add void 0)
|
18059
|
+
// so that it does not share code with the first version. This
|
18060
|
+
// ensures that the ICs are monomorphic.
|
18061
|
+
"function load2(x) { void 0; return x.foo; }"
|
18062
|
+
"function store2(x) { void 0; x.foo = void 0; }"
|
18063
|
+
"function keyed_load2(x, key) { void 0; return x[key]; }"
|
18064
|
+
|
18065
|
+
"obj.y = void 0;"
|
18066
|
+
"obj.__proto__ = null;"
|
18067
|
+
"var subobj = {};"
|
18068
|
+
"subobj.y = void 0;"
|
18069
|
+
"subobj.__proto__ = obj;"
|
18070
|
+
"%OptimizeObjectForAddingMultipleProperties(obj, 1);"
|
18071
|
+
|
18072
|
+
// Make the ICs monomorphic.
|
18073
|
+
"load(obj); load(obj);"
|
18074
|
+
"load2(subobj); load2(subobj);"
|
18075
|
+
"store(obj); store(obj);"
|
18076
|
+
"store2(subobj); store2(subobj);"
|
18077
|
+
"keyed_load(obj, 'foo'); keyed_load(obj, 'foo');"
|
18078
|
+
"keyed_load2(subobj, 'foo'); keyed_load2(subobj, 'foo');"
|
18079
|
+
|
18080
|
+
// Actually test the shiny new ICs and better not crash. This
|
18081
|
+
// serves as a regression test for issue 142088 as well.
|
18082
|
+
"load(obj);"
|
18083
|
+
"load2(subobj);"
|
18084
|
+
"store(obj);"
|
18085
|
+
"store2(subobj);"
|
18086
|
+
"keyed_load(obj, 'foo');"
|
18087
|
+
"keyed_load2(subobj, 'foo');"
|
18088
|
+
|
18089
|
+
// Delete the accessor. It better not be called any more now.
|
18090
|
+
"delete obj.foo;"
|
18091
|
+
"obj.y = void 0;"
|
18092
|
+
"subobj.y = void 0;"
|
18093
|
+
|
18094
|
+
"var load_result = load(obj);"
|
18095
|
+
"var load_result2 = load2(subobj);"
|
18096
|
+
"var keyed_load_result = keyed_load(obj, 'foo');"
|
18097
|
+
"var keyed_load_result2 = keyed_load2(subobj, 'foo');"
|
18098
|
+
"store(obj);"
|
18099
|
+
"store2(subobj);"
|
18100
|
+
"var y_from_obj = obj.y;"
|
18101
|
+
"var y_from_subobj = subobj.y;");
|
18102
|
+
CHECK(context->Global()->Get(v8_str("load_result"))->IsUndefined());
|
18103
|
+
CHECK(context->Global()->Get(v8_str("load_result2"))->IsUndefined());
|
18104
|
+
CHECK(context->Global()->Get(v8_str("keyed_load_result"))->IsUndefined());
|
18105
|
+
CHECK(context->Global()->Get(v8_str("keyed_load_result2"))->IsUndefined());
|
18106
|
+
CHECK(context->Global()->Get(v8_str("y_from_obj"))->IsUndefined());
|
18107
|
+
CHECK(context->Global()->Get(v8_str("y_from_subobj"))->IsUndefined());
|
18108
|
+
}
|
18109
|
+
|
18110
|
+
|
18111
|
+
THREADED_TEST(Regress142088) {
|
18112
|
+
i::FLAG_allow_natives_syntax = true;
|
18113
|
+
v8::HandleScope scope;
|
18114
|
+
LocalContext context;
|
18115
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
18116
|
+
templ->SetAccessor(v8_str("foo"),
|
18117
|
+
GetterWhichReturns42,
|
18118
|
+
SetterWhichSetsYOnThisTo23);
|
18119
|
+
context->Global()->Set(v8_str("obj"), templ->NewInstance());
|
18120
|
+
|
18121
|
+
CompileRun("function load(x) { return x.foo; }"
|
18122
|
+
"var o = Object.create(obj);"
|
18123
|
+
"%OptimizeObjectForAddingMultipleProperties(obj, 1);"
|
18124
|
+
"load(o); load(o); load(o); load(o);");
|
18125
|
+
}
|
18126
|
+
|
18127
|
+
|
18128
|
+
THREADED_TEST(Regress137496) {
|
18129
|
+
i::FLAG_expose_gc = true;
|
18130
|
+
v8::HandleScope scope;
|
18131
|
+
LocalContext context;
|
18132
|
+
|
18133
|
+
// Compile a try-finally clause where the finally block causes a GC
|
18134
|
+
// while there still is a message pending for external reporting.
|
18135
|
+
TryCatch try_catch;
|
18136
|
+
try_catch.SetVerbose(true);
|
18137
|
+
CompileRun("try { throw new Error(); } finally { gc(); }");
|
18138
|
+
CHECK(try_catch.HasCaught());
|
18139
|
+
}
|
18140
|
+
|
18141
|
+
|
18142
|
+
THREADED_TEST(Regress149912) {
|
18143
|
+
v8::HandleScope scope;
|
18144
|
+
LocalContext context;
|
18145
|
+
Handle<FunctionTemplate> templ = FunctionTemplate::New();
|
18146
|
+
AddInterceptor(templ, EmptyInterceptorGetter, EmptyInterceptorSetter);
|
18147
|
+
context->Global()->Set(v8_str("Bug"), templ->GetFunction());
|
18148
|
+
CompileRun("Number.prototype.__proto__ = new Bug; var x = 0; x.foo();");
|
18149
|
+
}
|
18150
|
+
|
18151
|
+
|
18152
|
+
THREADED_TEST(Regress157124) {
|
18153
|
+
v8::HandleScope scope;
|
18154
|
+
LocalContext context;
|
18155
|
+
Local<ObjectTemplate> templ = ObjectTemplate::New();
|
18156
|
+
Local<Object> obj = templ->NewInstance();
|
18157
|
+
obj->GetIdentityHash();
|
18158
|
+
obj->DeleteHiddenValue(v8_str("Bug"));
|
18159
|
+
}
|
18160
|
+
|
18161
|
+
|
18162
|
+
#ifndef WIN32
|
18163
|
+
class ThreadInterruptTest {
|
18164
|
+
public:
|
18165
|
+
ThreadInterruptTest() : sem_(NULL), sem_value_(0) { }
|
18166
|
+
~ThreadInterruptTest() { delete sem_; }
|
18167
|
+
|
18168
|
+
void RunTest() {
|
18169
|
+
sem_ = i::OS::CreateSemaphore(0);
|
18170
|
+
|
18171
|
+
InterruptThread i_thread(this);
|
18172
|
+
i_thread.Start();
|
18173
|
+
|
18174
|
+
sem_->Wait();
|
18175
|
+
CHECK_EQ(kExpectedValue, sem_value_);
|
18176
|
+
}
|
18177
|
+
|
18178
|
+
private:
|
18179
|
+
static const int kExpectedValue = 1;
|
18180
|
+
|
18181
|
+
class InterruptThread : public i::Thread {
|
18182
|
+
public:
|
18183
|
+
explicit InterruptThread(ThreadInterruptTest* test)
|
18184
|
+
: Thread("InterruptThread"), test_(test) {}
|
18185
|
+
|
18186
|
+
virtual void Run() {
|
18187
|
+
struct sigaction action;
|
18188
|
+
|
18189
|
+
// Ensure that we'll enter waiting condition
|
18190
|
+
i::OS::Sleep(100);
|
18191
|
+
|
18192
|
+
// Setup signal handler
|
18193
|
+
memset(&action, 0, sizeof(action));
|
18194
|
+
action.sa_handler = SignalHandler;
|
18195
|
+
sigaction(SIGCHLD, &action, NULL);
|
18196
|
+
|
18197
|
+
// Send signal
|
18198
|
+
kill(getpid(), SIGCHLD);
|
18199
|
+
|
18200
|
+
// Ensure that if wait has returned because of error
|
18201
|
+
i::OS::Sleep(100);
|
18202
|
+
|
18203
|
+
// Set value and signal semaphore
|
18204
|
+
test_->sem_value_ = 1;
|
18205
|
+
test_->sem_->Signal();
|
18206
|
+
}
|
18207
|
+
|
18208
|
+
static void SignalHandler(int signal) {
|
18209
|
+
}
|
18210
|
+
|
18211
|
+
private:
|
18212
|
+
ThreadInterruptTest* test_;
|
18213
|
+
};
|
18214
|
+
|
18215
|
+
i::Semaphore* sem_;
|
18216
|
+
volatile int sem_value_;
|
18217
|
+
};
|
18218
|
+
|
18219
|
+
|
18220
|
+
THREADED_TEST(SemaphoreInterruption) {
|
18221
|
+
ThreadInterruptTest().RunTest();
|
18222
|
+
}
|
18223
|
+
|
18224
|
+
#endif // WIN32
|