libv8-sgonyea 3.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/README.md +76 -0
- data/Rakefile +113 -0
- data/ext/libv8/extconf.rb +28 -0
- data/lib/libv8.rb +15 -0
- data/lib/libv8/Makefile +30 -0
- data/lib/libv8/detect_cpu.rb +27 -0
- data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
- data/lib/libv8/v8/.gitignore +35 -0
- data/lib/libv8/v8/AUTHORS +44 -0
- data/lib/libv8/v8/ChangeLog +2839 -0
- data/lib/libv8/v8/LICENSE +52 -0
- data/lib/libv8/v8/LICENSE.strongtalk +29 -0
- data/lib/libv8/v8/LICENSE.v8 +26 -0
- data/lib/libv8/v8/LICENSE.valgrind +45 -0
- data/lib/libv8/v8/SConstruct +1478 -0
- data/lib/libv8/v8/build/README.txt +49 -0
- data/lib/libv8/v8/build/all.gyp +18 -0
- data/lib/libv8/v8/build/armu.gypi +32 -0
- data/lib/libv8/v8/build/common.gypi +144 -0
- data/lib/libv8/v8/build/gyp_v8 +145 -0
- data/lib/libv8/v8/include/v8-debug.h +395 -0
- data/lib/libv8/v8/include/v8-preparser.h +117 -0
- data/lib/libv8/v8/include/v8-profiler.h +505 -0
- data/lib/libv8/v8/include/v8-testing.h +104 -0
- data/lib/libv8/v8/include/v8.h +4124 -0
- data/lib/libv8/v8/include/v8stdint.h +53 -0
- data/lib/libv8/v8/preparser/SConscript +38 -0
- data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
- data/lib/libv8/v8/src/SConscript +368 -0
- data/lib/libv8/v8/src/accessors.cc +767 -0
- data/lib/libv8/v8/src/accessors.h +123 -0
- data/lib/libv8/v8/src/allocation-inl.h +49 -0
- data/lib/libv8/v8/src/allocation.cc +122 -0
- data/lib/libv8/v8/src/allocation.h +143 -0
- data/lib/libv8/v8/src/api.cc +5845 -0
- data/lib/libv8/v8/src/api.h +574 -0
- data/lib/libv8/v8/src/apinatives.js +110 -0
- data/lib/libv8/v8/src/apiutils.h +73 -0
- data/lib/libv8/v8/src/arguments.h +118 -0
- data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
- data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
- data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
- data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
- data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
- data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
- data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
- data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
- data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
- data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
- data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
- data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
- data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
- data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
- data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
- data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
- data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
- data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
- data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
- data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
- data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
- data/lib/libv8/v8/src/array.js +1366 -0
- data/lib/libv8/v8/src/assembler.cc +1207 -0
- data/lib/libv8/v8/src/assembler.h +858 -0
- data/lib/libv8/v8/src/ast-inl.h +112 -0
- data/lib/libv8/v8/src/ast.cc +1146 -0
- data/lib/libv8/v8/src/ast.h +2188 -0
- data/lib/libv8/v8/src/atomicops.h +167 -0
- data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
- data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
- data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
- data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
- data/lib/libv8/v8/src/bignum.cc +768 -0
- data/lib/libv8/v8/src/bignum.h +140 -0
- data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
- data/lib/libv8/v8/src/bootstrapper.h +188 -0
- data/lib/libv8/v8/src/builtins.cc +1707 -0
- data/lib/libv8/v8/src/builtins.h +371 -0
- data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
- data/lib/libv8/v8/src/cached-powers.cc +177 -0
- data/lib/libv8/v8/src/cached-powers.h +65 -0
- data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
- data/lib/libv8/v8/src/char-predicates.h +67 -0
- data/lib/libv8/v8/src/checks.cc +110 -0
- data/lib/libv8/v8/src/checks.h +296 -0
- data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
- data/lib/libv8/v8/src/circular-queue.cc +122 -0
- data/lib/libv8/v8/src/circular-queue.h +103 -0
- data/lib/libv8/v8/src/code-stubs.cc +267 -0
- data/lib/libv8/v8/src/code-stubs.h +1011 -0
- data/lib/libv8/v8/src/code.h +70 -0
- data/lib/libv8/v8/src/codegen.cc +231 -0
- data/lib/libv8/v8/src/codegen.h +84 -0
- data/lib/libv8/v8/src/compilation-cache.cc +540 -0
- data/lib/libv8/v8/src/compilation-cache.h +287 -0
- data/lib/libv8/v8/src/compiler.cc +786 -0
- data/lib/libv8/v8/src/compiler.h +312 -0
- data/lib/libv8/v8/src/contexts.cc +347 -0
- data/lib/libv8/v8/src/contexts.h +391 -0
- data/lib/libv8/v8/src/conversions-inl.h +106 -0
- data/lib/libv8/v8/src/conversions.cc +1131 -0
- data/lib/libv8/v8/src/conversions.h +135 -0
- data/lib/libv8/v8/src/counters.cc +93 -0
- data/lib/libv8/v8/src/counters.h +254 -0
- data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
- data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
- data/lib/libv8/v8/src/cpu-profiler.h +302 -0
- data/lib/libv8/v8/src/cpu.h +69 -0
- data/lib/libv8/v8/src/d8-debug.cc +367 -0
- data/lib/libv8/v8/src/d8-debug.h +158 -0
- data/lib/libv8/v8/src/d8-posix.cc +695 -0
- data/lib/libv8/v8/src/d8-readline.cc +130 -0
- data/lib/libv8/v8/src/d8-windows.cc +42 -0
- data/lib/libv8/v8/src/d8.cc +803 -0
- data/lib/libv8/v8/src/d8.gyp +91 -0
- data/lib/libv8/v8/src/d8.h +235 -0
- data/lib/libv8/v8/src/d8.js +2798 -0
- data/lib/libv8/v8/src/data-flow.cc +66 -0
- data/lib/libv8/v8/src/data-flow.h +205 -0
- data/lib/libv8/v8/src/date.js +1103 -0
- data/lib/libv8/v8/src/dateparser-inl.h +127 -0
- data/lib/libv8/v8/src/dateparser.cc +178 -0
- data/lib/libv8/v8/src/dateparser.h +266 -0
- data/lib/libv8/v8/src/debug-agent.cc +447 -0
- data/lib/libv8/v8/src/debug-agent.h +129 -0
- data/lib/libv8/v8/src/debug-debugger.js +2569 -0
- data/lib/libv8/v8/src/debug.cc +3165 -0
- data/lib/libv8/v8/src/debug.h +1057 -0
- data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
- data/lib/libv8/v8/src/deoptimizer.h +602 -0
- data/lib/libv8/v8/src/disasm.h +80 -0
- data/lib/libv8/v8/src/disassembler.cc +343 -0
- data/lib/libv8/v8/src/disassembler.h +58 -0
- data/lib/libv8/v8/src/diy-fp.cc +58 -0
- data/lib/libv8/v8/src/diy-fp.h +117 -0
- data/lib/libv8/v8/src/double.h +238 -0
- data/lib/libv8/v8/src/dtoa.cc +103 -0
- data/lib/libv8/v8/src/dtoa.h +85 -0
- data/lib/libv8/v8/src/execution.cc +849 -0
- data/lib/libv8/v8/src/execution.h +297 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
- data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
- data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
- data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
- data/lib/libv8/v8/src/factory.cc +1222 -0
- data/lib/libv8/v8/src/factory.h +442 -0
- data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
- data/lib/libv8/v8/src/fast-dtoa.h +83 -0
- data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
- data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
- data/lib/libv8/v8/src/flag-definitions.h +560 -0
- data/lib/libv8/v8/src/flags.cc +551 -0
- data/lib/libv8/v8/src/flags.h +79 -0
- data/lib/libv8/v8/src/frames-inl.h +247 -0
- data/lib/libv8/v8/src/frames.cc +1243 -0
- data/lib/libv8/v8/src/frames.h +870 -0
- data/lib/libv8/v8/src/full-codegen.cc +1374 -0
- data/lib/libv8/v8/src/full-codegen.h +771 -0
- data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
- data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
- data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
- data/lib/libv8/v8/src/gdb-jit.h +143 -0
- data/lib/libv8/v8/src/global-handles.cc +665 -0
- data/lib/libv8/v8/src/global-handles.h +284 -0
- data/lib/libv8/v8/src/globals.h +325 -0
- data/lib/libv8/v8/src/handles-inl.h +177 -0
- data/lib/libv8/v8/src/handles.cc +987 -0
- data/lib/libv8/v8/src/handles.h +382 -0
- data/lib/libv8/v8/src/hashmap.cc +230 -0
- data/lib/libv8/v8/src/hashmap.h +123 -0
- data/lib/libv8/v8/src/heap-inl.h +704 -0
- data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
- data/lib/libv8/v8/src/heap-profiler.h +397 -0
- data/lib/libv8/v8/src/heap.cc +5930 -0
- data/lib/libv8/v8/src/heap.h +2268 -0
- data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
- data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
- data/lib/libv8/v8/src/hydrogen.cc +6239 -0
- data/lib/libv8/v8/src/hydrogen.h +1202 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
- data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
- data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
- data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
- data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
- data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
- data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
- data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
- data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
- data/lib/libv8/v8/src/ic-inl.h +130 -0
- data/lib/libv8/v8/src/ic.cc +2577 -0
- data/lib/libv8/v8/src/ic.h +736 -0
- data/lib/libv8/v8/src/inspector.cc +63 -0
- data/lib/libv8/v8/src/inspector.h +62 -0
- data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
- data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
- data/lib/libv8/v8/src/isolate-inl.h +50 -0
- data/lib/libv8/v8/src/isolate.cc +1869 -0
- data/lib/libv8/v8/src/isolate.h +1382 -0
- data/lib/libv8/v8/src/json-parser.cc +504 -0
- data/lib/libv8/v8/src/json-parser.h +161 -0
- data/lib/libv8/v8/src/json.js +342 -0
- data/lib/libv8/v8/src/jsregexp.cc +5385 -0
- data/lib/libv8/v8/src/jsregexp.h +1492 -0
- data/lib/libv8/v8/src/list-inl.h +212 -0
- data/lib/libv8/v8/src/list.h +174 -0
- data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
- data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
- data/lib/libv8/v8/src/lithium-allocator.h +630 -0
- data/lib/libv8/v8/src/lithium.cc +190 -0
- data/lib/libv8/v8/src/lithium.h +597 -0
- data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
- data/lib/libv8/v8/src/liveedit.cc +1691 -0
- data/lib/libv8/v8/src/liveedit.h +180 -0
- data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
- data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
- data/lib/libv8/v8/src/liveobjectlist.h +322 -0
- data/lib/libv8/v8/src/log-inl.h +59 -0
- data/lib/libv8/v8/src/log-utils.cc +428 -0
- data/lib/libv8/v8/src/log-utils.h +231 -0
- data/lib/libv8/v8/src/log.cc +1993 -0
- data/lib/libv8/v8/src/log.h +476 -0
- data/lib/libv8/v8/src/macro-assembler.h +120 -0
- data/lib/libv8/v8/src/macros.py +178 -0
- data/lib/libv8/v8/src/mark-compact.cc +3143 -0
- data/lib/libv8/v8/src/mark-compact.h +506 -0
- data/lib/libv8/v8/src/math.js +264 -0
- data/lib/libv8/v8/src/messages.cc +179 -0
- data/lib/libv8/v8/src/messages.h +113 -0
- data/lib/libv8/v8/src/messages.js +1096 -0
- data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
- data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
- data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
- data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
- data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
- data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
- data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
- data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
- data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
- data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
- data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
- data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
- data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
- data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
- data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
- data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
- data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
- data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
- data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
- data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
- data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
- data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
- data/lib/libv8/v8/src/mksnapshot.cc +328 -0
- data/lib/libv8/v8/src/natives.h +64 -0
- data/lib/libv8/v8/src/objects-debug.cc +738 -0
- data/lib/libv8/v8/src/objects-inl.h +4323 -0
- data/lib/libv8/v8/src/objects-printer.cc +829 -0
- data/lib/libv8/v8/src/objects-visiting.cc +148 -0
- data/lib/libv8/v8/src/objects-visiting.h +424 -0
- data/lib/libv8/v8/src/objects.cc +10585 -0
- data/lib/libv8/v8/src/objects.h +6838 -0
- data/lib/libv8/v8/src/parser.cc +4997 -0
- data/lib/libv8/v8/src/parser.h +765 -0
- data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
- data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
- data/lib/libv8/v8/src/platform-linux.cc +1149 -0
- data/lib/libv8/v8/src/platform-macos.cc +830 -0
- data/lib/libv8/v8/src/platform-nullos.cc +479 -0
- data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
- data/lib/libv8/v8/src/platform-posix.cc +424 -0
- data/lib/libv8/v8/src/platform-solaris.cc +762 -0
- data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
- data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
- data/lib/libv8/v8/src/platform-tls.h +50 -0
- data/lib/libv8/v8/src/platform-win32.cc +2021 -0
- data/lib/libv8/v8/src/platform.h +667 -0
- data/lib/libv8/v8/src/preparse-data-format.h +62 -0
- data/lib/libv8/v8/src/preparse-data.cc +183 -0
- data/lib/libv8/v8/src/preparse-data.h +225 -0
- data/lib/libv8/v8/src/preparser-api.cc +220 -0
- data/lib/libv8/v8/src/preparser.cc +1450 -0
- data/lib/libv8/v8/src/preparser.h +493 -0
- data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
- data/lib/libv8/v8/src/prettyprinter.h +223 -0
- data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
- data/lib/libv8/v8/src/profile-generator.cc +3098 -0
- data/lib/libv8/v8/src/profile-generator.h +1126 -0
- data/lib/libv8/v8/src/property.cc +105 -0
- data/lib/libv8/v8/src/property.h +365 -0
- data/lib/libv8/v8/src/proxy.js +83 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
- data/lib/libv8/v8/src/regexp-stack.cc +111 -0
- data/lib/libv8/v8/src/regexp-stack.h +147 -0
- data/lib/libv8/v8/src/regexp.js +483 -0
- data/lib/libv8/v8/src/rewriter.cc +360 -0
- data/lib/libv8/v8/src/rewriter.h +50 -0
- data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
- data/lib/libv8/v8/src/runtime-profiler.h +201 -0
- data/lib/libv8/v8/src/runtime.cc +12227 -0
- data/lib/libv8/v8/src/runtime.h +652 -0
- data/lib/libv8/v8/src/runtime.js +649 -0
- data/lib/libv8/v8/src/safepoint-table.cc +256 -0
- data/lib/libv8/v8/src/safepoint-table.h +270 -0
- data/lib/libv8/v8/src/scanner-base.cc +952 -0
- data/lib/libv8/v8/src/scanner-base.h +670 -0
- data/lib/libv8/v8/src/scanner.cc +345 -0
- data/lib/libv8/v8/src/scanner.h +146 -0
- data/lib/libv8/v8/src/scopeinfo.cc +646 -0
- data/lib/libv8/v8/src/scopeinfo.h +254 -0
- data/lib/libv8/v8/src/scopes.cc +1150 -0
- data/lib/libv8/v8/src/scopes.h +507 -0
- data/lib/libv8/v8/src/serialize.cc +1574 -0
- data/lib/libv8/v8/src/serialize.h +589 -0
- data/lib/libv8/v8/src/shell.h +55 -0
- data/lib/libv8/v8/src/simulator.h +43 -0
- data/lib/libv8/v8/src/small-pointer-list.h +163 -0
- data/lib/libv8/v8/src/smart-pointer.h +109 -0
- data/lib/libv8/v8/src/snapshot-common.cc +83 -0
- data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
- data/lib/libv8/v8/src/snapshot.h +91 -0
- data/lib/libv8/v8/src/spaces-inl.h +529 -0
- data/lib/libv8/v8/src/spaces.cc +3145 -0
- data/lib/libv8/v8/src/spaces.h +2369 -0
- data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
- data/lib/libv8/v8/src/splay-tree.h +205 -0
- data/lib/libv8/v8/src/string-search.cc +41 -0
- data/lib/libv8/v8/src/string-search.h +568 -0
- data/lib/libv8/v8/src/string-stream.cc +592 -0
- data/lib/libv8/v8/src/string-stream.h +191 -0
- data/lib/libv8/v8/src/string.js +994 -0
- data/lib/libv8/v8/src/strtod.cc +440 -0
- data/lib/libv8/v8/src/strtod.h +40 -0
- data/lib/libv8/v8/src/stub-cache.cc +1965 -0
- data/lib/libv8/v8/src/stub-cache.h +924 -0
- data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
- data/lib/libv8/v8/src/token.cc +63 -0
- data/lib/libv8/v8/src/token.h +288 -0
- data/lib/libv8/v8/src/type-info.cc +507 -0
- data/lib/libv8/v8/src/type-info.h +272 -0
- data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
- data/lib/libv8/v8/src/unbound-queue.h +69 -0
- data/lib/libv8/v8/src/unicode-inl.h +238 -0
- data/lib/libv8/v8/src/unicode.cc +1624 -0
- data/lib/libv8/v8/src/unicode.h +280 -0
- data/lib/libv8/v8/src/uri.js +408 -0
- data/lib/libv8/v8/src/utils-inl.h +48 -0
- data/lib/libv8/v8/src/utils.cc +371 -0
- data/lib/libv8/v8/src/utils.h +800 -0
- data/lib/libv8/v8/src/v8-counters.cc +62 -0
- data/lib/libv8/v8/src/v8-counters.h +314 -0
- data/lib/libv8/v8/src/v8.cc +213 -0
- data/lib/libv8/v8/src/v8.h +131 -0
- data/lib/libv8/v8/src/v8checks.h +64 -0
- data/lib/libv8/v8/src/v8dll-main.cc +44 -0
- data/lib/libv8/v8/src/v8globals.h +512 -0
- data/lib/libv8/v8/src/v8memory.h +82 -0
- data/lib/libv8/v8/src/v8natives.js +1310 -0
- data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
- data/lib/libv8/v8/src/v8threads.cc +464 -0
- data/lib/libv8/v8/src/v8threads.h +165 -0
- data/lib/libv8/v8/src/v8utils.h +319 -0
- data/lib/libv8/v8/src/variables.cc +114 -0
- data/lib/libv8/v8/src/variables.h +167 -0
- data/lib/libv8/v8/src/version.cc +116 -0
- data/lib/libv8/v8/src/version.h +68 -0
- data/lib/libv8/v8/src/vm-state-inl.h +138 -0
- data/lib/libv8/v8/src/vm-state.h +71 -0
- data/lib/libv8/v8/src/win32-headers.h +96 -0
- data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
- data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
- data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
- data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
- data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
- data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
- data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
- data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
- data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
- data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
- data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
- data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
- data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
- data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
- data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
- data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
- data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
- data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
- data/lib/libv8/v8/src/zone-inl.h +140 -0
- data/lib/libv8/v8/src/zone.cc +196 -0
- data/lib/libv8/v8/src/zone.h +240 -0
- data/lib/libv8/v8/tools/codemap.js +265 -0
- data/lib/libv8/v8/tools/consarray.js +93 -0
- data/lib/libv8/v8/tools/csvparser.js +78 -0
- data/lib/libv8/v8/tools/disasm.py +92 -0
- data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
- data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
- data/lib/libv8/v8/tools/gcmole/README +62 -0
- data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
- data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
- data/lib/libv8/v8/tools/grokdump.py +841 -0
- data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
- data/lib/libv8/v8/tools/js2c.py +364 -0
- data/lib/libv8/v8/tools/jsmin.py +280 -0
- data/lib/libv8/v8/tools/linux-tick-processor +35 -0
- data/lib/libv8/v8/tools/ll_prof.py +942 -0
- data/lib/libv8/v8/tools/logreader.js +185 -0
- data/lib/libv8/v8/tools/mac-nm +18 -0
- data/lib/libv8/v8/tools/mac-tick-processor +6 -0
- data/lib/libv8/v8/tools/oom_dump/README +31 -0
- data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
- data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
- data/lib/libv8/v8/tools/presubmit.py +305 -0
- data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
- data/lib/libv8/v8/tools/profile.js +751 -0
- data/lib/libv8/v8/tools/profile_view.js +219 -0
- data/lib/libv8/v8/tools/run-valgrind.py +77 -0
- data/lib/libv8/v8/tools/splaytree.js +316 -0
- data/lib/libv8/v8/tools/stats-viewer.py +468 -0
- data/lib/libv8/v8/tools/test.py +1510 -0
- data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
- data/lib/libv8/v8/tools/tickprocessor.js +877 -0
- data/lib/libv8/v8/tools/utils.py +96 -0
- data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
- data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
- data/lib/libv8/version.rb +5 -0
- data/libv8.gemspec +36 -0
- metadata +578 -0
@@ -0,0 +1,1382 @@
|
|
1
|
+
// Copyright 2011 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#ifndef V8_ISOLATE_H_
|
29
|
+
#define V8_ISOLATE_H_
|
30
|
+
|
31
|
+
#include "../include/v8-debug.h"
|
32
|
+
#include "allocation.h"
|
33
|
+
#include "apiutils.h"
|
34
|
+
#include "atomicops.h"
|
35
|
+
#include "builtins.h"
|
36
|
+
#include "contexts.h"
|
37
|
+
#include "execution.h"
|
38
|
+
#include "frames.h"
|
39
|
+
#include "global-handles.h"
|
40
|
+
#include "handles.h"
|
41
|
+
#include "heap.h"
|
42
|
+
#include "regexp-stack.h"
|
43
|
+
#include "runtime-profiler.h"
|
44
|
+
#include "runtime.h"
|
45
|
+
#include "zone.h"
|
46
|
+
|
47
|
+
namespace v8 {
|
48
|
+
namespace internal {
|
49
|
+
|
50
|
+
class AstSentinels;
|
51
|
+
class Bootstrapper;
|
52
|
+
class CodeGenerator;
|
53
|
+
class CodeRange;
|
54
|
+
class CompilationCache;
|
55
|
+
class ContextSlotCache;
|
56
|
+
class ContextSwitcher;
|
57
|
+
class Counters;
|
58
|
+
class CpuFeatures;
|
59
|
+
class CpuProfiler;
|
60
|
+
class DeoptimizerData;
|
61
|
+
class Deserializer;
|
62
|
+
class EmptyStatement;
|
63
|
+
class ExternalReferenceTable;
|
64
|
+
class Factory;
|
65
|
+
class FunctionInfoListener;
|
66
|
+
class HandleScopeImplementer;
|
67
|
+
class HeapProfiler;
|
68
|
+
class InlineRuntimeFunctionsTable;
|
69
|
+
class NoAllocationStringAllocator;
|
70
|
+
class PcToCodeCache;
|
71
|
+
class PreallocatedMemoryThread;
|
72
|
+
class ProducerHeapProfile;
|
73
|
+
class RegExpStack;
|
74
|
+
class SaveContext;
|
75
|
+
class UnicodeCache;
|
76
|
+
class StringInputBuffer;
|
77
|
+
class StringTracker;
|
78
|
+
class StubCache;
|
79
|
+
class ThreadManager;
|
80
|
+
class ThreadState;
|
81
|
+
class ThreadVisitor; // Defined in v8threads.h
|
82
|
+
class VMState;
|
83
|
+
|
84
|
+
// 'void function pointer', used to roundtrip the
|
85
|
+
// ExternalReference::ExternalReferenceRedirector since we can not include
|
86
|
+
// assembler.h, where it is defined, here.
|
87
|
+
typedef void* ExternalReferenceRedirectorPointer();
|
88
|
+
|
89
|
+
|
90
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
91
|
+
class Debug;
|
92
|
+
class Debugger;
|
93
|
+
class DebuggerAgent;
|
94
|
+
#endif
|
95
|
+
|
96
|
+
#if !defined(__arm__) && defined(V8_TARGET_ARCH_ARM) || \
|
97
|
+
!defined(__mips__) && defined(V8_TARGET_ARCH_MIPS)
|
98
|
+
class Redirection;
|
99
|
+
class Simulator;
|
100
|
+
#endif
|
101
|
+
|
102
|
+
|
103
|
+
// Static indirection table for handles to constants. If a frame
|
104
|
+
// element represents a constant, the data contains an index into
|
105
|
+
// this table of handles to the actual constants.
|
106
|
+
// Static indirection table for handles to constants. If a Result
|
107
|
+
// represents a constant, the data contains an index into this table
|
108
|
+
// of handles to the actual constants.
|
109
|
+
typedef ZoneList<Handle<Object> > ZoneObjectList;
|
110
|
+
|
111
|
+
#define RETURN_IF_SCHEDULED_EXCEPTION(isolate) \
|
112
|
+
if (isolate->has_scheduled_exception()) \
|
113
|
+
return isolate->PromoteScheduledException()
|
114
|
+
|
115
|
+
#define RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, value) \
|
116
|
+
if (call.is_null()) { \
|
117
|
+
ASSERT(isolate->has_pending_exception()); \
|
118
|
+
return value; \
|
119
|
+
}
|
120
|
+
|
121
|
+
#define RETURN_IF_EMPTY_HANDLE(isolate, call) \
|
122
|
+
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, call, Failure::Exception())
|
123
|
+
|
124
|
+
#define ISOLATE_ADDRESS_LIST(C) \
|
125
|
+
C(handler_address) \
|
126
|
+
C(c_entry_fp_address) \
|
127
|
+
C(context_address) \
|
128
|
+
C(pending_exception_address) \
|
129
|
+
C(external_caught_exception_address)
|
130
|
+
|
131
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
132
|
+
#define ISOLATE_ADDRESS_LIST_PROF(C) \
|
133
|
+
C(js_entry_sp_address)
|
134
|
+
#else
|
135
|
+
#define ISOLATE_ADDRESS_LIST_PROF(C)
|
136
|
+
#endif
|
137
|
+
|
138
|
+
|
139
|
+
// Platform-independent, reliable thread identifier.
|
140
|
+
class ThreadId {
|
141
|
+
public:
|
142
|
+
// Creates an invalid ThreadId.
|
143
|
+
ThreadId() : id_(kInvalidId) {}
|
144
|
+
|
145
|
+
// Returns ThreadId for current thread.
|
146
|
+
static ThreadId Current() { return ThreadId(GetCurrentThreadId()); }
|
147
|
+
|
148
|
+
// Returns invalid ThreadId (guaranteed not to be equal to any thread).
|
149
|
+
static ThreadId Invalid() { return ThreadId(kInvalidId); }
|
150
|
+
|
151
|
+
// Compares ThreadIds for equality.
|
152
|
+
INLINE(bool Equals(const ThreadId& other) const) {
|
153
|
+
return id_ == other.id_;
|
154
|
+
}
|
155
|
+
|
156
|
+
// Checks whether this ThreadId refers to any thread.
|
157
|
+
INLINE(bool IsValid() const) {
|
158
|
+
return id_ != kInvalidId;
|
159
|
+
}
|
160
|
+
|
161
|
+
// Converts ThreadId to an integer representation
|
162
|
+
// (required for public API: V8::V8::GetCurrentThreadId).
|
163
|
+
int ToInteger() const { return id_; }
|
164
|
+
|
165
|
+
// Converts ThreadId to an integer representation
|
166
|
+
// (required for public API: V8::V8::TerminateExecution).
|
167
|
+
static ThreadId FromInteger(int id) { return ThreadId(id); }
|
168
|
+
|
169
|
+
private:
|
170
|
+
static const int kInvalidId = -1;
|
171
|
+
|
172
|
+
explicit ThreadId(int id) : id_(id) {}
|
173
|
+
|
174
|
+
static int AllocateThreadId();
|
175
|
+
|
176
|
+
static int GetCurrentThreadId();
|
177
|
+
|
178
|
+
int id_;
|
179
|
+
|
180
|
+
static Atomic32 highest_thread_id_;
|
181
|
+
|
182
|
+
friend class Isolate;
|
183
|
+
};
|
184
|
+
|
185
|
+
|
186
|
+
class ThreadLocalTop BASE_EMBEDDED {
|
187
|
+
public:
|
188
|
+
// Does early low-level initialization that does not depend on the
|
189
|
+
// isolate being present.
|
190
|
+
ThreadLocalTop();
|
191
|
+
|
192
|
+
// Initialize the thread data.
|
193
|
+
void Initialize();
|
194
|
+
|
195
|
+
// Get the top C++ try catch handler or NULL if none are registered.
|
196
|
+
//
|
197
|
+
// This method is not guarenteed to return an address that can be
|
198
|
+
// used for comparison with addresses into the JS stack. If such an
|
199
|
+
// address is needed, use try_catch_handler_address.
|
200
|
+
v8::TryCatch* TryCatchHandler();
|
201
|
+
|
202
|
+
// Get the address of the top C++ try catch handler or NULL if
|
203
|
+
// none are registered.
|
204
|
+
//
|
205
|
+
// This method always returns an address that can be compared to
|
206
|
+
// pointers into the JavaScript stack. When running on actual
|
207
|
+
// hardware, try_catch_handler_address and TryCatchHandler return
|
208
|
+
// the same pointer. When running on a simulator with a separate JS
|
209
|
+
// stack, try_catch_handler_address returns a JS stack address that
|
210
|
+
// corresponds to the place on the JS stack where the C++ handler
|
211
|
+
// would have been if the stack were not separate.
|
212
|
+
inline Address try_catch_handler_address() {
|
213
|
+
return try_catch_handler_address_;
|
214
|
+
}
|
215
|
+
|
216
|
+
// Set the address of the top C++ try catch handler.
|
217
|
+
inline void set_try_catch_handler_address(Address address) {
|
218
|
+
try_catch_handler_address_ = address;
|
219
|
+
}
|
220
|
+
|
221
|
+
void Free() {
|
222
|
+
ASSERT(!has_pending_message_);
|
223
|
+
ASSERT(!external_caught_exception_);
|
224
|
+
ASSERT(try_catch_handler_address_ == NULL);
|
225
|
+
}
|
226
|
+
|
227
|
+
Isolate* isolate_;
|
228
|
+
// The context where the current execution method is created and for variable
|
229
|
+
// lookups.
|
230
|
+
Context* context_;
|
231
|
+
ThreadId thread_id_;
|
232
|
+
MaybeObject* pending_exception_;
|
233
|
+
bool has_pending_message_;
|
234
|
+
Object* pending_message_obj_;
|
235
|
+
Script* pending_message_script_;
|
236
|
+
int pending_message_start_pos_;
|
237
|
+
int pending_message_end_pos_;
|
238
|
+
// Use a separate value for scheduled exceptions to preserve the
|
239
|
+
// invariants that hold about pending_exception. We may want to
|
240
|
+
// unify them later.
|
241
|
+
MaybeObject* scheduled_exception_;
|
242
|
+
bool external_caught_exception_;
|
243
|
+
SaveContext* save_context_;
|
244
|
+
v8::TryCatch* catcher_;
|
245
|
+
|
246
|
+
// Stack.
|
247
|
+
Address c_entry_fp_; // the frame pointer of the top c entry frame
|
248
|
+
Address handler_; // try-blocks are chained through the stack
|
249
|
+
|
250
|
+
#ifdef USE_SIMULATOR
|
251
|
+
#if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
|
252
|
+
Simulator* simulator_;
|
253
|
+
#endif
|
254
|
+
#endif // USE_SIMULATOR
|
255
|
+
|
256
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
257
|
+
Address js_entry_sp_; // the stack pointer of the bottom js entry frame
|
258
|
+
Address external_callback_; // the external callback we're currently in
|
259
|
+
#endif
|
260
|
+
|
261
|
+
#ifdef ENABLE_VMSTATE_TRACKING
|
262
|
+
StateTag current_vm_state_;
|
263
|
+
#endif
|
264
|
+
|
265
|
+
// Generated code scratch locations.
|
266
|
+
int32_t formal_count_;
|
267
|
+
|
268
|
+
// Call back function to report unsafe JS accesses.
|
269
|
+
v8::FailedAccessCheckCallback failed_access_check_callback_;
|
270
|
+
|
271
|
+
private:
|
272
|
+
void InitializeInternal();
|
273
|
+
|
274
|
+
Address try_catch_handler_address_;
|
275
|
+
};
|
276
|
+
|
277
|
+
#if defined(V8_TARGET_ARCH_ARM) || defined(V8_TARGET_ARCH_MIPS)
|
278
|
+
|
279
|
+
#define ISOLATE_PLATFORM_INIT_LIST(V) \
|
280
|
+
/* VirtualFrame::SpilledScope state */ \
|
281
|
+
V(bool, is_virtual_frame_in_spilled_scope, false) \
|
282
|
+
/* CodeGenerator::EmitNamedStore state */ \
|
283
|
+
V(int, inlined_write_barrier_size, -1)
|
284
|
+
|
285
|
+
#if !defined(__arm__) && !defined(__mips__)
|
286
|
+
class HashMap;
|
287
|
+
#endif
|
288
|
+
|
289
|
+
#else
|
290
|
+
|
291
|
+
#define ISOLATE_PLATFORM_INIT_LIST(V)
|
292
|
+
|
293
|
+
#endif
|
294
|
+
|
295
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
296
|
+
|
297
|
+
#define ISOLATE_DEBUGGER_INIT_LIST(V) \
|
298
|
+
V(v8::Debug::EventCallback, debug_event_callback, NULL) \
|
299
|
+
V(DebuggerAgent*, debugger_agent_instance, NULL)
|
300
|
+
#else
|
301
|
+
|
302
|
+
#define ISOLATE_DEBUGGER_INIT_LIST(V)
|
303
|
+
|
304
|
+
#endif
|
305
|
+
|
306
|
+
#ifdef DEBUG
|
307
|
+
|
308
|
+
#define ISOLATE_INIT_DEBUG_ARRAY_LIST(V) \
|
309
|
+
V(CommentStatistic, paged_space_comments_statistics, \
|
310
|
+
CommentStatistic::kMaxComments + 1)
|
311
|
+
#else
|
312
|
+
|
313
|
+
#define ISOLATE_INIT_DEBUG_ARRAY_LIST(V)
|
314
|
+
|
315
|
+
#endif
|
316
|
+
|
317
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
318
|
+
|
319
|
+
#define ISOLATE_LOGGING_INIT_LIST(V) \
|
320
|
+
V(CpuProfiler*, cpu_profiler, NULL) \
|
321
|
+
V(HeapProfiler*, heap_profiler, NULL)
|
322
|
+
|
323
|
+
#else
|
324
|
+
|
325
|
+
#define ISOLATE_LOGGING_INIT_LIST(V)
|
326
|
+
|
327
|
+
#endif
|
328
|
+
|
329
|
+
#define ISOLATE_INIT_ARRAY_LIST(V) \
|
330
|
+
/* SerializerDeserializer state. */ \
|
331
|
+
V(Object*, serialize_partial_snapshot_cache, kPartialSnapshotCacheCapacity) \
|
332
|
+
V(int, jsregexp_static_offsets_vector, kJSRegexpStaticOffsetsVectorSize) \
|
333
|
+
V(int, bad_char_shift_table, kUC16AlphabetSize) \
|
334
|
+
V(int, good_suffix_shift_table, (kBMMaxShift + 1)) \
|
335
|
+
V(int, suffix_table, (kBMMaxShift + 1)) \
|
336
|
+
ISOLATE_INIT_DEBUG_ARRAY_LIST(V)
|
337
|
+
|
338
|
+
typedef List<HeapObject*, PreallocatedStorage> DebugObjectCache;
|
339
|
+
|
340
|
+
#define ISOLATE_INIT_LIST(V) \
|
341
|
+
/* AssertNoZoneAllocation state. */ \
|
342
|
+
V(bool, zone_allow_allocation, true) \
|
343
|
+
/* SerializerDeserializer state. */ \
|
344
|
+
V(int, serialize_partial_snapshot_cache_length, 0) \
|
345
|
+
/* Assembler state. */ \
|
346
|
+
/* A previously allocated buffer of kMinimalBufferSize bytes, or NULL. */ \
|
347
|
+
V(byte*, assembler_spare_buffer, NULL) \
|
348
|
+
V(FatalErrorCallback, exception_behavior, NULL) \
|
349
|
+
V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, NULL) \
|
350
|
+
V(v8::Debug::MessageHandler, message_handler, NULL) \
|
351
|
+
/* To distinguish the function templates, so that we can find them in the */ \
|
352
|
+
/* function cache of the global context. */ \
|
353
|
+
V(int, next_serial_number, 0) \
|
354
|
+
V(ExternalReferenceRedirectorPointer*, external_reference_redirector, NULL) \
|
355
|
+
V(bool, always_allow_natives_syntax, false) \
|
356
|
+
/* Part of the state of liveedit. */ \
|
357
|
+
V(FunctionInfoListener*, active_function_info_listener, NULL) \
|
358
|
+
/* State for Relocatable. */ \
|
359
|
+
V(Relocatable*, relocatable_top, NULL) \
|
360
|
+
/* State for CodeEntry in profile-generator. */ \
|
361
|
+
V(CodeGenerator*, current_code_generator, NULL) \
|
362
|
+
V(bool, jump_target_compiling_deferred_code, false) \
|
363
|
+
V(DebugObjectCache*, string_stream_debug_object_cache, NULL) \
|
364
|
+
V(Object*, string_stream_current_security_token, NULL) \
|
365
|
+
/* TODO(isolates): Release this on destruction? */ \
|
366
|
+
V(int*, irregexp_interpreter_backtrack_stack_cache, NULL) \
|
367
|
+
/* Serializer state. */ \
|
368
|
+
V(ExternalReferenceTable*, external_reference_table, NULL) \
|
369
|
+
/* AstNode state. */ \
|
370
|
+
V(unsigned, ast_node_id, 0) \
|
371
|
+
V(unsigned, ast_node_count, 0) \
|
372
|
+
/* SafeStackFrameIterator activations count. */ \
|
373
|
+
V(int, safe_stack_iterator_counter, 0) \
|
374
|
+
V(uint64_t, enabled_cpu_features, 0) \
|
375
|
+
ISOLATE_PLATFORM_INIT_LIST(V) \
|
376
|
+
ISOLATE_LOGGING_INIT_LIST(V) \
|
377
|
+
ISOLATE_DEBUGGER_INIT_LIST(V)
|
378
|
+
|
379
|
+
class Isolate {
|
380
|
+
// These forward declarations are required to make the friend declarations in
|
381
|
+
// PerIsolateThreadData work on some older versions of gcc.
|
382
|
+
class ThreadDataTable;
|
383
|
+
class EntryStackItem;
|
384
|
+
public:
|
385
|
+
~Isolate();
|
386
|
+
|
387
|
+
// A thread has a PerIsolateThreadData instance for each isolate that it has
|
388
|
+
// entered. That instance is allocated when the isolate is initially entered
|
389
|
+
// and reused on subsequent entries.
|
390
|
+
class PerIsolateThreadData {
|
391
|
+
public:
|
392
|
+
PerIsolateThreadData(Isolate* isolate, ThreadId thread_id)
|
393
|
+
: isolate_(isolate),
|
394
|
+
thread_id_(thread_id),
|
395
|
+
stack_limit_(0),
|
396
|
+
thread_state_(NULL),
|
397
|
+
#if !defined(__arm__) && defined(V8_TARGET_ARCH_ARM) || \
|
398
|
+
!defined(__mips__) && defined(V8_TARGET_ARCH_MIPS)
|
399
|
+
simulator_(NULL),
|
400
|
+
#endif
|
401
|
+
next_(NULL),
|
402
|
+
prev_(NULL) { }
|
403
|
+
Isolate* isolate() const { return isolate_; }
|
404
|
+
ThreadId thread_id() const { return thread_id_; }
|
405
|
+
void set_stack_limit(uintptr_t value) { stack_limit_ = value; }
|
406
|
+
uintptr_t stack_limit() const { return stack_limit_; }
|
407
|
+
ThreadState* thread_state() const { return thread_state_; }
|
408
|
+
void set_thread_state(ThreadState* value) { thread_state_ = value; }
|
409
|
+
|
410
|
+
#if !defined(__arm__) && defined(V8_TARGET_ARCH_ARM) || \
|
411
|
+
!defined(__mips__) && defined(V8_TARGET_ARCH_MIPS)
|
412
|
+
Simulator* simulator() const { return simulator_; }
|
413
|
+
void set_simulator(Simulator* simulator) {
|
414
|
+
simulator_ = simulator;
|
415
|
+
}
|
416
|
+
#endif
|
417
|
+
|
418
|
+
bool Matches(Isolate* isolate, ThreadId thread_id) const {
|
419
|
+
return isolate_ == isolate && thread_id_.Equals(thread_id);
|
420
|
+
}
|
421
|
+
|
422
|
+
private:
|
423
|
+
Isolate* isolate_;
|
424
|
+
ThreadId thread_id_;
|
425
|
+
uintptr_t stack_limit_;
|
426
|
+
ThreadState* thread_state_;
|
427
|
+
|
428
|
+
#if !defined(__arm__) && defined(V8_TARGET_ARCH_ARM) || \
|
429
|
+
!defined(__mips__) && defined(V8_TARGET_ARCH_MIPS)
|
430
|
+
Simulator* simulator_;
|
431
|
+
#endif
|
432
|
+
|
433
|
+
PerIsolateThreadData* next_;
|
434
|
+
PerIsolateThreadData* prev_;
|
435
|
+
|
436
|
+
friend class Isolate;
|
437
|
+
friend class ThreadDataTable;
|
438
|
+
friend class EntryStackItem;
|
439
|
+
|
440
|
+
DISALLOW_COPY_AND_ASSIGN(PerIsolateThreadData);
|
441
|
+
};
|
442
|
+
|
443
|
+
|
444
|
+
enum AddressId {
|
445
|
+
#define C(name) k_##name,
|
446
|
+
ISOLATE_ADDRESS_LIST(C)
|
447
|
+
ISOLATE_ADDRESS_LIST_PROF(C)
|
448
|
+
#undef C
|
449
|
+
k_isolate_address_count
|
450
|
+
};
|
451
|
+
|
452
|
+
// Returns the PerIsolateThreadData for the current thread (or NULL if one is
|
453
|
+
// not currently set).
|
454
|
+
static PerIsolateThreadData* CurrentPerIsolateThreadData() {
|
455
|
+
return reinterpret_cast<PerIsolateThreadData*>(
|
456
|
+
Thread::GetThreadLocal(per_isolate_thread_data_key_));
|
457
|
+
}
|
458
|
+
|
459
|
+
// Returns the isolate inside which the current thread is running.
|
460
|
+
INLINE(static Isolate* Current()) {
|
461
|
+
Isolate* isolate = reinterpret_cast<Isolate*>(
|
462
|
+
Thread::GetExistingThreadLocal(isolate_key_));
|
463
|
+
ASSERT(isolate != NULL);
|
464
|
+
return isolate;
|
465
|
+
}
|
466
|
+
|
467
|
+
INLINE(static Isolate* UncheckedCurrent()) {
|
468
|
+
return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key_));
|
469
|
+
}
|
470
|
+
|
471
|
+
bool Init(Deserializer* des);
|
472
|
+
|
473
|
+
bool IsInitialized() { return state_ == INITIALIZED; }
|
474
|
+
|
475
|
+
// True if at least one thread Enter'ed this isolate.
|
476
|
+
bool IsInUse() { return entry_stack_ != NULL; }
|
477
|
+
|
478
|
+
// Destroys the non-default isolates.
|
479
|
+
// Sets default isolate into "has_been_disposed" state rather then destroying,
|
480
|
+
// for legacy API reasons.
|
481
|
+
void TearDown();
|
482
|
+
|
483
|
+
bool IsDefaultIsolate() const { return this == default_isolate_; }
|
484
|
+
|
485
|
+
// Ensures that process-wide resources and the default isolate have been
|
486
|
+
// allocated. It is only necessary to call this method in rare casses, for
|
487
|
+
// example if you are using V8 from within the body of a static initializer.
|
488
|
+
// Safe to call multiple times.
|
489
|
+
static void EnsureDefaultIsolate();
|
490
|
+
|
491
|
+
// Find the PerThread for this particular (isolate, thread) combination
|
492
|
+
// If one does not yet exist, return null.
|
493
|
+
PerIsolateThreadData* FindPerThreadDataForThisThread();
|
494
|
+
|
495
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
496
|
+
// Get the debugger from the default isolate. Preinitializes the
|
497
|
+
// default isolate if needed.
|
498
|
+
static Debugger* GetDefaultIsolateDebugger();
|
499
|
+
#endif
|
500
|
+
|
501
|
+
// Get the stack guard from the default isolate. Preinitializes the
|
502
|
+
// default isolate if needed.
|
503
|
+
static StackGuard* GetDefaultIsolateStackGuard();
|
504
|
+
|
505
|
+
// Returns the key used to store the pointer to the current isolate.
|
506
|
+
// Used internally for V8 threads that do not execute JavaScript but still
|
507
|
+
// are part of the domain of an isolate (like the context switcher).
|
508
|
+
static Thread::LocalStorageKey isolate_key() {
|
509
|
+
return isolate_key_;
|
510
|
+
}
|
511
|
+
|
512
|
+
// Returns the key used to store process-wide thread IDs.
|
513
|
+
static Thread::LocalStorageKey thread_id_key() {
|
514
|
+
return thread_id_key_;
|
515
|
+
}
|
516
|
+
|
517
|
+
// If a client attempts to create a Locker without specifying an isolate,
|
518
|
+
// we assume that the client is using legacy behavior. Set up the current
|
519
|
+
// thread to be inside the implicit isolate (or fail a check if we have
|
520
|
+
// switched to non-legacy behavior).
|
521
|
+
static void EnterDefaultIsolate();
|
522
|
+
|
523
|
+
// Debug.
|
524
|
+
// Mutex for serializing access to break control structures.
|
525
|
+
Mutex* break_access() { return break_access_; }
|
526
|
+
|
527
|
+
Address get_address_from_id(AddressId id);
|
528
|
+
|
529
|
+
// Access to top context (where the current function object was created).
|
530
|
+
Context* context() { return thread_local_top_.context_; }
|
531
|
+
void set_context(Context* context) {
|
532
|
+
thread_local_top_.context_ = context;
|
533
|
+
}
|
534
|
+
Context** context_address() { return &thread_local_top_.context_; }
|
535
|
+
|
536
|
+
SaveContext* save_context() {return thread_local_top_.save_context_; }
|
537
|
+
void set_save_context(SaveContext* save) {
|
538
|
+
thread_local_top_.save_context_ = save;
|
539
|
+
}
|
540
|
+
|
541
|
+
// Access to current thread id.
|
542
|
+
ThreadId thread_id() { return thread_local_top_.thread_id_; }
|
543
|
+
void set_thread_id(ThreadId id) { thread_local_top_.thread_id_ = id; }
|
544
|
+
|
545
|
+
// Interface to pending exception.
|
546
|
+
MaybeObject* pending_exception() {
|
547
|
+
ASSERT(has_pending_exception());
|
548
|
+
return thread_local_top_.pending_exception_;
|
549
|
+
}
|
550
|
+
bool external_caught_exception() {
|
551
|
+
return thread_local_top_.external_caught_exception_;
|
552
|
+
}
|
553
|
+
void set_external_caught_exception(bool value) {
|
554
|
+
thread_local_top_.external_caught_exception_ = value;
|
555
|
+
}
|
556
|
+
void set_pending_exception(MaybeObject* exception) {
|
557
|
+
thread_local_top_.pending_exception_ = exception;
|
558
|
+
}
|
559
|
+
void clear_pending_exception() {
|
560
|
+
thread_local_top_.pending_exception_ = heap_.the_hole_value();
|
561
|
+
}
|
562
|
+
MaybeObject** pending_exception_address() {
|
563
|
+
return &thread_local_top_.pending_exception_;
|
564
|
+
}
|
565
|
+
bool has_pending_exception() {
|
566
|
+
return !thread_local_top_.pending_exception_->IsTheHole();
|
567
|
+
}
|
568
|
+
void clear_pending_message() {
|
569
|
+
thread_local_top_.has_pending_message_ = false;
|
570
|
+
thread_local_top_.pending_message_obj_ = heap_.the_hole_value();
|
571
|
+
thread_local_top_.pending_message_script_ = NULL;
|
572
|
+
}
|
573
|
+
v8::TryCatch* try_catch_handler() {
|
574
|
+
return thread_local_top_.TryCatchHandler();
|
575
|
+
}
|
576
|
+
Address try_catch_handler_address() {
|
577
|
+
return thread_local_top_.try_catch_handler_address();
|
578
|
+
}
|
579
|
+
bool* external_caught_exception_address() {
|
580
|
+
return &thread_local_top_.external_caught_exception_;
|
581
|
+
}
|
582
|
+
v8::TryCatch* catcher() {
|
583
|
+
return thread_local_top_.catcher_;
|
584
|
+
}
|
585
|
+
void set_catcher(v8::TryCatch* catcher) {
|
586
|
+
thread_local_top_.catcher_ = catcher;
|
587
|
+
}
|
588
|
+
|
589
|
+
MaybeObject** scheduled_exception_address() {
|
590
|
+
return &thread_local_top_.scheduled_exception_;
|
591
|
+
}
|
592
|
+
MaybeObject* scheduled_exception() {
|
593
|
+
ASSERT(has_scheduled_exception());
|
594
|
+
return thread_local_top_.scheduled_exception_;
|
595
|
+
}
|
596
|
+
bool has_scheduled_exception() {
|
597
|
+
return !thread_local_top_.scheduled_exception_->IsTheHole();
|
598
|
+
}
|
599
|
+
void clear_scheduled_exception() {
|
600
|
+
thread_local_top_.scheduled_exception_ = heap_.the_hole_value();
|
601
|
+
}
|
602
|
+
|
603
|
+
bool IsExternallyCaught();
|
604
|
+
|
605
|
+
bool is_catchable_by_javascript(MaybeObject* exception) {
|
606
|
+
return (exception != Failure::OutOfMemoryException()) &&
|
607
|
+
(exception != heap()->termination_exception());
|
608
|
+
}
|
609
|
+
|
610
|
+
// JS execution stack (see frames.h).
|
611
|
+
static Address c_entry_fp(ThreadLocalTop* thread) {
|
612
|
+
return thread->c_entry_fp_;
|
613
|
+
}
|
614
|
+
static Address handler(ThreadLocalTop* thread) { return thread->handler_; }
|
615
|
+
|
616
|
+
inline Address* c_entry_fp_address() {
|
617
|
+
return &thread_local_top_.c_entry_fp_;
|
618
|
+
}
|
619
|
+
inline Address* handler_address() { return &thread_local_top_.handler_; }
|
620
|
+
|
621
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
622
|
+
// Bottom JS entry (see StackTracer::Trace in log.cc).
|
623
|
+
static Address js_entry_sp(ThreadLocalTop* thread) {
|
624
|
+
return thread->js_entry_sp_;
|
625
|
+
}
|
626
|
+
inline Address* js_entry_sp_address() {
|
627
|
+
return &thread_local_top_.js_entry_sp_;
|
628
|
+
}
|
629
|
+
#endif
|
630
|
+
|
631
|
+
// Generated code scratch locations.
|
632
|
+
void* formal_count_address() { return &thread_local_top_.formal_count_; }
|
633
|
+
|
634
|
+
// Returns the global object of the current context. It could be
|
635
|
+
// a builtin object, or a js global object.
|
636
|
+
Handle<GlobalObject> global() {
|
637
|
+
return Handle<GlobalObject>(context()->global());
|
638
|
+
}
|
639
|
+
|
640
|
+
// Returns the global proxy object of the current context.
|
641
|
+
Object* global_proxy() {
|
642
|
+
return context()->global_proxy();
|
643
|
+
}
|
644
|
+
|
645
|
+
Handle<JSBuiltinsObject> js_builtins_object() {
|
646
|
+
return Handle<JSBuiltinsObject>(thread_local_top_.context_->builtins());
|
647
|
+
}
|
648
|
+
|
649
|
+
static int ArchiveSpacePerThread() { return sizeof(ThreadLocalTop); }
|
650
|
+
void FreeThreadResources() { thread_local_top_.Free(); }
|
651
|
+
|
652
|
+
// This method is called by the api after operations that may throw
|
653
|
+
// exceptions. If an exception was thrown and not handled by an external
|
654
|
+
// handler the exception is scheduled to be rethrown when we return to running
|
655
|
+
// JavaScript code. If an exception is scheduled true is returned.
|
656
|
+
bool OptionalRescheduleException(bool is_bottom_call);
|
657
|
+
|
658
|
+
class ExceptionScope {
|
659
|
+
public:
|
660
|
+
explicit ExceptionScope(Isolate* isolate) :
|
661
|
+
// Scope currently can only be used for regular exceptions, not
|
662
|
+
// failures like OOM or termination exception.
|
663
|
+
isolate_(isolate),
|
664
|
+
pending_exception_(isolate_->pending_exception()->ToObjectUnchecked()),
|
665
|
+
catcher_(isolate_->catcher())
|
666
|
+
{ }
|
667
|
+
|
668
|
+
~ExceptionScope() {
|
669
|
+
isolate_->set_catcher(catcher_);
|
670
|
+
isolate_->set_pending_exception(*pending_exception_);
|
671
|
+
}
|
672
|
+
|
673
|
+
private:
|
674
|
+
Isolate* isolate_;
|
675
|
+
Handle<Object> pending_exception_;
|
676
|
+
v8::TryCatch* catcher_;
|
677
|
+
};
|
678
|
+
|
679
|
+
void SetCaptureStackTraceForUncaughtExceptions(
|
680
|
+
bool capture,
|
681
|
+
int frame_limit,
|
682
|
+
StackTrace::StackTraceOptions options);
|
683
|
+
|
684
|
+
// Tells whether the current context has experienced an out of memory
|
685
|
+
// exception.
|
686
|
+
bool is_out_of_memory();
|
687
|
+
|
688
|
+
void PrintCurrentStackTrace(FILE* out);
|
689
|
+
void PrintStackTrace(FILE* out, char* thread_data);
|
690
|
+
void PrintStack(StringStream* accumulator);
|
691
|
+
void PrintStack();
|
692
|
+
Handle<String> StackTraceString();
|
693
|
+
Handle<JSArray> CaptureCurrentStackTrace(
|
694
|
+
int frame_limit,
|
695
|
+
StackTrace::StackTraceOptions options);
|
696
|
+
|
697
|
+
// Returns if the top context may access the given global object. If
|
698
|
+
// the result is false, the pending exception is guaranteed to be
|
699
|
+
// set.
|
700
|
+
bool MayNamedAccess(JSObject* receiver,
|
701
|
+
Object* key,
|
702
|
+
v8::AccessType type);
|
703
|
+
bool MayIndexedAccess(JSObject* receiver,
|
704
|
+
uint32_t index,
|
705
|
+
v8::AccessType type);
|
706
|
+
|
707
|
+
void SetFailedAccessCheckCallback(v8::FailedAccessCheckCallback callback);
|
708
|
+
void ReportFailedAccessCheck(JSObject* receiver, v8::AccessType type);
|
709
|
+
|
710
|
+
// Exception throwing support. The caller should use the result
|
711
|
+
// of Throw() as its return value.
|
712
|
+
Failure* Throw(Object* exception, MessageLocation* location = NULL);
|
713
|
+
// Re-throw an exception. This involves no error reporting since
|
714
|
+
// error reporting was handled when the exception was thrown
|
715
|
+
// originally.
|
716
|
+
Failure* ReThrow(MaybeObject* exception, MessageLocation* location = NULL);
|
717
|
+
void ScheduleThrow(Object* exception);
|
718
|
+
void ReportPendingMessages();
|
719
|
+
Failure* ThrowIllegalOperation();
|
720
|
+
|
721
|
+
// Promote a scheduled exception to pending. Asserts has_scheduled_exception.
|
722
|
+
Failure* PromoteScheduledException();
|
723
|
+
void DoThrow(MaybeObject* exception, MessageLocation* location);
|
724
|
+
// Checks if exception should be reported and finds out if it's
|
725
|
+
// caught externally.
|
726
|
+
bool ShouldReportException(bool* can_be_caught_externally,
|
727
|
+
bool catchable_by_javascript);
|
728
|
+
|
729
|
+
// Attempts to compute the current source location, storing the
|
730
|
+
// result in the target out parameter.
|
731
|
+
void ComputeLocation(MessageLocation* target);
|
732
|
+
|
733
|
+
// Override command line flag.
|
734
|
+
void TraceException(bool flag);
|
735
|
+
|
736
|
+
// Out of resource exception helpers.
|
737
|
+
Failure* StackOverflow();
|
738
|
+
Failure* TerminateExecution();
|
739
|
+
|
740
|
+
// Administration
|
741
|
+
void Iterate(ObjectVisitor* v);
|
742
|
+
void Iterate(ObjectVisitor* v, ThreadLocalTop* t);
|
743
|
+
char* Iterate(ObjectVisitor* v, char* t);
|
744
|
+
void IterateThread(ThreadVisitor* v);
|
745
|
+
void IterateThread(ThreadVisitor* v, char* t);
|
746
|
+
|
747
|
+
|
748
|
+
// Returns the current global context.
|
749
|
+
Handle<Context> global_context();
|
750
|
+
|
751
|
+
// Returns the global context of the calling JavaScript code. That
|
752
|
+
// is, the global context of the top-most JavaScript frame.
|
753
|
+
Handle<Context> GetCallingGlobalContext();
|
754
|
+
|
755
|
+
void RegisterTryCatchHandler(v8::TryCatch* that);
|
756
|
+
void UnregisterTryCatchHandler(v8::TryCatch* that);
|
757
|
+
|
758
|
+
char* ArchiveThread(char* to);
|
759
|
+
char* RestoreThread(char* from);
|
760
|
+
|
761
|
+
static const char* const kStackOverflowMessage;
|
762
|
+
|
763
|
+
static const int kUC16AlphabetSize = 256; // See StringSearchBase.
|
764
|
+
static const int kBMMaxShift = 250; // See StringSearchBase.
|
765
|
+
|
766
|
+
// Accessors.
|
767
|
+
#define GLOBAL_ACCESSOR(type, name, initialvalue) \
|
768
|
+
inline type name() const { \
|
769
|
+
ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
|
770
|
+
return name##_; \
|
771
|
+
} \
|
772
|
+
inline void set_##name(type value) { \
|
773
|
+
ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
|
774
|
+
name##_ = value; \
|
775
|
+
}
|
776
|
+
ISOLATE_INIT_LIST(GLOBAL_ACCESSOR)
|
777
|
+
#undef GLOBAL_ACCESSOR
|
778
|
+
|
779
|
+
#define GLOBAL_ARRAY_ACCESSOR(type, name, length) \
|
780
|
+
inline type* name() { \
|
781
|
+
ASSERT(OFFSET_OF(Isolate, name##_) == name##_debug_offset_); \
|
782
|
+
return &(name##_)[0]; \
|
783
|
+
}
|
784
|
+
ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_ACCESSOR)
|
785
|
+
#undef GLOBAL_ARRAY_ACCESSOR
|
786
|
+
|
787
|
+
#define GLOBAL_CONTEXT_FIELD_ACCESSOR(index, type, name) \
|
788
|
+
Handle<type> name() { \
|
789
|
+
return Handle<type>(context()->global_context()->name()); \
|
790
|
+
}
|
791
|
+
GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSOR)
|
792
|
+
#undef GLOBAL_CONTEXT_FIELD_ACCESSOR
|
793
|
+
|
794
|
+
Bootstrapper* bootstrapper() { return bootstrapper_; }
|
795
|
+
Counters* counters() { return counters_; }
|
796
|
+
CodeRange* code_range() { return code_range_; }
|
797
|
+
RuntimeProfiler* runtime_profiler() { return runtime_profiler_; }
|
798
|
+
CompilationCache* compilation_cache() { return compilation_cache_; }
|
799
|
+
Logger* logger() { return logger_; }
|
800
|
+
StackGuard* stack_guard() { return &stack_guard_; }
|
801
|
+
Heap* heap() { return &heap_; }
|
802
|
+
StatsTable* stats_table() { return stats_table_; }
|
803
|
+
StubCache* stub_cache() { return stub_cache_; }
|
804
|
+
DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; }
|
805
|
+
ThreadLocalTop* thread_local_top() { return &thread_local_top_; }
|
806
|
+
|
807
|
+
TranscendentalCache* transcendental_cache() const {
|
808
|
+
return transcendental_cache_;
|
809
|
+
}
|
810
|
+
|
811
|
+
MemoryAllocator* memory_allocator() {
|
812
|
+
return memory_allocator_;
|
813
|
+
}
|
814
|
+
|
815
|
+
KeyedLookupCache* keyed_lookup_cache() {
|
816
|
+
return keyed_lookup_cache_;
|
817
|
+
}
|
818
|
+
|
819
|
+
ContextSlotCache* context_slot_cache() {
|
820
|
+
return context_slot_cache_;
|
821
|
+
}
|
822
|
+
|
823
|
+
DescriptorLookupCache* descriptor_lookup_cache() {
|
824
|
+
return descriptor_lookup_cache_;
|
825
|
+
}
|
826
|
+
|
827
|
+
v8::ImplementationUtilities::HandleScopeData* handle_scope_data() {
|
828
|
+
return &handle_scope_data_;
|
829
|
+
}
|
830
|
+
HandleScopeImplementer* handle_scope_implementer() {
|
831
|
+
ASSERT(handle_scope_implementer_);
|
832
|
+
return handle_scope_implementer_;
|
833
|
+
}
|
834
|
+
Zone* zone() { return &zone_; }
|
835
|
+
|
836
|
+
UnicodeCache* unicode_cache() {
|
837
|
+
return unicode_cache_;
|
838
|
+
}
|
839
|
+
|
840
|
+
PcToCodeCache* pc_to_code_cache() { return pc_to_code_cache_; }
|
841
|
+
|
842
|
+
StringInputBuffer* write_input_buffer() { return write_input_buffer_; }
|
843
|
+
|
844
|
+
GlobalHandles* global_handles() { return global_handles_; }
|
845
|
+
|
846
|
+
ThreadManager* thread_manager() { return thread_manager_; }
|
847
|
+
|
848
|
+
ContextSwitcher* context_switcher() { return context_switcher_; }
|
849
|
+
|
850
|
+
void set_context_switcher(ContextSwitcher* switcher) {
|
851
|
+
context_switcher_ = switcher;
|
852
|
+
}
|
853
|
+
|
854
|
+
StringTracker* string_tracker() { return string_tracker_; }
|
855
|
+
|
856
|
+
unibrow::Mapping<unibrow::Ecma262UnCanonicalize>* jsregexp_uncanonicalize() {
|
857
|
+
return &jsregexp_uncanonicalize_;
|
858
|
+
}
|
859
|
+
|
860
|
+
unibrow::Mapping<unibrow::CanonicalizationRange>* jsregexp_canonrange() {
|
861
|
+
return &jsregexp_canonrange_;
|
862
|
+
}
|
863
|
+
|
864
|
+
StringInputBuffer* objects_string_compare_buffer_a() {
|
865
|
+
return &objects_string_compare_buffer_a_;
|
866
|
+
}
|
867
|
+
|
868
|
+
StringInputBuffer* objects_string_compare_buffer_b() {
|
869
|
+
return &objects_string_compare_buffer_b_;
|
870
|
+
}
|
871
|
+
|
872
|
+
StaticResource<StringInputBuffer>* objects_string_input_buffer() {
|
873
|
+
return &objects_string_input_buffer_;
|
874
|
+
}
|
875
|
+
|
876
|
+
AstSentinels* ast_sentinels() { return ast_sentinels_; }
|
877
|
+
|
878
|
+
RuntimeState* runtime_state() { return &runtime_state_; }
|
879
|
+
|
880
|
+
StaticResource<SafeStringInputBuffer>* compiler_safe_string_input_buffer() {
|
881
|
+
return &compiler_safe_string_input_buffer_;
|
882
|
+
}
|
883
|
+
|
884
|
+
Builtins* builtins() { return &builtins_; }
|
885
|
+
|
886
|
+
unibrow::Mapping<unibrow::Ecma262Canonicalize>*
|
887
|
+
regexp_macro_assembler_canonicalize() {
|
888
|
+
return ®exp_macro_assembler_canonicalize_;
|
889
|
+
}
|
890
|
+
|
891
|
+
RegExpStack* regexp_stack() { return regexp_stack_; }
|
892
|
+
|
893
|
+
unibrow::Mapping<unibrow::Ecma262Canonicalize>*
|
894
|
+
interp_canonicalize_mapping() {
|
895
|
+
return &interp_canonicalize_mapping_;
|
896
|
+
}
|
897
|
+
|
898
|
+
ZoneObjectList* frame_element_constant_list() {
|
899
|
+
return &frame_element_constant_list_;
|
900
|
+
}
|
901
|
+
|
902
|
+
ZoneObjectList* result_constant_list() {
|
903
|
+
return &result_constant_list_;
|
904
|
+
}
|
905
|
+
|
906
|
+
void* PreallocatedStorageNew(size_t size);
|
907
|
+
void PreallocatedStorageDelete(void* p);
|
908
|
+
void PreallocatedStorageInit(size_t size);
|
909
|
+
|
910
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
911
|
+
Debugger* debugger() { return debugger_; }
|
912
|
+
Debug* debug() { return debug_; }
|
913
|
+
#endif
|
914
|
+
|
915
|
+
inline bool DebuggerHasBreakPoints();
|
916
|
+
|
917
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
918
|
+
ProducerHeapProfile* producer_heap_profile() {
|
919
|
+
return producer_heap_profile_;
|
920
|
+
}
|
921
|
+
#endif
|
922
|
+
|
923
|
+
#ifdef DEBUG
|
924
|
+
HistogramInfo* heap_histograms() { return heap_histograms_; }
|
925
|
+
|
926
|
+
JSObject::SpillInformation* js_spill_information() {
|
927
|
+
return &js_spill_information_;
|
928
|
+
}
|
929
|
+
|
930
|
+
int* code_kind_statistics() { return code_kind_statistics_; }
|
931
|
+
#endif
|
932
|
+
|
933
|
+
#if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
|
934
|
+
defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__)
|
935
|
+
bool simulator_initialized() { return simulator_initialized_; }
|
936
|
+
void set_simulator_initialized(bool initialized) {
|
937
|
+
simulator_initialized_ = initialized;
|
938
|
+
}
|
939
|
+
|
940
|
+
HashMap* simulator_i_cache() { return simulator_i_cache_; }
|
941
|
+
void set_simulator_i_cache(HashMap* hash_map) {
|
942
|
+
simulator_i_cache_ = hash_map;
|
943
|
+
}
|
944
|
+
|
945
|
+
Redirection* simulator_redirection() {
|
946
|
+
return simulator_redirection_;
|
947
|
+
}
|
948
|
+
void set_simulator_redirection(Redirection* redirection) {
|
949
|
+
simulator_redirection_ = redirection;
|
950
|
+
}
|
951
|
+
#endif
|
952
|
+
|
953
|
+
Factory* factory() { return reinterpret_cast<Factory*>(this); }
|
954
|
+
|
955
|
+
// SerializerDeserializer state.
|
956
|
+
static const int kPartialSnapshotCacheCapacity = 1400;
|
957
|
+
|
958
|
+
static const int kJSRegexpStaticOffsetsVectorSize = 50;
|
959
|
+
|
960
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
961
|
+
Address external_callback() {
|
962
|
+
return thread_local_top_.external_callback_;
|
963
|
+
}
|
964
|
+
void set_external_callback(Address callback) {
|
965
|
+
thread_local_top_.external_callback_ = callback;
|
966
|
+
}
|
967
|
+
#endif
|
968
|
+
|
969
|
+
#ifdef ENABLE_VMSTATE_TRACKING
|
970
|
+
StateTag current_vm_state() {
|
971
|
+
return thread_local_top_.current_vm_state_;
|
972
|
+
}
|
973
|
+
|
974
|
+
void SetCurrentVMState(StateTag state) {
|
975
|
+
if (RuntimeProfiler::IsEnabled()) {
|
976
|
+
StateTag current_state = thread_local_top_.current_vm_state_;
|
977
|
+
if (current_state != JS && state == JS) {
|
978
|
+
// Non-JS -> JS transition.
|
979
|
+
RuntimeProfiler::IsolateEnteredJS(this);
|
980
|
+
} else if (current_state == JS && state != JS) {
|
981
|
+
// JS -> non-JS transition.
|
982
|
+
ASSERT(RuntimeProfiler::IsSomeIsolateInJS());
|
983
|
+
RuntimeProfiler::IsolateExitedJS(this);
|
984
|
+
} else {
|
985
|
+
// Other types of state transitions are not interesting to the
|
986
|
+
// runtime profiler, because they don't affect whether we're
|
987
|
+
// in JS or not.
|
988
|
+
ASSERT((current_state == JS) == (state == JS));
|
989
|
+
}
|
990
|
+
}
|
991
|
+
thread_local_top_.current_vm_state_ = state;
|
992
|
+
}
|
993
|
+
#endif
|
994
|
+
|
995
|
+
void ResetEagerOptimizingData();
|
996
|
+
|
997
|
+
void SetData(void* data) { embedder_data_ = data; }
|
998
|
+
void* GetData() { return embedder_data_; }
|
999
|
+
|
1000
|
+
private:
|
1001
|
+
Isolate();
|
1002
|
+
|
1003
|
+
// The per-process lock should be acquired before the ThreadDataTable is
|
1004
|
+
// modified.
|
1005
|
+
class ThreadDataTable {
|
1006
|
+
public:
|
1007
|
+
ThreadDataTable();
|
1008
|
+
~ThreadDataTable();
|
1009
|
+
|
1010
|
+
PerIsolateThreadData* Lookup(Isolate* isolate, ThreadId thread_id);
|
1011
|
+
void Insert(PerIsolateThreadData* data);
|
1012
|
+
void Remove(Isolate* isolate, ThreadId thread_id);
|
1013
|
+
void Remove(PerIsolateThreadData* data);
|
1014
|
+
|
1015
|
+
private:
|
1016
|
+
PerIsolateThreadData* list_;
|
1017
|
+
};
|
1018
|
+
|
1019
|
+
// These items form a stack synchronously with threads Enter'ing and Exit'ing
|
1020
|
+
// the Isolate. The top of the stack points to a thread which is currently
|
1021
|
+
// running the Isolate. When the stack is empty, the Isolate is considered
|
1022
|
+
// not entered by any thread and can be Disposed.
|
1023
|
+
// If the same thread enters the Isolate more then once, the entry_count_
|
1024
|
+
// is incremented rather then a new item pushed to the stack.
|
1025
|
+
class EntryStackItem {
|
1026
|
+
public:
|
1027
|
+
EntryStackItem(PerIsolateThreadData* previous_thread_data,
|
1028
|
+
Isolate* previous_isolate,
|
1029
|
+
EntryStackItem* previous_item)
|
1030
|
+
: entry_count(1),
|
1031
|
+
previous_thread_data(previous_thread_data),
|
1032
|
+
previous_isolate(previous_isolate),
|
1033
|
+
previous_item(previous_item) { }
|
1034
|
+
|
1035
|
+
int entry_count;
|
1036
|
+
PerIsolateThreadData* previous_thread_data;
|
1037
|
+
Isolate* previous_isolate;
|
1038
|
+
EntryStackItem* previous_item;
|
1039
|
+
|
1040
|
+
DISALLOW_COPY_AND_ASSIGN(EntryStackItem);
|
1041
|
+
};
|
1042
|
+
|
1043
|
+
// This mutex protects highest_thread_id_, thread_data_table_ and
|
1044
|
+
// default_isolate_.
|
1045
|
+
static Mutex* process_wide_mutex_;
|
1046
|
+
|
1047
|
+
static Thread::LocalStorageKey per_isolate_thread_data_key_;
|
1048
|
+
static Thread::LocalStorageKey isolate_key_;
|
1049
|
+
static Thread::LocalStorageKey thread_id_key_;
|
1050
|
+
static Isolate* default_isolate_;
|
1051
|
+
static ThreadDataTable* thread_data_table_;
|
1052
|
+
|
1053
|
+
bool PreInit();
|
1054
|
+
|
1055
|
+
void Deinit();
|
1056
|
+
|
1057
|
+
static void SetIsolateThreadLocals(Isolate* isolate,
|
1058
|
+
PerIsolateThreadData* data);
|
1059
|
+
|
1060
|
+
enum State {
|
1061
|
+
UNINITIALIZED, // Some components may not have been allocated.
|
1062
|
+
PREINITIALIZED, // Components have been allocated but not initialized.
|
1063
|
+
INITIALIZED // All components are fully initialized.
|
1064
|
+
};
|
1065
|
+
|
1066
|
+
State state_;
|
1067
|
+
EntryStackItem* entry_stack_;
|
1068
|
+
|
1069
|
+
// Allocate and insert PerIsolateThreadData into the ThreadDataTable
|
1070
|
+
// (regardless of whether such data already exists).
|
1071
|
+
PerIsolateThreadData* AllocatePerIsolateThreadData(ThreadId thread_id);
|
1072
|
+
|
1073
|
+
// Find the PerThread for this particular (isolate, thread) combination.
|
1074
|
+
// If one does not yet exist, allocate a new one.
|
1075
|
+
PerIsolateThreadData* FindOrAllocatePerThreadDataForThisThread();
|
1076
|
+
|
1077
|
+
// PreInits and returns a default isolate. Needed when a new thread tries
|
1078
|
+
// to create a Locker for the first time (the lock itself is in the isolate).
|
1079
|
+
static Isolate* GetDefaultIsolateForLocking();
|
1080
|
+
|
1081
|
+
// Initializes the current thread to run this Isolate.
|
1082
|
+
// Not thread-safe. Multiple threads should not Enter/Exit the same isolate
|
1083
|
+
// at the same time, this should be prevented using external locking.
|
1084
|
+
void Enter();
|
1085
|
+
|
1086
|
+
// Exits the current thread. The previosuly entered Isolate is restored
|
1087
|
+
// for the thread.
|
1088
|
+
// Not thread-safe. Multiple threads should not Enter/Exit the same isolate
|
1089
|
+
// at the same time, this should be prevented using external locking.
|
1090
|
+
void Exit();
|
1091
|
+
|
1092
|
+
void PreallocatedMemoryThreadStart();
|
1093
|
+
void PreallocatedMemoryThreadStop();
|
1094
|
+
void InitializeThreadLocal();
|
1095
|
+
|
1096
|
+
void PrintStackTrace(FILE* out, ThreadLocalTop* thread);
|
1097
|
+
void MarkCompactPrologue(bool is_compacting,
|
1098
|
+
ThreadLocalTop* archived_thread_data);
|
1099
|
+
void MarkCompactEpilogue(bool is_compacting,
|
1100
|
+
ThreadLocalTop* archived_thread_data);
|
1101
|
+
|
1102
|
+
void FillCache();
|
1103
|
+
|
1104
|
+
void PropagatePendingExceptionToExternalTryCatch();
|
1105
|
+
|
1106
|
+
int stack_trace_nesting_level_;
|
1107
|
+
StringStream* incomplete_message_;
|
1108
|
+
// The preallocated memory thread singleton.
|
1109
|
+
PreallocatedMemoryThread* preallocated_memory_thread_;
|
1110
|
+
Address isolate_addresses_[k_isolate_address_count + 1]; // NOLINT
|
1111
|
+
NoAllocationStringAllocator* preallocated_message_space_;
|
1112
|
+
|
1113
|
+
Bootstrapper* bootstrapper_;
|
1114
|
+
RuntimeProfiler* runtime_profiler_;
|
1115
|
+
CompilationCache* compilation_cache_;
|
1116
|
+
Counters* counters_;
|
1117
|
+
CodeRange* code_range_;
|
1118
|
+
Mutex* break_access_;
|
1119
|
+
Heap heap_;
|
1120
|
+
Logger* logger_;
|
1121
|
+
StackGuard stack_guard_;
|
1122
|
+
StatsTable* stats_table_;
|
1123
|
+
StubCache* stub_cache_;
|
1124
|
+
DeoptimizerData* deoptimizer_data_;
|
1125
|
+
ThreadLocalTop thread_local_top_;
|
1126
|
+
bool capture_stack_trace_for_uncaught_exceptions_;
|
1127
|
+
int stack_trace_for_uncaught_exceptions_frame_limit_;
|
1128
|
+
StackTrace::StackTraceOptions stack_trace_for_uncaught_exceptions_options_;
|
1129
|
+
TranscendentalCache* transcendental_cache_;
|
1130
|
+
MemoryAllocator* memory_allocator_;
|
1131
|
+
KeyedLookupCache* keyed_lookup_cache_;
|
1132
|
+
ContextSlotCache* context_slot_cache_;
|
1133
|
+
DescriptorLookupCache* descriptor_lookup_cache_;
|
1134
|
+
v8::ImplementationUtilities::HandleScopeData handle_scope_data_;
|
1135
|
+
HandleScopeImplementer* handle_scope_implementer_;
|
1136
|
+
UnicodeCache* unicode_cache_;
|
1137
|
+
Zone zone_;
|
1138
|
+
PreallocatedStorage in_use_list_;
|
1139
|
+
PreallocatedStorage free_list_;
|
1140
|
+
bool preallocated_storage_preallocated_;
|
1141
|
+
PcToCodeCache* pc_to_code_cache_;
|
1142
|
+
StringInputBuffer* write_input_buffer_;
|
1143
|
+
GlobalHandles* global_handles_;
|
1144
|
+
ContextSwitcher* context_switcher_;
|
1145
|
+
ThreadManager* thread_manager_;
|
1146
|
+
AstSentinels* ast_sentinels_;
|
1147
|
+
RuntimeState runtime_state_;
|
1148
|
+
StaticResource<SafeStringInputBuffer> compiler_safe_string_input_buffer_;
|
1149
|
+
Builtins builtins_;
|
1150
|
+
StringTracker* string_tracker_;
|
1151
|
+
unibrow::Mapping<unibrow::Ecma262UnCanonicalize> jsregexp_uncanonicalize_;
|
1152
|
+
unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_;
|
1153
|
+
StringInputBuffer objects_string_compare_buffer_a_;
|
1154
|
+
StringInputBuffer objects_string_compare_buffer_b_;
|
1155
|
+
StaticResource<StringInputBuffer> objects_string_input_buffer_;
|
1156
|
+
unibrow::Mapping<unibrow::Ecma262Canonicalize>
|
1157
|
+
regexp_macro_assembler_canonicalize_;
|
1158
|
+
RegExpStack* regexp_stack_;
|
1159
|
+
unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_;
|
1160
|
+
ZoneObjectList frame_element_constant_list_;
|
1161
|
+
ZoneObjectList result_constant_list_;
|
1162
|
+
void* embedder_data_;
|
1163
|
+
|
1164
|
+
#if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
|
1165
|
+
defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__)
|
1166
|
+
bool simulator_initialized_;
|
1167
|
+
HashMap* simulator_i_cache_;
|
1168
|
+
Redirection* simulator_redirection_;
|
1169
|
+
#endif
|
1170
|
+
|
1171
|
+
#ifdef DEBUG
|
1172
|
+
// A static array of histogram info for each type.
|
1173
|
+
HistogramInfo heap_histograms_[LAST_TYPE + 1];
|
1174
|
+
JSObject::SpillInformation js_spill_information_;
|
1175
|
+
int code_kind_statistics_[Code::NUMBER_OF_KINDS];
|
1176
|
+
#endif
|
1177
|
+
|
1178
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
1179
|
+
Debugger* debugger_;
|
1180
|
+
Debug* debug_;
|
1181
|
+
#endif
|
1182
|
+
|
1183
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
1184
|
+
ProducerHeapProfile* producer_heap_profile_;
|
1185
|
+
#endif
|
1186
|
+
|
1187
|
+
#define GLOBAL_BACKING_STORE(type, name, initialvalue) \
|
1188
|
+
type name##_;
|
1189
|
+
ISOLATE_INIT_LIST(GLOBAL_BACKING_STORE)
|
1190
|
+
#undef GLOBAL_BACKING_STORE
|
1191
|
+
|
1192
|
+
#define GLOBAL_ARRAY_BACKING_STORE(type, name, length) \
|
1193
|
+
type name##_[length];
|
1194
|
+
ISOLATE_INIT_ARRAY_LIST(GLOBAL_ARRAY_BACKING_STORE)
|
1195
|
+
#undef GLOBAL_ARRAY_BACKING_STORE
|
1196
|
+
|
1197
|
+
#ifdef DEBUG
|
1198
|
+
// This class is huge and has a number of fields controlled by
|
1199
|
+
// preprocessor defines. Make sure the offsets of these fields agree
|
1200
|
+
// between compilation units.
|
1201
|
+
#define ISOLATE_FIELD_OFFSET(type, name, ignored) \
|
1202
|
+
static const intptr_t name##_debug_offset_;
|
1203
|
+
ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
|
1204
|
+
ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
|
1205
|
+
#undef ISOLATE_FIELD_OFFSET
|
1206
|
+
#endif
|
1207
|
+
|
1208
|
+
friend class ExecutionAccess;
|
1209
|
+
friend class IsolateInitializer;
|
1210
|
+
friend class ThreadManager;
|
1211
|
+
friend class Simulator;
|
1212
|
+
friend class StackGuard;
|
1213
|
+
friend class ThreadId;
|
1214
|
+
friend class v8::Isolate;
|
1215
|
+
friend class v8::Locker;
|
1216
|
+
friend class v8::Unlocker;
|
1217
|
+
|
1218
|
+
DISALLOW_COPY_AND_ASSIGN(Isolate);
|
1219
|
+
};
|
1220
|
+
|
1221
|
+
|
1222
|
+
// If the GCC version is 4.1.x or 4.2.x an additional field is added to the
|
1223
|
+
// class as a work around for a bug in the generated code found with these
|
1224
|
+
// versions of GCC. See V8 issue 122 for details.
|
1225
|
+
class SaveContext BASE_EMBEDDED {
|
1226
|
+
public:
|
1227
|
+
explicit SaveContext(Isolate* isolate) : prev_(isolate->save_context()) {
|
1228
|
+
if (isolate->context() != NULL) {
|
1229
|
+
context_ = Handle<Context>(isolate->context());
|
1230
|
+
#if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300
|
1231
|
+
dummy_ = Handle<Context>(isolate->context());
|
1232
|
+
#endif
|
1233
|
+
}
|
1234
|
+
isolate->set_save_context(this);
|
1235
|
+
|
1236
|
+
// If there is no JS frame under the current C frame, use the value 0.
|
1237
|
+
JavaScriptFrameIterator it(isolate);
|
1238
|
+
js_sp_ = it.done() ? 0 : it.frame()->sp();
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
~SaveContext() {
|
1242
|
+
if (context_.is_null()) {
|
1243
|
+
Isolate* isolate = Isolate::Current();
|
1244
|
+
isolate->set_context(NULL);
|
1245
|
+
isolate->set_save_context(prev_);
|
1246
|
+
} else {
|
1247
|
+
Isolate* isolate = context_->GetIsolate();
|
1248
|
+
isolate->set_context(*context_);
|
1249
|
+
isolate->set_save_context(prev_);
|
1250
|
+
}
|
1251
|
+
}
|
1252
|
+
|
1253
|
+
Handle<Context> context() { return context_; }
|
1254
|
+
SaveContext* prev() { return prev_; }
|
1255
|
+
|
1256
|
+
// Returns true if this save context is below a given JavaScript frame.
|
1257
|
+
bool below(JavaScriptFrame* frame) {
|
1258
|
+
return (js_sp_ == 0) || (frame->sp() < js_sp_);
|
1259
|
+
}
|
1260
|
+
|
1261
|
+
private:
|
1262
|
+
Handle<Context> context_;
|
1263
|
+
#if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300
|
1264
|
+
Handle<Context> dummy_;
|
1265
|
+
#endif
|
1266
|
+
SaveContext* prev_;
|
1267
|
+
Address js_sp_; // The top JS frame's sp when saving context.
|
1268
|
+
};
|
1269
|
+
|
1270
|
+
|
1271
|
+
class AssertNoContextChange BASE_EMBEDDED {
|
1272
|
+
#ifdef DEBUG
|
1273
|
+
public:
|
1274
|
+
AssertNoContextChange() :
|
1275
|
+
scope_(Isolate::Current()),
|
1276
|
+
context_(Isolate::Current()->context(), Isolate::Current()) {
|
1277
|
+
}
|
1278
|
+
|
1279
|
+
~AssertNoContextChange() {
|
1280
|
+
ASSERT(Isolate::Current()->context() == *context_);
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
private:
|
1284
|
+
HandleScope scope_;
|
1285
|
+
Handle<Context> context_;
|
1286
|
+
#else
|
1287
|
+
public:
|
1288
|
+
AssertNoContextChange() { }
|
1289
|
+
#endif
|
1290
|
+
};
|
1291
|
+
|
1292
|
+
|
1293
|
+
class ExecutionAccess BASE_EMBEDDED {
|
1294
|
+
public:
|
1295
|
+
explicit ExecutionAccess(Isolate* isolate) : isolate_(isolate) {
|
1296
|
+
Lock(isolate);
|
1297
|
+
}
|
1298
|
+
~ExecutionAccess() { Unlock(isolate_); }
|
1299
|
+
|
1300
|
+
static void Lock(Isolate* isolate) { isolate->break_access_->Lock(); }
|
1301
|
+
static void Unlock(Isolate* isolate) { isolate->break_access_->Unlock(); }
|
1302
|
+
|
1303
|
+
static bool TryLock(Isolate* isolate) {
|
1304
|
+
return isolate->break_access_->TryLock();
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
private:
|
1308
|
+
Isolate* isolate_;
|
1309
|
+
};
|
1310
|
+
|
1311
|
+
|
1312
|
+
// Support for checking for stack-overflows in C++ code.
|
1313
|
+
class StackLimitCheck BASE_EMBEDDED {
|
1314
|
+
public:
|
1315
|
+
explicit StackLimitCheck(Isolate* isolate) : isolate_(isolate) { }
|
1316
|
+
|
1317
|
+
bool HasOverflowed() const {
|
1318
|
+
StackGuard* stack_guard = isolate_->stack_guard();
|
1319
|
+
// Stack has overflowed in C++ code only if stack pointer exceeds the C++
|
1320
|
+
// stack guard and the limits are not set to interrupt values.
|
1321
|
+
// TODO(214): Stack overflows are ignored if a interrupt is pending. This
|
1322
|
+
// code should probably always use the initial C++ limit.
|
1323
|
+
return (reinterpret_cast<uintptr_t>(this) < stack_guard->climit()) &&
|
1324
|
+
stack_guard->IsStackOverflow();
|
1325
|
+
}
|
1326
|
+
private:
|
1327
|
+
Isolate* isolate_;
|
1328
|
+
};
|
1329
|
+
|
1330
|
+
|
1331
|
+
// Support for temporarily postponing interrupts. When the outermost
|
1332
|
+
// postpone scope is left the interrupts will be re-enabled and any
|
1333
|
+
// interrupts that occurred while in the scope will be taken into
|
1334
|
+
// account.
|
1335
|
+
class PostponeInterruptsScope BASE_EMBEDDED {
|
1336
|
+
public:
|
1337
|
+
explicit PostponeInterruptsScope(Isolate* isolate)
|
1338
|
+
: stack_guard_(isolate->stack_guard()) {
|
1339
|
+
stack_guard_->thread_local_.postpone_interrupts_nesting_++;
|
1340
|
+
stack_guard_->DisableInterrupts();
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
~PostponeInterruptsScope() {
|
1344
|
+
if (--stack_guard_->thread_local_.postpone_interrupts_nesting_ == 0) {
|
1345
|
+
stack_guard_->EnableInterrupts();
|
1346
|
+
}
|
1347
|
+
}
|
1348
|
+
private:
|
1349
|
+
StackGuard* stack_guard_;
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
|
1353
|
+
// Temporary macros for accessing current isolate and its subobjects.
|
1354
|
+
// They provide better readability, especially when used a lot in the code.
|
1355
|
+
#define HEAP (v8::internal::Isolate::Current()->heap())
|
1356
|
+
#define FACTORY (v8::internal::Isolate::Current()->factory())
|
1357
|
+
#define ISOLATE (v8::internal::Isolate::Current())
|
1358
|
+
#define ZONE (v8::internal::Isolate::Current()->zone())
|
1359
|
+
#define LOGGER (v8::internal::Isolate::Current()->logger())
|
1360
|
+
|
1361
|
+
|
1362
|
+
// Tells whether the global context is marked with out of memory.
|
1363
|
+
inline bool Context::has_out_of_memory() {
|
1364
|
+
return global_context()->out_of_memory()->IsTrue();
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
|
1368
|
+
// Mark the global context with out of memory.
|
1369
|
+
inline void Context::mark_out_of_memory() {
|
1370
|
+
global_context()->set_out_of_memory(HEAP->true_value());
|
1371
|
+
}
|
1372
|
+
|
1373
|
+
|
1374
|
+
} } // namespace v8::internal
|
1375
|
+
|
1376
|
+
// TODO(isolates): Get rid of these -inl.h includes and place them only where
|
1377
|
+
// they're needed.
|
1378
|
+
#include "allocation-inl.h"
|
1379
|
+
#include "zone-inl.h"
|
1380
|
+
#include "frames-inl.h"
|
1381
|
+
|
1382
|
+
#endif // V8_ISOLATE_H_
|