therubyracer 0.8.1.pre2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/Changelog.md +2 -1
- data/README.md +6 -3
- data/ext/v8/upstream/3.1.8/.gitignore +31 -0
- data/ext/v8/upstream/3.1.8/AUTHORS +40 -0
- data/ext/v8/upstream/3.1.8/ChangeLog +2566 -0
- data/ext/v8/upstream/3.1.8/LICENSE +52 -0
- data/ext/v8/upstream/3.1.8/LICENSE.strongtalk +29 -0
- data/ext/v8/upstream/3.1.8/LICENSE.v8 +26 -0
- data/ext/v8/upstream/3.1.8/LICENSE.valgrind +45 -0
- data/ext/v8/upstream/3.1.8/SConstruct +1192 -0
- data/ext/v8/upstream/3.1.8/build/README.txt +25 -0
- data/ext/v8/upstream/3.1.8/build/all.gyp +18 -0
- data/ext/v8/upstream/3.1.8/build/armu.gypi +32 -0
- data/ext/v8/upstream/3.1.8/build/common.gypi +82 -0
- data/ext/v8/upstream/3.1.8/build/gyp_v8 +145 -0
- data/ext/v8/upstream/3.1.8/include/v8-debug.h +384 -0
- data/ext/v8/upstream/3.1.8/include/v8-preparser.h +116 -0
- data/ext/v8/upstream/3.1.8/include/v8-profiler.h +426 -0
- data/ext/v8/upstream/3.1.8/include/v8-testing.h +99 -0
- data/ext/v8/upstream/3.1.8/include/v8.h +3846 -0
- data/ext/v8/upstream/3.1.8/include/v8stdint.h +53 -0
- data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +206 -0
- data/ext/v8/upstream/3.1.8/src/SConscript +356 -0
- data/ext/v8/upstream/3.1.8/src/accessors.cc +907 -0
- data/ext/v8/upstream/3.1.8/src/accessors.h +121 -0
- data/ext/v8/upstream/3.1.8/src/allocation.cc +204 -0
- data/ext/v8/upstream/3.1.8/src/allocation.h +176 -0
- data/ext/v8/upstream/3.1.8/src/api.cc +5191 -0
- data/ext/v8/upstream/3.1.8/src/api.h +508 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/apinatives.js +0 -0
- data/ext/v8/upstream/3.1.8/src/apiutils.h +80 -0
- data/ext/v8/upstream/3.1.8/src/arguments.h +105 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +352 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +2756 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +1294 -0
- data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +1628 -0
- data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +6783 -0
- data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +657 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm-inl.h +48 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +7403 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +595 -0
- data/ext/v8/upstream/3.1.8/src/arm/constants-arm.cc +152 -0
- data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +769 -0
- data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +147 -0
- data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +315 -0
- data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +700 -0
- data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +1439 -0
- data/ext/v8/upstream/3.1.8/src/arm/frames-arm.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +168 -0
- data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +4230 -0
- data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +1799 -0
- data/ext/v8/upstream/3.1.8/src/arm/jump-target-arm.cc +174 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +2041 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +2046 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +3822 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +312 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +303 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +2701 -0
- data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +1015 -0
- data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +1280 -0
- data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +252 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.h +0 -0
- data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +3165 -0
- data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +402 -0
- data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +4077 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/virtual-frame-arm-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +843 -0
- data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +520 -0
- data/ext/v8/upstream/3.1.8/src/array.js +1231 -0
- data/ext/v8/upstream/3.1.8/src/assembler.cc +973 -0
- data/ext/v8/upstream/3.1.8/src/assembler.h +787 -0
- data/ext/v8/upstream/3.1.8/src/ast-inl.h +107 -0
- data/ext/v8/upstream/3.1.8/src/ast.cc +1067 -0
- data/ext/v8/upstream/3.1.8/src/ast.h +2177 -0
- data/ext/v8/upstream/3.1.8/src/atomicops.h +165 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_arm_gcc.h +145 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.cc +126 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.h +287 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_macosx.h +301 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_msvc.h +203 -0
- data/ext/v8/upstream/3.1.8/src/bignum-dtoa.cc +655 -0
- data/ext/v8/upstream/3.1.8/src/bignum-dtoa.h +81 -0
- data/ext/v8/upstream/3.1.8/src/bignum.cc +768 -0
- data/ext/v8/upstream/3.1.8/src/bignum.h +140 -0
- data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +1888 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/bootstrapper.h +0 -0
- data/ext/v8/upstream/3.1.8/src/builtins.cc +1586 -0
- data/ext/v8/upstream/3.1.8/src/builtins.h +339 -0
- data/ext/v8/upstream/3.1.8/src/bytecodes-irregexp.h +105 -0
- data/ext/v8/upstream/3.1.8/src/cached-powers.cc +177 -0
- data/ext/v8/upstream/3.1.8/src/cached-powers.h +65 -0
- data/ext/v8/upstream/3.1.8/src/char-predicates-inl.h +94 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/char-predicates.h +0 -0
- data/ext/v8/upstream/3.1.8/src/checks.cc +110 -0
- data/ext/v8/upstream/3.1.8/src/checks.h +292 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/circular-queue.cc +122 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue.h +0 -0
- data/ext/v8/upstream/3.1.8/src/code-stubs.cc +230 -0
- data/ext/v8/upstream/3.1.8/src/code-stubs.h +950 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/code.h +0 -0
- data/ext/v8/upstream/3.1.8/src/codegen-inl.h +64 -0
- data/ext/v8/upstream/3.1.8/src/codegen.cc +495 -0
- data/ext/v8/upstream/3.1.8/src/codegen.h +245 -0
- data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +654 -0
- data/ext/v8/upstream/3.1.8/src/compilation-cache.h +112 -0
- data/ext/v8/upstream/3.1.8/src/compiler.cc +806 -0
- data/ext/v8/upstream/3.1.8/src/compiler.h +290 -0
- data/ext/v8/upstream/3.1.8/src/contexts.cc +320 -0
- data/ext/v8/upstream/3.1.8/src/contexts.h +376 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/conversions-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/conversions.cc +1069 -0
- data/ext/v8/upstream/3.1.8/src/conversions.h +122 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/counters.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/counters.h +242 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +100 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +554 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +291 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/cpu.h +0 -0
- data/ext/v8/upstream/3.1.8/src/d8-debug.cc +367 -0
- data/ext/v8/upstream/3.1.8/src/d8-debug.h +157 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-posix.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-readline.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-windows.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/d8.cc +792 -0
- data/ext/v8/upstream/3.1.8/src/d8.gyp +85 -0
- data/ext/v8/upstream/3.1.8/src/d8.h +231 -0
- data/ext/v8/upstream/3.1.8/src/d8.js +2798 -0
- data/ext/v8/upstream/3.1.8/src/data-flow.cc +545 -0
- data/ext/v8/upstream/3.1.8/src/data-flow.h +379 -0
- data/ext/v8/upstream/3.1.8/src/date.js +1103 -0
- data/ext/v8/upstream/3.1.8/src/dateparser-inl.h +125 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/dateparser.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/dateparser.h +263 -0
- data/ext/v8/upstream/3.1.8/src/debug-agent.cc +446 -0
- data/ext/v8/upstream/3.1.8/src/debug-agent.h +131 -0
- data/ext/v8/upstream/3.1.8/src/debug-debugger.js +2569 -0
- data/ext/v8/upstream/3.1.8/src/debug.cc +3085 -0
- data/ext/v8/upstream/3.1.8/src/debug.h +1025 -0
- data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +1185 -0
- data/ext/v8/upstream/3.1.8/src/deoptimizer.h +529 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disasm.h +0 -0
- data/ext/v8/upstream/3.1.8/src/disassembler.cc +338 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disassembler.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.h +0 -0
- data/ext/v8/upstream/3.1.8/src/double.h +238 -0
- data/ext/v8/upstream/3.1.8/src/dtoa.cc +103 -0
- data/ext/v8/upstream/3.1.8/src/dtoa.h +85 -0
- data/ext/v8/upstream/3.1.8/src/execution.cc +735 -0
- data/ext/v8/upstream/3.1.8/src/execution.h +322 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +53 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +264 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.h +64 -0
- data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +141 -0
- data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.h +50 -0
- data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +58 -0
- data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.h +49 -0
- data/ext/v8/upstream/3.1.8/src/factory.cc +1087 -0
- data/ext/v8/upstream/3.1.8/src/factory.h +432 -0
- data/ext/v8/upstream/3.1.8/src/fast-dtoa.cc +736 -0
- data/ext/v8/upstream/3.1.8/src/fast-dtoa.h +83 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.h +0 -0
- data/ext/v8/upstream/3.1.8/src/flag-definitions.h +552 -0
- data/ext/v8/upstream/3.1.8/src/flags.cc +551 -0
- data/ext/v8/upstream/3.1.8/src/flags.h +79 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/frame-element.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/frame-element.h +277 -0
- data/ext/v8/upstream/3.1.8/src/frames-inl.h +210 -0
- data/ext/v8/upstream/3.1.8/src/frames.cc +1232 -0
- data/ext/v8/upstream/3.1.8/src/frames.h +826 -0
- data/ext/v8/upstream/3.1.8/src/full-codegen.cc +1382 -0
- data/ext/v8/upstream/3.1.8/src/full-codegen.h +751 -0
- data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +90 -0
- data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +111 -0
- data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +1547 -0
- data/ext/v8/upstream/3.1.8/src/gdb-jit.h +138 -0
- data/ext/v8/upstream/3.1.8/src/global-handles.cc +534 -0
- data/ext/v8/upstream/3.1.8/src/global-handles.h +181 -0
- data/ext/v8/upstream/3.1.8/src/globals.h +325 -0
- data/ext/v8/upstream/3.1.8/src/handles-inl.h +80 -0
- data/ext/v8/upstream/3.1.8/src/handles.cc +910 -0
- data/ext/v8/upstream/3.1.8/src/handles.h +424 -0
- data/ext/v8/upstream/3.1.8/src/hashmap.cc +230 -0
- data/ext/v8/upstream/3.1.8/src/hashmap.h +121 -0
- data/ext/v8/upstream/3.1.8/src/heap-inl.h +587 -0
- data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +1128 -0
- data/ext/v8/upstream/3.1.8/src/heap-profiler.h +381 -0
- data/ext/v8/upstream/3.1.8/src/heap.cc +5610 -0
- data/ext/v8/upstream/3.1.8/src/heap.h +2218 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +1490 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +3493 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen.cc +6056 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen.h +1091 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +429 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +2800 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +1093 -0
- data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +1590 -0
- data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +6624 -0
- data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +536 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/codegen-ia32-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +10354 -0
- data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +798 -0
- data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +87 -0
- data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +309 -0
- data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +664 -0
- data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +1597 -0
- data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +140 -0
- data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +4278 -0
- data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +1786 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/jump-target-ia32.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +3880 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +309 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +460 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +2095 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +2127 -0
- data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +2031 -0
- data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +798 -0
- data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +1253 -0
- data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +215 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/simulator-ia32.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +72 -0
- data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +3732 -0
- data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +1360 -0
- data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +646 -0
- data/ext/v8/upstream/3.1.8/src/ic-inl.h +129 -0
- data/ext/v8/upstream/3.1.8/src/ic.cc +2333 -0
- data/ext/v8/upstream/3.1.8/src/ic.h +639 -0
- data/ext/v8/upstream/3.1.8/src/inspector.cc +63 -0
- data/ext/v8/upstream/3.1.8/src/inspector.h +62 -0
- data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +655 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/interpreter-irregexp.h +0 -0
- data/ext/v8/upstream/3.1.8/src/json.js +342 -0
- data/ext/v8/upstream/3.1.8/src/jsregexp.cc +5340 -0
- data/ext/v8/upstream/3.1.8/src/jsregexp.h +1484 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-heavy-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +430 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +244 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-light-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +111 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-light.h +193 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.h +0 -0
- data/ext/v8/upstream/3.1.8/src/list-inl.h +206 -0
- data/ext/v8/upstream/3.1.8/src/list.h +164 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +140 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +2093 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +644 -0
- data/ext/v8/upstream/3.1.8/src/lithium.cc +168 -0
- data/ext/v8/upstream/3.1.8/src/lithium.h +592 -0
- data/ext/v8/upstream/3.1.8/src/liveedit-debugger.js +1082 -0
- data/ext/v8/upstream/3.1.8/src/liveedit.cc +1650 -0
- data/ext/v8/upstream/3.1.8/src/liveedit.h +174 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist-inl.h +126 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +2527 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +322 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/log-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/log-utils.cc +336 -0
- data/ext/v8/upstream/3.1.8/src/log-utils.h +232 -0
- data/ext/v8/upstream/3.1.8/src/log.cc +1608 -0
- data/ext/v8/upstream/3.1.8/src/log.h +379 -0
- data/ext/v8/upstream/3.1.8/src/macro-assembler.h +120 -0
- data/ext/v8/upstream/3.1.8/src/macros.py +178 -0
- data/ext/v8/upstream/3.1.8/src/mark-compact.cc +2957 -0
- data/ext/v8/upstream/3.1.8/src/mark-compact.h +433 -0
- data/ext/v8/upstream/3.1.8/src/math.js +264 -0
- data/ext/v8/upstream/3.1.8/src/memory.h +82 -0
- data/ext/v8/upstream/3.1.8/src/messages.cc +164 -0
- data/ext/v8/upstream/3.1.8/src/messages.h +114 -0
- data/ext/v8/upstream/3.1.8/src/messages.js +1071 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +667 -0
- data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +205 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +431 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/cpu-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +127 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/disasm-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/fast-codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +96 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/frames-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/full-codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +208 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/jump-target-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.h +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +1650 -0
- data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +311 -0
- data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +418 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.h +0 -0
- data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +2380 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mksnapshot.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/natives.h +0 -0
- data/ext/v8/upstream/3.1.8/src/objects-debug.cc +722 -0
- data/ext/v8/upstream/3.1.8/src/objects-inl.h +3946 -0
- data/ext/v8/upstream/3.1.8/src/objects-printer.cc +801 -0
- data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +142 -0
- data/ext/v8/upstream/3.1.8/src/objects-visiting.h +401 -0
- data/ext/v8/upstream/3.1.8/src/objects.cc +10044 -0
- data/ext/v8/upstream/3.1.8/src/objects.h +6571 -0
- data/ext/v8/upstream/3.1.8/src/parser.cc +5165 -0
- data/ext/v8/upstream/3.1.8/src/parser.h +802 -0
- data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +745 -0
- data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +702 -0
- data/ext/v8/upstream/3.1.8/src/platform-linux.cc +981 -0
- data/ext/v8/upstream/3.1.8/src/platform-macos.cc +732 -0
- data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +498 -0
- data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +657 -0
- data/ext/v8/upstream/3.1.8/src/platform-posix.cc +399 -0
- data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +714 -0
- data/ext/v8/upstream/3.1.8/src/platform-win32.cc +1974 -0
- data/ext/v8/upstream/3.1.8/src/platform.h +636 -0
- data/ext/v8/upstream/3.1.8/src/preparse-data.cc +183 -0
- data/ext/v8/upstream/3.1.8/src/preparse-data.h +249 -0
- data/ext/v8/upstream/3.1.8/src/preparser-api.cc +213 -0
- data/ext/v8/upstream/3.1.8/src/preparser.cc +1205 -0
- data/ext/v8/upstream/3.1.8/src/preparser.h +278 -0
- data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +1539 -0
- data/ext/v8/upstream/3.1.8/src/prettyprinter.h +223 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator-inl.h +128 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator.cc +2899 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator.h +1151 -0
- data/ext/v8/upstream/3.1.8/src/property.cc +96 -0
- data/ext/v8/upstream/3.1.8/src/property.h +337 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +470 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.h +104 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +257 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +231 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.h +0 -0
- data/ext/v8/upstream/3.1.8/src/regexp.js +483 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.h +0 -0
- data/ext/v8/upstream/3.1.8/src/rewriter.cc +1023 -0
- data/ext/v8/upstream/3.1.8/src/rewriter.h +59 -0
- data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +443 -0
- data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +77 -0
- data/ext/v8/upstream/3.1.8/src/runtime.cc +11592 -0
- data/ext/v8/upstream/3.1.8/src/runtime.h +582 -0
- data/ext/v8/upstream/3.1.8/src/runtime.js +643 -0
- data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +253 -0
- data/ext/v8/upstream/3.1.8/src/safepoint-table.h +263 -0
- data/ext/v8/upstream/3.1.8/src/scanner-base.cc +971 -0
- data/ext/v8/upstream/3.1.8/src/scanner-base.h +653 -0
- data/ext/v8/upstream/3.1.8/src/scanner.cc +586 -0
- data/ext/v8/upstream/3.1.8/src/scanner.h +194 -0
- data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +636 -0
- data/ext/v8/upstream/3.1.8/src/scopeinfo.h +238 -0
- data/ext/v8/upstream/3.1.8/src/scopes.cc +1063 -0
- data/ext/v8/upstream/3.1.8/src/scopes.h +494 -0
- data/ext/v8/upstream/3.1.8/src/serialize.cc +1535 -0
- data/ext/v8/upstream/3.1.8/src/serialize.h +584 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/shell.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/simulator.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/smart-pointer.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-common.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-empty.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot.h +0 -0
- data/ext/v8/upstream/3.1.8/src/spaces-inl.h +524 -0
- data/ext/v8/upstream/3.1.8/src/spaces.cc +3254 -0
- data/ext/v8/upstream/3.1.8/src/spaces.h +2362 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree.h +0 -0
- data/ext/v8/upstream/3.1.8/src/string-search.cc +40 -0
- data/ext/v8/upstream/3.1.8/src/string-search.h +567 -0
- data/ext/v8/upstream/3.1.8/src/string-stream.cc +584 -0
- data/ext/v8/upstream/3.1.8/src/string-stream.h +191 -0
- data/ext/v8/upstream/3.1.8/src/string.js +915 -0
- data/ext/v8/upstream/3.1.8/src/strtod.cc +440 -0
- data/ext/v8/upstream/3.1.8/src/strtod.h +40 -0
- data/ext/v8/upstream/3.1.8/src/stub-cache.cc +1878 -0
- data/ext/v8/upstream/3.1.8/src/stub-cache.h +849 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/third_party/valgrind/valgrind.h +0 -0
- data/ext/v8/upstream/3.1.8/src/token.cc +63 -0
- data/ext/v8/upstream/3.1.8/src/token.h +288 -0
- data/ext/v8/upstream/3.1.8/src/top.cc +1152 -0
- data/ext/v8/upstream/3.1.8/src/top.h +608 -0
- data/ext/v8/upstream/3.1.8/src/type-info.cc +406 -0
- data/ext/v8/upstream/3.1.8/src/type-info.h +283 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue.h +0 -0
- data/ext/v8/upstream/3.1.8/src/unicode-inl.h +238 -0
- data/ext/v8/upstream/3.1.8/src/unicode.cc +1624 -0
- data/ext/v8/upstream/3.1.8/src/unicode.h +280 -0
- data/ext/v8/upstream/3.1.8/src/uri.js +402 -0
- data/ext/v8/upstream/3.1.8/src/utils.cc +371 -0
- data/ext/v8/upstream/3.1.8/src/utils.h +793 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8-counters.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/v8-counters.h +290 -0
- data/ext/v8/upstream/3.1.8/src/v8.cc +270 -0
- data/ext/v8/upstream/3.1.8/src/v8.h +127 -0
- data/ext/v8/upstream/3.1.8/src/v8checks.h +64 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8dll-main.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/v8globals.h +480 -0
- data/ext/v8/upstream/3.1.8/src/v8natives.js +1252 -0
- data/ext/v8/upstream/3.1.8/src/v8preparserdll-main.cc +39 -0
- data/ext/v8/upstream/3.1.8/src/v8threads.cc +440 -0
- data/ext/v8/upstream/3.1.8/src/v8threads.h +157 -0
- data/ext/v8/upstream/3.1.8/src/v8utils.h +354 -0
- data/ext/v8/upstream/3.1.8/src/variables.cc +132 -0
- data/ext/v8/upstream/3.1.8/src/variables.h +212 -0
- data/ext/v8/upstream/3.1.8/src/version.cc +95 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/version.h +0 -0
- data/ext/v8/upstream/3.1.8/src/virtual-frame-heavy-inl.h +190 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-heavy.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/virtual-frame.h +59 -0
- data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +134 -0
- data/ext/v8/upstream/3.1.8/src/vm-state.h +68 -0
- data/ext/v8/upstream/3.1.8/src/win32-headers.h +95 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +455 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +3162 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +1584 -0
- data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +1492 -0
- data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +5150 -0
- data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +519 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64-inl.h +46 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +8835 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +750 -0
- data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +86 -0
- data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +316 -0
- data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +781 -0
- data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +1737 -0
- data/ext/v8/upstream/3.1.8/src/x64/frames-x64.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +130 -0
- data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +3984 -0
- data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +1761 -0
- data/ext/v8/upstream/3.1.8/src/x64/jump-target-x64.cc +437 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +3639 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +305 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +2044 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +2052 -0
- data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +2660 -0
- data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +1852 -0
- data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +1382 -0
- data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +278 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/simulator-x64.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +71 -0
- data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +3509 -0
- data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +1292 -0
- data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +593 -0
- data/ext/v8/upstream/3.1.8/src/zone-inl.h +83 -0
- data/ext/v8/upstream/3.1.8/src/zone.cc +195 -0
- data/ext/v8/upstream/3.1.8/src/zone.h +233 -0
- data/ext/v8/upstream/3.1.8/tools/codemap.js +265 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/consarray.js +0 -0
- data/ext/v8/upstream/3.1.8/tools/csvparser.js +78 -0
- data/ext/v8/upstream/3.1.8/tools/disasm.py +92 -0
- data/ext/v8/upstream/3.1.8/tools/gc-nvp-trace-processor.py +328 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/generate-ten-powers.scm +0 -0
- data/ext/v8/upstream/3.1.8/tools/grokdump.py +840 -0
- data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +869 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/js2c.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/jsmin.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/linux-tick-processor +0 -0
- data/ext/v8/upstream/3.1.8/tools/ll_prof.py +919 -0
- data/ext/v8/upstream/3.1.8/tools/logreader.js +185 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-nm +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-tick-processor +0 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/README +31 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/SConstruct +42 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/oom_dump.cc +288 -0
- data/ext/v8/upstream/3.1.8/tools/presubmit.py +305 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/process-heap-prof.py +0 -0
- data/ext/v8/upstream/3.1.8/tools/profile.js +751 -0
- data/ext/v8/upstream/3.1.8/tools/profile_view.js +219 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/run-valgrind.py +0 -0
- data/ext/v8/upstream/3.1.8/tools/splaytree.js +316 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/stats-viewer.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/tickprocessor-driver.js +0 -0
- data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +863 -0
- data/ext/v8/upstream/3.1.8/tools/utils.py +96 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/README.txt +70 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/arm.vsprops +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/common.vsprops +34 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8js2c.cmd +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/debug.vsprops +17 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/ia32.vsprops +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/js2c.cmd +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/release.vsprops +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.vcproj +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +1296 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +1234 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +1296 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample.vcproj +147 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_arm.vcproj +147 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_x64.vcproj +163 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/x64.vsprops +0 -0
- data/ext/v8/upstream/3.1.8/tools/windows-tick-processor.bat +30 -0
- data/ext/v8/upstream/Makefile +2 -1
- data/ext/v8/v8_template.cpp +2 -2
- data/lib/v8/version.rb +1 -1
- data/spec/redjs/jsapi_spec.rb +2 -2
- metadata +552 -490
- data/ext/v8/upstream/2.3.3/.gitignore +0 -26
- data/ext/v8/upstream/2.3.3/AUTHORS +0 -31
- data/ext/v8/upstream/2.3.3/ChangeLog +0 -1916
- data/ext/v8/upstream/2.3.3/LICENSE +0 -55
- data/ext/v8/upstream/2.3.3/SConstruct +0 -1154
- data/ext/v8/upstream/2.3.3/include/v8-debug.h +0 -381
- data/ext/v8/upstream/2.3.3/include/v8-profiler.h +0 -353
- data/ext/v8/upstream/2.3.3/include/v8.h +0 -3616
- data/ext/v8/upstream/2.3.3/src/SConscript +0 -330
- data/ext/v8/upstream/2.3.3/src/accessors.cc +0 -661
- data/ext/v8/upstream/2.3.3/src/accessors.h +0 -114
- data/ext/v8/upstream/2.3.3/src/allocation.cc +0 -198
- data/ext/v8/upstream/2.3.3/src/allocation.h +0 -169
- data/ext/v8/upstream/2.3.3/src/api.cc +0 -4795
- data/ext/v8/upstream/2.3.3/src/api.h +0 -485
- data/ext/v8/upstream/2.3.3/src/apiutils.h +0 -69
- data/ext/v8/upstream/2.3.3/src/arguments.h +0 -96
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm-inl.h +0 -305
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.cc +0 -2580
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.h +0 -1275
- data/ext/v8/upstream/2.3.3/src/arm/builtins-arm.cc +0 -1320
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +0 -48
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.cc +0 -11398
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.h +0 -1102
- data/ext/v8/upstream/2.3.3/src/arm/constants-arm.cc +0 -154
- data/ext/v8/upstream/2.3.3/src/arm/constants-arm.h +0 -388
- data/ext/v8/upstream/2.3.3/src/arm/cpu-arm.cc +0 -142
- data/ext/v8/upstream/2.3.3/src/arm/debug-arm.cc +0 -309
- data/ext/v8/upstream/2.3.3/src/arm/disasm-arm.cc +0 -1459
- data/ext/v8/upstream/2.3.3/src/arm/fast-codegen-arm.cc +0 -241
- data/ext/v8/upstream/2.3.3/src/arm/frames-arm.cc +0 -123
- data/ext/v8/upstream/2.3.3/src/arm/frames-arm.h +0 -162
- data/ext/v8/upstream/2.3.3/src/arm/full-codegen-arm.cc +0 -3178
- data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +0 -2258
- data/ext/v8/upstream/2.3.3/src/arm/jump-target-arm.cc +0 -164
- data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.cc +0 -1892
- data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.h +0 -727
- data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.cc +0 -1261
- data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.h +0 -266
- data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.cc +0 -2822
- data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.h +0 -361
- data/ext/v8/upstream/2.3.3/src/arm/stub-cache-arm.cc +0 -2387
- data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.cc +0 -834
- data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.h +0 -519
- data/ext/v8/upstream/2.3.3/src/array.js +0 -1127
- data/ext/v8/upstream/2.3.3/src/assembler.cc +0 -801
- data/ext/v8/upstream/2.3.3/src/assembler.h +0 -573
- data/ext/v8/upstream/2.3.3/src/ast-inl.h +0 -81
- data/ext/v8/upstream/2.3.3/src/ast.cc +0 -1152
- data/ext/v8/upstream/2.3.3/src/ast.h +0 -2106
- data/ext/v8/upstream/2.3.3/src/bootstrapper.cc +0 -1819
- data/ext/v8/upstream/2.3.3/src/builtins.cc +0 -1529
- data/ext/v8/upstream/2.3.3/src/builtins.h +0 -263
- data/ext/v8/upstream/2.3.3/src/bytecodes-irregexp.h +0 -104
- data/ext/v8/upstream/2.3.3/src/cached-powers.h +0 -119
- data/ext/v8/upstream/2.3.3/src/char-predicates-inl.h +0 -86
- data/ext/v8/upstream/2.3.3/src/checks.cc +0 -100
- data/ext/v8/upstream/2.3.3/src/checks.h +0 -310
- data/ext/v8/upstream/2.3.3/src/circular-queue.cc +0 -121
- data/ext/v8/upstream/2.3.3/src/code-stubs.cc +0 -177
- data/ext/v8/upstream/2.3.3/src/code-stubs.h +0 -177
- data/ext/v8/upstream/2.3.3/src/codegen-inl.h +0 -60
- data/ext/v8/upstream/2.3.3/src/codegen.cc +0 -516
- data/ext/v8/upstream/2.3.3/src/codegen.h +0 -897
- data/ext/v8/upstream/2.3.3/src/compilation-cache.cc +0 -562
- data/ext/v8/upstream/2.3.3/src/compilation-cache.h +0 -102
- data/ext/v8/upstream/2.3.3/src/compiler.cc +0 -654
- data/ext/v8/upstream/2.3.3/src/compiler.h +0 -299
- data/ext/v8/upstream/2.3.3/src/contexts.cc +0 -256
- data/ext/v8/upstream/2.3.3/src/contexts.h +0 -342
- data/ext/v8/upstream/2.3.3/src/conversions.cc +0 -1119
- data/ext/v8/upstream/2.3.3/src/conversions.h +0 -123
- data/ext/v8/upstream/2.3.3/src/counters.h +0 -239
- data/ext/v8/upstream/2.3.3/src/cpu-profiler-inl.h +0 -100
- data/ext/v8/upstream/2.3.3/src/cpu-profiler.cc +0 -538
- data/ext/v8/upstream/2.3.3/src/cpu-profiler.h +0 -285
- data/ext/v8/upstream/2.3.3/src/d8-debug.cc +0 -356
- data/ext/v8/upstream/2.3.3/src/d8-debug.h +0 -155
- data/ext/v8/upstream/2.3.3/src/d8.cc +0 -783
- data/ext/v8/upstream/2.3.3/src/d8.h +0 -227
- data/ext/v8/upstream/2.3.3/src/d8.js +0 -1683
- data/ext/v8/upstream/2.3.3/src/data-flow.cc +0 -758
- data/ext/v8/upstream/2.3.3/src/data-flow.h +0 -278
- data/ext/v8/upstream/2.3.3/src/date.js +0 -1059
- data/ext/v8/upstream/2.3.3/src/dateparser-inl.h +0 -123
- data/ext/v8/upstream/2.3.3/src/dateparser.h +0 -244
- data/ext/v8/upstream/2.3.3/src/debug-agent.cc +0 -427
- data/ext/v8/upstream/2.3.3/src/debug-agent.h +0 -129
- data/ext/v8/upstream/2.3.3/src/debug-debugger.js +0 -2227
- data/ext/v8/upstream/2.3.3/src/debug.cc +0 -3005
- data/ext/v8/upstream/2.3.3/src/debug.h +0 -993
- data/ext/v8/upstream/2.3.3/src/disassembler.cc +0 -312
- data/ext/v8/upstream/2.3.3/src/double.h +0 -169
- data/ext/v8/upstream/2.3.3/src/dtoa-config.c +0 -92
- data/ext/v8/upstream/2.3.3/src/dtoa.cc +0 -77
- data/ext/v8/upstream/2.3.3/src/dtoa.h +0 -81
- data/ext/v8/upstream/2.3.3/src/execution.cc +0 -809
- data/ext/v8/upstream/2.3.3/src/execution.h +0 -336
- data/ext/v8/upstream/2.3.3/src/factory.cc +0 -1003
- data/ext/v8/upstream/2.3.3/src/factory.h +0 -410
- data/ext/v8/upstream/2.3.3/src/fast-codegen.cc +0 -746
- data/ext/v8/upstream/2.3.3/src/fast-codegen.h +0 -161
- data/ext/v8/upstream/2.3.3/src/fast-dtoa.cc +0 -505
- data/ext/v8/upstream/2.3.3/src/fast-dtoa.h +0 -58
- data/ext/v8/upstream/2.3.3/src/flag-definitions.h +0 -455
- data/ext/v8/upstream/2.3.3/src/flags.cc +0 -551
- data/ext/v8/upstream/2.3.3/src/flags.h +0 -81
- data/ext/v8/upstream/2.3.3/src/flow-graph.cc +0 -763
- data/ext/v8/upstream/2.3.3/src/flow-graph.h +0 -180
- data/ext/v8/upstream/2.3.3/src/frame-element.h +0 -273
- data/ext/v8/upstream/2.3.3/src/frames-inl.h +0 -217
- data/ext/v8/upstream/2.3.3/src/frames.cc +0 -826
- data/ext/v8/upstream/2.3.3/src/frames.h +0 -682
- data/ext/v8/upstream/2.3.3/src/full-codegen.cc +0 -1443
- data/ext/v8/upstream/2.3.3/src/full-codegen.h +0 -548
- data/ext/v8/upstream/2.3.3/src/func-name-inferrer.cc +0 -76
- data/ext/v8/upstream/2.3.3/src/func-name-inferrer.h +0 -135
- data/ext/v8/upstream/2.3.3/src/global-handles.cc +0 -520
- data/ext/v8/upstream/2.3.3/src/global-handles.h +0 -180
- data/ext/v8/upstream/2.3.3/src/globals.h +0 -669
- data/ext/v8/upstream/2.3.3/src/handles-inl.h +0 -76
- data/ext/v8/upstream/2.3.3/src/handles.cc +0 -825
- data/ext/v8/upstream/2.3.3/src/handles.h +0 -393
- data/ext/v8/upstream/2.3.3/src/hashmap.cc +0 -226
- data/ext/v8/upstream/2.3.3/src/hashmap.h +0 -120
- data/ext/v8/upstream/2.3.3/src/heap-inl.h +0 -493
- data/ext/v8/upstream/2.3.3/src/heap-profiler.cc +0 -779
- data/ext/v8/upstream/2.3.3/src/heap-profiler.h +0 -323
- data/ext/v8/upstream/2.3.3/src/heap.cc +0 -4994
- data/ext/v8/upstream/2.3.3/src/heap.h +0 -1984
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32-inl.h +0 -360
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.cc +0 -2600
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.h +0 -969
- data/ext/v8/upstream/2.3.3/src/ia32/builtins-ia32.cc +0 -1261
- data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.cc +0 -13968
- data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.h +0 -1097
- data/ext/v8/upstream/2.3.3/src/ia32/cpu-ia32.cc +0 -83
- data/ext/v8/upstream/2.3.3/src/ia32/debug-ia32.cc +0 -309
- data/ext/v8/upstream/2.3.3/src/ia32/disasm-ia32.cc +0 -1471
- data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.cc +0 -954
- data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.h +0 -155
- data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.cc +0 -115
- data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.h +0 -135
- data/ext/v8/upstream/2.3.3/src/ia32/full-codegen-ia32.cc +0 -3281
- data/ext/v8/upstream/2.3.3/src/ia32/ic-ia32.cc +0 -1966
- data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.cc +0 -1610
- data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.h +0 -610
- data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.cc +0 -1247
- data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.h +0 -214
- data/ext/v8/upstream/2.3.3/src/ia32/simulator-ia32.h +0 -62
- data/ext/v8/upstream/2.3.3/src/ia32/stub-cache-ia32.cc +0 -2750
- data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.cc +0 -1334
- data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.h +0 -627
- data/ext/v8/upstream/2.3.3/src/ic-inl.h +0 -120
- data/ext/v8/upstream/2.3.3/src/ic.cc +0 -1827
- data/ext/v8/upstream/2.3.3/src/ic.h +0 -515
- data/ext/v8/upstream/2.3.3/src/interpreter-irregexp.cc +0 -646
- data/ext/v8/upstream/2.3.3/src/json.js +0 -268
- data/ext/v8/upstream/2.3.3/src/jsregexp.cc +0 -5283
- data/ext/v8/upstream/2.3.3/src/jsregexp.h +0 -1463
- data/ext/v8/upstream/2.3.3/src/jump-target-heavy.cc +0 -429
- data/ext/v8/upstream/2.3.3/src/jump-target-heavy.h +0 -244
- data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +0 -110
- data/ext/v8/upstream/2.3.3/src/jump-target-light.h +0 -192
- data/ext/v8/upstream/2.3.3/src/list-inl.h +0 -166
- data/ext/v8/upstream/2.3.3/src/list.h +0 -159
- data/ext/v8/upstream/2.3.3/src/liveedit-debugger.js +0 -1057
- data/ext/v8/upstream/2.3.3/src/liveedit.cc +0 -1480
- data/ext/v8/upstream/2.3.3/src/liveedit.h +0 -170
- data/ext/v8/upstream/2.3.3/src/log-utils.cc +0 -497
- data/ext/v8/upstream/2.3.3/src/log-utils.h +0 -289
- data/ext/v8/upstream/2.3.3/src/log.cc +0 -1561
- data/ext/v8/upstream/2.3.3/src/log.h +0 -384
- data/ext/v8/upstream/2.3.3/src/macro-assembler.h +0 -86
- data/ext/v8/upstream/2.3.3/src/macros.py +0 -177
- data/ext/v8/upstream/2.3.3/src/mark-compact.cc +0 -2330
- data/ext/v8/upstream/2.3.3/src/mark-compact.h +0 -451
- data/ext/v8/upstream/2.3.3/src/math.js +0 -264
- data/ext/v8/upstream/2.3.3/src/memory.h +0 -74
- data/ext/v8/upstream/2.3.3/src/messages.cc +0 -183
- data/ext/v8/upstream/2.3.3/src/messages.h +0 -113
- data/ext/v8/upstream/2.3.3/src/messages.js +0 -982
- data/ext/v8/upstream/2.3.3/src/mips/assembler-mips.h +0 -668
- data/ext/v8/upstream/2.3.3/src/mips/builtins-mips.cc +0 -205
- data/ext/v8/upstream/2.3.3/src/mips/codegen-mips.h +0 -434
- data/ext/v8/upstream/2.3.3/src/mips/debug-mips.cc +0 -131
- data/ext/v8/upstream/2.3.3/src/mips/frames-mips.cc +0 -102
- data/ext/v8/upstream/2.3.3/src/mips/ic-mips.cc +0 -220
- data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.cc +0 -1651
- data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.h +0 -311
- data/ext/v8/upstream/2.3.3/src/mips/stub-cache-mips.cc +0 -403
- data/ext/v8/upstream/2.3.3/src/mirror-debugger.js +0 -2380
- data/ext/v8/upstream/2.3.3/src/objects-debug.cc +0 -1366
- data/ext/v8/upstream/2.3.3/src/objects-inl.h +0 -3333
- data/ext/v8/upstream/2.3.3/src/objects.cc +0 -8820
- data/ext/v8/upstream/2.3.3/src/objects.h +0 -5373
- data/ext/v8/upstream/2.3.3/src/oprofile-agent.cc +0 -108
- data/ext/v8/upstream/2.3.3/src/oprofile-agent.h +0 -77
- data/ext/v8/upstream/2.3.3/src/parser.cc +0 -5207
- data/ext/v8/upstream/2.3.3/src/parser.h +0 -197
- data/ext/v8/upstream/2.3.3/src/platform-freebsd.cc +0 -667
- data/ext/v8/upstream/2.3.3/src/platform-linux.cc +0 -862
- data/ext/v8/upstream/2.3.3/src/platform-macos.cc +0 -665
- data/ext/v8/upstream/2.3.3/src/platform-nullos.cc +0 -454
- data/ext/v8/upstream/2.3.3/src/platform-openbsd.cc +0 -622
- data/ext/v8/upstream/2.3.3/src/platform-posix.cc +0 -362
- data/ext/v8/upstream/2.3.3/src/platform-solaris.cc +0 -653
- data/ext/v8/upstream/2.3.3/src/platform-win32.cc +0 -1911
- data/ext/v8/upstream/2.3.3/src/platform.h +0 -577
- data/ext/v8/upstream/2.3.3/src/powers-ten.h +0 -2461
- data/ext/v8/upstream/2.3.3/src/prettyprinter.cc +0 -1531
- data/ext/v8/upstream/2.3.3/src/prettyprinter.h +0 -221
- data/ext/v8/upstream/2.3.3/src/profile-generator-inl.h +0 -148
- data/ext/v8/upstream/2.3.3/src/profile-generator.cc +0 -1830
- data/ext/v8/upstream/2.3.3/src/profile-generator.h +0 -853
- data/ext/v8/upstream/2.3.3/src/property.cc +0 -96
- data/ext/v8/upstream/2.3.3/src/property.h +0 -315
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.cc +0 -464
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.h +0 -141
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.cc +0 -356
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.h +0 -103
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.cc +0 -261
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.h +0 -228
- data/ext/v8/upstream/2.3.3/src/regexp.js +0 -549
- data/ext/v8/upstream/2.3.3/src/rewriter.cc +0 -1038
- data/ext/v8/upstream/2.3.3/src/rewriter.h +0 -54
- data/ext/v8/upstream/2.3.3/src/runtime.cc +0 -10599
- data/ext/v8/upstream/2.3.3/src/runtime.h +0 -459
- data/ext/v8/upstream/2.3.3/src/runtime.js +0 -629
- data/ext/v8/upstream/2.3.3/src/scanner.cc +0 -1346
- data/ext/v8/upstream/2.3.3/src/scanner.h +0 -503
- data/ext/v8/upstream/2.3.3/src/scopeinfo.cc +0 -637
- data/ext/v8/upstream/2.3.3/src/scopeinfo.h +0 -233
- data/ext/v8/upstream/2.3.3/src/scopes.cc +0 -962
- data/ext/v8/upstream/2.3.3/src/scopes.h +0 -400
- data/ext/v8/upstream/2.3.3/src/serialize.cc +0 -1461
- data/ext/v8/upstream/2.3.3/src/serialize.h +0 -581
- data/ext/v8/upstream/2.3.3/src/spaces-inl.h +0 -483
- data/ext/v8/upstream/2.3.3/src/spaces.cc +0 -2901
- data/ext/v8/upstream/2.3.3/src/spaces.h +0 -2197
- data/ext/v8/upstream/2.3.3/src/string-stream.cc +0 -584
- data/ext/v8/upstream/2.3.3/src/string-stream.h +0 -189
- data/ext/v8/upstream/2.3.3/src/string.js +0 -1006
- data/ext/v8/upstream/2.3.3/src/stub-cache.cc +0 -1379
- data/ext/v8/upstream/2.3.3/src/stub-cache.h +0 -756
- data/ext/v8/upstream/2.3.3/src/third_party/dtoa/COPYING +0 -15
- data/ext/v8/upstream/2.3.3/src/third_party/dtoa/dtoa.c +0 -3334
- data/ext/v8/upstream/2.3.3/src/token.cc +0 -56
- data/ext/v8/upstream/2.3.3/src/token.h +0 -270
- data/ext/v8/upstream/2.3.3/src/top.cc +0 -1067
- data/ext/v8/upstream/2.3.3/src/top.h +0 -463
- data/ext/v8/upstream/2.3.3/src/type-info.cc +0 -53
- data/ext/v8/upstream/2.3.3/src/type-info.h +0 -244
- data/ext/v8/upstream/2.3.3/src/unicode-inl.h +0 -238
- data/ext/v8/upstream/2.3.3/src/unicode.cc +0 -749
- data/ext/v8/upstream/2.3.3/src/unicode.h +0 -279
- data/ext/v8/upstream/2.3.3/src/uri.js +0 -415
- data/ext/v8/upstream/2.3.3/src/utils.cc +0 -285
- data/ext/v8/upstream/2.3.3/src/utils.h +0 -745
- data/ext/v8/upstream/2.3.3/src/v8-counters.h +0 -250
- data/ext/v8/upstream/2.3.3/src/v8.cc +0 -228
- data/ext/v8/upstream/2.3.3/src/v8.h +0 -121
- data/ext/v8/upstream/2.3.3/src/v8natives.js +0 -1188
- data/ext/v8/upstream/2.3.3/src/v8threads.cc +0 -461
- data/ext/v8/upstream/2.3.3/src/v8threads.h +0 -159
- data/ext/v8/upstream/2.3.3/src/variables.cc +0 -119
- data/ext/v8/upstream/2.3.3/src/variables.h +0 -205
- data/ext/v8/upstream/2.3.3/src/version.cc +0 -88
- data/ext/v8/upstream/2.3.3/src/virtual-frame-heavy-inl.h +0 -192
- data/ext/v8/upstream/2.3.3/src/virtual-frame.h +0 -46
- data/ext/v8/upstream/2.3.3/src/vm-state-inl.h +0 -137
- data/ext/v8/upstream/2.3.3/src/vm-state.cc +0 -39
- data/ext/v8/upstream/2.3.3/src/vm-state.h +0 -77
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64-inl.h +0 -400
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.cc +0 -2963
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.h +0 -1438
- data/ext/v8/upstream/2.3.3/src/x64/builtins-x64.cc +0 -1296
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64-inl.h +0 -46
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.cc +0 -12491
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.h +0 -1090
- data/ext/v8/upstream/2.3.3/src/x64/cpu-x64.cc +0 -83
- data/ext/v8/upstream/2.3.3/src/x64/debug-x64.cc +0 -267
- data/ext/v8/upstream/2.3.3/src/x64/disasm-x64.cc +0 -1696
- data/ext/v8/upstream/2.3.3/src/x64/fast-codegen-x64.cc +0 -250
- data/ext/v8/upstream/2.3.3/src/x64/frames-x64.cc +0 -113
- data/ext/v8/upstream/2.3.3/src/x64/frames-x64.h +0 -125
- data/ext/v8/upstream/2.3.3/src/x64/full-codegen-x64.cc +0 -3270
- data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +0 -1907
- data/ext/v8/upstream/2.3.3/src/x64/jump-target-x64.cc +0 -437
- data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.cc +0 -2793
- data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.h +0 -916
- data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.cc +0 -1374
- data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.h +0 -277
- data/ext/v8/upstream/2.3.3/src/x64/simulator-x64.h +0 -63
- data/ext/v8/upstream/2.3.3/src/x64/stub-cache-x64.cc +0 -2560
- data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.cc +0 -1264
- data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.h +0 -590
- data/ext/v8/upstream/2.3.3/src/zone-inl.h +0 -82
- data/ext/v8/upstream/2.3.3/src/zone.cc +0 -194
- data/ext/v8/upstream/2.3.3/src/zone.h +0 -221
- data/ext/v8/upstream/2.3.3/tools/codemap.js +0 -270
- data/ext/v8/upstream/2.3.3/tools/csvparser.js +0 -83
- data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +0 -317
- data/ext/v8/upstream/2.3.3/tools/gyp/v8.gyp +0 -749
- data/ext/v8/upstream/2.3.3/tools/linux-tick-processor.py +0 -78
- data/ext/v8/upstream/2.3.3/tools/logreader.js +0 -338
- data/ext/v8/upstream/2.3.3/tools/oprofile/annotate +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/common +0 -19
- data/ext/v8/upstream/2.3.3/tools/oprofile/dump +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/report +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/reset +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/run +0 -14
- data/ext/v8/upstream/2.3.3/tools/oprofile/shutdown +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/start +0 -7
- data/ext/v8/upstream/2.3.3/tools/presubmit.py +0 -299
- data/ext/v8/upstream/2.3.3/tools/profile.js +0 -691
- data/ext/v8/upstream/2.3.3/tools/profile_view.js +0 -224
- data/ext/v8/upstream/2.3.3/tools/splaytree.js +0 -322
- data/ext/v8/upstream/2.3.3/tools/splaytree.py +0 -226
- data/ext/v8/upstream/2.3.3/tools/tickprocessor.js +0 -862
- data/ext/v8/upstream/2.3.3/tools/tickprocessor.py +0 -571
- data/ext/v8/upstream/2.3.3/tools/utils.py +0 -88
- data/ext/v8/upstream/2.3.3/tools/visual_studio/README.txt +0 -71
- data/ext/v8/upstream/2.3.3/tools/visual_studio/common.vsprops +0 -34
- data/ext/v8/upstream/2.3.3/tools/visual_studio/debug.vsprops +0 -17
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base.vcproj +0 -1143
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_arm.vcproj +0 -1115
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_x64.vcproj +0 -1096
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample.vcproj +0 -145
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -145
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -161
- data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.bat +0 -29
- data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.py +0 -137
@@ -0,0 +1,3085 @@
|
|
1
|
+
// Copyright 2006-2008 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#include "v8.h"
|
29
|
+
|
30
|
+
#include "api.h"
|
31
|
+
#include "arguments.h"
|
32
|
+
#include "bootstrapper.h"
|
33
|
+
#include "code-stubs.h"
|
34
|
+
#include "codegen.h"
|
35
|
+
#include "compilation-cache.h"
|
36
|
+
#include "compiler.h"
|
37
|
+
#include "debug.h"
|
38
|
+
#include "deoptimizer.h"
|
39
|
+
#include "execution.h"
|
40
|
+
#include "global-handles.h"
|
41
|
+
#include "ic.h"
|
42
|
+
#include "ic-inl.h"
|
43
|
+
#include "messages.h"
|
44
|
+
#include "natives.h"
|
45
|
+
#include "stub-cache.h"
|
46
|
+
#include "log.h"
|
47
|
+
|
48
|
+
#include "../include/v8-debug.h"
|
49
|
+
|
50
|
+
namespace v8 {
|
51
|
+
namespace internal {
|
52
|
+
|
53
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
54
|
+
static void PrintLn(v8::Local<v8::Value> value) {
|
55
|
+
v8::Local<v8::String> s = value->ToString();
|
56
|
+
ScopedVector<char> data(s->Length() + 1);
|
57
|
+
if (data.start() == NULL) {
|
58
|
+
V8::FatalProcessOutOfMemory("PrintLn");
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
s->WriteAscii(data.start());
|
62
|
+
PrintF("%s\n", data.start());
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
static Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind) {
|
67
|
+
CALL_HEAP_FUNCTION(StubCache::ComputeCallDebugBreak(argc, kind), Code);
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
static Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) {
|
72
|
+
CALL_HEAP_FUNCTION(
|
73
|
+
StubCache::ComputeCallDebugPrepareStepIn(argc, kind), Code);
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
static v8::Handle<v8::Context> GetDebugEventContext() {
|
78
|
+
Handle<Context> context = Debug::debugger_entry()->GetContext();
|
79
|
+
// Top::context() may have been NULL when "script collected" event occured.
|
80
|
+
if (*context == NULL) {
|
81
|
+
return v8::Local<v8::Context>();
|
82
|
+
}
|
83
|
+
Handle<Context> global_context(context->global_context());
|
84
|
+
return v8::Utils::ToLocal(global_context);
|
85
|
+
}
|
86
|
+
|
87
|
+
|
88
|
+
BreakLocationIterator::BreakLocationIterator(Handle<DebugInfo> debug_info,
|
89
|
+
BreakLocatorType type) {
|
90
|
+
debug_info_ = debug_info;
|
91
|
+
type_ = type;
|
92
|
+
reloc_iterator_ = NULL;
|
93
|
+
reloc_iterator_original_ = NULL;
|
94
|
+
Reset(); // Initialize the rest of the member variables.
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
BreakLocationIterator::~BreakLocationIterator() {
|
99
|
+
ASSERT(reloc_iterator_ != NULL);
|
100
|
+
ASSERT(reloc_iterator_original_ != NULL);
|
101
|
+
delete reloc_iterator_;
|
102
|
+
delete reloc_iterator_original_;
|
103
|
+
}
|
104
|
+
|
105
|
+
|
106
|
+
void BreakLocationIterator::Next() {
|
107
|
+
AssertNoAllocation nogc;
|
108
|
+
ASSERT(!RinfoDone());
|
109
|
+
|
110
|
+
// Iterate through reloc info for code and original code stopping at each
|
111
|
+
// breakable code target.
|
112
|
+
bool first = break_point_ == -1;
|
113
|
+
while (!RinfoDone()) {
|
114
|
+
if (!first) RinfoNext();
|
115
|
+
first = false;
|
116
|
+
if (RinfoDone()) return;
|
117
|
+
|
118
|
+
// Whenever a statement position or (plain) position is passed update the
|
119
|
+
// current value of these.
|
120
|
+
if (RelocInfo::IsPosition(rmode())) {
|
121
|
+
if (RelocInfo::IsStatementPosition(rmode())) {
|
122
|
+
statement_position_ = static_cast<int>(
|
123
|
+
rinfo()->data() - debug_info_->shared()->start_position());
|
124
|
+
}
|
125
|
+
// Always update the position as we don't want that to be before the
|
126
|
+
// statement position.
|
127
|
+
position_ = static_cast<int>(
|
128
|
+
rinfo()->data() - debug_info_->shared()->start_position());
|
129
|
+
ASSERT(position_ >= 0);
|
130
|
+
ASSERT(statement_position_ >= 0);
|
131
|
+
}
|
132
|
+
|
133
|
+
if (IsDebugBreakSlot()) {
|
134
|
+
// There is always a possible break point at a debug break slot.
|
135
|
+
break_point_++;
|
136
|
+
return;
|
137
|
+
} else if (RelocInfo::IsCodeTarget(rmode())) {
|
138
|
+
// Check for breakable code target. Look in the original code as setting
|
139
|
+
// break points can cause the code targets in the running (debugged) code
|
140
|
+
// to be of a different kind than in the original code.
|
141
|
+
Address target = original_rinfo()->target_address();
|
142
|
+
Code* code = Code::GetCodeFromTargetAddress(target);
|
143
|
+
if ((code->is_inline_cache_stub() &&
|
144
|
+
!code->is_binary_op_stub() &&
|
145
|
+
!code->is_type_recording_binary_op_stub() &&
|
146
|
+
!code->is_compare_ic_stub()) ||
|
147
|
+
RelocInfo::IsConstructCall(rmode())) {
|
148
|
+
break_point_++;
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
if (code->kind() == Code::STUB) {
|
152
|
+
if (IsDebuggerStatement()) {
|
153
|
+
break_point_++;
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
if (type_ == ALL_BREAK_LOCATIONS) {
|
157
|
+
if (Debug::IsBreakStub(code)) {
|
158
|
+
break_point_++;
|
159
|
+
return;
|
160
|
+
}
|
161
|
+
} else {
|
162
|
+
ASSERT(type_ == SOURCE_BREAK_LOCATIONS);
|
163
|
+
if (Debug::IsSourceBreakStub(code)) {
|
164
|
+
break_point_++;
|
165
|
+
return;
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
// Check for break at return.
|
172
|
+
if (RelocInfo::IsJSReturn(rmode())) {
|
173
|
+
// Set the positions to the end of the function.
|
174
|
+
if (debug_info_->shared()->HasSourceCode()) {
|
175
|
+
position_ = debug_info_->shared()->end_position() -
|
176
|
+
debug_info_->shared()->start_position() - 1;
|
177
|
+
} else {
|
178
|
+
position_ = 0;
|
179
|
+
}
|
180
|
+
statement_position_ = position_;
|
181
|
+
break_point_++;
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
|
188
|
+
void BreakLocationIterator::Next(int count) {
|
189
|
+
while (count > 0) {
|
190
|
+
Next();
|
191
|
+
count--;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
// Find the break point closest to the supplied address.
|
197
|
+
void BreakLocationIterator::FindBreakLocationFromAddress(Address pc) {
|
198
|
+
// Run through all break points to locate the one closest to the address.
|
199
|
+
int closest_break_point = 0;
|
200
|
+
int distance = kMaxInt;
|
201
|
+
while (!Done()) {
|
202
|
+
// Check if this break point is closer that what was previously found.
|
203
|
+
if (this->pc() < pc && pc - this->pc() < distance) {
|
204
|
+
closest_break_point = break_point();
|
205
|
+
distance = static_cast<int>(pc - this->pc());
|
206
|
+
// Check whether we can't get any closer.
|
207
|
+
if (distance == 0) break;
|
208
|
+
}
|
209
|
+
Next();
|
210
|
+
}
|
211
|
+
|
212
|
+
// Move to the break point found.
|
213
|
+
Reset();
|
214
|
+
Next(closest_break_point);
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
// Find the break point closest to the supplied source position.
|
219
|
+
void BreakLocationIterator::FindBreakLocationFromPosition(int position) {
|
220
|
+
// Run through all break points to locate the one closest to the source
|
221
|
+
// position.
|
222
|
+
int closest_break_point = 0;
|
223
|
+
int distance = kMaxInt;
|
224
|
+
while (!Done()) {
|
225
|
+
// Check if this break point is closer that what was previously found.
|
226
|
+
if (position <= statement_position() &&
|
227
|
+
statement_position() - position < distance) {
|
228
|
+
closest_break_point = break_point();
|
229
|
+
distance = statement_position() - position;
|
230
|
+
// Check whether we can't get any closer.
|
231
|
+
if (distance == 0) break;
|
232
|
+
}
|
233
|
+
Next();
|
234
|
+
}
|
235
|
+
|
236
|
+
// Move to the break point found.
|
237
|
+
Reset();
|
238
|
+
Next(closest_break_point);
|
239
|
+
}
|
240
|
+
|
241
|
+
|
242
|
+
void BreakLocationIterator::Reset() {
|
243
|
+
// Create relocation iterators for the two code objects.
|
244
|
+
if (reloc_iterator_ != NULL) delete reloc_iterator_;
|
245
|
+
if (reloc_iterator_original_ != NULL) delete reloc_iterator_original_;
|
246
|
+
reloc_iterator_ = new RelocIterator(debug_info_->code());
|
247
|
+
reloc_iterator_original_ = new RelocIterator(debug_info_->original_code());
|
248
|
+
|
249
|
+
// Position at the first break point.
|
250
|
+
break_point_ = -1;
|
251
|
+
position_ = 1;
|
252
|
+
statement_position_ = 1;
|
253
|
+
Next();
|
254
|
+
}
|
255
|
+
|
256
|
+
|
257
|
+
bool BreakLocationIterator::Done() const {
|
258
|
+
return RinfoDone();
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
void BreakLocationIterator::SetBreakPoint(Handle<Object> break_point_object) {
|
263
|
+
// If there is not already a real break point here patch code with debug
|
264
|
+
// break.
|
265
|
+
if (!HasBreakPoint()) {
|
266
|
+
SetDebugBreak();
|
267
|
+
}
|
268
|
+
ASSERT(IsDebugBreak() || IsDebuggerStatement());
|
269
|
+
// Set the break point information.
|
270
|
+
DebugInfo::SetBreakPoint(debug_info_, code_position(),
|
271
|
+
position(), statement_position(),
|
272
|
+
break_point_object);
|
273
|
+
}
|
274
|
+
|
275
|
+
|
276
|
+
void BreakLocationIterator::ClearBreakPoint(Handle<Object> break_point_object) {
|
277
|
+
// Clear the break point information.
|
278
|
+
DebugInfo::ClearBreakPoint(debug_info_, code_position(), break_point_object);
|
279
|
+
// If there are no more break points here remove the debug break.
|
280
|
+
if (!HasBreakPoint()) {
|
281
|
+
ClearDebugBreak();
|
282
|
+
ASSERT(!IsDebugBreak());
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
|
287
|
+
void BreakLocationIterator::SetOneShot() {
|
288
|
+
// Debugger statement always calls debugger. No need to modify it.
|
289
|
+
if (IsDebuggerStatement()) {
|
290
|
+
return;
|
291
|
+
}
|
292
|
+
|
293
|
+
// If there is a real break point here no more to do.
|
294
|
+
if (HasBreakPoint()) {
|
295
|
+
ASSERT(IsDebugBreak());
|
296
|
+
return;
|
297
|
+
}
|
298
|
+
|
299
|
+
// Patch code with debug break.
|
300
|
+
SetDebugBreak();
|
301
|
+
}
|
302
|
+
|
303
|
+
|
304
|
+
void BreakLocationIterator::ClearOneShot() {
|
305
|
+
// Debugger statement always calls debugger. No need to modify it.
|
306
|
+
if (IsDebuggerStatement()) {
|
307
|
+
return;
|
308
|
+
}
|
309
|
+
|
310
|
+
// If there is a real break point here no more to do.
|
311
|
+
if (HasBreakPoint()) {
|
312
|
+
ASSERT(IsDebugBreak());
|
313
|
+
return;
|
314
|
+
}
|
315
|
+
|
316
|
+
// Patch code removing debug break.
|
317
|
+
ClearDebugBreak();
|
318
|
+
ASSERT(!IsDebugBreak());
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
void BreakLocationIterator::SetDebugBreak() {
|
323
|
+
// Debugger statement always calls debugger. No need to modify it.
|
324
|
+
if (IsDebuggerStatement()) {
|
325
|
+
return;
|
326
|
+
}
|
327
|
+
|
328
|
+
// If there is already a break point here just return. This might happen if
|
329
|
+
// the same code is flooded with break points twice. Flooding the same
|
330
|
+
// function twice might happen when stepping in a function with an exception
|
331
|
+
// handler as the handler and the function is the same.
|
332
|
+
if (IsDebugBreak()) {
|
333
|
+
return;
|
334
|
+
}
|
335
|
+
|
336
|
+
if (RelocInfo::IsJSReturn(rmode())) {
|
337
|
+
// Patch the frame exit code with a break point.
|
338
|
+
SetDebugBreakAtReturn();
|
339
|
+
} else if (IsDebugBreakSlot()) {
|
340
|
+
// Patch the code in the break slot.
|
341
|
+
SetDebugBreakAtSlot();
|
342
|
+
} else {
|
343
|
+
// Patch the IC call.
|
344
|
+
SetDebugBreakAtIC();
|
345
|
+
}
|
346
|
+
ASSERT(IsDebugBreak());
|
347
|
+
}
|
348
|
+
|
349
|
+
|
350
|
+
void BreakLocationIterator::ClearDebugBreak() {
|
351
|
+
// Debugger statement always calls debugger. No need to modify it.
|
352
|
+
if (IsDebuggerStatement()) {
|
353
|
+
return;
|
354
|
+
}
|
355
|
+
|
356
|
+
if (RelocInfo::IsJSReturn(rmode())) {
|
357
|
+
// Restore the frame exit code.
|
358
|
+
ClearDebugBreakAtReturn();
|
359
|
+
} else if (IsDebugBreakSlot()) {
|
360
|
+
// Restore the code in the break slot.
|
361
|
+
ClearDebugBreakAtSlot();
|
362
|
+
} else {
|
363
|
+
// Patch the IC call.
|
364
|
+
ClearDebugBreakAtIC();
|
365
|
+
}
|
366
|
+
ASSERT(!IsDebugBreak());
|
367
|
+
}
|
368
|
+
|
369
|
+
|
370
|
+
void BreakLocationIterator::PrepareStepIn() {
|
371
|
+
HandleScope scope;
|
372
|
+
|
373
|
+
// Step in can only be prepared if currently positioned on an IC call,
|
374
|
+
// construct call or CallFunction stub call.
|
375
|
+
Address target = rinfo()->target_address();
|
376
|
+
Handle<Code> code(Code::GetCodeFromTargetAddress(target));
|
377
|
+
if (code->is_call_stub() || code->is_keyed_call_stub()) {
|
378
|
+
// Step in through IC call is handled by the runtime system. Therefore make
|
379
|
+
// sure that the any current IC is cleared and the runtime system is
|
380
|
+
// called. If the executing code has a debug break at the location change
|
381
|
+
// the call in the original code as it is the code there that will be
|
382
|
+
// executed in place of the debug break call.
|
383
|
+
Handle<Code> stub = ComputeCallDebugPrepareStepIn(code->arguments_count(),
|
384
|
+
code->kind());
|
385
|
+
if (IsDebugBreak()) {
|
386
|
+
original_rinfo()->set_target_address(stub->entry());
|
387
|
+
} else {
|
388
|
+
rinfo()->set_target_address(stub->entry());
|
389
|
+
}
|
390
|
+
} else {
|
391
|
+
#ifdef DEBUG
|
392
|
+
// All the following stuff is needed only for assertion checks so the code
|
393
|
+
// is wrapped in ifdef.
|
394
|
+
Handle<Code> maybe_call_function_stub = code;
|
395
|
+
if (IsDebugBreak()) {
|
396
|
+
Address original_target = original_rinfo()->target_address();
|
397
|
+
maybe_call_function_stub =
|
398
|
+
Handle<Code>(Code::GetCodeFromTargetAddress(original_target));
|
399
|
+
}
|
400
|
+
bool is_call_function_stub =
|
401
|
+
(maybe_call_function_stub->kind() == Code::STUB &&
|
402
|
+
maybe_call_function_stub->major_key() == CodeStub::CallFunction);
|
403
|
+
|
404
|
+
// Step in through construct call requires no changes to the running code.
|
405
|
+
// Step in through getters/setters should already be prepared as well
|
406
|
+
// because caller of this function (Debug::PrepareStep) is expected to
|
407
|
+
// flood the top frame's function with one shot breakpoints.
|
408
|
+
// Step in through CallFunction stub should also be prepared by caller of
|
409
|
+
// this function (Debug::PrepareStep) which should flood target function
|
410
|
+
// with breakpoints.
|
411
|
+
ASSERT(RelocInfo::IsConstructCall(rmode()) || code->is_inline_cache_stub()
|
412
|
+
|| is_call_function_stub);
|
413
|
+
#endif
|
414
|
+
}
|
415
|
+
}
|
416
|
+
|
417
|
+
|
418
|
+
// Check whether the break point is at a position which will exit the function.
|
419
|
+
bool BreakLocationIterator::IsExit() const {
|
420
|
+
return (RelocInfo::IsJSReturn(rmode()));
|
421
|
+
}
|
422
|
+
|
423
|
+
|
424
|
+
bool BreakLocationIterator::HasBreakPoint() {
|
425
|
+
return debug_info_->HasBreakPoint(code_position());
|
426
|
+
}
|
427
|
+
|
428
|
+
|
429
|
+
// Check whether there is a debug break at the current position.
|
430
|
+
bool BreakLocationIterator::IsDebugBreak() {
|
431
|
+
if (RelocInfo::IsJSReturn(rmode())) {
|
432
|
+
return IsDebugBreakAtReturn();
|
433
|
+
} else if (IsDebugBreakSlot()) {
|
434
|
+
return IsDebugBreakAtSlot();
|
435
|
+
} else {
|
436
|
+
return Debug::IsDebugBreak(rinfo()->target_address());
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
|
441
|
+
void BreakLocationIterator::SetDebugBreakAtIC() {
|
442
|
+
// Patch the original code with the current address as the current address
|
443
|
+
// might have changed by the inline caching since the code was copied.
|
444
|
+
original_rinfo()->set_target_address(rinfo()->target_address());
|
445
|
+
|
446
|
+
RelocInfo::Mode mode = rmode();
|
447
|
+
if (RelocInfo::IsCodeTarget(mode)) {
|
448
|
+
Address target = rinfo()->target_address();
|
449
|
+
Handle<Code> code(Code::GetCodeFromTargetAddress(target));
|
450
|
+
|
451
|
+
// Patch the code to invoke the builtin debug break function matching the
|
452
|
+
// calling convention used by the call site.
|
453
|
+
Handle<Code> dbgbrk_code(Debug::FindDebugBreak(code, mode));
|
454
|
+
rinfo()->set_target_address(dbgbrk_code->entry());
|
455
|
+
|
456
|
+
// For stubs that refer back to an inlined version clear the cached map for
|
457
|
+
// the inlined case to always go through the IC. As long as the break point
|
458
|
+
// is set the patching performed by the runtime system will take place in
|
459
|
+
// the code copy and will therefore have no effect on the running code
|
460
|
+
// keeping it from using the inlined code.
|
461
|
+
if (code->is_keyed_load_stub()) {
|
462
|
+
KeyedLoadIC::ClearInlinedVersion(pc());
|
463
|
+
} else if (code->is_keyed_store_stub()) {
|
464
|
+
KeyedStoreIC::ClearInlinedVersion(pc());
|
465
|
+
} else if (code->is_load_stub()) {
|
466
|
+
LoadIC::ClearInlinedVersion(pc());
|
467
|
+
} else if (code->is_store_stub()) {
|
468
|
+
StoreIC::ClearInlinedVersion(pc());
|
469
|
+
}
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
|
474
|
+
void BreakLocationIterator::ClearDebugBreakAtIC() {
|
475
|
+
// Patch the code to the original invoke.
|
476
|
+
rinfo()->set_target_address(original_rinfo()->target_address());
|
477
|
+
|
478
|
+
RelocInfo::Mode mode = rmode();
|
479
|
+
if (RelocInfo::IsCodeTarget(mode)) {
|
480
|
+
AssertNoAllocation nogc;
|
481
|
+
Address target = original_rinfo()->target_address();
|
482
|
+
Code* code = Code::GetCodeFromTargetAddress(target);
|
483
|
+
|
484
|
+
// Restore the inlined version of keyed stores to get back to the
|
485
|
+
// fast case. We need to patch back the keyed store because no
|
486
|
+
// patching happens when running normally. For keyed loads, the
|
487
|
+
// map check will get patched back when running normally after ICs
|
488
|
+
// have been cleared at GC.
|
489
|
+
if (code->is_keyed_store_stub()) KeyedStoreIC::RestoreInlinedVersion(pc());
|
490
|
+
}
|
491
|
+
}
|
492
|
+
|
493
|
+
|
494
|
+
bool BreakLocationIterator::IsDebuggerStatement() {
|
495
|
+
return RelocInfo::DEBUG_BREAK == rmode();
|
496
|
+
}
|
497
|
+
|
498
|
+
|
499
|
+
bool BreakLocationIterator::IsDebugBreakSlot() {
|
500
|
+
return RelocInfo::DEBUG_BREAK_SLOT == rmode();
|
501
|
+
}
|
502
|
+
|
503
|
+
|
504
|
+
Object* BreakLocationIterator::BreakPointObjects() {
|
505
|
+
return debug_info_->GetBreakPointObjects(code_position());
|
506
|
+
}
|
507
|
+
|
508
|
+
|
509
|
+
// Clear out all the debug break code. This is ONLY supposed to be used when
|
510
|
+
// shutting down the debugger as it will leave the break point information in
|
511
|
+
// DebugInfo even though the code is patched back to the non break point state.
|
512
|
+
void BreakLocationIterator::ClearAllDebugBreak() {
|
513
|
+
while (!Done()) {
|
514
|
+
ClearDebugBreak();
|
515
|
+
Next();
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
|
520
|
+
bool BreakLocationIterator::RinfoDone() const {
|
521
|
+
ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
|
522
|
+
return reloc_iterator_->done();
|
523
|
+
}
|
524
|
+
|
525
|
+
|
526
|
+
void BreakLocationIterator::RinfoNext() {
|
527
|
+
reloc_iterator_->next();
|
528
|
+
reloc_iterator_original_->next();
|
529
|
+
#ifdef DEBUG
|
530
|
+
ASSERT(reloc_iterator_->done() == reloc_iterator_original_->done());
|
531
|
+
if (!reloc_iterator_->done()) {
|
532
|
+
ASSERT(rmode() == original_rmode());
|
533
|
+
}
|
534
|
+
#endif
|
535
|
+
}
|
536
|
+
|
537
|
+
|
538
|
+
bool Debug::has_break_points_ = false;
|
539
|
+
ScriptCache* Debug::script_cache_ = NULL;
|
540
|
+
DebugInfoListNode* Debug::debug_info_list_ = NULL;
|
541
|
+
|
542
|
+
|
543
|
+
// Threading support.
|
544
|
+
void Debug::ThreadInit() {
|
545
|
+
thread_local_.break_count_ = 0;
|
546
|
+
thread_local_.break_id_ = 0;
|
547
|
+
thread_local_.break_frame_id_ = StackFrame::NO_ID;
|
548
|
+
thread_local_.last_step_action_ = StepNone;
|
549
|
+
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
|
550
|
+
thread_local_.step_count_ = 0;
|
551
|
+
thread_local_.last_fp_ = 0;
|
552
|
+
thread_local_.step_into_fp_ = 0;
|
553
|
+
thread_local_.step_out_fp_ = 0;
|
554
|
+
thread_local_.after_break_target_ = 0;
|
555
|
+
thread_local_.debugger_entry_ = NULL;
|
556
|
+
thread_local_.pending_interrupts_ = 0;
|
557
|
+
thread_local_.restarter_frame_function_pointer_ = NULL;
|
558
|
+
}
|
559
|
+
|
560
|
+
|
561
|
+
JSCallerSavedBuffer Debug::registers_;
|
562
|
+
Debug::ThreadLocal Debug::thread_local_;
|
563
|
+
|
564
|
+
|
565
|
+
char* Debug::ArchiveDebug(char* storage) {
|
566
|
+
char* to = storage;
|
567
|
+
memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
|
568
|
+
to += sizeof(ThreadLocal);
|
569
|
+
memcpy(to, reinterpret_cast<char*>(®isters_), sizeof(registers_));
|
570
|
+
ThreadInit();
|
571
|
+
ASSERT(to <= storage + ArchiveSpacePerThread());
|
572
|
+
return storage + ArchiveSpacePerThread();
|
573
|
+
}
|
574
|
+
|
575
|
+
|
576
|
+
char* Debug::RestoreDebug(char* storage) {
|
577
|
+
char* from = storage;
|
578
|
+
memcpy(reinterpret_cast<char*>(&thread_local_), from, sizeof(ThreadLocal));
|
579
|
+
from += sizeof(ThreadLocal);
|
580
|
+
memcpy(reinterpret_cast<char*>(®isters_), from, sizeof(registers_));
|
581
|
+
ASSERT(from <= storage + ArchiveSpacePerThread());
|
582
|
+
return storage + ArchiveSpacePerThread();
|
583
|
+
}
|
584
|
+
|
585
|
+
|
586
|
+
int Debug::ArchiveSpacePerThread() {
|
587
|
+
return sizeof(ThreadLocal) + sizeof(registers_);
|
588
|
+
}
|
589
|
+
|
590
|
+
|
591
|
+
// Frame structure (conforms InternalFrame structure):
|
592
|
+
// -- code
|
593
|
+
// -- SMI maker
|
594
|
+
// -- function (slot is called "context")
|
595
|
+
// -- frame base
|
596
|
+
Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
|
597
|
+
Handle<Code> code) {
|
598
|
+
ASSERT(bottom_js_frame->is_java_script());
|
599
|
+
|
600
|
+
Address fp = bottom_js_frame->fp();
|
601
|
+
|
602
|
+
// Move function pointer into "context" slot.
|
603
|
+
Memory::Object_at(fp + StandardFrameConstants::kContextOffset) =
|
604
|
+
Memory::Object_at(fp + JavaScriptFrameConstants::kFunctionOffset);
|
605
|
+
|
606
|
+
Memory::Object_at(fp + InternalFrameConstants::kCodeOffset) = *code;
|
607
|
+
Memory::Object_at(fp + StandardFrameConstants::kMarkerOffset) =
|
608
|
+
Smi::FromInt(StackFrame::INTERNAL);
|
609
|
+
|
610
|
+
return reinterpret_cast<Object**>(&Memory::Object_at(
|
611
|
+
fp + StandardFrameConstants::kContextOffset));
|
612
|
+
}
|
613
|
+
|
614
|
+
const int Debug::kFrameDropperFrameSize = 4;
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
// Default break enabled.
|
621
|
+
bool Debug::disable_break_ = false;
|
622
|
+
|
623
|
+
// Default call debugger on uncaught exception.
|
624
|
+
bool Debug::break_on_exception_ = false;
|
625
|
+
bool Debug::break_on_uncaught_exception_ = false;
|
626
|
+
|
627
|
+
Handle<Context> Debug::debug_context_ = Handle<Context>();
|
628
|
+
Code* Debug::debug_break_return_ = NULL;
|
629
|
+
Code* Debug::debug_break_slot_ = NULL;
|
630
|
+
|
631
|
+
|
632
|
+
void ScriptCache::Add(Handle<Script> script) {
|
633
|
+
// Create an entry in the hash map for the script.
|
634
|
+
int id = Smi::cast(script->id())->value();
|
635
|
+
HashMap::Entry* entry =
|
636
|
+
HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true);
|
637
|
+
if (entry->value != NULL) {
|
638
|
+
ASSERT(*script == *reinterpret_cast<Script**>(entry->value));
|
639
|
+
return;
|
640
|
+
}
|
641
|
+
|
642
|
+
// Globalize the script object, make it weak and use the location of the
|
643
|
+
// global handle as the value in the hash map.
|
644
|
+
Handle<Script> script_ =
|
645
|
+
Handle<Script>::cast((GlobalHandles::Create(*script)));
|
646
|
+
GlobalHandles::MakeWeak(reinterpret_cast<Object**>(script_.location()),
|
647
|
+
this, ScriptCache::HandleWeakScript);
|
648
|
+
entry->value = script_.location();
|
649
|
+
}
|
650
|
+
|
651
|
+
|
652
|
+
Handle<FixedArray> ScriptCache::GetScripts() {
|
653
|
+
Handle<FixedArray> instances = Factory::NewFixedArray(occupancy());
|
654
|
+
int count = 0;
|
655
|
+
for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) {
|
656
|
+
ASSERT(entry->value != NULL);
|
657
|
+
if (entry->value != NULL) {
|
658
|
+
instances->set(count, *reinterpret_cast<Script**>(entry->value));
|
659
|
+
count++;
|
660
|
+
}
|
661
|
+
}
|
662
|
+
return instances;
|
663
|
+
}
|
664
|
+
|
665
|
+
|
666
|
+
void ScriptCache::ProcessCollectedScripts() {
|
667
|
+
for (int i = 0; i < collected_scripts_.length(); i++) {
|
668
|
+
Debugger::OnScriptCollected(collected_scripts_[i]);
|
669
|
+
}
|
670
|
+
collected_scripts_.Clear();
|
671
|
+
}
|
672
|
+
|
673
|
+
|
674
|
+
void ScriptCache::Clear() {
|
675
|
+
// Iterate the script cache to get rid of all the weak handles.
|
676
|
+
for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) {
|
677
|
+
ASSERT(entry != NULL);
|
678
|
+
Object** location = reinterpret_cast<Object**>(entry->value);
|
679
|
+
ASSERT((*location)->IsScript());
|
680
|
+
GlobalHandles::ClearWeakness(location);
|
681
|
+
GlobalHandles::Destroy(location);
|
682
|
+
}
|
683
|
+
// Clear the content of the hash map.
|
684
|
+
HashMap::Clear();
|
685
|
+
}
|
686
|
+
|
687
|
+
|
688
|
+
void ScriptCache::HandleWeakScript(v8::Persistent<v8::Value> obj, void* data) {
|
689
|
+
ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data);
|
690
|
+
// Find the location of the global handle.
|
691
|
+
Script** location =
|
692
|
+
reinterpret_cast<Script**>(Utils::OpenHandle(*obj).location());
|
693
|
+
ASSERT((*location)->IsScript());
|
694
|
+
|
695
|
+
// Remove the entry from the cache.
|
696
|
+
int id = Smi::cast((*location)->id())->value();
|
697
|
+
script_cache->Remove(reinterpret_cast<void*>(id), Hash(id));
|
698
|
+
script_cache->collected_scripts_.Add(id);
|
699
|
+
|
700
|
+
// Clear the weak handle.
|
701
|
+
obj.Dispose();
|
702
|
+
obj.Clear();
|
703
|
+
}
|
704
|
+
|
705
|
+
|
706
|
+
void Debug::Setup(bool create_heap_objects) {
|
707
|
+
ThreadInit();
|
708
|
+
if (create_heap_objects) {
|
709
|
+
// Get code to handle debug break on return.
|
710
|
+
debug_break_return_ =
|
711
|
+
Builtins::builtin(Builtins::Return_DebugBreak);
|
712
|
+
ASSERT(debug_break_return_->IsCode());
|
713
|
+
// Get code to handle debug break in debug break slots.
|
714
|
+
debug_break_slot_ =
|
715
|
+
Builtins::builtin(Builtins::Slot_DebugBreak);
|
716
|
+
ASSERT(debug_break_slot_->IsCode());
|
717
|
+
}
|
718
|
+
}
|
719
|
+
|
720
|
+
|
721
|
+
void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
|
722
|
+
DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data);
|
723
|
+
// We need to clear all breakpoints associated with the function to restore
|
724
|
+
// original code and avoid patching the code twice later because
|
725
|
+
// the function will live in the heap until next gc, and can be found by
|
726
|
+
// Runtime::FindSharedFunctionInfoInScript.
|
727
|
+
BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
|
728
|
+
it.ClearAllDebugBreak();
|
729
|
+
RemoveDebugInfo(node->debug_info());
|
730
|
+
#ifdef DEBUG
|
731
|
+
node = Debug::debug_info_list_;
|
732
|
+
while (node != NULL) {
|
733
|
+
ASSERT(node != reinterpret_cast<DebugInfoListNode*>(data));
|
734
|
+
node = node->next();
|
735
|
+
}
|
736
|
+
#endif
|
737
|
+
}
|
738
|
+
|
739
|
+
|
740
|
+
DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) {
|
741
|
+
// Globalize the request debug info object and make it weak.
|
742
|
+
debug_info_ = Handle<DebugInfo>::cast((GlobalHandles::Create(debug_info)));
|
743
|
+
GlobalHandles::MakeWeak(reinterpret_cast<Object**>(debug_info_.location()),
|
744
|
+
this, Debug::HandleWeakDebugInfo);
|
745
|
+
}
|
746
|
+
|
747
|
+
|
748
|
+
DebugInfoListNode::~DebugInfoListNode() {
|
749
|
+
GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_info_.location()));
|
750
|
+
}
|
751
|
+
|
752
|
+
|
753
|
+
bool Debug::CompileDebuggerScript(int index) {
|
754
|
+
HandleScope scope;
|
755
|
+
|
756
|
+
// Bail out if the index is invalid.
|
757
|
+
if (index == -1) {
|
758
|
+
return false;
|
759
|
+
}
|
760
|
+
|
761
|
+
// Find source and name for the requested script.
|
762
|
+
Handle<String> source_code = Bootstrapper::NativesSourceLookup(index);
|
763
|
+
Vector<const char> name = Natives::GetScriptName(index);
|
764
|
+
Handle<String> script_name = Factory::NewStringFromAscii(name);
|
765
|
+
|
766
|
+
// Compile the script.
|
767
|
+
bool allow_natives_syntax = FLAG_allow_natives_syntax;
|
768
|
+
FLAG_allow_natives_syntax = true;
|
769
|
+
Handle<SharedFunctionInfo> function_info;
|
770
|
+
function_info = Compiler::Compile(source_code,
|
771
|
+
script_name,
|
772
|
+
0, 0, NULL, NULL,
|
773
|
+
Handle<String>::null(),
|
774
|
+
NATIVES_CODE);
|
775
|
+
FLAG_allow_natives_syntax = allow_natives_syntax;
|
776
|
+
|
777
|
+
// Silently ignore stack overflows during compilation.
|
778
|
+
if (function_info.is_null()) {
|
779
|
+
ASSERT(Top::has_pending_exception());
|
780
|
+
Top::clear_pending_exception();
|
781
|
+
return false;
|
782
|
+
}
|
783
|
+
|
784
|
+
// Execute the shared function in the debugger context.
|
785
|
+
Handle<Context> context = Top::global_context();
|
786
|
+
bool caught_exception = false;
|
787
|
+
Handle<JSFunction> function =
|
788
|
+
Factory::NewFunctionFromSharedFunctionInfo(function_info, context);
|
789
|
+
Handle<Object> result =
|
790
|
+
Execution::TryCall(function, Handle<Object>(context->global()),
|
791
|
+
0, NULL, &caught_exception);
|
792
|
+
|
793
|
+
// Check for caught exceptions.
|
794
|
+
if (caught_exception) {
|
795
|
+
Handle<Object> message = MessageHandler::MakeMessageObject(
|
796
|
+
"error_loading_debugger", NULL, Vector<Handle<Object> >::empty(),
|
797
|
+
Handle<String>(), Handle<JSArray>());
|
798
|
+
MessageHandler::ReportMessage(NULL, message);
|
799
|
+
return false;
|
800
|
+
}
|
801
|
+
|
802
|
+
// Mark this script as native and return successfully.
|
803
|
+
Handle<Script> script(Script::cast(function->shared()->script()));
|
804
|
+
script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
|
805
|
+
return true;
|
806
|
+
}
|
807
|
+
|
808
|
+
|
809
|
+
bool Debug::Load() {
|
810
|
+
// Return if debugger is already loaded.
|
811
|
+
if (IsLoaded()) return true;
|
812
|
+
|
813
|
+
// Bail out if we're already in the process of compiling the native
|
814
|
+
// JavaScript source code for the debugger.
|
815
|
+
if (Debugger::compiling_natives() || Debugger::is_loading_debugger())
|
816
|
+
return false;
|
817
|
+
Debugger::set_loading_debugger(true);
|
818
|
+
|
819
|
+
// Disable breakpoints and interrupts while compiling and running the
|
820
|
+
// debugger scripts including the context creation code.
|
821
|
+
DisableBreak disable(true);
|
822
|
+
PostponeInterruptsScope postpone;
|
823
|
+
|
824
|
+
// Create the debugger context.
|
825
|
+
HandleScope scope;
|
826
|
+
Handle<Context> context =
|
827
|
+
Bootstrapper::CreateEnvironment(Handle<Object>::null(),
|
828
|
+
v8::Handle<ObjectTemplate>(),
|
829
|
+
NULL);
|
830
|
+
|
831
|
+
// Use the debugger context.
|
832
|
+
SaveContext save;
|
833
|
+
Top::set_context(*context);
|
834
|
+
|
835
|
+
// Expose the builtins object in the debugger context.
|
836
|
+
Handle<String> key = Factory::LookupAsciiSymbol("builtins");
|
837
|
+
Handle<GlobalObject> global = Handle<GlobalObject>(context->global());
|
838
|
+
RETURN_IF_EMPTY_HANDLE_VALUE(
|
839
|
+
SetProperty(global, key, Handle<Object>(global->builtins()),
|
840
|
+
NONE, kNonStrictMode),
|
841
|
+
false);
|
842
|
+
|
843
|
+
// Compile the JavaScript for the debugger in the debugger context.
|
844
|
+
Debugger::set_compiling_natives(true);
|
845
|
+
bool caught_exception =
|
846
|
+
!CompileDebuggerScript(Natives::GetIndex("mirror")) ||
|
847
|
+
!CompileDebuggerScript(Natives::GetIndex("debug"));
|
848
|
+
|
849
|
+
if (FLAG_enable_liveedit) {
|
850
|
+
caught_exception = caught_exception ||
|
851
|
+
!CompileDebuggerScript(Natives::GetIndex("liveedit"));
|
852
|
+
}
|
853
|
+
|
854
|
+
Debugger::set_compiling_natives(false);
|
855
|
+
|
856
|
+
// Make sure we mark the debugger as not loading before we might
|
857
|
+
// return.
|
858
|
+
Debugger::set_loading_debugger(false);
|
859
|
+
|
860
|
+
// Check for caught exceptions.
|
861
|
+
if (caught_exception) return false;
|
862
|
+
|
863
|
+
// Debugger loaded.
|
864
|
+
debug_context_ = context;
|
865
|
+
|
866
|
+
return true;
|
867
|
+
}
|
868
|
+
|
869
|
+
|
870
|
+
void Debug::Unload() {
|
871
|
+
// Return debugger is not loaded.
|
872
|
+
if (!IsLoaded()) {
|
873
|
+
return;
|
874
|
+
}
|
875
|
+
|
876
|
+
// Clear the script cache.
|
877
|
+
DestroyScriptCache();
|
878
|
+
|
879
|
+
// Clear debugger context global handle.
|
880
|
+
GlobalHandles::Destroy(reinterpret_cast<Object**>(debug_context_.location()));
|
881
|
+
debug_context_ = Handle<Context>();
|
882
|
+
}
|
883
|
+
|
884
|
+
|
885
|
+
// Set the flag indicating that preemption happened during debugging.
|
886
|
+
void Debug::PreemptionWhileInDebugger() {
|
887
|
+
ASSERT(InDebugger());
|
888
|
+
Debug::set_interrupts_pending(PREEMPT);
|
889
|
+
}
|
890
|
+
|
891
|
+
|
892
|
+
void Debug::Iterate(ObjectVisitor* v) {
|
893
|
+
v->VisitPointer(BitCast<Object**>(&(debug_break_return_)));
|
894
|
+
v->VisitPointer(BitCast<Object**>(&(debug_break_slot_)));
|
895
|
+
}
|
896
|
+
|
897
|
+
|
898
|
+
Object* Debug::Break(Arguments args) {
|
899
|
+
HandleScope scope;
|
900
|
+
ASSERT(args.length() == 0);
|
901
|
+
|
902
|
+
thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED;
|
903
|
+
|
904
|
+
// Get the top-most JavaScript frame.
|
905
|
+
JavaScriptFrameIterator it;
|
906
|
+
JavaScriptFrame* frame = it.frame();
|
907
|
+
|
908
|
+
// Just continue if breaks are disabled or debugger cannot be loaded.
|
909
|
+
if (disable_break() || !Load()) {
|
910
|
+
SetAfterBreakTarget(frame);
|
911
|
+
return Heap::undefined_value();
|
912
|
+
}
|
913
|
+
|
914
|
+
// Enter the debugger.
|
915
|
+
EnterDebugger debugger;
|
916
|
+
if (debugger.FailedToEnter()) {
|
917
|
+
return Heap::undefined_value();
|
918
|
+
}
|
919
|
+
|
920
|
+
// Postpone interrupt during breakpoint processing.
|
921
|
+
PostponeInterruptsScope postpone;
|
922
|
+
|
923
|
+
// Get the debug info (create it if it does not exist).
|
924
|
+
Handle<SharedFunctionInfo> shared =
|
925
|
+
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
|
926
|
+
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
927
|
+
|
928
|
+
// Find the break point where execution has stopped.
|
929
|
+
BreakLocationIterator break_location_iterator(debug_info,
|
930
|
+
ALL_BREAK_LOCATIONS);
|
931
|
+
break_location_iterator.FindBreakLocationFromAddress(frame->pc());
|
932
|
+
|
933
|
+
// Check whether step next reached a new statement.
|
934
|
+
if (!StepNextContinue(&break_location_iterator, frame)) {
|
935
|
+
// Decrease steps left if performing multiple steps.
|
936
|
+
if (thread_local_.step_count_ > 0) {
|
937
|
+
thread_local_.step_count_--;
|
938
|
+
}
|
939
|
+
}
|
940
|
+
|
941
|
+
// If there is one or more real break points check whether any of these are
|
942
|
+
// triggered.
|
943
|
+
Handle<Object> break_points_hit(Heap::undefined_value());
|
944
|
+
if (break_location_iterator.HasBreakPoint()) {
|
945
|
+
Handle<Object> break_point_objects =
|
946
|
+
Handle<Object>(break_location_iterator.BreakPointObjects());
|
947
|
+
break_points_hit = CheckBreakPoints(break_point_objects);
|
948
|
+
}
|
949
|
+
|
950
|
+
// If step out is active skip everything until the frame where we need to step
|
951
|
+
// out to is reached, unless real breakpoint is hit.
|
952
|
+
if (Debug::StepOutActive() && frame->fp() != Debug::step_out_fp() &&
|
953
|
+
break_points_hit->IsUndefined() ) {
|
954
|
+
// Step count should always be 0 for StepOut.
|
955
|
+
ASSERT(thread_local_.step_count_ == 0);
|
956
|
+
} else if (!break_points_hit->IsUndefined() ||
|
957
|
+
(thread_local_.last_step_action_ != StepNone &&
|
958
|
+
thread_local_.step_count_ == 0)) {
|
959
|
+
// Notify debugger if a real break point is triggered or if performing
|
960
|
+
// single stepping with no more steps to perform. Otherwise do another step.
|
961
|
+
|
962
|
+
// Clear all current stepping setup.
|
963
|
+
ClearStepping();
|
964
|
+
|
965
|
+
// Notify the debug event listeners.
|
966
|
+
Debugger::OnDebugBreak(break_points_hit, false);
|
967
|
+
} else if (thread_local_.last_step_action_ != StepNone) {
|
968
|
+
// Hold on to last step action as it is cleared by the call to
|
969
|
+
// ClearStepping.
|
970
|
+
StepAction step_action = thread_local_.last_step_action_;
|
971
|
+
int step_count = thread_local_.step_count_;
|
972
|
+
|
973
|
+
// Clear all current stepping setup.
|
974
|
+
ClearStepping();
|
975
|
+
|
976
|
+
// Set up for the remaining steps.
|
977
|
+
PrepareStep(step_action, step_count);
|
978
|
+
}
|
979
|
+
|
980
|
+
if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) {
|
981
|
+
SetAfterBreakTarget(frame);
|
982
|
+
} else if (thread_local_.frame_drop_mode_ == FRAME_DROPPED_IN_IC_CALL) {
|
983
|
+
// We must have been calling IC stub. Do not go there anymore.
|
984
|
+
Code* plain_return = Builtins::builtin(Builtins::PlainReturn_LiveEdit);
|
985
|
+
thread_local_.after_break_target_ = plain_return->entry();
|
986
|
+
} else if (thread_local_.frame_drop_mode_ ==
|
987
|
+
FRAME_DROPPED_IN_DEBUG_SLOT_CALL) {
|
988
|
+
// Debug break slot stub does not return normally, instead it manually
|
989
|
+
// cleans the stack and jumps. We should patch the jump address.
|
990
|
+
Code* plain_return = Builtins::builtin(Builtins::FrameDropper_LiveEdit);
|
991
|
+
thread_local_.after_break_target_ = plain_return->entry();
|
992
|
+
} else if (thread_local_.frame_drop_mode_ == FRAME_DROPPED_IN_DIRECT_CALL) {
|
993
|
+
// Nothing to do, after_break_target is not used here.
|
994
|
+
} else {
|
995
|
+
UNREACHABLE();
|
996
|
+
}
|
997
|
+
|
998
|
+
return Heap::undefined_value();
|
999
|
+
}
|
1000
|
+
|
1001
|
+
|
1002
|
+
// Check the break point objects for whether one or more are actually
|
1003
|
+
// triggered. This function returns a JSArray with the break point objects
|
1004
|
+
// which is triggered.
|
1005
|
+
Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
|
1006
|
+
int break_points_hit_count = 0;
|
1007
|
+
Handle<JSArray> break_points_hit = Factory::NewJSArray(1);
|
1008
|
+
|
1009
|
+
// If there are multiple break points they are in a FixedArray.
|
1010
|
+
ASSERT(!break_point_objects->IsUndefined());
|
1011
|
+
if (break_point_objects->IsFixedArray()) {
|
1012
|
+
Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
|
1013
|
+
for (int i = 0; i < array->length(); i++) {
|
1014
|
+
Handle<Object> o(array->get(i));
|
1015
|
+
if (CheckBreakPoint(o)) {
|
1016
|
+
SetElement(break_points_hit, break_points_hit_count++, o);
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
} else {
|
1020
|
+
if (CheckBreakPoint(break_point_objects)) {
|
1021
|
+
SetElement(break_points_hit,
|
1022
|
+
break_points_hit_count++,
|
1023
|
+
break_point_objects);
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
// Return undefined if no break points were triggered.
|
1028
|
+
if (break_points_hit_count == 0) {
|
1029
|
+
return Factory::undefined_value();
|
1030
|
+
}
|
1031
|
+
return break_points_hit;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
|
1035
|
+
// Check whether a single break point object is triggered.
|
1036
|
+
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
|
1037
|
+
HandleScope scope;
|
1038
|
+
|
1039
|
+
// Ignore check if break point object is not a JSObject.
|
1040
|
+
if (!break_point_object->IsJSObject()) return true;
|
1041
|
+
|
1042
|
+
// Get the function CheckBreakPoint (defined in debug.js).
|
1043
|
+
Handle<String> is_break_point_triggered_symbol =
|
1044
|
+
Factory::LookupAsciiSymbol("IsBreakPointTriggered");
|
1045
|
+
Handle<JSFunction> check_break_point =
|
1046
|
+
Handle<JSFunction>(JSFunction::cast(
|
1047
|
+
debug_context()->global()->GetPropertyNoExceptionThrown(
|
1048
|
+
*is_break_point_triggered_symbol)));
|
1049
|
+
|
1050
|
+
// Get the break id as an object.
|
1051
|
+
Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id());
|
1052
|
+
|
1053
|
+
// Call HandleBreakPointx.
|
1054
|
+
bool caught_exception = false;
|
1055
|
+
const int argc = 2;
|
1056
|
+
Object** argv[argc] = {
|
1057
|
+
break_id.location(),
|
1058
|
+
reinterpret_cast<Object**>(break_point_object.location())
|
1059
|
+
};
|
1060
|
+
Handle<Object> result = Execution::TryCall(check_break_point,
|
1061
|
+
Top::builtins(), argc, argv,
|
1062
|
+
&caught_exception);
|
1063
|
+
|
1064
|
+
// If exception or non boolean result handle as not triggered
|
1065
|
+
if (caught_exception || !result->IsBoolean()) {
|
1066
|
+
return false;
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
// Return whether the break point is triggered.
|
1070
|
+
return *result == Heap::true_value();
|
1071
|
+
}
|
1072
|
+
|
1073
|
+
|
1074
|
+
// Check whether the function has debug information.
|
1075
|
+
bool Debug::HasDebugInfo(Handle<SharedFunctionInfo> shared) {
|
1076
|
+
return !shared->debug_info()->IsUndefined();
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
|
1080
|
+
// Return the debug info for this function. EnsureDebugInfo must be called
|
1081
|
+
// prior to ensure the debug info has been generated for shared.
|
1082
|
+
Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
|
1083
|
+
ASSERT(HasDebugInfo(shared));
|
1084
|
+
return Handle<DebugInfo>(DebugInfo::cast(shared->debug_info()));
|
1085
|
+
}
|
1086
|
+
|
1087
|
+
|
1088
|
+
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
|
1089
|
+
Handle<Object> break_point_object,
|
1090
|
+
int* source_position) {
|
1091
|
+
HandleScope scope;
|
1092
|
+
|
1093
|
+
if (!EnsureDebugInfo(shared)) {
|
1094
|
+
// Return if retrieving debug info failed.
|
1095
|
+
return;
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
1099
|
+
// Source positions starts with zero.
|
1100
|
+
ASSERT(source_position >= 0);
|
1101
|
+
|
1102
|
+
// Find the break point and change it.
|
1103
|
+
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
|
1104
|
+
it.FindBreakLocationFromPosition(*source_position);
|
1105
|
+
it.SetBreakPoint(break_point_object);
|
1106
|
+
|
1107
|
+
*source_position = it.position();
|
1108
|
+
|
1109
|
+
// At least one active break point now.
|
1110
|
+
ASSERT(debug_info->GetBreakPointCount() > 0);
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
|
1114
|
+
void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
|
1115
|
+
HandleScope scope;
|
1116
|
+
|
1117
|
+
DebugInfoListNode* node = debug_info_list_;
|
1118
|
+
while (node != NULL) {
|
1119
|
+
Object* result = DebugInfo::FindBreakPointInfo(node->debug_info(),
|
1120
|
+
break_point_object);
|
1121
|
+
if (!result->IsUndefined()) {
|
1122
|
+
// Get information in the break point.
|
1123
|
+
BreakPointInfo* break_point_info = BreakPointInfo::cast(result);
|
1124
|
+
Handle<DebugInfo> debug_info = node->debug_info();
|
1125
|
+
Handle<SharedFunctionInfo> shared(debug_info->shared());
|
1126
|
+
int source_position = break_point_info->statement_position()->value();
|
1127
|
+
|
1128
|
+
// Source positions starts with zero.
|
1129
|
+
ASSERT(source_position >= 0);
|
1130
|
+
|
1131
|
+
// Find the break point and clear it.
|
1132
|
+
BreakLocationIterator it(debug_info, SOURCE_BREAK_LOCATIONS);
|
1133
|
+
it.FindBreakLocationFromPosition(source_position);
|
1134
|
+
it.ClearBreakPoint(break_point_object);
|
1135
|
+
|
1136
|
+
// If there are no more break points left remove the debug info for this
|
1137
|
+
// function.
|
1138
|
+
if (debug_info->GetBreakPointCount() == 0) {
|
1139
|
+
RemoveDebugInfo(debug_info);
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
return;
|
1143
|
+
}
|
1144
|
+
node = node->next();
|
1145
|
+
}
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
|
1149
|
+
void Debug::ClearAllBreakPoints() {
|
1150
|
+
DebugInfoListNode* node = debug_info_list_;
|
1151
|
+
while (node != NULL) {
|
1152
|
+
// Remove all debug break code.
|
1153
|
+
BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
|
1154
|
+
it.ClearAllDebugBreak();
|
1155
|
+
node = node->next();
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
// Remove all debug info.
|
1159
|
+
while (debug_info_list_ != NULL) {
|
1160
|
+
RemoveDebugInfo(debug_info_list_->debug_info());
|
1161
|
+
}
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
|
1165
|
+
void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) {
|
1166
|
+
// Make sure the function has setup the debug info.
|
1167
|
+
if (!EnsureDebugInfo(shared)) {
|
1168
|
+
// Return if we failed to retrieve the debug info.
|
1169
|
+
return;
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
// Flood the function with break points.
|
1173
|
+
BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS);
|
1174
|
+
while (!it.Done()) {
|
1175
|
+
it.SetOneShot();
|
1176
|
+
it.Next();
|
1177
|
+
}
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
|
1181
|
+
void Debug::FloodHandlerWithOneShot() {
|
1182
|
+
// Iterate through the JavaScript stack looking for handlers.
|
1183
|
+
StackFrame::Id id = break_frame_id();
|
1184
|
+
if (id == StackFrame::NO_ID) {
|
1185
|
+
// If there is no JavaScript stack don't do anything.
|
1186
|
+
return;
|
1187
|
+
}
|
1188
|
+
for (JavaScriptFrameIterator it(id); !it.done(); it.Advance()) {
|
1189
|
+
JavaScriptFrame* frame = it.frame();
|
1190
|
+
if (frame->HasHandler()) {
|
1191
|
+
Handle<SharedFunctionInfo> shared =
|
1192
|
+
Handle<SharedFunctionInfo>(
|
1193
|
+
JSFunction::cast(frame->function())->shared());
|
1194
|
+
// Flood the function with the catch block with break points
|
1195
|
+
FloodWithOneShot(shared);
|
1196
|
+
return;
|
1197
|
+
}
|
1198
|
+
}
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
|
1202
|
+
void Debug::ChangeBreakOnException(ExceptionBreakType type, bool enable) {
|
1203
|
+
if (type == BreakUncaughtException) {
|
1204
|
+
break_on_uncaught_exception_ = enable;
|
1205
|
+
} else {
|
1206
|
+
break_on_exception_ = enable;
|
1207
|
+
}
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
|
1211
|
+
bool Debug::IsBreakOnException(ExceptionBreakType type) {
|
1212
|
+
if (type == BreakUncaughtException) {
|
1213
|
+
return break_on_uncaught_exception_;
|
1214
|
+
} else {
|
1215
|
+
return break_on_exception_;
|
1216
|
+
}
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
|
1220
|
+
void Debug::PrepareStep(StepAction step_action, int step_count) {
|
1221
|
+
HandleScope scope;
|
1222
|
+
ASSERT(Debug::InDebugger());
|
1223
|
+
|
1224
|
+
// Remember this step action and count.
|
1225
|
+
thread_local_.last_step_action_ = step_action;
|
1226
|
+
if (step_action == StepOut) {
|
1227
|
+
// For step out target frame will be found on the stack so there is no need
|
1228
|
+
// to set step counter for it. It's expected to always be 0 for StepOut.
|
1229
|
+
thread_local_.step_count_ = 0;
|
1230
|
+
} else {
|
1231
|
+
thread_local_.step_count_ = step_count;
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
// Get the frame where the execution has stopped and skip the debug frame if
|
1235
|
+
// any. The debug frame will only be present if execution was stopped due to
|
1236
|
+
// hitting a break point. In other situations (e.g. unhandled exception) the
|
1237
|
+
// debug frame is not present.
|
1238
|
+
StackFrame::Id id = break_frame_id();
|
1239
|
+
if (id == StackFrame::NO_ID) {
|
1240
|
+
// If there is no JavaScript stack don't do anything.
|
1241
|
+
return;
|
1242
|
+
}
|
1243
|
+
JavaScriptFrameIterator frames_it(id);
|
1244
|
+
JavaScriptFrame* frame = frames_it.frame();
|
1245
|
+
|
1246
|
+
// First of all ensure there is one-shot break points in the top handler
|
1247
|
+
// if any.
|
1248
|
+
FloodHandlerWithOneShot();
|
1249
|
+
|
1250
|
+
// If the function on the top frame is unresolved perform step out. This will
|
1251
|
+
// be the case when calling unknown functions and having the debugger stopped
|
1252
|
+
// in an unhandled exception.
|
1253
|
+
if (!frame->function()->IsJSFunction()) {
|
1254
|
+
// Step out: Find the calling JavaScript frame and flood it with
|
1255
|
+
// breakpoints.
|
1256
|
+
frames_it.Advance();
|
1257
|
+
// Fill the function to return to with one-shot break points.
|
1258
|
+
JSFunction* function = JSFunction::cast(frames_it.frame()->function());
|
1259
|
+
FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
|
1260
|
+
return;
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
// Get the debug info (create it if it does not exist).
|
1264
|
+
Handle<SharedFunctionInfo> shared =
|
1265
|
+
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
|
1266
|
+
if (!EnsureDebugInfo(shared)) {
|
1267
|
+
// Return if ensuring debug info failed.
|
1268
|
+
return;
|
1269
|
+
}
|
1270
|
+
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
1271
|
+
|
1272
|
+
// Find the break location where execution has stopped.
|
1273
|
+
BreakLocationIterator it(debug_info, ALL_BREAK_LOCATIONS);
|
1274
|
+
it.FindBreakLocationFromAddress(frame->pc());
|
1275
|
+
|
1276
|
+
// Compute whether or not the target is a call target.
|
1277
|
+
bool is_load_or_store = false;
|
1278
|
+
bool is_inline_cache_stub = false;
|
1279
|
+
bool is_at_restarted_function = false;
|
1280
|
+
Handle<Code> call_function_stub;
|
1281
|
+
|
1282
|
+
if (thread_local_.restarter_frame_function_pointer_ == NULL) {
|
1283
|
+
if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) {
|
1284
|
+
bool is_call_target = false;
|
1285
|
+
Address target = it.rinfo()->target_address();
|
1286
|
+
Code* code = Code::GetCodeFromTargetAddress(target);
|
1287
|
+
if (code->is_call_stub() || code->is_keyed_call_stub()) {
|
1288
|
+
is_call_target = true;
|
1289
|
+
}
|
1290
|
+
if (code->is_inline_cache_stub()) {
|
1291
|
+
is_inline_cache_stub = true;
|
1292
|
+
is_load_or_store = !is_call_target;
|
1293
|
+
}
|
1294
|
+
|
1295
|
+
// Check if target code is CallFunction stub.
|
1296
|
+
Code* maybe_call_function_stub = code;
|
1297
|
+
// If there is a breakpoint at this line look at the original code to
|
1298
|
+
// check if it is a CallFunction stub.
|
1299
|
+
if (it.IsDebugBreak()) {
|
1300
|
+
Address original_target = it.original_rinfo()->target_address();
|
1301
|
+
maybe_call_function_stub =
|
1302
|
+
Code::GetCodeFromTargetAddress(original_target);
|
1303
|
+
}
|
1304
|
+
if (maybe_call_function_stub->kind() == Code::STUB &&
|
1305
|
+
maybe_call_function_stub->major_key() == CodeStub::CallFunction) {
|
1306
|
+
// Save reference to the code as we may need it to find out arguments
|
1307
|
+
// count for 'step in' later.
|
1308
|
+
call_function_stub = Handle<Code>(maybe_call_function_stub);
|
1309
|
+
}
|
1310
|
+
}
|
1311
|
+
} else {
|
1312
|
+
is_at_restarted_function = true;
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
// If this is the last break code target step out is the only possibility.
|
1316
|
+
if (it.IsExit() || step_action == StepOut) {
|
1317
|
+
if (step_action == StepOut) {
|
1318
|
+
// Skip step_count frames starting with the current one.
|
1319
|
+
while (step_count-- > 0 && !frames_it.done()) {
|
1320
|
+
frames_it.Advance();
|
1321
|
+
}
|
1322
|
+
} else {
|
1323
|
+
ASSERT(it.IsExit());
|
1324
|
+
frames_it.Advance();
|
1325
|
+
}
|
1326
|
+
// Skip builtin functions on the stack.
|
1327
|
+
while (!frames_it.done() &&
|
1328
|
+
JSFunction::cast(frames_it.frame()->function())->IsBuiltin()) {
|
1329
|
+
frames_it.Advance();
|
1330
|
+
}
|
1331
|
+
// Step out: If there is a JavaScript caller frame, we need to
|
1332
|
+
// flood it with breakpoints.
|
1333
|
+
if (!frames_it.done()) {
|
1334
|
+
// Fill the function to return to with one-shot break points.
|
1335
|
+
JSFunction* function = JSFunction::cast(frames_it.frame()->function());
|
1336
|
+
FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
|
1337
|
+
// Set target frame pointer.
|
1338
|
+
ActivateStepOut(frames_it.frame());
|
1339
|
+
}
|
1340
|
+
} else if (!(is_inline_cache_stub || RelocInfo::IsConstructCall(it.rmode()) ||
|
1341
|
+
!call_function_stub.is_null() || is_at_restarted_function)
|
1342
|
+
|| step_action == StepNext || step_action == StepMin) {
|
1343
|
+
// Step next or step min.
|
1344
|
+
|
1345
|
+
// Fill the current function with one-shot break points.
|
1346
|
+
FloodWithOneShot(shared);
|
1347
|
+
|
1348
|
+
// Remember source position and frame to handle step next.
|
1349
|
+
thread_local_.last_statement_position_ =
|
1350
|
+
debug_info->code()->SourceStatementPosition(frame->pc());
|
1351
|
+
thread_local_.last_fp_ = frame->fp();
|
1352
|
+
} else {
|
1353
|
+
// If there's restarter frame on top of the stack, just get the pointer
|
1354
|
+
// to function which is going to be restarted.
|
1355
|
+
if (is_at_restarted_function) {
|
1356
|
+
Handle<JSFunction> restarted_function(
|
1357
|
+
JSFunction::cast(*thread_local_.restarter_frame_function_pointer_));
|
1358
|
+
Handle<SharedFunctionInfo> restarted_shared(
|
1359
|
+
restarted_function->shared());
|
1360
|
+
FloodWithOneShot(restarted_shared);
|
1361
|
+
} else if (!call_function_stub.is_null()) {
|
1362
|
+
// If it's CallFunction stub ensure target function is compiled and flood
|
1363
|
+
// it with one shot breakpoints.
|
1364
|
+
|
1365
|
+
// Find out number of arguments from the stub minor key.
|
1366
|
+
// Reverse lookup required as the minor key cannot be retrieved
|
1367
|
+
// from the code object.
|
1368
|
+
Handle<Object> obj(
|
1369
|
+
Heap::code_stubs()->SlowReverseLookup(*call_function_stub));
|
1370
|
+
ASSERT(*obj != Heap::undefined_value());
|
1371
|
+
ASSERT(obj->IsSmi());
|
1372
|
+
// Get the STUB key and extract major and minor key.
|
1373
|
+
uint32_t key = Smi::cast(*obj)->value();
|
1374
|
+
// Argc in the stub is the number of arguments passed - not the
|
1375
|
+
// expected arguments of the called function.
|
1376
|
+
int call_function_arg_count =
|
1377
|
+
CallFunctionStub::ExtractArgcFromMinorKey(
|
1378
|
+
CodeStub::MinorKeyFromKey(key));
|
1379
|
+
ASSERT(call_function_stub->major_key() ==
|
1380
|
+
CodeStub::MajorKeyFromKey(key));
|
1381
|
+
|
1382
|
+
// Find target function on the expression stack.
|
1383
|
+
// Expression stack looks like this (top to bottom):
|
1384
|
+
// argN
|
1385
|
+
// ...
|
1386
|
+
// arg0
|
1387
|
+
// Receiver
|
1388
|
+
// Function to call
|
1389
|
+
int expressions_count = frame->ComputeExpressionsCount();
|
1390
|
+
ASSERT(expressions_count - 2 - call_function_arg_count >= 0);
|
1391
|
+
Object* fun = frame->GetExpression(
|
1392
|
+
expressions_count - 2 - call_function_arg_count);
|
1393
|
+
if (fun->IsJSFunction()) {
|
1394
|
+
Handle<JSFunction> js_function(JSFunction::cast(fun));
|
1395
|
+
// Don't step into builtins.
|
1396
|
+
if (!js_function->IsBuiltin()) {
|
1397
|
+
// It will also compile target function if it's not compiled yet.
|
1398
|
+
FloodWithOneShot(Handle<SharedFunctionInfo>(js_function->shared()));
|
1399
|
+
}
|
1400
|
+
}
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
// Fill the current function with one-shot break points even for step in on
|
1404
|
+
// a call target as the function called might be a native function for
|
1405
|
+
// which step in will not stop. It also prepares for stepping in
|
1406
|
+
// getters/setters.
|
1407
|
+
FloodWithOneShot(shared);
|
1408
|
+
|
1409
|
+
if (is_load_or_store) {
|
1410
|
+
// Remember source position and frame to handle step in getter/setter. If
|
1411
|
+
// there is a custom getter/setter it will be handled in
|
1412
|
+
// Object::Get/SetPropertyWithCallback, otherwise the step action will be
|
1413
|
+
// propagated on the next Debug::Break.
|
1414
|
+
thread_local_.last_statement_position_ =
|
1415
|
+
debug_info->code()->SourceStatementPosition(frame->pc());
|
1416
|
+
thread_local_.last_fp_ = frame->fp();
|
1417
|
+
}
|
1418
|
+
|
1419
|
+
// Step in or Step in min
|
1420
|
+
it.PrepareStepIn();
|
1421
|
+
ActivateStepIn(frame);
|
1422
|
+
}
|
1423
|
+
}
|
1424
|
+
|
1425
|
+
|
1426
|
+
// Check whether the current debug break should be reported to the debugger. It
|
1427
|
+
// is used to have step next and step in only report break back to the debugger
|
1428
|
+
// if on a different frame or in a different statement. In some situations
|
1429
|
+
// there will be several break points in the same statement when the code is
|
1430
|
+
// flooded with one-shot break points. This function helps to perform several
|
1431
|
+
// steps before reporting break back to the debugger.
|
1432
|
+
bool Debug::StepNextContinue(BreakLocationIterator* break_location_iterator,
|
1433
|
+
JavaScriptFrame* frame) {
|
1434
|
+
// If the step last action was step next or step in make sure that a new
|
1435
|
+
// statement is hit.
|
1436
|
+
if (thread_local_.last_step_action_ == StepNext ||
|
1437
|
+
thread_local_.last_step_action_ == StepIn) {
|
1438
|
+
// Never continue if returning from function.
|
1439
|
+
if (break_location_iterator->IsExit()) return false;
|
1440
|
+
|
1441
|
+
// Continue if we are still on the same frame and in the same statement.
|
1442
|
+
int current_statement_position =
|
1443
|
+
break_location_iterator->code()->SourceStatementPosition(frame->pc());
|
1444
|
+
return thread_local_.last_fp_ == frame->fp() &&
|
1445
|
+
thread_local_.last_statement_position_ == current_statement_position;
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
// No step next action - don't continue.
|
1449
|
+
return false;
|
1450
|
+
}
|
1451
|
+
|
1452
|
+
|
1453
|
+
// Check whether the code object at the specified address is a debug break code
|
1454
|
+
// object.
|
1455
|
+
bool Debug::IsDebugBreak(Address addr) {
|
1456
|
+
Code* code = Code::GetCodeFromTargetAddress(addr);
|
1457
|
+
return code->ic_state() == DEBUG_BREAK;
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
|
1461
|
+
// Check whether a code stub with the specified major key is a possible break
|
1462
|
+
// point location when looking for source break locations.
|
1463
|
+
bool Debug::IsSourceBreakStub(Code* code) {
|
1464
|
+
CodeStub::Major major_key = CodeStub::GetMajorKey(code);
|
1465
|
+
return major_key == CodeStub::CallFunction;
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
|
1469
|
+
// Check whether a code stub with the specified major key is a possible break
|
1470
|
+
// location.
|
1471
|
+
bool Debug::IsBreakStub(Code* code) {
|
1472
|
+
CodeStub::Major major_key = CodeStub::GetMajorKey(code);
|
1473
|
+
return major_key == CodeStub::CallFunction;
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
|
1477
|
+
// Find the builtin to use for invoking the debug break
|
1478
|
+
Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
|
1479
|
+
// Find the builtin debug break function matching the calling convention
|
1480
|
+
// used by the call site.
|
1481
|
+
if (code->is_inline_cache_stub()) {
|
1482
|
+
switch (code->kind()) {
|
1483
|
+
case Code::CALL_IC:
|
1484
|
+
case Code::KEYED_CALL_IC:
|
1485
|
+
return ComputeCallDebugBreak(code->arguments_count(), code->kind());
|
1486
|
+
|
1487
|
+
case Code::LOAD_IC:
|
1488
|
+
return Handle<Code>(Builtins::builtin(Builtins::LoadIC_DebugBreak));
|
1489
|
+
|
1490
|
+
case Code::STORE_IC:
|
1491
|
+
return Handle<Code>(Builtins::builtin(Builtins::StoreIC_DebugBreak));
|
1492
|
+
|
1493
|
+
case Code::KEYED_LOAD_IC:
|
1494
|
+
return Handle<Code>(
|
1495
|
+
Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak));
|
1496
|
+
|
1497
|
+
case Code::KEYED_STORE_IC:
|
1498
|
+
return Handle<Code>(
|
1499
|
+
Builtins::builtin(Builtins::KeyedStoreIC_DebugBreak));
|
1500
|
+
|
1501
|
+
default:
|
1502
|
+
UNREACHABLE();
|
1503
|
+
}
|
1504
|
+
}
|
1505
|
+
if (RelocInfo::IsConstructCall(mode)) {
|
1506
|
+
Handle<Code> result =
|
1507
|
+
Handle<Code>(Builtins::builtin(Builtins::ConstructCall_DebugBreak));
|
1508
|
+
return result;
|
1509
|
+
}
|
1510
|
+
if (code->kind() == Code::STUB) {
|
1511
|
+
ASSERT(code->major_key() == CodeStub::CallFunction);
|
1512
|
+
Handle<Code> result =
|
1513
|
+
Handle<Code>(Builtins::builtin(Builtins::StubNoRegisters_DebugBreak));
|
1514
|
+
return result;
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
UNREACHABLE();
|
1518
|
+
return Handle<Code>::null();
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
|
1522
|
+
// Simple function for returning the source positions for active break points.
|
1523
|
+
Handle<Object> Debug::GetSourceBreakLocations(
|
1524
|
+
Handle<SharedFunctionInfo> shared) {
|
1525
|
+
if (!HasDebugInfo(shared)) return Handle<Object>(Heap::undefined_value());
|
1526
|
+
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
1527
|
+
if (debug_info->GetBreakPointCount() == 0) {
|
1528
|
+
return Handle<Object>(Heap::undefined_value());
|
1529
|
+
}
|
1530
|
+
Handle<FixedArray> locations =
|
1531
|
+
Factory::NewFixedArray(debug_info->GetBreakPointCount());
|
1532
|
+
int count = 0;
|
1533
|
+
for (int i = 0; i < debug_info->break_points()->length(); i++) {
|
1534
|
+
if (!debug_info->break_points()->get(i)->IsUndefined()) {
|
1535
|
+
BreakPointInfo* break_point_info =
|
1536
|
+
BreakPointInfo::cast(debug_info->break_points()->get(i));
|
1537
|
+
if (break_point_info->GetBreakPointCount() > 0) {
|
1538
|
+
locations->set(count++, break_point_info->statement_position());
|
1539
|
+
}
|
1540
|
+
}
|
1541
|
+
}
|
1542
|
+
return locations;
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
|
1546
|
+
void Debug::NewBreak(StackFrame::Id break_frame_id) {
|
1547
|
+
thread_local_.break_frame_id_ = break_frame_id;
|
1548
|
+
thread_local_.break_id_ = ++thread_local_.break_count_;
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
|
1552
|
+
void Debug::SetBreak(StackFrame::Id break_frame_id, int break_id) {
|
1553
|
+
thread_local_.break_frame_id_ = break_frame_id;
|
1554
|
+
thread_local_.break_id_ = break_id;
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
|
1558
|
+
// Handle stepping into a function.
|
1559
|
+
void Debug::HandleStepIn(Handle<JSFunction> function,
|
1560
|
+
Handle<Object> holder,
|
1561
|
+
Address fp,
|
1562
|
+
bool is_constructor) {
|
1563
|
+
// If the frame pointer is not supplied by the caller find it.
|
1564
|
+
if (fp == 0) {
|
1565
|
+
StackFrameIterator it;
|
1566
|
+
it.Advance();
|
1567
|
+
// For constructor functions skip another frame.
|
1568
|
+
if (is_constructor) {
|
1569
|
+
ASSERT(it.frame()->is_construct());
|
1570
|
+
it.Advance();
|
1571
|
+
}
|
1572
|
+
fp = it.frame()->fp();
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
// Flood the function with one-shot break points if it is called from where
|
1576
|
+
// step into was requested.
|
1577
|
+
if (fp == Debug::step_in_fp()) {
|
1578
|
+
// Don't allow step into functions in the native context.
|
1579
|
+
if (!function->IsBuiltin()) {
|
1580
|
+
if (function->shared()->code() ==
|
1581
|
+
Builtins::builtin(Builtins::FunctionApply) ||
|
1582
|
+
function->shared()->code() ==
|
1583
|
+
Builtins::builtin(Builtins::FunctionCall)) {
|
1584
|
+
// Handle function.apply and function.call separately to flood the
|
1585
|
+
// function to be called and not the code for Builtins::FunctionApply or
|
1586
|
+
// Builtins::FunctionCall. The receiver of call/apply is the target
|
1587
|
+
// function.
|
1588
|
+
if (!holder.is_null() && holder->IsJSFunction() &&
|
1589
|
+
!JSFunction::cast(*holder)->IsBuiltin()) {
|
1590
|
+
Handle<SharedFunctionInfo> shared_info(
|
1591
|
+
JSFunction::cast(*holder)->shared());
|
1592
|
+
Debug::FloodWithOneShot(shared_info);
|
1593
|
+
}
|
1594
|
+
} else {
|
1595
|
+
Debug::FloodWithOneShot(Handle<SharedFunctionInfo>(function->shared()));
|
1596
|
+
}
|
1597
|
+
}
|
1598
|
+
}
|
1599
|
+
}
|
1600
|
+
|
1601
|
+
|
1602
|
+
void Debug::ClearStepping() {
|
1603
|
+
// Clear the various stepping setup.
|
1604
|
+
ClearOneShot();
|
1605
|
+
ClearStepIn();
|
1606
|
+
ClearStepOut();
|
1607
|
+
ClearStepNext();
|
1608
|
+
|
1609
|
+
// Clear multiple step counter.
|
1610
|
+
thread_local_.step_count_ = 0;
|
1611
|
+
}
|
1612
|
+
|
1613
|
+
// Clears all the one-shot break points that are currently set. Normally this
|
1614
|
+
// function is called each time a break point is hit as one shot break points
|
1615
|
+
// are used to support stepping.
|
1616
|
+
void Debug::ClearOneShot() {
|
1617
|
+
// The current implementation just runs through all the breakpoints. When the
|
1618
|
+
// last break point for a function is removed that function is automatically
|
1619
|
+
// removed from the list.
|
1620
|
+
|
1621
|
+
DebugInfoListNode* node = debug_info_list_;
|
1622
|
+
while (node != NULL) {
|
1623
|
+
BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
|
1624
|
+
while (!it.Done()) {
|
1625
|
+
it.ClearOneShot();
|
1626
|
+
it.Next();
|
1627
|
+
}
|
1628
|
+
node = node->next();
|
1629
|
+
}
|
1630
|
+
}
|
1631
|
+
|
1632
|
+
|
1633
|
+
void Debug::ActivateStepIn(StackFrame* frame) {
|
1634
|
+
ASSERT(!StepOutActive());
|
1635
|
+
thread_local_.step_into_fp_ = frame->fp();
|
1636
|
+
}
|
1637
|
+
|
1638
|
+
|
1639
|
+
void Debug::ClearStepIn() {
|
1640
|
+
thread_local_.step_into_fp_ = 0;
|
1641
|
+
}
|
1642
|
+
|
1643
|
+
|
1644
|
+
void Debug::ActivateStepOut(StackFrame* frame) {
|
1645
|
+
ASSERT(!StepInActive());
|
1646
|
+
thread_local_.step_out_fp_ = frame->fp();
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
|
1650
|
+
void Debug::ClearStepOut() {
|
1651
|
+
thread_local_.step_out_fp_ = 0;
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
|
1655
|
+
void Debug::ClearStepNext() {
|
1656
|
+
thread_local_.last_step_action_ = StepNone;
|
1657
|
+
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
|
1658
|
+
thread_local_.last_fp_ = 0;
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
|
1662
|
+
// Ensures the debug information is present for shared.
|
1663
|
+
bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) {
|
1664
|
+
// Return if we already have the debug info for shared.
|
1665
|
+
if (HasDebugInfo(shared)) return true;
|
1666
|
+
|
1667
|
+
// Ensure shared in compiled. Return false if this failed.
|
1668
|
+
if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
|
1669
|
+
|
1670
|
+
// If preparing for the first break point make sure to deoptimize all
|
1671
|
+
// functions as debugging does not work with optimized code.
|
1672
|
+
if (!has_break_points_) {
|
1673
|
+
Deoptimizer::DeoptimizeAll();
|
1674
|
+
}
|
1675
|
+
|
1676
|
+
// Create the debug info object.
|
1677
|
+
Handle<DebugInfo> debug_info = Factory::NewDebugInfo(shared);
|
1678
|
+
|
1679
|
+
// Add debug info to the list.
|
1680
|
+
DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
|
1681
|
+
node->set_next(debug_info_list_);
|
1682
|
+
debug_info_list_ = node;
|
1683
|
+
|
1684
|
+
// Now there is at least one break point.
|
1685
|
+
has_break_points_ = true;
|
1686
|
+
|
1687
|
+
return true;
|
1688
|
+
}
|
1689
|
+
|
1690
|
+
|
1691
|
+
void Debug::RemoveDebugInfo(Handle<DebugInfo> debug_info) {
|
1692
|
+
ASSERT(debug_info_list_ != NULL);
|
1693
|
+
// Run through the debug info objects to find this one and remove it.
|
1694
|
+
DebugInfoListNode* prev = NULL;
|
1695
|
+
DebugInfoListNode* current = debug_info_list_;
|
1696
|
+
while (current != NULL) {
|
1697
|
+
if (*current->debug_info() == *debug_info) {
|
1698
|
+
// Unlink from list. If prev is NULL we are looking at the first element.
|
1699
|
+
if (prev == NULL) {
|
1700
|
+
debug_info_list_ = current->next();
|
1701
|
+
} else {
|
1702
|
+
prev->set_next(current->next());
|
1703
|
+
}
|
1704
|
+
current->debug_info()->shared()->set_debug_info(Heap::undefined_value());
|
1705
|
+
delete current;
|
1706
|
+
|
1707
|
+
// If there are no more debug info objects there are not more break
|
1708
|
+
// points.
|
1709
|
+
has_break_points_ = debug_info_list_ != NULL;
|
1710
|
+
|
1711
|
+
return;
|
1712
|
+
}
|
1713
|
+
// Move to next in list.
|
1714
|
+
prev = current;
|
1715
|
+
current = current->next();
|
1716
|
+
}
|
1717
|
+
UNREACHABLE();
|
1718
|
+
}
|
1719
|
+
|
1720
|
+
|
1721
|
+
void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
|
1722
|
+
HandleScope scope;
|
1723
|
+
|
1724
|
+
// Get the executing function in which the debug break occurred.
|
1725
|
+
Handle<SharedFunctionInfo> shared =
|
1726
|
+
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
|
1727
|
+
if (!EnsureDebugInfo(shared)) {
|
1728
|
+
// Return if we failed to retrieve the debug info.
|
1729
|
+
return;
|
1730
|
+
}
|
1731
|
+
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
1732
|
+
Handle<Code> code(debug_info->code());
|
1733
|
+
Handle<Code> original_code(debug_info->original_code());
|
1734
|
+
#ifdef DEBUG
|
1735
|
+
// Get the code which is actually executing.
|
1736
|
+
Handle<Code> frame_code(frame->code());
|
1737
|
+
ASSERT(frame_code.is_identical_to(code));
|
1738
|
+
#endif
|
1739
|
+
|
1740
|
+
// Find the call address in the running code. This address holds the call to
|
1741
|
+
// either a DebugBreakXXX or to the debug break return entry code if the
|
1742
|
+
// break point is still active after processing the break point.
|
1743
|
+
Address addr = frame->pc() - Assembler::kCallTargetAddressOffset;
|
1744
|
+
|
1745
|
+
// Check if the location is at JS exit or debug break slot.
|
1746
|
+
bool at_js_return = false;
|
1747
|
+
bool break_at_js_return_active = false;
|
1748
|
+
bool at_debug_break_slot = false;
|
1749
|
+
RelocIterator it(debug_info->code());
|
1750
|
+
while (!it.done() && !at_js_return && !at_debug_break_slot) {
|
1751
|
+
if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
|
1752
|
+
at_js_return = (it.rinfo()->pc() ==
|
1753
|
+
addr - Assembler::kPatchReturnSequenceAddressOffset);
|
1754
|
+
break_at_js_return_active = it.rinfo()->IsPatchedReturnSequence();
|
1755
|
+
}
|
1756
|
+
if (RelocInfo::IsDebugBreakSlot(it.rinfo()->rmode())) {
|
1757
|
+
at_debug_break_slot = (it.rinfo()->pc() ==
|
1758
|
+
addr - Assembler::kPatchDebugBreakSlotAddressOffset);
|
1759
|
+
}
|
1760
|
+
it.next();
|
1761
|
+
}
|
1762
|
+
|
1763
|
+
// Handle the jump to continue execution after break point depending on the
|
1764
|
+
// break location.
|
1765
|
+
if (at_js_return) {
|
1766
|
+
// If the break point as return is still active jump to the corresponding
|
1767
|
+
// place in the original code. If not the break point was removed during
|
1768
|
+
// break point processing.
|
1769
|
+
if (break_at_js_return_active) {
|
1770
|
+
addr += original_code->instruction_start() - code->instruction_start();
|
1771
|
+
}
|
1772
|
+
|
1773
|
+
// Move back to where the call instruction sequence started.
|
1774
|
+
thread_local_.after_break_target_ =
|
1775
|
+
addr - Assembler::kPatchReturnSequenceAddressOffset;
|
1776
|
+
} else if (at_debug_break_slot) {
|
1777
|
+
// Address of where the debug break slot starts.
|
1778
|
+
addr = addr - Assembler::kPatchDebugBreakSlotAddressOffset;
|
1779
|
+
|
1780
|
+
// Continue just after the slot.
|
1781
|
+
thread_local_.after_break_target_ = addr + Assembler::kDebugBreakSlotLength;
|
1782
|
+
} else if (IsDebugBreak(Assembler::target_address_at(addr))) {
|
1783
|
+
// We now know that there is still a debug break call at the target address,
|
1784
|
+
// so the break point is still there and the original code will hold the
|
1785
|
+
// address to jump to in order to complete the call which is replaced by a
|
1786
|
+
// call to DebugBreakXXX.
|
1787
|
+
|
1788
|
+
// Find the corresponding address in the original code.
|
1789
|
+
addr += original_code->instruction_start() - code->instruction_start();
|
1790
|
+
|
1791
|
+
// Install jump to the call address in the original code. This will be the
|
1792
|
+
// call which was overwritten by the call to DebugBreakXXX.
|
1793
|
+
thread_local_.after_break_target_ = Assembler::target_address_at(addr);
|
1794
|
+
} else {
|
1795
|
+
// There is no longer a break point present. Don't try to look in the
|
1796
|
+
// original code as the running code will have the right address. This takes
|
1797
|
+
// care of the case where the last break point is removed from the function
|
1798
|
+
// and therefore no "original code" is available.
|
1799
|
+
thread_local_.after_break_target_ = Assembler::target_address_at(addr);
|
1800
|
+
}
|
1801
|
+
}
|
1802
|
+
|
1803
|
+
|
1804
|
+
bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
|
1805
|
+
HandleScope scope;
|
1806
|
+
|
1807
|
+
// Get the executing function in which the debug break occurred.
|
1808
|
+
Handle<SharedFunctionInfo> shared =
|
1809
|
+
Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared());
|
1810
|
+
if (!EnsureDebugInfo(shared)) {
|
1811
|
+
// Return if we failed to retrieve the debug info.
|
1812
|
+
return false;
|
1813
|
+
}
|
1814
|
+
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
1815
|
+
Handle<Code> code(debug_info->code());
|
1816
|
+
#ifdef DEBUG
|
1817
|
+
// Get the code which is actually executing.
|
1818
|
+
Handle<Code> frame_code(frame->code());
|
1819
|
+
ASSERT(frame_code.is_identical_to(code));
|
1820
|
+
#endif
|
1821
|
+
|
1822
|
+
// Find the call address in the running code.
|
1823
|
+
Address addr = frame->pc() - Assembler::kCallTargetAddressOffset;
|
1824
|
+
|
1825
|
+
// Check if the location is at JS return.
|
1826
|
+
RelocIterator it(debug_info->code());
|
1827
|
+
while (!it.done()) {
|
1828
|
+
if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) {
|
1829
|
+
return (it.rinfo()->pc() ==
|
1830
|
+
addr - Assembler::kPatchReturnSequenceAddressOffset);
|
1831
|
+
}
|
1832
|
+
it.next();
|
1833
|
+
}
|
1834
|
+
return false;
|
1835
|
+
}
|
1836
|
+
|
1837
|
+
|
1838
|
+
void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
|
1839
|
+
FrameDropMode mode,
|
1840
|
+
Object** restarter_frame_function_pointer) {
|
1841
|
+
thread_local_.frame_drop_mode_ = mode;
|
1842
|
+
thread_local_.break_frame_id_ = new_break_frame_id;
|
1843
|
+
thread_local_.restarter_frame_function_pointer_ =
|
1844
|
+
restarter_frame_function_pointer;
|
1845
|
+
}
|
1846
|
+
|
1847
|
+
|
1848
|
+
bool Debug::IsDebugGlobal(GlobalObject* global) {
|
1849
|
+
return IsLoaded() && global == Debug::debug_context()->global();
|
1850
|
+
}
|
1851
|
+
|
1852
|
+
|
1853
|
+
void Debug::ClearMirrorCache() {
|
1854
|
+
PostponeInterruptsScope postpone;
|
1855
|
+
HandleScope scope;
|
1856
|
+
ASSERT(Top::context() == *Debug::debug_context());
|
1857
|
+
|
1858
|
+
// Clear the mirror cache.
|
1859
|
+
Handle<String> function_name =
|
1860
|
+
Factory::LookupSymbol(CStrVector("ClearMirrorCache"));
|
1861
|
+
Handle<Object> fun(Top::global()->GetPropertyNoExceptionThrown(
|
1862
|
+
*function_name));
|
1863
|
+
ASSERT(fun->IsJSFunction());
|
1864
|
+
bool caught_exception;
|
1865
|
+
Handle<Object> js_object = Execution::TryCall(
|
1866
|
+
Handle<JSFunction>::cast(fun),
|
1867
|
+
Handle<JSObject>(Debug::debug_context()->global()),
|
1868
|
+
0, NULL, &caught_exception);
|
1869
|
+
}
|
1870
|
+
|
1871
|
+
|
1872
|
+
void Debug::CreateScriptCache() {
|
1873
|
+
HandleScope scope;
|
1874
|
+
|
1875
|
+
// Perform two GCs to get rid of all unreferenced scripts. The first GC gets
|
1876
|
+
// rid of all the cached script wrappers and the second gets rid of the
|
1877
|
+
// scripts which are no longer referenced.
|
1878
|
+
Heap::CollectAllGarbage(false);
|
1879
|
+
Heap::CollectAllGarbage(false);
|
1880
|
+
|
1881
|
+
ASSERT(script_cache_ == NULL);
|
1882
|
+
script_cache_ = new ScriptCache();
|
1883
|
+
|
1884
|
+
// Scan heap for Script objects.
|
1885
|
+
int count = 0;
|
1886
|
+
HeapIterator iterator;
|
1887
|
+
for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
|
1888
|
+
if (obj->IsScript() && Script::cast(obj)->HasValidSource()) {
|
1889
|
+
script_cache_->Add(Handle<Script>(Script::cast(obj)));
|
1890
|
+
count++;
|
1891
|
+
}
|
1892
|
+
}
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
|
1896
|
+
void Debug::DestroyScriptCache() {
|
1897
|
+
// Get rid of the script cache if it was created.
|
1898
|
+
if (script_cache_ != NULL) {
|
1899
|
+
delete script_cache_;
|
1900
|
+
script_cache_ = NULL;
|
1901
|
+
}
|
1902
|
+
}
|
1903
|
+
|
1904
|
+
|
1905
|
+
void Debug::AddScriptToScriptCache(Handle<Script> script) {
|
1906
|
+
if (script_cache_ != NULL) {
|
1907
|
+
script_cache_->Add(script);
|
1908
|
+
}
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
|
1912
|
+
Handle<FixedArray> Debug::GetLoadedScripts() {
|
1913
|
+
// Create and fill the script cache when the loaded scripts is requested for
|
1914
|
+
// the first time.
|
1915
|
+
if (script_cache_ == NULL) {
|
1916
|
+
CreateScriptCache();
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
// If the script cache is not active just return an empty array.
|
1920
|
+
ASSERT(script_cache_ != NULL);
|
1921
|
+
if (script_cache_ == NULL) {
|
1922
|
+
Factory::NewFixedArray(0);
|
1923
|
+
}
|
1924
|
+
|
1925
|
+
// Perform GC to get unreferenced scripts evicted from the cache before
|
1926
|
+
// returning the content.
|
1927
|
+
Heap::CollectAllGarbage(false);
|
1928
|
+
|
1929
|
+
// Get the scripts from the cache.
|
1930
|
+
return script_cache_->GetScripts();
|
1931
|
+
}
|
1932
|
+
|
1933
|
+
|
1934
|
+
void Debug::AfterGarbageCollection() {
|
1935
|
+
// Generate events for collected scripts.
|
1936
|
+
if (script_cache_ != NULL) {
|
1937
|
+
script_cache_->ProcessCollectedScripts();
|
1938
|
+
}
|
1939
|
+
}
|
1940
|
+
|
1941
|
+
|
1942
|
+
Mutex* Debugger::debugger_access_ = OS::CreateMutex();
|
1943
|
+
Handle<Object> Debugger::event_listener_ = Handle<Object>();
|
1944
|
+
Handle<Object> Debugger::event_listener_data_ = Handle<Object>();
|
1945
|
+
bool Debugger::compiling_natives_ = false;
|
1946
|
+
bool Debugger::is_loading_debugger_ = false;
|
1947
|
+
bool Debugger::never_unload_debugger_ = false;
|
1948
|
+
v8::Debug::MessageHandler2 Debugger::message_handler_ = NULL;
|
1949
|
+
bool Debugger::debugger_unload_pending_ = false;
|
1950
|
+
v8::Debug::HostDispatchHandler Debugger::host_dispatch_handler_ = NULL;
|
1951
|
+
Mutex* Debugger::dispatch_handler_access_ = OS::CreateMutex();
|
1952
|
+
v8::Debug::DebugMessageDispatchHandler
|
1953
|
+
Debugger::debug_message_dispatch_handler_ = NULL;
|
1954
|
+
MessageDispatchHelperThread* Debugger::message_dispatch_helper_thread_ = NULL;
|
1955
|
+
int Debugger::host_dispatch_micros_ = 100 * 1000;
|
1956
|
+
DebuggerAgent* Debugger::agent_ = NULL;
|
1957
|
+
LockingCommandMessageQueue Debugger::command_queue_(kQueueInitialSize);
|
1958
|
+
Semaphore* Debugger::command_received_ = OS::CreateSemaphore(0);
|
1959
|
+
LockingCommandMessageQueue Debugger::event_command_queue_(kQueueInitialSize);
|
1960
|
+
|
1961
|
+
|
1962
|
+
Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
|
1963
|
+
int argc, Object*** argv,
|
1964
|
+
bool* caught_exception) {
|
1965
|
+
ASSERT(Top::context() == *Debug::debug_context());
|
1966
|
+
|
1967
|
+
// Create the execution state object.
|
1968
|
+
Handle<String> constructor_str = Factory::LookupSymbol(constructor_name);
|
1969
|
+
Handle<Object> constructor(Top::global()->GetPropertyNoExceptionThrown(
|
1970
|
+
*constructor_str));
|
1971
|
+
ASSERT(constructor->IsJSFunction());
|
1972
|
+
if (!constructor->IsJSFunction()) {
|
1973
|
+
*caught_exception = true;
|
1974
|
+
return Factory::undefined_value();
|
1975
|
+
}
|
1976
|
+
Handle<Object> js_object = Execution::TryCall(
|
1977
|
+
Handle<JSFunction>::cast(constructor),
|
1978
|
+
Handle<JSObject>(Debug::debug_context()->global()), argc, argv,
|
1979
|
+
caught_exception);
|
1980
|
+
return js_object;
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
|
1984
|
+
Handle<Object> Debugger::MakeExecutionState(bool* caught_exception) {
|
1985
|
+
// Create the execution state object.
|
1986
|
+
Handle<Object> break_id = Factory::NewNumberFromInt(Debug::break_id());
|
1987
|
+
const int argc = 1;
|
1988
|
+
Object** argv[argc] = { break_id.location() };
|
1989
|
+
return MakeJSObject(CStrVector("MakeExecutionState"),
|
1990
|
+
argc, argv, caught_exception);
|
1991
|
+
}
|
1992
|
+
|
1993
|
+
|
1994
|
+
Handle<Object> Debugger::MakeBreakEvent(Handle<Object> exec_state,
|
1995
|
+
Handle<Object> break_points_hit,
|
1996
|
+
bool* caught_exception) {
|
1997
|
+
// Create the new break event object.
|
1998
|
+
const int argc = 2;
|
1999
|
+
Object** argv[argc] = { exec_state.location(),
|
2000
|
+
break_points_hit.location() };
|
2001
|
+
return MakeJSObject(CStrVector("MakeBreakEvent"),
|
2002
|
+
argc,
|
2003
|
+
argv,
|
2004
|
+
caught_exception);
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
|
2008
|
+
Handle<Object> Debugger::MakeExceptionEvent(Handle<Object> exec_state,
|
2009
|
+
Handle<Object> exception,
|
2010
|
+
bool uncaught,
|
2011
|
+
bool* caught_exception) {
|
2012
|
+
// Create the new exception event object.
|
2013
|
+
const int argc = 3;
|
2014
|
+
Object** argv[argc] = { exec_state.location(),
|
2015
|
+
exception.location(),
|
2016
|
+
uncaught ? Factory::true_value().location() :
|
2017
|
+
Factory::false_value().location()};
|
2018
|
+
return MakeJSObject(CStrVector("MakeExceptionEvent"),
|
2019
|
+
argc, argv, caught_exception);
|
2020
|
+
}
|
2021
|
+
|
2022
|
+
|
2023
|
+
Handle<Object> Debugger::MakeNewFunctionEvent(Handle<Object> function,
|
2024
|
+
bool* caught_exception) {
|
2025
|
+
// Create the new function event object.
|
2026
|
+
const int argc = 1;
|
2027
|
+
Object** argv[argc] = { function.location() };
|
2028
|
+
return MakeJSObject(CStrVector("MakeNewFunctionEvent"),
|
2029
|
+
argc, argv, caught_exception);
|
2030
|
+
}
|
2031
|
+
|
2032
|
+
|
2033
|
+
Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script,
|
2034
|
+
bool before,
|
2035
|
+
bool* caught_exception) {
|
2036
|
+
// Create the compile event object.
|
2037
|
+
Handle<Object> exec_state = MakeExecutionState(caught_exception);
|
2038
|
+
Handle<Object> script_wrapper = GetScriptWrapper(script);
|
2039
|
+
const int argc = 3;
|
2040
|
+
Object** argv[argc] = { exec_state.location(),
|
2041
|
+
script_wrapper.location(),
|
2042
|
+
before ? Factory::true_value().location() :
|
2043
|
+
Factory::false_value().location() };
|
2044
|
+
|
2045
|
+
return MakeJSObject(CStrVector("MakeCompileEvent"),
|
2046
|
+
argc,
|
2047
|
+
argv,
|
2048
|
+
caught_exception);
|
2049
|
+
}
|
2050
|
+
|
2051
|
+
|
2052
|
+
Handle<Object> Debugger::MakeScriptCollectedEvent(int id,
|
2053
|
+
bool* caught_exception) {
|
2054
|
+
// Create the script collected event object.
|
2055
|
+
Handle<Object> exec_state = MakeExecutionState(caught_exception);
|
2056
|
+
Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id));
|
2057
|
+
const int argc = 2;
|
2058
|
+
Object** argv[argc] = { exec_state.location(), id_object.location() };
|
2059
|
+
|
2060
|
+
return MakeJSObject(CStrVector("MakeScriptCollectedEvent"),
|
2061
|
+
argc,
|
2062
|
+
argv,
|
2063
|
+
caught_exception);
|
2064
|
+
}
|
2065
|
+
|
2066
|
+
|
2067
|
+
void Debugger::OnException(Handle<Object> exception, bool uncaught) {
|
2068
|
+
HandleScope scope;
|
2069
|
+
|
2070
|
+
// Bail out based on state or if there is no listener for this event
|
2071
|
+
if (Debug::InDebugger()) return;
|
2072
|
+
if (!Debugger::EventActive(v8::Exception)) return;
|
2073
|
+
|
2074
|
+
// Bail out if exception breaks are not active
|
2075
|
+
if (uncaught) {
|
2076
|
+
// Uncaught exceptions are reported by either flags.
|
2077
|
+
if (!(Debug::break_on_uncaught_exception() ||
|
2078
|
+
Debug::break_on_exception())) return;
|
2079
|
+
} else {
|
2080
|
+
// Caught exceptions are reported is activated.
|
2081
|
+
if (!Debug::break_on_exception()) return;
|
2082
|
+
}
|
2083
|
+
|
2084
|
+
// Enter the debugger.
|
2085
|
+
EnterDebugger debugger;
|
2086
|
+
if (debugger.FailedToEnter()) return;
|
2087
|
+
|
2088
|
+
// Clear all current stepping setup.
|
2089
|
+
Debug::ClearStepping();
|
2090
|
+
// Create the event data object.
|
2091
|
+
bool caught_exception = false;
|
2092
|
+
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
|
2093
|
+
Handle<Object> event_data;
|
2094
|
+
if (!caught_exception) {
|
2095
|
+
event_data = MakeExceptionEvent(exec_state, exception, uncaught,
|
2096
|
+
&caught_exception);
|
2097
|
+
}
|
2098
|
+
// Bail out and don't call debugger if exception.
|
2099
|
+
if (caught_exception) {
|
2100
|
+
return;
|
2101
|
+
}
|
2102
|
+
|
2103
|
+
// Process debug event.
|
2104
|
+
ProcessDebugEvent(v8::Exception, Handle<JSObject>::cast(event_data), false);
|
2105
|
+
// Return to continue execution from where the exception was thrown.
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
|
2109
|
+
void Debugger::OnDebugBreak(Handle<Object> break_points_hit,
|
2110
|
+
bool auto_continue) {
|
2111
|
+
HandleScope scope;
|
2112
|
+
|
2113
|
+
// Debugger has already been entered by caller.
|
2114
|
+
ASSERT(Top::context() == *Debug::debug_context());
|
2115
|
+
|
2116
|
+
// Bail out if there is no listener for this event
|
2117
|
+
if (!Debugger::EventActive(v8::Break)) return;
|
2118
|
+
|
2119
|
+
// Debugger must be entered in advance.
|
2120
|
+
ASSERT(Top::context() == *Debug::debug_context());
|
2121
|
+
|
2122
|
+
// Create the event data object.
|
2123
|
+
bool caught_exception = false;
|
2124
|
+
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
|
2125
|
+
Handle<Object> event_data;
|
2126
|
+
if (!caught_exception) {
|
2127
|
+
event_data = MakeBreakEvent(exec_state, break_points_hit,
|
2128
|
+
&caught_exception);
|
2129
|
+
}
|
2130
|
+
// Bail out and don't call debugger if exception.
|
2131
|
+
if (caught_exception) {
|
2132
|
+
return;
|
2133
|
+
}
|
2134
|
+
|
2135
|
+
// Process debug event.
|
2136
|
+
ProcessDebugEvent(v8::Break,
|
2137
|
+
Handle<JSObject>::cast(event_data),
|
2138
|
+
auto_continue);
|
2139
|
+
}
|
2140
|
+
|
2141
|
+
|
2142
|
+
void Debugger::OnBeforeCompile(Handle<Script> script) {
|
2143
|
+
HandleScope scope;
|
2144
|
+
|
2145
|
+
// Bail out based on state or if there is no listener for this event
|
2146
|
+
if (Debug::InDebugger()) return;
|
2147
|
+
if (compiling_natives()) return;
|
2148
|
+
if (!EventActive(v8::BeforeCompile)) return;
|
2149
|
+
|
2150
|
+
// Enter the debugger.
|
2151
|
+
EnterDebugger debugger;
|
2152
|
+
if (debugger.FailedToEnter()) return;
|
2153
|
+
|
2154
|
+
// Create the event data object.
|
2155
|
+
bool caught_exception = false;
|
2156
|
+
Handle<Object> event_data = MakeCompileEvent(script, true, &caught_exception);
|
2157
|
+
// Bail out and don't call debugger if exception.
|
2158
|
+
if (caught_exception) {
|
2159
|
+
return;
|
2160
|
+
}
|
2161
|
+
|
2162
|
+
// Process debug event.
|
2163
|
+
ProcessDebugEvent(v8::BeforeCompile,
|
2164
|
+
Handle<JSObject>::cast(event_data),
|
2165
|
+
true);
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
|
2169
|
+
// Handle debugger actions when a new script is compiled.
|
2170
|
+
void Debugger::OnAfterCompile(Handle<Script> script,
|
2171
|
+
AfterCompileFlags after_compile_flags) {
|
2172
|
+
HandleScope scope;
|
2173
|
+
|
2174
|
+
// Add the newly compiled script to the script cache.
|
2175
|
+
Debug::AddScriptToScriptCache(script);
|
2176
|
+
|
2177
|
+
// No more to do if not debugging.
|
2178
|
+
if (!IsDebuggerActive()) return;
|
2179
|
+
|
2180
|
+
// No compile events while compiling natives.
|
2181
|
+
if (compiling_natives()) return;
|
2182
|
+
|
2183
|
+
// Store whether in debugger before entering debugger.
|
2184
|
+
bool in_debugger = Debug::InDebugger();
|
2185
|
+
|
2186
|
+
// Enter the debugger.
|
2187
|
+
EnterDebugger debugger;
|
2188
|
+
if (debugger.FailedToEnter()) return;
|
2189
|
+
|
2190
|
+
// If debugging there might be script break points registered for this
|
2191
|
+
// script. Make sure that these break points are set.
|
2192
|
+
|
2193
|
+
// Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
|
2194
|
+
Handle<String> update_script_break_points_symbol =
|
2195
|
+
Factory::LookupAsciiSymbol("UpdateScriptBreakPoints");
|
2196
|
+
Handle<Object> update_script_break_points =
|
2197
|
+
Handle<Object>(Debug::debug_context()->global()->
|
2198
|
+
GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
|
2199
|
+
if (!update_script_break_points->IsJSFunction()) {
|
2200
|
+
return;
|
2201
|
+
}
|
2202
|
+
ASSERT(update_script_break_points->IsJSFunction());
|
2203
|
+
|
2204
|
+
// Wrap the script object in a proper JS object before passing it
|
2205
|
+
// to JavaScript.
|
2206
|
+
Handle<JSValue> wrapper = GetScriptWrapper(script);
|
2207
|
+
|
2208
|
+
// Call UpdateScriptBreakPoints expect no exceptions.
|
2209
|
+
bool caught_exception = false;
|
2210
|
+
const int argc = 1;
|
2211
|
+
Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) };
|
2212
|
+
Handle<Object> result = Execution::TryCall(
|
2213
|
+
Handle<JSFunction>::cast(update_script_break_points),
|
2214
|
+
Top::builtins(), argc, argv,
|
2215
|
+
&caught_exception);
|
2216
|
+
if (caught_exception) {
|
2217
|
+
return;
|
2218
|
+
}
|
2219
|
+
// Bail out based on state or if there is no listener for this event
|
2220
|
+
if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0) return;
|
2221
|
+
if (!Debugger::EventActive(v8::AfterCompile)) return;
|
2222
|
+
|
2223
|
+
// Create the compile state object.
|
2224
|
+
Handle<Object> event_data = MakeCompileEvent(script,
|
2225
|
+
false,
|
2226
|
+
&caught_exception);
|
2227
|
+
// Bail out and don't call debugger if exception.
|
2228
|
+
if (caught_exception) {
|
2229
|
+
return;
|
2230
|
+
}
|
2231
|
+
// Process debug event.
|
2232
|
+
ProcessDebugEvent(v8::AfterCompile,
|
2233
|
+
Handle<JSObject>::cast(event_data),
|
2234
|
+
true);
|
2235
|
+
}
|
2236
|
+
|
2237
|
+
|
2238
|
+
void Debugger::OnScriptCollected(int id) {
|
2239
|
+
HandleScope scope;
|
2240
|
+
|
2241
|
+
// No more to do if not debugging.
|
2242
|
+
if (!IsDebuggerActive()) return;
|
2243
|
+
if (!Debugger::EventActive(v8::ScriptCollected)) return;
|
2244
|
+
|
2245
|
+
// Enter the debugger.
|
2246
|
+
EnterDebugger debugger;
|
2247
|
+
if (debugger.FailedToEnter()) return;
|
2248
|
+
|
2249
|
+
// Create the script collected state object.
|
2250
|
+
bool caught_exception = false;
|
2251
|
+
Handle<Object> event_data = MakeScriptCollectedEvent(id,
|
2252
|
+
&caught_exception);
|
2253
|
+
// Bail out and don't call debugger if exception.
|
2254
|
+
if (caught_exception) {
|
2255
|
+
return;
|
2256
|
+
}
|
2257
|
+
|
2258
|
+
// Process debug event.
|
2259
|
+
ProcessDebugEvent(v8::ScriptCollected,
|
2260
|
+
Handle<JSObject>::cast(event_data),
|
2261
|
+
true);
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
|
2265
|
+
void Debugger::ProcessDebugEvent(v8::DebugEvent event,
|
2266
|
+
Handle<JSObject> event_data,
|
2267
|
+
bool auto_continue) {
|
2268
|
+
HandleScope scope;
|
2269
|
+
|
2270
|
+
// Clear any pending debug break if this is a real break.
|
2271
|
+
if (!auto_continue) {
|
2272
|
+
Debug::clear_interrupt_pending(DEBUGBREAK);
|
2273
|
+
}
|
2274
|
+
|
2275
|
+
// Create the execution state.
|
2276
|
+
bool caught_exception = false;
|
2277
|
+
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
|
2278
|
+
if (caught_exception) {
|
2279
|
+
return;
|
2280
|
+
}
|
2281
|
+
// First notify the message handler if any.
|
2282
|
+
if (message_handler_ != NULL) {
|
2283
|
+
NotifyMessageHandler(event,
|
2284
|
+
Handle<JSObject>::cast(exec_state),
|
2285
|
+
event_data,
|
2286
|
+
auto_continue);
|
2287
|
+
}
|
2288
|
+
// Notify registered debug event listener. This can be either a C or
|
2289
|
+
// a JavaScript function. Don't call event listener for v8::Break
|
2290
|
+
// here, if it's only a debug command -- they will be processed later.
|
2291
|
+
if ((event != v8::Break || !auto_continue) && !event_listener_.is_null()) {
|
2292
|
+
CallEventCallback(event, exec_state, event_data, NULL);
|
2293
|
+
}
|
2294
|
+
// Process pending debug commands.
|
2295
|
+
if (event == v8::Break) {
|
2296
|
+
while (!event_command_queue_.IsEmpty()) {
|
2297
|
+
CommandMessage command = event_command_queue_.Get();
|
2298
|
+
if (!event_listener_.is_null()) {
|
2299
|
+
CallEventCallback(v8::BreakForCommand,
|
2300
|
+
exec_state,
|
2301
|
+
event_data,
|
2302
|
+
command.client_data());
|
2303
|
+
}
|
2304
|
+
command.Dispose();
|
2305
|
+
}
|
2306
|
+
}
|
2307
|
+
}
|
2308
|
+
|
2309
|
+
|
2310
|
+
void Debugger::CallEventCallback(v8::DebugEvent event,
|
2311
|
+
Handle<Object> exec_state,
|
2312
|
+
Handle<Object> event_data,
|
2313
|
+
v8::Debug::ClientData* client_data) {
|
2314
|
+
if (event_listener_->IsProxy()) {
|
2315
|
+
CallCEventCallback(event, exec_state, event_data, client_data);
|
2316
|
+
} else {
|
2317
|
+
CallJSEventCallback(event, exec_state, event_data);
|
2318
|
+
}
|
2319
|
+
}
|
2320
|
+
|
2321
|
+
|
2322
|
+
void Debugger::CallCEventCallback(v8::DebugEvent event,
|
2323
|
+
Handle<Object> exec_state,
|
2324
|
+
Handle<Object> event_data,
|
2325
|
+
v8::Debug::ClientData* client_data) {
|
2326
|
+
Handle<Proxy> callback_obj(Handle<Proxy>::cast(event_listener_));
|
2327
|
+
v8::Debug::EventCallback2 callback =
|
2328
|
+
FUNCTION_CAST<v8::Debug::EventCallback2>(callback_obj->proxy());
|
2329
|
+
EventDetailsImpl event_details(
|
2330
|
+
event,
|
2331
|
+
Handle<JSObject>::cast(exec_state),
|
2332
|
+
Handle<JSObject>::cast(event_data),
|
2333
|
+
event_listener_data_,
|
2334
|
+
client_data);
|
2335
|
+
callback(event_details);
|
2336
|
+
}
|
2337
|
+
|
2338
|
+
|
2339
|
+
void Debugger::CallJSEventCallback(v8::DebugEvent event,
|
2340
|
+
Handle<Object> exec_state,
|
2341
|
+
Handle<Object> event_data) {
|
2342
|
+
ASSERT(event_listener_->IsJSFunction());
|
2343
|
+
Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_));
|
2344
|
+
|
2345
|
+
// Invoke the JavaScript debug event listener.
|
2346
|
+
const int argc = 4;
|
2347
|
+
Object** argv[argc] = { Handle<Object>(Smi::FromInt(event)).location(),
|
2348
|
+
exec_state.location(),
|
2349
|
+
Handle<Object>::cast(event_data).location(),
|
2350
|
+
event_listener_data_.location() };
|
2351
|
+
bool caught_exception = false;
|
2352
|
+
Execution::TryCall(fun, Top::global(), argc, argv, &caught_exception);
|
2353
|
+
// Silently ignore exceptions from debug event listeners.
|
2354
|
+
}
|
2355
|
+
|
2356
|
+
|
2357
|
+
Handle<Context> Debugger::GetDebugContext() {
|
2358
|
+
never_unload_debugger_ = true;
|
2359
|
+
EnterDebugger debugger;
|
2360
|
+
return Debug::debug_context();
|
2361
|
+
}
|
2362
|
+
|
2363
|
+
|
2364
|
+
void Debugger::UnloadDebugger() {
|
2365
|
+
// Make sure that there are no breakpoints left.
|
2366
|
+
Debug::ClearAllBreakPoints();
|
2367
|
+
|
2368
|
+
// Unload the debugger if feasible.
|
2369
|
+
if (!never_unload_debugger_) {
|
2370
|
+
Debug::Unload();
|
2371
|
+
}
|
2372
|
+
|
2373
|
+
// Clear the flag indicating that the debugger should be unloaded.
|
2374
|
+
debugger_unload_pending_ = false;
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
|
2378
|
+
void Debugger::NotifyMessageHandler(v8::DebugEvent event,
|
2379
|
+
Handle<JSObject> exec_state,
|
2380
|
+
Handle<JSObject> event_data,
|
2381
|
+
bool auto_continue) {
|
2382
|
+
HandleScope scope;
|
2383
|
+
|
2384
|
+
if (!Debug::Load()) return;
|
2385
|
+
|
2386
|
+
// Process the individual events.
|
2387
|
+
bool sendEventMessage = false;
|
2388
|
+
switch (event) {
|
2389
|
+
case v8::Break:
|
2390
|
+
case v8::BreakForCommand:
|
2391
|
+
sendEventMessage = !auto_continue;
|
2392
|
+
break;
|
2393
|
+
case v8::Exception:
|
2394
|
+
sendEventMessage = true;
|
2395
|
+
break;
|
2396
|
+
case v8::BeforeCompile:
|
2397
|
+
break;
|
2398
|
+
case v8::AfterCompile:
|
2399
|
+
sendEventMessage = true;
|
2400
|
+
break;
|
2401
|
+
case v8::ScriptCollected:
|
2402
|
+
sendEventMessage = true;
|
2403
|
+
break;
|
2404
|
+
case v8::NewFunction:
|
2405
|
+
break;
|
2406
|
+
default:
|
2407
|
+
UNREACHABLE();
|
2408
|
+
}
|
2409
|
+
|
2410
|
+
// The debug command interrupt flag might have been set when the command was
|
2411
|
+
// added. It should be enough to clear the flag only once while we are in the
|
2412
|
+
// debugger.
|
2413
|
+
ASSERT(Debug::InDebugger());
|
2414
|
+
StackGuard::Continue(DEBUGCOMMAND);
|
2415
|
+
|
2416
|
+
// Notify the debugger that a debug event has occurred unless auto continue is
|
2417
|
+
// active in which case no event is send.
|
2418
|
+
if (sendEventMessage) {
|
2419
|
+
MessageImpl message = MessageImpl::NewEvent(
|
2420
|
+
event,
|
2421
|
+
auto_continue,
|
2422
|
+
Handle<JSObject>::cast(exec_state),
|
2423
|
+
Handle<JSObject>::cast(event_data));
|
2424
|
+
InvokeMessageHandler(message);
|
2425
|
+
}
|
2426
|
+
|
2427
|
+
// If auto continue don't make the event cause a break, but process messages
|
2428
|
+
// in the queue if any. For script collected events don't even process
|
2429
|
+
// messages in the queue as the execution state might not be what is expected
|
2430
|
+
// by the client.
|
2431
|
+
if ((auto_continue && !HasCommands()) || event == v8::ScriptCollected) {
|
2432
|
+
return;
|
2433
|
+
}
|
2434
|
+
|
2435
|
+
v8::TryCatch try_catch;
|
2436
|
+
|
2437
|
+
// DebugCommandProcessor goes here.
|
2438
|
+
v8::Local<v8::Object> cmd_processor;
|
2439
|
+
{
|
2440
|
+
v8::Local<v8::Object> api_exec_state =
|
2441
|
+
v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
|
2442
|
+
v8::Local<v8::String> fun_name =
|
2443
|
+
v8::String::New("debugCommandProcessor");
|
2444
|
+
v8::Local<v8::Function> fun =
|
2445
|
+
v8::Function::Cast(*api_exec_state->Get(fun_name));
|
2446
|
+
|
2447
|
+
v8::Handle<v8::Boolean> running =
|
2448
|
+
auto_continue ? v8::True() : v8::False();
|
2449
|
+
static const int kArgc = 1;
|
2450
|
+
v8::Handle<Value> argv[kArgc] = { running };
|
2451
|
+
cmd_processor = v8::Object::Cast(*fun->Call(api_exec_state, kArgc, argv));
|
2452
|
+
if (try_catch.HasCaught()) {
|
2453
|
+
PrintLn(try_catch.Exception());
|
2454
|
+
return;
|
2455
|
+
}
|
2456
|
+
}
|
2457
|
+
|
2458
|
+
bool running = auto_continue;
|
2459
|
+
|
2460
|
+
// Process requests from the debugger.
|
2461
|
+
while (true) {
|
2462
|
+
// Wait for new command in the queue.
|
2463
|
+
if (Debugger::host_dispatch_handler_) {
|
2464
|
+
// In case there is a host dispatch - do periodic dispatches.
|
2465
|
+
if (!command_received_->Wait(host_dispatch_micros_)) {
|
2466
|
+
// Timout expired, do the dispatch.
|
2467
|
+
Debugger::host_dispatch_handler_();
|
2468
|
+
continue;
|
2469
|
+
}
|
2470
|
+
} else {
|
2471
|
+
// In case there is no host dispatch - just wait.
|
2472
|
+
command_received_->Wait();
|
2473
|
+
}
|
2474
|
+
|
2475
|
+
// Get the command from the queue.
|
2476
|
+
CommandMessage command = command_queue_.Get();
|
2477
|
+
Logger::DebugTag("Got request from command queue, in interactive loop.");
|
2478
|
+
if (!Debugger::IsDebuggerActive()) {
|
2479
|
+
// Delete command text and user data.
|
2480
|
+
command.Dispose();
|
2481
|
+
return;
|
2482
|
+
}
|
2483
|
+
|
2484
|
+
// Invoke JavaScript to process the debug request.
|
2485
|
+
v8::Local<v8::String> fun_name;
|
2486
|
+
v8::Local<v8::Function> fun;
|
2487
|
+
v8::Local<v8::Value> request;
|
2488
|
+
v8::TryCatch try_catch;
|
2489
|
+
fun_name = v8::String::New("processDebugRequest");
|
2490
|
+
fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
|
2491
|
+
|
2492
|
+
request = v8::String::New(command.text().start(),
|
2493
|
+
command.text().length());
|
2494
|
+
static const int kArgc = 1;
|
2495
|
+
v8::Handle<Value> argv[kArgc] = { request };
|
2496
|
+
v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv);
|
2497
|
+
|
2498
|
+
// Get the response.
|
2499
|
+
v8::Local<v8::String> response;
|
2500
|
+
if (!try_catch.HasCaught()) {
|
2501
|
+
// Get response string.
|
2502
|
+
if (!response_val->IsUndefined()) {
|
2503
|
+
response = v8::String::Cast(*response_val);
|
2504
|
+
} else {
|
2505
|
+
response = v8::String::New("");
|
2506
|
+
}
|
2507
|
+
|
2508
|
+
// Log the JSON request/response.
|
2509
|
+
if (FLAG_trace_debug_json) {
|
2510
|
+
PrintLn(request);
|
2511
|
+
PrintLn(response);
|
2512
|
+
}
|
2513
|
+
|
2514
|
+
// Get the running state.
|
2515
|
+
fun_name = v8::String::New("isRunning");
|
2516
|
+
fun = v8::Function::Cast(*cmd_processor->Get(fun_name));
|
2517
|
+
static const int kArgc = 1;
|
2518
|
+
v8::Handle<Value> argv[kArgc] = { response };
|
2519
|
+
v8::Local<v8::Value> running_val = fun->Call(cmd_processor, kArgc, argv);
|
2520
|
+
if (!try_catch.HasCaught()) {
|
2521
|
+
running = running_val->ToBoolean()->Value();
|
2522
|
+
}
|
2523
|
+
} else {
|
2524
|
+
// In case of failure the result text is the exception text.
|
2525
|
+
response = try_catch.Exception()->ToString();
|
2526
|
+
}
|
2527
|
+
|
2528
|
+
// Return the result.
|
2529
|
+
MessageImpl message = MessageImpl::NewResponse(
|
2530
|
+
event,
|
2531
|
+
running,
|
2532
|
+
Handle<JSObject>::cast(exec_state),
|
2533
|
+
Handle<JSObject>::cast(event_data),
|
2534
|
+
Handle<String>(Utils::OpenHandle(*response)),
|
2535
|
+
command.client_data());
|
2536
|
+
InvokeMessageHandler(message);
|
2537
|
+
command.Dispose();
|
2538
|
+
|
2539
|
+
// Return from debug event processing if either the VM is put into the
|
2540
|
+
// runnning state (through a continue command) or auto continue is active
|
2541
|
+
// and there are no more commands queued.
|
2542
|
+
if (running && !HasCommands()) {
|
2543
|
+
return;
|
2544
|
+
}
|
2545
|
+
}
|
2546
|
+
}
|
2547
|
+
|
2548
|
+
|
2549
|
+
void Debugger::SetEventListener(Handle<Object> callback,
|
2550
|
+
Handle<Object> data) {
|
2551
|
+
HandleScope scope;
|
2552
|
+
|
2553
|
+
// Clear the global handles for the event listener and the event listener data
|
2554
|
+
// object.
|
2555
|
+
if (!event_listener_.is_null()) {
|
2556
|
+
GlobalHandles::Destroy(
|
2557
|
+
reinterpret_cast<Object**>(event_listener_.location()));
|
2558
|
+
event_listener_ = Handle<Object>();
|
2559
|
+
}
|
2560
|
+
if (!event_listener_data_.is_null()) {
|
2561
|
+
GlobalHandles::Destroy(
|
2562
|
+
reinterpret_cast<Object**>(event_listener_data_.location()));
|
2563
|
+
event_listener_data_ = Handle<Object>();
|
2564
|
+
}
|
2565
|
+
|
2566
|
+
// If there is a new debug event listener register it together with its data
|
2567
|
+
// object.
|
2568
|
+
if (!callback->IsUndefined() && !callback->IsNull()) {
|
2569
|
+
event_listener_ = Handle<Object>::cast(GlobalHandles::Create(*callback));
|
2570
|
+
if (data.is_null()) {
|
2571
|
+
data = Factory::undefined_value();
|
2572
|
+
}
|
2573
|
+
event_listener_data_ = Handle<Object>::cast(GlobalHandles::Create(*data));
|
2574
|
+
}
|
2575
|
+
|
2576
|
+
ListenersChanged();
|
2577
|
+
}
|
2578
|
+
|
2579
|
+
|
2580
|
+
void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
|
2581
|
+
ScopedLock with(debugger_access_);
|
2582
|
+
|
2583
|
+
message_handler_ = handler;
|
2584
|
+
ListenersChanged();
|
2585
|
+
if (handler == NULL) {
|
2586
|
+
// Send an empty command to the debugger if in a break to make JavaScript
|
2587
|
+
// run again if the debugger is closed.
|
2588
|
+
if (Debug::InDebugger()) {
|
2589
|
+
ProcessCommand(Vector<const uint16_t>::empty());
|
2590
|
+
}
|
2591
|
+
}
|
2592
|
+
}
|
2593
|
+
|
2594
|
+
|
2595
|
+
void Debugger::ListenersChanged() {
|
2596
|
+
if (IsDebuggerActive()) {
|
2597
|
+
// Disable the compilation cache when the debugger is active.
|
2598
|
+
CompilationCache::Disable();
|
2599
|
+
debugger_unload_pending_ = false;
|
2600
|
+
} else {
|
2601
|
+
CompilationCache::Enable();
|
2602
|
+
// Unload the debugger if event listener and message handler cleared.
|
2603
|
+
// Schedule this for later, because we may be in non-V8 thread.
|
2604
|
+
debugger_unload_pending_ = true;
|
2605
|
+
}
|
2606
|
+
}
|
2607
|
+
|
2608
|
+
|
2609
|
+
void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
|
2610
|
+
int period) {
|
2611
|
+
host_dispatch_handler_ = handler;
|
2612
|
+
host_dispatch_micros_ = period * 1000;
|
2613
|
+
}
|
2614
|
+
|
2615
|
+
|
2616
|
+
void Debugger::SetDebugMessageDispatchHandler(
|
2617
|
+
v8::Debug::DebugMessageDispatchHandler handler, bool provide_locker) {
|
2618
|
+
ScopedLock with(dispatch_handler_access_);
|
2619
|
+
debug_message_dispatch_handler_ = handler;
|
2620
|
+
|
2621
|
+
if (provide_locker && message_dispatch_helper_thread_ == NULL) {
|
2622
|
+
message_dispatch_helper_thread_ = new MessageDispatchHelperThread;
|
2623
|
+
message_dispatch_helper_thread_->Start();
|
2624
|
+
}
|
2625
|
+
}
|
2626
|
+
|
2627
|
+
|
2628
|
+
// Calls the registered debug message handler. This callback is part of the
|
2629
|
+
// public API.
|
2630
|
+
void Debugger::InvokeMessageHandler(MessageImpl message) {
|
2631
|
+
ScopedLock with(debugger_access_);
|
2632
|
+
|
2633
|
+
if (message_handler_ != NULL) {
|
2634
|
+
message_handler_(message);
|
2635
|
+
}
|
2636
|
+
}
|
2637
|
+
|
2638
|
+
|
2639
|
+
// Puts a command coming from the public API on the queue. Creates
|
2640
|
+
// a copy of the command string managed by the debugger. Up to this
|
2641
|
+
// point, the command data was managed by the API client. Called
|
2642
|
+
// by the API client thread.
|
2643
|
+
void Debugger::ProcessCommand(Vector<const uint16_t> command,
|
2644
|
+
v8::Debug::ClientData* client_data) {
|
2645
|
+
// Need to cast away const.
|
2646
|
+
CommandMessage message = CommandMessage::New(
|
2647
|
+
Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
|
2648
|
+
command.length()),
|
2649
|
+
client_data);
|
2650
|
+
Logger::DebugTag("Put command on command_queue.");
|
2651
|
+
command_queue_.Put(message);
|
2652
|
+
command_received_->Signal();
|
2653
|
+
|
2654
|
+
// Set the debug command break flag to have the command processed.
|
2655
|
+
if (!Debug::InDebugger()) {
|
2656
|
+
StackGuard::DebugCommand();
|
2657
|
+
}
|
2658
|
+
|
2659
|
+
MessageDispatchHelperThread* dispatch_thread;
|
2660
|
+
{
|
2661
|
+
ScopedLock with(dispatch_handler_access_);
|
2662
|
+
dispatch_thread = message_dispatch_helper_thread_;
|
2663
|
+
}
|
2664
|
+
|
2665
|
+
if (dispatch_thread == NULL) {
|
2666
|
+
CallMessageDispatchHandler();
|
2667
|
+
} else {
|
2668
|
+
dispatch_thread->Schedule();
|
2669
|
+
}
|
2670
|
+
}
|
2671
|
+
|
2672
|
+
|
2673
|
+
bool Debugger::HasCommands() {
|
2674
|
+
return !command_queue_.IsEmpty();
|
2675
|
+
}
|
2676
|
+
|
2677
|
+
|
2678
|
+
void Debugger::EnqueueDebugCommand(v8::Debug::ClientData* client_data) {
|
2679
|
+
CommandMessage message = CommandMessage::New(Vector<uint16_t>(), client_data);
|
2680
|
+
event_command_queue_.Put(message);
|
2681
|
+
|
2682
|
+
// Set the debug command break flag to have the command processed.
|
2683
|
+
if (!Debug::InDebugger()) {
|
2684
|
+
StackGuard::DebugCommand();
|
2685
|
+
}
|
2686
|
+
}
|
2687
|
+
|
2688
|
+
|
2689
|
+
bool Debugger::IsDebuggerActive() {
|
2690
|
+
ScopedLock with(debugger_access_);
|
2691
|
+
|
2692
|
+
return message_handler_ != NULL || !event_listener_.is_null();
|
2693
|
+
}
|
2694
|
+
|
2695
|
+
|
2696
|
+
Handle<Object> Debugger::Call(Handle<JSFunction> fun,
|
2697
|
+
Handle<Object> data,
|
2698
|
+
bool* pending_exception) {
|
2699
|
+
// When calling functions in the debugger prevent it from beeing unloaded.
|
2700
|
+
Debugger::never_unload_debugger_ = true;
|
2701
|
+
|
2702
|
+
// Enter the debugger.
|
2703
|
+
EnterDebugger debugger;
|
2704
|
+
if (debugger.FailedToEnter()) {
|
2705
|
+
return Factory::undefined_value();
|
2706
|
+
}
|
2707
|
+
|
2708
|
+
// Create the execution state.
|
2709
|
+
bool caught_exception = false;
|
2710
|
+
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
|
2711
|
+
if (caught_exception) {
|
2712
|
+
return Factory::undefined_value();
|
2713
|
+
}
|
2714
|
+
|
2715
|
+
static const int kArgc = 2;
|
2716
|
+
Object** argv[kArgc] = { exec_state.location(), data.location() };
|
2717
|
+
Handle<Object> result = Execution::Call(
|
2718
|
+
fun,
|
2719
|
+
Handle<Object>(Debug::debug_context_->global_proxy()),
|
2720
|
+
kArgc,
|
2721
|
+
argv,
|
2722
|
+
pending_exception);
|
2723
|
+
return result;
|
2724
|
+
}
|
2725
|
+
|
2726
|
+
|
2727
|
+
static void StubMessageHandler2(const v8::Debug::Message& message) {
|
2728
|
+
// Simply ignore message.
|
2729
|
+
}
|
2730
|
+
|
2731
|
+
|
2732
|
+
bool Debugger::StartAgent(const char* name, int port,
|
2733
|
+
bool wait_for_connection) {
|
2734
|
+
if (wait_for_connection) {
|
2735
|
+
// Suspend V8 if it is already running or set V8 to suspend whenever
|
2736
|
+
// it starts.
|
2737
|
+
// Provide stub message handler; V8 auto-continues each suspend
|
2738
|
+
// when there is no message handler; we doesn't need it.
|
2739
|
+
// Once become suspended, V8 will stay so indefinitely long, until remote
|
2740
|
+
// debugger connects and issues "continue" command.
|
2741
|
+
Debugger::message_handler_ = StubMessageHandler2;
|
2742
|
+
v8::Debug::DebugBreak();
|
2743
|
+
}
|
2744
|
+
|
2745
|
+
if (Socket::Setup()) {
|
2746
|
+
if (agent_ == NULL) {
|
2747
|
+
agent_ = new DebuggerAgent(name, port);
|
2748
|
+
agent_->Start();
|
2749
|
+
}
|
2750
|
+
return true;
|
2751
|
+
}
|
2752
|
+
|
2753
|
+
return false;
|
2754
|
+
}
|
2755
|
+
|
2756
|
+
|
2757
|
+
void Debugger::StopAgent() {
|
2758
|
+
if (agent_ != NULL) {
|
2759
|
+
agent_->Shutdown();
|
2760
|
+
agent_->Join();
|
2761
|
+
delete agent_;
|
2762
|
+
agent_ = NULL;
|
2763
|
+
}
|
2764
|
+
}
|
2765
|
+
|
2766
|
+
|
2767
|
+
void Debugger::WaitForAgent() {
|
2768
|
+
if (agent_ != NULL)
|
2769
|
+
agent_->WaitUntilListening();
|
2770
|
+
}
|
2771
|
+
|
2772
|
+
|
2773
|
+
void Debugger::CallMessageDispatchHandler() {
|
2774
|
+
v8::Debug::DebugMessageDispatchHandler handler;
|
2775
|
+
{
|
2776
|
+
ScopedLock with(dispatch_handler_access_);
|
2777
|
+
handler = Debugger::debug_message_dispatch_handler_;
|
2778
|
+
}
|
2779
|
+
if (handler != NULL) {
|
2780
|
+
handler();
|
2781
|
+
}
|
2782
|
+
}
|
2783
|
+
|
2784
|
+
|
2785
|
+
MessageImpl MessageImpl::NewEvent(DebugEvent event,
|
2786
|
+
bool running,
|
2787
|
+
Handle<JSObject> exec_state,
|
2788
|
+
Handle<JSObject> event_data) {
|
2789
|
+
MessageImpl message(true, event, running,
|
2790
|
+
exec_state, event_data, Handle<String>(), NULL);
|
2791
|
+
return message;
|
2792
|
+
}
|
2793
|
+
|
2794
|
+
|
2795
|
+
MessageImpl MessageImpl::NewResponse(DebugEvent event,
|
2796
|
+
bool running,
|
2797
|
+
Handle<JSObject> exec_state,
|
2798
|
+
Handle<JSObject> event_data,
|
2799
|
+
Handle<String> response_json,
|
2800
|
+
v8::Debug::ClientData* client_data) {
|
2801
|
+
MessageImpl message(false, event, running,
|
2802
|
+
exec_state, event_data, response_json, client_data);
|
2803
|
+
return message;
|
2804
|
+
}
|
2805
|
+
|
2806
|
+
|
2807
|
+
MessageImpl::MessageImpl(bool is_event,
|
2808
|
+
DebugEvent event,
|
2809
|
+
bool running,
|
2810
|
+
Handle<JSObject> exec_state,
|
2811
|
+
Handle<JSObject> event_data,
|
2812
|
+
Handle<String> response_json,
|
2813
|
+
v8::Debug::ClientData* client_data)
|
2814
|
+
: is_event_(is_event),
|
2815
|
+
event_(event),
|
2816
|
+
running_(running),
|
2817
|
+
exec_state_(exec_state),
|
2818
|
+
event_data_(event_data),
|
2819
|
+
response_json_(response_json),
|
2820
|
+
client_data_(client_data) {}
|
2821
|
+
|
2822
|
+
|
2823
|
+
bool MessageImpl::IsEvent() const {
|
2824
|
+
return is_event_;
|
2825
|
+
}
|
2826
|
+
|
2827
|
+
|
2828
|
+
bool MessageImpl::IsResponse() const {
|
2829
|
+
return !is_event_;
|
2830
|
+
}
|
2831
|
+
|
2832
|
+
|
2833
|
+
DebugEvent MessageImpl::GetEvent() const {
|
2834
|
+
return event_;
|
2835
|
+
}
|
2836
|
+
|
2837
|
+
|
2838
|
+
bool MessageImpl::WillStartRunning() const {
|
2839
|
+
return running_;
|
2840
|
+
}
|
2841
|
+
|
2842
|
+
|
2843
|
+
v8::Handle<v8::Object> MessageImpl::GetExecutionState() const {
|
2844
|
+
return v8::Utils::ToLocal(exec_state_);
|
2845
|
+
}
|
2846
|
+
|
2847
|
+
|
2848
|
+
v8::Handle<v8::Object> MessageImpl::GetEventData() const {
|
2849
|
+
return v8::Utils::ToLocal(event_data_);
|
2850
|
+
}
|
2851
|
+
|
2852
|
+
|
2853
|
+
v8::Handle<v8::String> MessageImpl::GetJSON() const {
|
2854
|
+
v8::HandleScope scope;
|
2855
|
+
|
2856
|
+
if (IsEvent()) {
|
2857
|
+
// Call toJSONProtocol on the debug event object.
|
2858
|
+
Handle<Object> fun = GetProperty(event_data_, "toJSONProtocol");
|
2859
|
+
if (!fun->IsJSFunction()) {
|
2860
|
+
return v8::Handle<v8::String>();
|
2861
|
+
}
|
2862
|
+
bool caught_exception;
|
2863
|
+
Handle<Object> json = Execution::TryCall(Handle<JSFunction>::cast(fun),
|
2864
|
+
event_data_,
|
2865
|
+
0, NULL, &caught_exception);
|
2866
|
+
if (caught_exception || !json->IsString()) {
|
2867
|
+
return v8::Handle<v8::String>();
|
2868
|
+
}
|
2869
|
+
return scope.Close(v8::Utils::ToLocal(Handle<String>::cast(json)));
|
2870
|
+
} else {
|
2871
|
+
return v8::Utils::ToLocal(response_json_);
|
2872
|
+
}
|
2873
|
+
}
|
2874
|
+
|
2875
|
+
|
2876
|
+
v8::Handle<v8::Context> MessageImpl::GetEventContext() const {
|
2877
|
+
v8::Handle<v8::Context> context = GetDebugEventContext();
|
2878
|
+
// Top::context() may be NULL when "script collected" event occures.
|
2879
|
+
ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
|
2880
|
+
return GetDebugEventContext();
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
|
2884
|
+
v8::Debug::ClientData* MessageImpl::GetClientData() const {
|
2885
|
+
return client_data_;
|
2886
|
+
}
|
2887
|
+
|
2888
|
+
|
2889
|
+
EventDetailsImpl::EventDetailsImpl(DebugEvent event,
|
2890
|
+
Handle<JSObject> exec_state,
|
2891
|
+
Handle<JSObject> event_data,
|
2892
|
+
Handle<Object> callback_data,
|
2893
|
+
v8::Debug::ClientData* client_data)
|
2894
|
+
: event_(event),
|
2895
|
+
exec_state_(exec_state),
|
2896
|
+
event_data_(event_data),
|
2897
|
+
callback_data_(callback_data),
|
2898
|
+
client_data_(client_data) {}
|
2899
|
+
|
2900
|
+
|
2901
|
+
DebugEvent EventDetailsImpl::GetEvent() const {
|
2902
|
+
return event_;
|
2903
|
+
}
|
2904
|
+
|
2905
|
+
|
2906
|
+
v8::Handle<v8::Object> EventDetailsImpl::GetExecutionState() const {
|
2907
|
+
return v8::Utils::ToLocal(exec_state_);
|
2908
|
+
}
|
2909
|
+
|
2910
|
+
|
2911
|
+
v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const {
|
2912
|
+
return v8::Utils::ToLocal(event_data_);
|
2913
|
+
}
|
2914
|
+
|
2915
|
+
|
2916
|
+
v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const {
|
2917
|
+
return GetDebugEventContext();
|
2918
|
+
}
|
2919
|
+
|
2920
|
+
|
2921
|
+
v8::Handle<v8::Value> EventDetailsImpl::GetCallbackData() const {
|
2922
|
+
return v8::Utils::ToLocal(callback_data_);
|
2923
|
+
}
|
2924
|
+
|
2925
|
+
|
2926
|
+
v8::Debug::ClientData* EventDetailsImpl::GetClientData() const {
|
2927
|
+
return client_data_;
|
2928
|
+
}
|
2929
|
+
|
2930
|
+
|
2931
|
+
CommandMessage::CommandMessage() : text_(Vector<uint16_t>::empty()),
|
2932
|
+
client_data_(NULL) {
|
2933
|
+
}
|
2934
|
+
|
2935
|
+
|
2936
|
+
CommandMessage::CommandMessage(const Vector<uint16_t>& text,
|
2937
|
+
v8::Debug::ClientData* data)
|
2938
|
+
: text_(text),
|
2939
|
+
client_data_(data) {
|
2940
|
+
}
|
2941
|
+
|
2942
|
+
|
2943
|
+
CommandMessage::~CommandMessage() {
|
2944
|
+
}
|
2945
|
+
|
2946
|
+
|
2947
|
+
void CommandMessage::Dispose() {
|
2948
|
+
text_.Dispose();
|
2949
|
+
delete client_data_;
|
2950
|
+
client_data_ = NULL;
|
2951
|
+
}
|
2952
|
+
|
2953
|
+
|
2954
|
+
CommandMessage CommandMessage::New(const Vector<uint16_t>& command,
|
2955
|
+
v8::Debug::ClientData* data) {
|
2956
|
+
return CommandMessage(command.Clone(), data);
|
2957
|
+
}
|
2958
|
+
|
2959
|
+
|
2960
|
+
CommandMessageQueue::CommandMessageQueue(int size) : start_(0), end_(0),
|
2961
|
+
size_(size) {
|
2962
|
+
messages_ = NewArray<CommandMessage>(size);
|
2963
|
+
}
|
2964
|
+
|
2965
|
+
|
2966
|
+
CommandMessageQueue::~CommandMessageQueue() {
|
2967
|
+
while (!IsEmpty()) {
|
2968
|
+
CommandMessage m = Get();
|
2969
|
+
m.Dispose();
|
2970
|
+
}
|
2971
|
+
DeleteArray(messages_);
|
2972
|
+
}
|
2973
|
+
|
2974
|
+
|
2975
|
+
CommandMessage CommandMessageQueue::Get() {
|
2976
|
+
ASSERT(!IsEmpty());
|
2977
|
+
int result = start_;
|
2978
|
+
start_ = (start_ + 1) % size_;
|
2979
|
+
return messages_[result];
|
2980
|
+
}
|
2981
|
+
|
2982
|
+
|
2983
|
+
void CommandMessageQueue::Put(const CommandMessage& message) {
|
2984
|
+
if ((end_ + 1) % size_ == start_) {
|
2985
|
+
Expand();
|
2986
|
+
}
|
2987
|
+
messages_[end_] = message;
|
2988
|
+
end_ = (end_ + 1) % size_;
|
2989
|
+
}
|
2990
|
+
|
2991
|
+
|
2992
|
+
void CommandMessageQueue::Expand() {
|
2993
|
+
CommandMessageQueue new_queue(size_ * 2);
|
2994
|
+
while (!IsEmpty()) {
|
2995
|
+
new_queue.Put(Get());
|
2996
|
+
}
|
2997
|
+
CommandMessage* array_to_free = messages_;
|
2998
|
+
*this = new_queue;
|
2999
|
+
new_queue.messages_ = array_to_free;
|
3000
|
+
// Make the new_queue empty so that it doesn't call Dispose on any messages.
|
3001
|
+
new_queue.start_ = new_queue.end_;
|
3002
|
+
// Automatic destructor called on new_queue, freeing array_to_free.
|
3003
|
+
}
|
3004
|
+
|
3005
|
+
|
3006
|
+
LockingCommandMessageQueue::LockingCommandMessageQueue(int size)
|
3007
|
+
: queue_(size) {
|
3008
|
+
lock_ = OS::CreateMutex();
|
3009
|
+
}
|
3010
|
+
|
3011
|
+
|
3012
|
+
LockingCommandMessageQueue::~LockingCommandMessageQueue() {
|
3013
|
+
delete lock_;
|
3014
|
+
}
|
3015
|
+
|
3016
|
+
|
3017
|
+
bool LockingCommandMessageQueue::IsEmpty() const {
|
3018
|
+
ScopedLock sl(lock_);
|
3019
|
+
return queue_.IsEmpty();
|
3020
|
+
}
|
3021
|
+
|
3022
|
+
|
3023
|
+
CommandMessage LockingCommandMessageQueue::Get() {
|
3024
|
+
ScopedLock sl(lock_);
|
3025
|
+
CommandMessage result = queue_.Get();
|
3026
|
+
Logger::DebugEvent("Get", result.text());
|
3027
|
+
return result;
|
3028
|
+
}
|
3029
|
+
|
3030
|
+
|
3031
|
+
void LockingCommandMessageQueue::Put(const CommandMessage& message) {
|
3032
|
+
ScopedLock sl(lock_);
|
3033
|
+
queue_.Put(message);
|
3034
|
+
Logger::DebugEvent("Put", message.text());
|
3035
|
+
}
|
3036
|
+
|
3037
|
+
|
3038
|
+
void LockingCommandMessageQueue::Clear() {
|
3039
|
+
ScopedLock sl(lock_);
|
3040
|
+
queue_.Clear();
|
3041
|
+
}
|
3042
|
+
|
3043
|
+
|
3044
|
+
MessageDispatchHelperThread::MessageDispatchHelperThread()
|
3045
|
+
: Thread("v8:MsgDispHelpr"),
|
3046
|
+
sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
|
3047
|
+
already_signalled_(false) {
|
3048
|
+
}
|
3049
|
+
|
3050
|
+
|
3051
|
+
MessageDispatchHelperThread::~MessageDispatchHelperThread() {
|
3052
|
+
delete mutex_;
|
3053
|
+
delete sem_;
|
3054
|
+
}
|
3055
|
+
|
3056
|
+
|
3057
|
+
void MessageDispatchHelperThread::Schedule() {
|
3058
|
+
{
|
3059
|
+
ScopedLock lock(mutex_);
|
3060
|
+
if (already_signalled_) {
|
3061
|
+
return;
|
3062
|
+
}
|
3063
|
+
already_signalled_ = true;
|
3064
|
+
}
|
3065
|
+
sem_->Signal();
|
3066
|
+
}
|
3067
|
+
|
3068
|
+
|
3069
|
+
void MessageDispatchHelperThread::Run() {
|
3070
|
+
while (true) {
|
3071
|
+
sem_->Wait();
|
3072
|
+
{
|
3073
|
+
ScopedLock lock(mutex_);
|
3074
|
+
already_signalled_ = false;
|
3075
|
+
}
|
3076
|
+
{
|
3077
|
+
Locker locker;
|
3078
|
+
Debugger::CallMessageDispatchHandler();
|
3079
|
+
}
|
3080
|
+
}
|
3081
|
+
}
|
3082
|
+
|
3083
|
+
#endif // ENABLE_DEBUGGER_SUPPORT
|
3084
|
+
|
3085
|
+
} } // namespace v8::internal
|