mustang 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/Isolate +9 -0
- data/README.md +6 -12
- data/Rakefile +30 -4
- data/TODO.md +9 -0
- data/ext/v8/extconf.rb +56 -0
- data/ext/v8/v8.cpp +37 -0
- data/ext/v8/v8_array.cpp +161 -0
- data/ext/v8/v8_array.h +17 -0
- data/ext/v8/v8_base.cpp +147 -0
- data/ext/v8/v8_base.h +23 -0
- data/ext/v8/v8_cast.cpp +151 -0
- data/ext/v8/v8_cast.h +64 -0
- data/ext/v8/v8_context.cpp +174 -0
- data/ext/v8/v8_context.h +12 -0
- data/ext/v8/v8_date.cpp +61 -0
- data/ext/v8/v8_date.h +16 -0
- data/ext/v8/v8_errors.cpp +147 -0
- data/ext/v8/v8_errors.h +19 -0
- data/ext/v8/v8_external.cpp +66 -0
- data/ext/v8/v8_external.h +16 -0
- data/ext/v8/v8_function.cpp +182 -0
- data/ext/v8/v8_function.h +14 -0
- data/ext/v8/v8_integer.cpp +70 -0
- data/ext/v8/v8_integer.h +16 -0
- data/ext/v8/v8_macros.h +30 -0
- data/ext/v8/v8_main.cpp +53 -0
- data/ext/v8/v8_main.h +13 -0
- data/ext/v8/v8_number.cpp +62 -0
- data/ext/v8/v8_number.h +16 -0
- data/ext/v8/v8_object.cpp +172 -0
- data/ext/v8/v8_object.h +17 -0
- data/ext/v8/v8_ref.cpp +72 -0
- data/ext/v8/v8_ref.h +43 -0
- data/ext/v8/v8_regexp.cpp +148 -0
- data/ext/v8/v8_regexp.h +16 -0
- data/ext/v8/v8_string.cpp +78 -0
- data/ext/v8/v8_string.h +16 -0
- data/ext/v8/v8_value.cpp +370 -0
- data/ext/v8/v8_value.h +19 -0
- data/gemspec.yml +2 -1
- data/lib/core_ext/class.rb +14 -0
- data/lib/core_ext/object.rb +12 -0
- data/lib/core_ext/symbol.rb +23 -0
- data/lib/mustang.rb +44 -0
- data/lib/mustang/context.rb +69 -0
- data/lib/mustang/errors.rb +36 -0
- data/lib/support/delegated.rb +25 -0
- data/lib/v8/array.rb +21 -0
- data/lib/v8/context.rb +13 -0
- data/lib/v8/date.rb +20 -0
- data/lib/v8/error.rb +15 -0
- data/lib/v8/external.rb +16 -0
- data/lib/v8/function.rb +11 -0
- data/lib/v8/integer.rb +16 -0
- data/lib/v8/number.rb +16 -0
- data/lib/v8/object.rb +66 -0
- data/lib/v8/regexp.rb +23 -0
- data/lib/v8/string.rb +27 -0
- data/mustang.gemspec +3 -0
- data/spec/core_ext/class_spec.rb +19 -0
- data/spec/core_ext/object_spec.rb +19 -0
- data/spec/core_ext/symbol_spec.rb +27 -0
- data/spec/fixtures/test1.js +2 -0
- data/spec/fixtures/test2.js +2 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/v8/array_spec.rb +88 -0
- data/spec/v8/cast_spec.rb +151 -0
- data/spec/v8/context_spec.rb +78 -0
- data/spec/v8/data_spec.rb +39 -0
- data/spec/v8/date_spec.rb +45 -0
- data/spec/v8/empty_spec.rb +27 -0
- data/spec/v8/errors_spec.rb +142 -0
- data/spec/v8/external_spec.rb +44 -0
- data/spec/v8/function_spec.rb +170 -0
- data/spec/v8/integer_spec.rb +41 -0
- data/spec/v8/main_spec.rb +18 -0
- data/spec/v8/null_spec.rb +27 -0
- data/spec/v8/number_spec.rb +40 -0
- data/spec/v8/object_spec.rb +79 -0
- data/spec/v8/primitive_spec.rb +9 -0
- data/spec/v8/regexp_spec.rb +65 -0
- data/spec/v8/string_spec.rb +48 -0
- data/spec/v8/undefined_spec.rb +27 -0
- data/spec/v8/value_spec.rb +215 -0
- data/vendor/v8/.gitignore +2 -0
- data/vendor/v8/AUTHORS +3 -1
- data/vendor/v8/ChangeLog +117 -0
- data/vendor/v8/SConstruct +334 -53
- data/vendor/v8/include/v8-debug.h +21 -11
- data/vendor/v8/include/v8-preparser.h +1 -1
- data/vendor/v8/include/v8-profiler.h +122 -43
- data/vendor/v8/include/v8-testing.h +5 -0
- data/vendor/v8/include/v8.h +171 -17
- data/vendor/v8/preparser/SConscript +38 -0
- data/vendor/v8/preparser/preparser-process.cc +77 -114
- data/vendor/v8/samples/shell.cc +232 -46
- data/vendor/v8/src/SConscript +29 -5
- data/vendor/v8/src/accessors.cc +70 -211
- data/vendor/v8/{test/cctest/test-mips.cc → src/allocation-inl.h} +15 -18
- data/vendor/v8/src/allocation.cc +0 -82
- data/vendor/v8/src/allocation.h +9 -42
- data/vendor/v8/src/api.cc +1645 -1156
- data/vendor/v8/src/api.h +76 -12
- data/vendor/v8/src/apiutils.h +0 -7
- data/vendor/v8/src/arguments.h +15 -4
- data/vendor/v8/src/arm/assembler-arm-inl.h +10 -9
- data/vendor/v8/src/arm/assembler-arm.cc +62 -23
- data/vendor/v8/src/arm/assembler-arm.h +76 -11
- data/vendor/v8/src/arm/builtins-arm.cc +39 -33
- data/vendor/v8/src/arm/code-stubs-arm.cc +1182 -402
- data/vendor/v8/src/arm/code-stubs-arm.h +20 -54
- data/vendor/v8/src/arm/codegen-arm.cc +159 -106
- data/vendor/v8/src/arm/codegen-arm.h +6 -6
- data/vendor/v8/src/arm/constants-arm.h +16 -1
- data/vendor/v8/src/arm/cpu-arm.cc +7 -5
- data/vendor/v8/src/arm/debug-arm.cc +6 -4
- data/vendor/v8/src/arm/deoptimizer-arm.cc +51 -14
- data/vendor/v8/src/arm/disasm-arm.cc +47 -15
- data/vendor/v8/src/arm/frames-arm.h +1 -1
- data/vendor/v8/src/arm/full-codegen-arm.cc +724 -408
- data/vendor/v8/src/arm/ic-arm.cc +90 -85
- data/vendor/v8/src/arm/lithium-arm.cc +140 -69
- data/vendor/v8/src/arm/lithium-arm.h +161 -46
- data/vendor/v8/src/arm/lithium-codegen-arm.cc +567 -297
- data/vendor/v8/src/arm/lithium-codegen-arm.h +21 -9
- data/vendor/v8/src/arm/lithium-gap-resolver-arm.cc +2 -0
- data/vendor/v8/src/arm/macro-assembler-arm.cc +457 -96
- data/vendor/v8/src/arm/macro-assembler-arm.h +115 -18
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.cc +20 -13
- data/vendor/v8/src/arm/regexp-macro-assembler-arm.h +1 -0
- data/vendor/v8/src/arm/simulator-arm.cc +184 -101
- data/vendor/v8/src/arm/simulator-arm.h +26 -21
- data/vendor/v8/src/arm/stub-cache-arm.cc +450 -467
- data/vendor/v8/src/arm/virtual-frame-arm.cc +14 -12
- data/vendor/v8/src/arm/virtual-frame-arm.h +11 -8
- data/vendor/v8/src/array.js +35 -18
- data/vendor/v8/src/assembler.cc +186 -92
- data/vendor/v8/src/assembler.h +106 -69
- data/vendor/v8/src/ast-inl.h +5 -0
- data/vendor/v8/src/ast.cc +46 -35
- data/vendor/v8/src/ast.h +107 -50
- data/vendor/v8/src/atomicops.h +2 -0
- data/vendor/v8/src/atomicops_internals_mips_gcc.h +169 -0
- data/vendor/v8/src/bootstrapper.cc +649 -399
- data/vendor/v8/src/bootstrapper.h +94 -27
- data/vendor/v8/src/builtins.cc +359 -227
- data/vendor/v8/src/builtins.h +157 -123
- data/vendor/v8/src/checks.cc +2 -2
- data/vendor/v8/src/checks.h +4 -0
- data/vendor/v8/src/code-stubs.cc +27 -17
- data/vendor/v8/src/code-stubs.h +38 -17
- data/vendor/v8/src/codegen-inl.h +5 -1
- data/vendor/v8/src/codegen.cc +27 -17
- data/vendor/v8/src/codegen.h +9 -9
- data/vendor/v8/src/compilation-cache.cc +92 -206
- data/vendor/v8/src/compilation-cache.h +205 -30
- data/vendor/v8/src/compiler.cc +107 -120
- data/vendor/v8/src/compiler.h +17 -2
- data/vendor/v8/src/contexts.cc +22 -15
- data/vendor/v8/src/contexts.h +14 -8
- data/vendor/v8/src/conversions.cc +86 -30
- data/vendor/v8/src/counters.cc +19 -4
- data/vendor/v8/src/counters.h +28 -16
- data/vendor/v8/src/cpu-profiler-inl.h +4 -3
- data/vendor/v8/src/cpu-profiler.cc +123 -72
- data/vendor/v8/src/cpu-profiler.h +33 -19
- data/vendor/v8/src/cpu.h +2 -0
- data/vendor/v8/src/d8-debug.cc +3 -3
- data/vendor/v8/src/d8-debug.h +7 -6
- data/vendor/v8/src/d8-posix.cc +2 -0
- data/vendor/v8/src/d8.cc +22 -12
- data/vendor/v8/src/d8.gyp +3 -0
- data/vendor/v8/src/d8.js +618 -0
- data/vendor/v8/src/data-flow.h +3 -3
- data/vendor/v8/src/dateparser.h +4 -2
- data/vendor/v8/src/debug-agent.cc +10 -9
- data/vendor/v8/src/debug-agent.h +9 -11
- data/vendor/v8/src/debug-debugger.js +121 -0
- data/vendor/v8/src/debug.cc +331 -227
- data/vendor/v8/src/debug.h +248 -219
- data/vendor/v8/src/deoptimizer.cc +173 -62
- data/vendor/v8/src/deoptimizer.h +119 -19
- data/vendor/v8/src/disasm.h +3 -0
- data/vendor/v8/src/disassembler.cc +10 -9
- data/vendor/v8/src/execution.cc +185 -129
- data/vendor/v8/src/execution.h +47 -78
- data/vendor/v8/src/extensions/experimental/break-iterator.cc +250 -0
- data/vendor/v8/src/extensions/experimental/break-iterator.h +89 -0
- data/vendor/v8/src/extensions/experimental/experimental.gyp +2 -0
- data/vendor/v8/src/extensions/experimental/i18n-extension.cc +22 -2
- data/vendor/v8/src/extensions/externalize-string-extension.cc +2 -2
- data/vendor/v8/src/extensions/gc-extension.cc +1 -1
- data/vendor/v8/src/factory.cc +261 -154
- data/vendor/v8/src/factory.h +162 -158
- data/vendor/v8/src/flag-definitions.h +17 -11
- data/vendor/v8/src/frame-element.cc +0 -5
- data/vendor/v8/src/frame-element.h +9 -13
- data/vendor/v8/src/frames-inl.h +7 -0
- data/vendor/v8/src/frames.cc +56 -46
- data/vendor/v8/src/frames.h +36 -25
- data/vendor/v8/src/full-codegen.cc +15 -24
- data/vendor/v8/src/full-codegen.h +13 -41
- data/vendor/v8/src/func-name-inferrer.cc +7 -6
- data/vendor/v8/src/func-name-inferrer.h +1 -1
- data/vendor/v8/src/gdb-jit.cc +1 -0
- data/vendor/v8/src/global-handles.cc +118 -56
- data/vendor/v8/src/global-handles.h +98 -40
- data/vendor/v8/src/globals.h +2 -2
- data/vendor/v8/src/handles-inl.h +106 -9
- data/vendor/v8/src/handles.cc +220 -157
- data/vendor/v8/src/handles.h +38 -59
- data/vendor/v8/src/hashmap.h +3 -3
- data/vendor/v8/src/heap-inl.h +141 -25
- data/vendor/v8/src/heap-profiler.cc +117 -63
- data/vendor/v8/src/heap-profiler.h +38 -21
- data/vendor/v8/src/heap.cc +805 -564
- data/vendor/v8/src/heap.h +640 -594
- data/vendor/v8/src/hydrogen-instructions.cc +216 -73
- data/vendor/v8/src/hydrogen-instructions.h +259 -124
- data/vendor/v8/src/hydrogen.cc +996 -1171
- data/vendor/v8/src/hydrogen.h +163 -144
- data/vendor/v8/src/ia32/assembler-ia32-inl.h +12 -11
- data/vendor/v8/src/ia32/assembler-ia32.cc +85 -39
- data/vendor/v8/src/ia32/assembler-ia32.h +82 -16
- data/vendor/v8/src/ia32/builtins-ia32.cc +64 -58
- data/vendor/v8/src/ia32/code-stubs-ia32.cc +248 -324
- data/vendor/v8/src/ia32/code-stubs-ia32.h +3 -44
- data/vendor/v8/src/ia32/codegen-ia32.cc +217 -165
- data/vendor/v8/src/ia32/codegen-ia32.h +3 -0
- data/vendor/v8/src/ia32/cpu-ia32.cc +6 -5
- data/vendor/v8/src/ia32/debug-ia32.cc +8 -5
- data/vendor/v8/src/ia32/deoptimizer-ia32.cc +124 -14
- data/vendor/v8/src/ia32/disasm-ia32.cc +85 -62
- data/vendor/v8/src/ia32/frames-ia32.h +1 -1
- data/vendor/v8/src/ia32/full-codegen-ia32.cc +348 -435
- data/vendor/v8/src/ia32/ic-ia32.cc +91 -91
- data/vendor/v8/src/ia32/lithium-codegen-ia32.cc +500 -255
- data/vendor/v8/src/ia32/lithium-codegen-ia32.h +13 -4
- data/vendor/v8/src/ia32/lithium-gap-resolver-ia32.cc +6 -0
- data/vendor/v8/src/ia32/lithium-ia32.cc +122 -45
- data/vendor/v8/src/ia32/lithium-ia32.h +128 -41
- data/vendor/v8/src/ia32/macro-assembler-ia32.cc +109 -84
- data/vendor/v8/src/ia32/macro-assembler-ia32.h +18 -9
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.cc +26 -15
- data/vendor/v8/src/ia32/regexp-macro-assembler-ia32.h +1 -0
- data/vendor/v8/src/ia32/register-allocator-ia32.cc +30 -30
- data/vendor/v8/src/ia32/simulator-ia32.h +4 -4
- data/vendor/v8/src/ia32/stub-cache-ia32.cc +383 -400
- data/vendor/v8/src/ia32/virtual-frame-ia32.cc +36 -13
- data/vendor/v8/src/ia32/virtual-frame-ia32.h +11 -5
- data/vendor/v8/src/ic-inl.h +12 -2
- data/vendor/v8/src/ic.cc +304 -221
- data/vendor/v8/src/ic.h +115 -58
- data/vendor/v8/src/interpreter-irregexp.cc +25 -21
- data/vendor/v8/src/interpreter-irregexp.h +2 -1
- data/vendor/v8/src/isolate.cc +883 -0
- data/vendor/v8/src/isolate.h +1304 -0
- data/vendor/v8/src/json.js +10 -10
- data/vendor/v8/src/jsregexp.cc +111 -80
- data/vendor/v8/src/jsregexp.h +6 -7
- data/vendor/v8/src/jump-target-heavy.cc +5 -8
- data/vendor/v8/src/jump-target-heavy.h +0 -6
- data/vendor/v8/src/jump-target-inl.h +1 -1
- data/vendor/v8/src/jump-target-light.cc +3 -3
- data/vendor/v8/src/lithium-allocator-inl.h +2 -0
- data/vendor/v8/src/lithium-allocator.cc +42 -30
- data/vendor/v8/src/lithium-allocator.h +8 -22
- data/vendor/v8/src/lithium.cc +1 -0
- data/vendor/v8/src/liveedit.cc +141 -99
- data/vendor/v8/src/liveedit.h +7 -2
- data/vendor/v8/src/liveobjectlist-inl.h +90 -0
- data/vendor/v8/src/liveobjectlist.cc +2537 -1
- data/vendor/v8/src/liveobjectlist.h +245 -35
- data/vendor/v8/src/log-utils.cc +122 -35
- data/vendor/v8/src/log-utils.h +33 -36
- data/vendor/v8/src/log.cc +299 -241
- data/vendor/v8/src/log.h +177 -110
- data/vendor/v8/src/mark-compact.cc +612 -470
- data/vendor/v8/src/mark-compact.h +153 -80
- data/vendor/v8/src/messages.cc +16 -14
- data/vendor/v8/src/messages.js +30 -7
- data/vendor/v8/src/mips/assembler-mips-inl.h +155 -35
- data/vendor/v8/src/mips/assembler-mips.cc +1093 -219
- data/vendor/v8/src/mips/assembler-mips.h +552 -153
- data/vendor/v8/src/mips/builtins-mips.cc +43 -100
- data/vendor/v8/src/mips/code-stubs-mips.cc +752 -0
- data/vendor/v8/src/mips/code-stubs-mips.h +511 -0
- data/vendor/v8/src/mips/codegen-mips-inl.h +8 -14
- data/vendor/v8/src/mips/codegen-mips.cc +672 -896
- data/vendor/v8/src/mips/codegen-mips.h +271 -69
- data/vendor/v8/src/mips/constants-mips.cc +44 -20
- data/vendor/v8/src/mips/constants-mips.h +238 -40
- data/vendor/v8/src/mips/cpu-mips.cc +20 -3
- data/vendor/v8/src/mips/debug-mips.cc +35 -7
- data/vendor/v8/src/mips/deoptimizer-mips.cc +91 -0
- data/vendor/v8/src/mips/disasm-mips.cc +329 -93
- data/vendor/v8/src/mips/frames-mips.cc +2 -50
- data/vendor/v8/src/mips/frames-mips.h +24 -9
- data/vendor/v8/src/mips/full-codegen-mips.cc +473 -23
- data/vendor/v8/src/mips/ic-mips.cc +81 -45
- data/vendor/v8/src/mips/jump-target-mips.cc +11 -106
- data/vendor/v8/src/mips/lithium-codegen-mips.h +65 -0
- data/vendor/v8/src/mips/lithium-mips.h +304 -0
- data/vendor/v8/src/mips/macro-assembler-mips.cc +2391 -390
- data/vendor/v8/src/mips/macro-assembler-mips.h +718 -121
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.cc +478 -0
- data/vendor/v8/src/mips/regexp-macro-assembler-mips.h +250 -0
- data/vendor/v8/src/mips/register-allocator-mips-inl.h +0 -3
- data/vendor/v8/src/mips/register-allocator-mips.h +3 -2
- data/vendor/v8/src/mips/simulator-mips.cc +1009 -221
- data/vendor/v8/src/mips/simulator-mips.h +119 -36
- data/vendor/v8/src/mips/stub-cache-mips.cc +331 -148
- data/vendor/v8/src/mips/{fast-codegen-mips.cc → virtual-frame-mips-inl.h} +11 -30
- data/vendor/v8/src/mips/virtual-frame-mips.cc +137 -149
- data/vendor/v8/src/mips/virtual-frame-mips.h +294 -312
- data/vendor/v8/src/mirror-debugger.js +9 -8
- data/vendor/v8/src/mksnapshot.cc +2 -2
- data/vendor/v8/src/objects-debug.cc +16 -16
- data/vendor/v8/src/objects-inl.h +421 -195
- data/vendor/v8/src/objects-printer.cc +7 -7
- data/vendor/v8/src/objects-visiting.cc +1 -1
- data/vendor/v8/src/objects-visiting.h +33 -12
- data/vendor/v8/src/objects.cc +935 -658
- data/vendor/v8/src/objects.h +234 -139
- data/vendor/v8/src/parser.cc +484 -439
- data/vendor/v8/src/parser.h +35 -14
- data/vendor/v8/src/platform-cygwin.cc +173 -107
- data/vendor/v8/src/platform-freebsd.cc +224 -72
- data/vendor/v8/src/platform-linux.cc +234 -95
- data/vendor/v8/src/platform-macos.cc +215 -82
- data/vendor/v8/src/platform-nullos.cc +9 -3
- data/vendor/v8/src/platform-openbsd.cc +22 -7
- data/vendor/v8/src/platform-posix.cc +30 -5
- data/vendor/v8/src/platform-solaris.cc +120 -38
- data/vendor/v8/src/platform-tls-mac.h +62 -0
- data/vendor/v8/src/platform-tls-win32.h +62 -0
- data/vendor/v8/src/platform-tls.h +50 -0
- data/vendor/v8/src/platform-win32.cc +195 -97
- data/vendor/v8/src/platform.h +72 -15
- data/vendor/v8/src/preparse-data.cc +2 -0
- data/vendor/v8/src/preparser-api.cc +8 -2
- data/vendor/v8/src/preparser.cc +1 -1
- data/vendor/v8/src/prettyprinter.cc +43 -52
- data/vendor/v8/src/prettyprinter.h +1 -1
- data/vendor/v8/src/profile-generator-inl.h +0 -28
- data/vendor/v8/src/profile-generator.cc +942 -685
- data/vendor/v8/src/profile-generator.h +210 -176
- data/vendor/v8/src/property.cc +6 -0
- data/vendor/v8/src/property.h +14 -3
- data/vendor/v8/src/regexp-macro-assembler-irregexp.cc +1 -1
- data/vendor/v8/src/regexp-macro-assembler.cc +28 -19
- data/vendor/v8/src/regexp-macro-assembler.h +11 -6
- data/vendor/v8/src/regexp-stack.cc +18 -10
- data/vendor/v8/src/regexp-stack.h +45 -21
- data/vendor/v8/src/regexp.js +3 -3
- data/vendor/v8/src/register-allocator-inl.h +3 -3
- data/vendor/v8/src/register-allocator.cc +1 -7
- data/vendor/v8/src/register-allocator.h +5 -15
- data/vendor/v8/src/rewriter.cc +2 -1
- data/vendor/v8/src/runtime-profiler.cc +158 -128
- data/vendor/v8/src/runtime-profiler.h +131 -15
- data/vendor/v8/src/runtime.cc +2409 -1692
- data/vendor/v8/src/runtime.h +93 -17
- data/vendor/v8/src/safepoint-table.cc +3 -0
- data/vendor/v8/src/safepoint-table.h +9 -3
- data/vendor/v8/src/scanner-base.cc +21 -28
- data/vendor/v8/src/scanner-base.h +22 -11
- data/vendor/v8/src/scanner.cc +3 -5
- data/vendor/v8/src/scanner.h +4 -2
- data/vendor/v8/src/scopeinfo.cc +11 -16
- data/vendor/v8/src/scopeinfo.h +26 -15
- data/vendor/v8/src/scopes.cc +67 -37
- data/vendor/v8/src/scopes.h +26 -12
- data/vendor/v8/src/serialize.cc +193 -154
- data/vendor/v8/src/serialize.h +41 -36
- data/vendor/v8/src/small-pointer-list.h +163 -0
- data/vendor/v8/src/snapshot-common.cc +1 -1
- data/vendor/v8/src/snapshot.h +3 -1
- data/vendor/v8/src/spaces-inl.h +30 -25
- data/vendor/v8/src/spaces.cc +263 -370
- data/vendor/v8/src/spaces.h +178 -166
- data/vendor/v8/src/string-search.cc +4 -3
- data/vendor/v8/src/string-search.h +21 -20
- data/vendor/v8/src/string-stream.cc +32 -24
- data/vendor/v8/src/string.js +7 -7
- data/vendor/v8/src/stub-cache.cc +324 -248
- data/vendor/v8/src/stub-cache.h +181 -155
- data/vendor/v8/src/token.cc +3 -3
- data/vendor/v8/src/token.h +3 -3
- data/vendor/v8/src/top.cc +218 -390
- data/vendor/v8/src/type-info.cc +98 -32
- data/vendor/v8/src/type-info.h +10 -3
- data/vendor/v8/src/unicode.cc +1 -1
- data/vendor/v8/src/unicode.h +1 -1
- data/vendor/v8/src/utils.h +3 -0
- data/vendor/v8/src/v8-counters.cc +18 -11
- data/vendor/v8/src/v8-counters.h +34 -13
- data/vendor/v8/src/v8.cc +66 -121
- data/vendor/v8/src/v8.h +7 -4
- data/vendor/v8/src/v8globals.h +18 -12
- data/vendor/v8/src/{memory.h → v8memory.h} +0 -0
- data/vendor/v8/src/v8natives.js +59 -18
- data/vendor/v8/src/v8threads.cc +127 -114
- data/vendor/v8/src/v8threads.h +42 -35
- data/vendor/v8/src/v8utils.h +2 -39
- data/vendor/v8/src/variables.h +1 -1
- data/vendor/v8/src/version.cc +26 -5
- data/vendor/v8/src/version.h +4 -0
- data/vendor/v8/src/virtual-frame-heavy-inl.h +2 -4
- data/vendor/v8/src/virtual-frame-light-inl.h +5 -4
- data/vendor/v8/src/vm-state-inl.h +21 -17
- data/vendor/v8/src/vm-state.h +7 -5
- data/vendor/v8/src/win32-headers.h +1 -0
- data/vendor/v8/src/x64/assembler-x64-inl.h +12 -11
- data/vendor/v8/src/x64/assembler-x64.cc +80 -40
- data/vendor/v8/src/x64/assembler-x64.h +67 -17
- data/vendor/v8/src/x64/builtins-x64.cc +34 -33
- data/vendor/v8/src/x64/code-stubs-x64.cc +636 -377
- data/vendor/v8/src/x64/code-stubs-x64.h +14 -48
- data/vendor/v8/src/x64/codegen-x64-inl.h +1 -1
- data/vendor/v8/src/x64/codegen-x64.cc +158 -136
- data/vendor/v8/src/x64/codegen-x64.h +4 -1
- data/vendor/v8/src/x64/cpu-x64.cc +7 -5
- data/vendor/v8/src/x64/debug-x64.cc +8 -6
- data/vendor/v8/src/x64/deoptimizer-x64.cc +195 -20
- data/vendor/v8/src/x64/disasm-x64.cc +42 -23
- data/vendor/v8/src/x64/frames-x64.cc +1 -1
- data/vendor/v8/src/x64/frames-x64.h +2 -2
- data/vendor/v8/src/x64/full-codegen-x64.cc +780 -218
- data/vendor/v8/src/x64/ic-x64.cc +77 -79
- data/vendor/v8/src/x64/jump-target-x64.cc +1 -1
- data/vendor/v8/src/x64/lithium-codegen-x64.cc +698 -181
- data/vendor/v8/src/x64/lithium-codegen-x64.h +31 -6
- data/vendor/v8/src/x64/lithium-x64.cc +136 -54
- data/vendor/v8/src/x64/lithium-x64.h +142 -51
- data/vendor/v8/src/x64/macro-assembler-x64.cc +456 -187
- data/vendor/v8/src/x64/macro-assembler-x64.h +166 -34
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.cc +44 -28
- data/vendor/v8/src/x64/regexp-macro-assembler-x64.h +8 -4
- data/vendor/v8/src/x64/register-allocator-x64-inl.h +3 -3
- data/vendor/v8/src/x64/register-allocator-x64.cc +12 -8
- data/vendor/v8/src/x64/simulator-x64.h +5 -5
- data/vendor/v8/src/x64/stub-cache-x64.cc +299 -344
- data/vendor/v8/src/x64/virtual-frame-x64.cc +37 -13
- data/vendor/v8/src/x64/virtual-frame-x64.h +13 -7
- data/vendor/v8/src/zone-inl.h +49 -3
- data/vendor/v8/src/zone.cc +42 -41
- data/vendor/v8/src/zone.h +37 -34
- data/vendor/v8/test/benchmarks/testcfg.py +100 -0
- data/vendor/v8/test/cctest/SConscript +5 -4
- data/vendor/v8/test/cctest/cctest.h +3 -2
- data/vendor/v8/test/cctest/cctest.status +6 -11
- data/vendor/v8/test/cctest/test-accessors.cc +3 -3
- data/vendor/v8/test/cctest/test-alloc.cc +39 -33
- data/vendor/v8/test/cctest/test-api.cc +1092 -205
- data/vendor/v8/test/cctest/test-assembler-arm.cc +39 -25
- data/vendor/v8/test/cctest/test-assembler-ia32.cc +36 -37
- data/vendor/v8/test/cctest/test-assembler-mips.cc +1098 -40
- data/vendor/v8/test/cctest/test-assembler-x64.cc +32 -25
- data/vendor/v8/test/cctest/test-ast.cc +1 -0
- data/vendor/v8/test/cctest/test-circular-queue.cc +8 -5
- data/vendor/v8/test/cctest/test-compiler.cc +24 -24
- data/vendor/v8/test/cctest/test-cpu-profiler.cc +140 -5
- data/vendor/v8/test/cctest/test-dataflow.cc +1 -0
- data/vendor/v8/test/cctest/test-debug.cc +136 -77
- data/vendor/v8/test/cctest/test-decls.cc +1 -1
- data/vendor/v8/test/cctest/test-deoptimization.cc +25 -24
- data/vendor/v8/test/cctest/test-disasm-arm.cc +9 -4
- data/vendor/v8/test/cctest/test-disasm-ia32.cc +10 -8
- data/vendor/v8/test/cctest/test-func-name-inference.cc +10 -4
- data/vendor/v8/test/cctest/test-heap-profiler.cc +226 -164
- data/vendor/v8/test/cctest/test-heap.cc +240 -217
- data/vendor/v8/test/cctest/test-liveedit.cc +1 -0
- data/vendor/v8/test/cctest/test-log-stack-tracer.cc +18 -20
- data/vendor/v8/test/cctest/test-log.cc +114 -108
- data/vendor/v8/test/cctest/test-macro-assembler-x64.cc +247 -177
- data/vendor/v8/test/cctest/test-mark-compact.cc +129 -90
- data/vendor/v8/test/cctest/test-parsing.cc +15 -14
- data/vendor/v8/test/cctest/test-platform-linux.cc +1 -0
- data/vendor/v8/test/cctest/test-platform-tls.cc +66 -0
- data/vendor/v8/test/cctest/test-platform-win32.cc +1 -0
- data/vendor/v8/test/cctest/test-profile-generator.cc +1 -1
- data/vendor/v8/test/cctest/test-regexp.cc +53 -41
- data/vendor/v8/test/cctest/test-reloc-info.cc +18 -11
- data/vendor/v8/test/cctest/test-serialize.cc +44 -43
- data/vendor/v8/test/cctest/test-sockets.cc +8 -3
- data/vendor/v8/test/cctest/test-spaces.cc +47 -29
- data/vendor/v8/test/cctest/test-strings.cc +20 -20
- data/vendor/v8/test/cctest/test-thread-termination.cc +8 -3
- data/vendor/v8/test/cctest/test-threads.cc +5 -3
- data/vendor/v8/test/cctest/test-utils.cc +5 -4
- data/vendor/v8/test/cctest/testcfg.py +7 -3
- data/vendor/v8/test/es5conform/es5conform.status +2 -77
- data/vendor/v8/test/es5conform/testcfg.py +1 -1
- data/vendor/v8/test/message/testcfg.py +1 -1
- data/vendor/v8/test/mjsunit/accessors-on-global-object.js +3 -3
- data/vendor/v8/test/mjsunit/array-concat.js +43 -1
- data/vendor/v8/test/mjsunit/array-join.js +25 -0
- data/vendor/v8/test/mjsunit/bitops-info.js +7 -1
- data/vendor/v8/test/mjsunit/compiler/array-length.js +2 -2
- data/vendor/v8/test/mjsunit/compiler/global-accessors.js +47 -0
- data/vendor/v8/test/mjsunit/compiler/pic.js +1 -1
- data/vendor/v8/test/mjsunit/compiler/regress-loadfield.js +65 -0
- data/vendor/v8/test/mjsunit/math-sqrt.js +5 -1
- data/vendor/v8/test/mjsunit/mjsunit.js +59 -8
- data/vendor/v8/test/mjsunit/mjsunit.status +0 -12
- data/vendor/v8/test/mjsunit/mul-exhaustive.js +129 -11
- data/vendor/v8/test/mjsunit/negate-zero.js +1 -1
- data/vendor/v8/test/mjsunit/object-freeze.js +5 -13
- data/vendor/v8/test/mjsunit/object-prevent-extensions.js +9 -50
- data/vendor/v8/test/mjsunit/object-seal.js +4 -13
- data/vendor/v8/test/mjsunit/override-eval-with-non-function.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-1145.js +54 -0
- data/vendor/v8/test/mjsunit/regress/regress-1172-bis.js +37 -0
- data/vendor/v8/test/mjsunit/regress/regress-1181.js +54 -0
- data/vendor/v8/test/mjsunit/regress/regress-1207.js +35 -0
- data/vendor/v8/test/mjsunit/regress/regress-1209.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-1210.js +48 -0
- data/vendor/v8/test/mjsunit/regress/regress-1213.js +43 -0
- data/vendor/v8/test/mjsunit/regress/regress-1218.js +29 -0
- data/vendor/v8/test/mjsunit/regress/regress-1229.js +79 -0
- data/vendor/v8/test/mjsunit/regress/regress-1233.js +47 -0
- data/vendor/v8/test/mjsunit/regress/regress-1236.js +34 -0
- data/vendor/v8/test/mjsunit/regress/regress-1237.js +36 -0
- data/vendor/v8/test/mjsunit/regress/regress-1240.js +39 -0
- data/vendor/v8/test/mjsunit/regress/regress-1257.js +58 -0
- data/vendor/v8/test/mjsunit/regress/regress-1278.js +69 -0
- data/vendor/v8/test/mjsunit/regress/regress-create-exception.js +1 -0
- data/vendor/v8/test/mjsunit/regress/regress-lazy-deopt-reloc.js +52 -0
- data/vendor/v8/test/mjsunit/sin-cos.js +15 -10
- data/vendor/v8/test/mjsunit/smi-negative-zero.js +2 -2
- data/vendor/v8/test/mjsunit/str-to-num.js +1 -1
- data/vendor/v8/test/mjsunit/strict-mode.js +435 -0
- data/vendor/v8/test/mjsunit/testcfg.py +23 -6
- data/vendor/v8/test/mozilla/mozilla.status +0 -2
- data/vendor/v8/test/mozilla/testcfg.py +1 -1
- data/vendor/v8/test/preparser/empty.js +28 -0
- data/vendor/v8/test/preparser/functions-only.js +38 -0
- data/vendor/v8/test/preparser/non-alphanum.js +34 -0
- data/vendor/v8/test/preparser/symbols-only.js +49 -0
- data/vendor/v8/test/preparser/testcfg.py +90 -0
- data/vendor/v8/test/sputnik/testcfg.py +1 -1
- data/vendor/v8/test/test262/README +16 -0
- data/vendor/v8/test/test262/harness-adapt.js +80 -0
- data/vendor/v8/test/test262/test262.status +1506 -0
- data/vendor/v8/test/test262/testcfg.py +123 -0
- data/vendor/v8/tools/freebsd-tick-processor +10 -0
- data/vendor/v8/tools/gyp/v8.gyp +8 -33
- data/vendor/v8/tools/linux-tick-processor +5 -3
- data/vendor/v8/tools/test.py +37 -14
- data/vendor/v8/tools/tickprocessor.js +22 -8
- data/vendor/v8/tools/visual_studio/v8_base.vcproj +13 -1
- data/vendor/v8/tools/visual_studio/v8_base_arm.vcproj +5 -1
- data/vendor/v8/tools/visual_studio/v8_base_x64.vcproj +5 -1
- data/vendor/v8/tools/visual_studio/x64.vsprops +1 -0
- metadata +1495 -1341
- data/ext/extconf.rb +0 -22
- data/ext/mustang.cpp +0 -58
- data/vendor/v8/src/top.h +0 -608
data/vendor/v8/src/data-flow.h
CHANGED
@@ -90,7 +90,7 @@ class BitVector: public ZoneObject {
|
|
90
90
|
explicit BitVector(int length)
|
91
91
|
: length_(length),
|
92
92
|
data_length_(SizeFor(length)),
|
93
|
-
data_(
|
93
|
+
data_(ZONE->NewArray<uint32_t>(data_length_)) {
|
94
94
|
ASSERT(length > 0);
|
95
95
|
Clear();
|
96
96
|
}
|
@@ -98,7 +98,7 @@ class BitVector: public ZoneObject {
|
|
98
98
|
BitVector(const BitVector& other)
|
99
99
|
: length_(other.length()),
|
100
100
|
data_length_(SizeFor(length_)),
|
101
|
-
data_(
|
101
|
+
data_(ZONE->NewArray<uint32_t>(data_length_)) {
|
102
102
|
CopyFrom(other);
|
103
103
|
}
|
104
104
|
|
@@ -237,7 +237,7 @@ class SparseSet: public ZoneObject {
|
|
237
237
|
|
238
238
|
explicit SparseSet(int universe_size)
|
239
239
|
: dense_(4),
|
240
|
-
sparse_(
|
240
|
+
sparse_(ZONE->NewArray<int>(universe_size)) {
|
241
241
|
#ifdef DEBUG
|
242
242
|
size_ = universe_size;
|
243
243
|
iterator_count_ = 0;
|
data/vendor/v8/src/dateparser.h
CHANGED
@@ -70,7 +70,8 @@ class DateParser : public AllStatic {
|
|
70
70
|
explicit InputReader(Vector<Char> s)
|
71
71
|
: index_(0),
|
72
72
|
buffer_(s),
|
73
|
-
has_read_number_(false)
|
73
|
+
has_read_number_(false),
|
74
|
+
scanner_constants_(Isolate::Current()->scanner_constants()) {
|
74
75
|
Next();
|
75
76
|
}
|
76
77
|
|
@@ -121,7 +122,7 @@ class DateParser : public AllStatic {
|
|
121
122
|
}
|
122
123
|
|
123
124
|
bool SkipWhiteSpace() {
|
124
|
-
if (
|
125
|
+
if (scanner_constants_->IsWhiteSpace(ch_)) {
|
125
126
|
Next();
|
126
127
|
return true;
|
127
128
|
}
|
@@ -157,6 +158,7 @@ class DateParser : public AllStatic {
|
|
157
158
|
Vector<Char> buffer_;
|
158
159
|
bool has_read_number_;
|
159
160
|
uint32_t ch_;
|
161
|
+
ScannerConstants* scanner_constants_;
|
160
162
|
};
|
161
163
|
|
162
164
|
enum KeywordType { INVALID, MONTH_NAME, TIME_ZONE_NAME, AM_PM };
|
@@ -38,11 +38,11 @@ namespace internal {
|
|
38
38
|
// Public V8 debugger API message handler function. This function just delegates
|
39
39
|
// to the debugger agent through it's data parameter.
|
40
40
|
void DebuggerAgentMessageHandler(const v8::Debug::Message& message) {
|
41
|
-
DebuggerAgent::
|
41
|
+
DebuggerAgent* agent = Isolate::Current()->debugger_agent_instance();
|
42
|
+
ASSERT(agent != NULL);
|
43
|
+
agent->DebuggerMessage(message);
|
42
44
|
}
|
43
45
|
|
44
|
-
// static
|
45
|
-
DebuggerAgent* DebuggerAgent::instance_ = NULL;
|
46
46
|
|
47
47
|
// Debugger agent main thread.
|
48
48
|
void DebuggerAgent::Run() {
|
@@ -102,20 +102,21 @@ void DebuggerAgent::WaitUntilListening() {
|
|
102
102
|
listening_->Wait();
|
103
103
|
}
|
104
104
|
|
105
|
+
static const char* kCreateSessionMessage =
|
106
|
+
"Remote debugging session already active\r\n";
|
107
|
+
|
105
108
|
void DebuggerAgent::CreateSession(Socket* client) {
|
106
109
|
ScopedLock with(session_access_);
|
107
110
|
|
108
111
|
// If another session is already established terminate this one.
|
109
112
|
if (session_ != NULL) {
|
110
|
-
|
111
|
-
|
112
|
-
client->Send(message, StrLength(message));
|
113
|
+
client->Send(kCreateSessionMessage, StrLength(kCreateSessionMessage));
|
113
114
|
delete client;
|
114
115
|
return;
|
115
116
|
}
|
116
117
|
|
117
118
|
// Create a new session and hook up the debug message handler.
|
118
|
-
session_ = new DebuggerAgentSession(this, client);
|
119
|
+
session_ = new DebuggerAgentSession(isolate(), this, client);
|
119
120
|
v8::Debug::SetMessageHandler2(DebuggerAgentMessageHandler);
|
120
121
|
session_->Start();
|
121
122
|
}
|
@@ -224,8 +225,8 @@ void DebuggerAgentSession::Shutdown() {
|
|
224
225
|
}
|
225
226
|
|
226
227
|
|
227
|
-
const char* DebuggerAgentUtil::kContentLength = "Content-Length";
|
228
|
-
int DebuggerAgentUtil::kContentLengthSize =
|
228
|
+
const char* const DebuggerAgentUtil::kContentLength = "Content-Length";
|
229
|
+
const int DebuggerAgentUtil::kContentLengthSize =
|
229
230
|
StrLength(kContentLength);
|
230
231
|
|
231
232
|
|
data/vendor/v8/src/debug-agent.h
CHANGED
@@ -43,18 +43,18 @@ class DebuggerAgentSession;
|
|
43
43
|
// handles connection from a remote debugger.
|
44
44
|
class DebuggerAgent: public Thread {
|
45
45
|
public:
|
46
|
-
|
47
|
-
: Thread(name),
|
46
|
+
DebuggerAgent(Isolate* isolate, const char* name, int port)
|
47
|
+
: Thread(isolate, name),
|
48
48
|
name_(StrDup(name)), port_(port),
|
49
49
|
server_(OS::CreateSocket()), terminate_(false),
|
50
50
|
session_access_(OS::CreateMutex()), session_(NULL),
|
51
51
|
terminate_now_(OS::CreateSemaphore(0)),
|
52
52
|
listening_(OS::CreateSemaphore(0)) {
|
53
|
-
ASSERT(
|
54
|
-
|
53
|
+
ASSERT(Isolate::Current()->debugger_agent_instance() == NULL);
|
54
|
+
Isolate::Current()->set_debugger_agent_instance(this);
|
55
55
|
}
|
56
56
|
~DebuggerAgent() {
|
57
|
-
|
57
|
+
Isolate::Current()->set_debugger_agent_instance(NULL);
|
58
58
|
delete server_;
|
59
59
|
}
|
60
60
|
|
@@ -77,8 +77,6 @@ class DebuggerAgent: public Thread {
|
|
77
77
|
Semaphore* terminate_now_; // Semaphore to signal termination.
|
78
78
|
Semaphore* listening_;
|
79
79
|
|
80
|
-
static DebuggerAgent* instance_;
|
81
|
-
|
82
80
|
friend class DebuggerAgentSession;
|
83
81
|
friend void DebuggerAgentMessageHandler(const v8::Debug::Message& message);
|
84
82
|
|
@@ -90,8 +88,8 @@ class DebuggerAgent: public Thread {
|
|
90
88
|
// debugger and sends debugger events/responses to the remote debugger.
|
91
89
|
class DebuggerAgentSession: public Thread {
|
92
90
|
public:
|
93
|
-
DebuggerAgentSession(DebuggerAgent* agent, Socket* client)
|
94
|
-
: Thread("v8:DbgAgntSessn"),
|
91
|
+
DebuggerAgentSession(Isolate* isolate, DebuggerAgent* agent, Socket* client)
|
92
|
+
: Thread(isolate, "v8:DbgAgntSessn"),
|
95
93
|
agent_(agent), client_(client) {}
|
96
94
|
|
97
95
|
void DebuggerMessage(Vector<uint16_t> message);
|
@@ -112,8 +110,8 @@ class DebuggerAgentSession: public Thread {
|
|
112
110
|
// Utility methods factored out to be used by the D8 shell as well.
|
113
111
|
class DebuggerAgentUtil {
|
114
112
|
public:
|
115
|
-
static const char* kContentLength;
|
116
|
-
static int kContentLengthSize;
|
113
|
+
static const char* const kContentLength;
|
114
|
+
static const int kContentLengthSize;
|
117
115
|
|
118
116
|
static SmartPointer<char> ReceiveMessage(const Socket* conn);
|
119
117
|
static bool SendConnectMessage(const Socket* conn,
|
@@ -109,6 +109,7 @@ var debugger_flags = {
|
|
109
109
|
}
|
110
110
|
},
|
111
111
|
};
|
112
|
+
var lol_is_enabled = %HasLOLEnabled();
|
112
113
|
|
113
114
|
|
114
115
|
// Create a new break point object and add it to the list of break points.
|
@@ -1391,6 +1392,8 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request)
|
|
1391
1392
|
this.scopeRequest_(request, response);
|
1392
1393
|
} else if (request.command == 'evaluate') {
|
1393
1394
|
this.evaluateRequest_(request, response);
|
1395
|
+
} else if (lol_is_enabled && request.command == 'getobj') {
|
1396
|
+
this.getobjRequest_(request, response);
|
1394
1397
|
} else if (request.command == 'lookup') {
|
1395
1398
|
this.lookupRequest_(request, response);
|
1396
1399
|
} else if (request.command == 'references') {
|
@@ -1418,6 +1421,28 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request)
|
|
1418
1421
|
} else if (request.command == 'gc') {
|
1419
1422
|
this.gcRequest_(request, response);
|
1420
1423
|
|
1424
|
+
// LiveObjectList tools:
|
1425
|
+
} else if (lol_is_enabled && request.command == 'lol-capture') {
|
1426
|
+
this.lolCaptureRequest_(request, response);
|
1427
|
+
} else if (lol_is_enabled && request.command == 'lol-delete') {
|
1428
|
+
this.lolDeleteRequest_(request, response);
|
1429
|
+
} else if (lol_is_enabled && request.command == 'lol-diff') {
|
1430
|
+
this.lolDiffRequest_(request, response);
|
1431
|
+
} else if (lol_is_enabled && request.command == 'lol-getid') {
|
1432
|
+
this.lolGetIdRequest_(request, response);
|
1433
|
+
} else if (lol_is_enabled && request.command == 'lol-info') {
|
1434
|
+
this.lolInfoRequest_(request, response);
|
1435
|
+
} else if (lol_is_enabled && request.command == 'lol-reset') {
|
1436
|
+
this.lolResetRequest_(request, response);
|
1437
|
+
} else if (lol_is_enabled && request.command == 'lol-retainers') {
|
1438
|
+
this.lolRetainersRequest_(request, response);
|
1439
|
+
} else if (lol_is_enabled && request.command == 'lol-path') {
|
1440
|
+
this.lolPathRequest_(request, response);
|
1441
|
+
} else if (lol_is_enabled && request.command == 'lol-print') {
|
1442
|
+
this.lolPrintRequest_(request, response);
|
1443
|
+
} else if (lol_is_enabled && request.command == 'lol-stats') {
|
1444
|
+
this.lolStatsRequest_(request, response);
|
1445
|
+
|
1421
1446
|
} else {
|
1422
1447
|
throw new Error('Unknown command "' + request.command + '" in request');
|
1423
1448
|
}
|
@@ -2011,6 +2036,24 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
|
|
2011
2036
|
};
|
2012
2037
|
|
2013
2038
|
|
2039
|
+
DebugCommandProcessor.prototype.getobjRequest_ = function(request, response) {
|
2040
|
+
if (!request.arguments) {
|
2041
|
+
return response.failed('Missing arguments');
|
2042
|
+
}
|
2043
|
+
|
2044
|
+
// Pull out arguments.
|
2045
|
+
var obj_id = request.arguments.obj_id;
|
2046
|
+
|
2047
|
+
// Check for legal arguments.
|
2048
|
+
if (IS_UNDEFINED(obj_id)) {
|
2049
|
+
return response.failed('Argument "obj_id" missing');
|
2050
|
+
}
|
2051
|
+
|
2052
|
+
// Dump the object.
|
2053
|
+
response.body = MakeMirror(%GetLOLObj(obj_id));
|
2054
|
+
};
|
2055
|
+
|
2056
|
+
|
2014
2057
|
DebugCommandProcessor.prototype.lookupRequest_ = function(request, response) {
|
2015
2058
|
if (!request.arguments) {
|
2016
2059
|
return response.failed('Missing arguments');
|
@@ -2341,6 +2384,84 @@ DebugCommandProcessor.prototype.gcRequest_ = function(request, response) {
|
|
2341
2384
|
};
|
2342
2385
|
|
2343
2386
|
|
2387
|
+
DebugCommandProcessor.prototype.lolCaptureRequest_ =
|
2388
|
+
function(request, response) {
|
2389
|
+
response.body = %CaptureLOL();
|
2390
|
+
};
|
2391
|
+
|
2392
|
+
|
2393
|
+
DebugCommandProcessor.prototype.lolDeleteRequest_ =
|
2394
|
+
function(request, response) {
|
2395
|
+
var id = request.arguments.id;
|
2396
|
+
var result = %DeleteLOL(id);
|
2397
|
+
if (result) {
|
2398
|
+
response.body = { id: id };
|
2399
|
+
} else {
|
2400
|
+
response.failed('Failed to delete: live object list ' + id + ' not found.');
|
2401
|
+
}
|
2402
|
+
};
|
2403
|
+
|
2404
|
+
|
2405
|
+
DebugCommandProcessor.prototype.lolDiffRequest_ = function(request, response) {
|
2406
|
+
var id1 = request.arguments.id1;
|
2407
|
+
var id2 = request.arguments.id2;
|
2408
|
+
var verbose = request.arguments.verbose;
|
2409
|
+
var filter = request.arguments.filter;
|
2410
|
+
if (verbose === true) {
|
2411
|
+
var start = request.arguments.start;
|
2412
|
+
var count = request.arguments.count;
|
2413
|
+
response.body = %DumpLOL(id1, id2, start, count, filter);
|
2414
|
+
} else {
|
2415
|
+
response.body = %SummarizeLOL(id1, id2, filter);
|
2416
|
+
}
|
2417
|
+
};
|
2418
|
+
|
2419
|
+
|
2420
|
+
DebugCommandProcessor.prototype.lolGetIdRequest_ = function(request, response) {
|
2421
|
+
var address = request.arguments.address;
|
2422
|
+
response.body = {};
|
2423
|
+
response.body.id = %GetLOLObjId(address);
|
2424
|
+
};
|
2425
|
+
|
2426
|
+
|
2427
|
+
DebugCommandProcessor.prototype.lolInfoRequest_ = function(request, response) {
|
2428
|
+
var start = request.arguments.start;
|
2429
|
+
var count = request.arguments.count;
|
2430
|
+
response.body = %InfoLOL(start, count);
|
2431
|
+
};
|
2432
|
+
|
2433
|
+
|
2434
|
+
DebugCommandProcessor.prototype.lolResetRequest_ = function(request, response) {
|
2435
|
+
%ResetLOL();
|
2436
|
+
};
|
2437
|
+
|
2438
|
+
|
2439
|
+
DebugCommandProcessor.prototype.lolRetainersRequest_ =
|
2440
|
+
function(request, response) {
|
2441
|
+
var id = request.arguments.id;
|
2442
|
+
var verbose = request.arguments.verbose;
|
2443
|
+
var start = request.arguments.start;
|
2444
|
+
var count = request.arguments.count;
|
2445
|
+
var filter = request.arguments.filter;
|
2446
|
+
|
2447
|
+
response.body = %GetLOLObjRetainers(id, Mirror.prototype, verbose,
|
2448
|
+
start, count, filter);
|
2449
|
+
};
|
2450
|
+
|
2451
|
+
|
2452
|
+
DebugCommandProcessor.prototype.lolPathRequest_ = function(request, response) {
|
2453
|
+
var id1 = request.arguments.id1;
|
2454
|
+
var id2 = request.arguments.id2;
|
2455
|
+
response.body = {};
|
2456
|
+
response.body.path = %GetLOLPath(id1, id2, Mirror.prototype);
|
2457
|
+
};
|
2458
|
+
|
2459
|
+
|
2460
|
+
DebugCommandProcessor.prototype.lolPrintRequest_ = function(request, response) {
|
2461
|
+
var id = request.arguments.id;
|
2462
|
+
response.body = {};
|
2463
|
+
response.body.dump = %PrintLOLObj(id);
|
2464
|
+
};
|
2344
2465
|
|
2345
2466
|
|
2346
2467
|
// Check whether the previously processed command caused the VM to become
|
data/vendor/v8/src/debug.cc
CHANGED
@@ -51,6 +51,26 @@ namespace v8 {
|
|
51
51
|
namespace internal {
|
52
52
|
|
53
53
|
#ifdef ENABLE_DEBUGGER_SUPPORT
|
54
|
+
|
55
|
+
|
56
|
+
Debug::Debug(Isolate* isolate)
|
57
|
+
: has_break_points_(false),
|
58
|
+
script_cache_(NULL),
|
59
|
+
debug_info_list_(NULL),
|
60
|
+
disable_break_(false),
|
61
|
+
break_on_exception_(false),
|
62
|
+
break_on_uncaught_exception_(false),
|
63
|
+
debug_break_return_(NULL),
|
64
|
+
debug_break_slot_(NULL),
|
65
|
+
isolate_(isolate) {
|
66
|
+
memset(registers_, 0, sizeof(JSCallerSavedBuffer));
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
Debug::~Debug() {
|
71
|
+
}
|
72
|
+
|
73
|
+
|
54
74
|
static void PrintLn(v8::Local<v8::Value> value) {
|
55
75
|
v8::Local<v8::String> s = value->ToString();
|
56
76
|
ScopedVector<char> data(s->Length() + 1);
|
@@ -64,22 +84,28 @@ static void PrintLn(v8::Local<v8::Value> value) {
|
|
64
84
|
|
65
85
|
|
66
86
|
static Handle<Code> ComputeCallDebugBreak(int argc, Code::Kind kind) {
|
67
|
-
|
87
|
+
Isolate* isolate = Isolate::Current();
|
88
|
+
CALL_HEAP_FUNCTION(
|
89
|
+
isolate,
|
90
|
+
isolate->stub_cache()->ComputeCallDebugBreak(argc, kind),
|
91
|
+
Code);
|
68
92
|
}
|
69
93
|
|
70
94
|
|
71
|
-
static Handle<Code> ComputeCallDebugPrepareStepIn(int argc,
|
95
|
+
static Handle<Code> ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind) {
|
96
|
+
Isolate* isolate = Isolate::Current();
|
72
97
|
CALL_HEAP_FUNCTION(
|
73
|
-
|
98
|
+
isolate,
|
99
|
+
isolate->stub_cache()->ComputeCallDebugPrepareStepIn(argc, kind),
|
100
|
+
Code);
|
74
101
|
}
|
75
102
|
|
76
103
|
|
77
|
-
static v8::Handle<v8::Context> GetDebugEventContext() {
|
78
|
-
Handle<Context> context =
|
79
|
-
//
|
80
|
-
|
81
|
-
|
82
|
-
}
|
104
|
+
static v8::Handle<v8::Context> GetDebugEventContext(Isolate* isolate) {
|
105
|
+
Handle<Context> context = isolate->debug()->debugger_entry()->GetContext();
|
106
|
+
// Isolate::context() may have been NULL when "script collected" event
|
107
|
+
// occured.
|
108
|
+
if (context.is_null()) return v8::Local<v8::Context>();
|
83
109
|
Handle<Context> global_context(context->global_context());
|
84
110
|
return v8::Utils::ToLocal(global_context);
|
85
111
|
}
|
@@ -535,11 +561,6 @@ void BreakLocationIterator::RinfoNext() {
|
|
535
561
|
}
|
536
562
|
|
537
563
|
|
538
|
-
bool Debug::has_break_points_ = false;
|
539
|
-
ScriptCache* Debug::script_cache_ = NULL;
|
540
|
-
DebugInfoListNode* Debug::debug_info_list_ = NULL;
|
541
|
-
|
542
|
-
|
543
564
|
// Threading support.
|
544
565
|
void Debug::ThreadInit() {
|
545
566
|
thread_local_.break_count_ = 0;
|
@@ -552,16 +573,13 @@ void Debug::ThreadInit() {
|
|
552
573
|
thread_local_.step_into_fp_ = 0;
|
553
574
|
thread_local_.step_out_fp_ = 0;
|
554
575
|
thread_local_.after_break_target_ = 0;
|
576
|
+
// TODO(isolates): frames_are_dropped_?
|
555
577
|
thread_local_.debugger_entry_ = NULL;
|
556
578
|
thread_local_.pending_interrupts_ = 0;
|
557
579
|
thread_local_.restarter_frame_function_pointer_ = NULL;
|
558
580
|
}
|
559
581
|
|
560
582
|
|
561
|
-
JSCallerSavedBuffer Debug::registers_;
|
562
|
-
Debug::ThreadLocal Debug::thread_local_;
|
563
|
-
|
564
|
-
|
565
583
|
char* Debug::ArchiveDebug(char* storage) {
|
566
584
|
char* to = storage;
|
567
585
|
memcpy(to, reinterpret_cast<char*>(&thread_local_), sizeof(ThreadLocal));
|
@@ -584,7 +602,7 @@ char* Debug::RestoreDebug(char* storage) {
|
|
584
602
|
|
585
603
|
|
586
604
|
int Debug::ArchiveSpacePerThread() {
|
587
|
-
return sizeof(ThreadLocal) + sizeof(
|
605
|
+
return sizeof(ThreadLocal) + sizeof(JSCallerSavedBuffer);
|
588
606
|
}
|
589
607
|
|
590
608
|
|
@@ -614,22 +632,8 @@ Object** Debug::SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
|
|
614
632
|
const int Debug::kFrameDropperFrameSize = 4;
|
615
633
|
|
616
634
|
|
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
635
|
void ScriptCache::Add(Handle<Script> script) {
|
636
|
+
GlobalHandles* global_handles = Isolate::Current()->global_handles();
|
633
637
|
// Create an entry in the hash map for the script.
|
634
638
|
int id = Smi::cast(script->id())->value();
|
635
639
|
HashMap::Entry* entry =
|
@@ -642,15 +646,18 @@ void ScriptCache::Add(Handle<Script> script) {
|
|
642
646
|
// Globalize the script object, make it weak and use the location of the
|
643
647
|
// global handle as the value in the hash map.
|
644
648
|
Handle<Script> script_ =
|
645
|
-
Handle<Script>::cast(
|
646
|
-
|
647
|
-
|
649
|
+
Handle<Script>::cast(
|
650
|
+
(global_handles->Create(*script)));
|
651
|
+
global_handles->MakeWeak(
|
652
|
+
reinterpret_cast<Object**>(script_.location()),
|
653
|
+
this,
|
654
|
+
ScriptCache::HandleWeakScript);
|
648
655
|
entry->value = script_.location();
|
649
656
|
}
|
650
657
|
|
651
658
|
|
652
659
|
Handle<FixedArray> ScriptCache::GetScripts() {
|
653
|
-
Handle<FixedArray> instances =
|
660
|
+
Handle<FixedArray> instances = FACTORY->NewFixedArray(occupancy());
|
654
661
|
int count = 0;
|
655
662
|
for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) {
|
656
663
|
ASSERT(entry->value != NULL);
|
@@ -664,21 +671,23 @@ Handle<FixedArray> ScriptCache::GetScripts() {
|
|
664
671
|
|
665
672
|
|
666
673
|
void ScriptCache::ProcessCollectedScripts() {
|
674
|
+
Debugger* debugger = Isolate::Current()->debugger();
|
667
675
|
for (int i = 0; i < collected_scripts_.length(); i++) {
|
668
|
-
|
676
|
+
debugger->OnScriptCollected(collected_scripts_[i]);
|
669
677
|
}
|
670
678
|
collected_scripts_.Clear();
|
671
679
|
}
|
672
680
|
|
673
681
|
|
674
682
|
void ScriptCache::Clear() {
|
683
|
+
GlobalHandles* global_handles = Isolate::Current()->global_handles();
|
675
684
|
// Iterate the script cache to get rid of all the weak handles.
|
676
685
|
for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) {
|
677
686
|
ASSERT(entry != NULL);
|
678
687
|
Object** location = reinterpret_cast<Object**>(entry->value);
|
679
688
|
ASSERT((*location)->IsScript());
|
680
|
-
|
681
|
-
|
689
|
+
global_handles->ClearWeakness(location);
|
690
|
+
global_handles->Destroy(location);
|
682
691
|
}
|
683
692
|
// Clear the content of the hash map.
|
684
693
|
HashMap::Clear();
|
@@ -708,17 +717,18 @@ void Debug::Setup(bool create_heap_objects) {
|
|
708
717
|
if (create_heap_objects) {
|
709
718
|
// Get code to handle debug break on return.
|
710
719
|
debug_break_return_ =
|
711
|
-
|
720
|
+
isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak);
|
712
721
|
ASSERT(debug_break_return_->IsCode());
|
713
722
|
// Get code to handle debug break in debug break slots.
|
714
723
|
debug_break_slot_ =
|
715
|
-
|
724
|
+
isolate_->builtins()->builtin(Builtins::kSlot_DebugBreak);
|
716
725
|
ASSERT(debug_break_slot_->IsCode());
|
717
726
|
}
|
718
727
|
}
|
719
728
|
|
720
729
|
|
721
730
|
void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
|
731
|
+
Debug* debug = Isolate::Current()->debug();
|
722
732
|
DebugInfoListNode* node = reinterpret_cast<DebugInfoListNode*>(data);
|
723
733
|
// We need to clear all breakpoints associated with the function to restore
|
724
734
|
// original code and avoid patching the code twice later because
|
@@ -726,9 +736,9 @@ void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
|
|
726
736
|
// Runtime::FindSharedFunctionInfoInScript.
|
727
737
|
BreakLocationIterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
|
728
738
|
it.ClearAllDebugBreak();
|
729
|
-
RemoveDebugInfo(node->debug_info());
|
739
|
+
debug->RemoveDebugInfo(node->debug_info());
|
730
740
|
#ifdef DEBUG
|
731
|
-
node =
|
741
|
+
node = debug->debug_info_list_;
|
732
742
|
while (node != NULL) {
|
733
743
|
ASSERT(node != reinterpret_cast<DebugInfoListNode*>(data));
|
734
744
|
node = node->next();
|
@@ -738,20 +748,27 @@ void Debug::HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data) {
|
|
738
748
|
|
739
749
|
|
740
750
|
DebugInfoListNode::DebugInfoListNode(DebugInfo* debug_info): next_(NULL) {
|
751
|
+
GlobalHandles* global_handles = Isolate::Current()->global_handles();
|
741
752
|
// Globalize the request debug info object and make it weak.
|
742
|
-
debug_info_ = Handle<DebugInfo>::cast(
|
743
|
-
|
744
|
-
|
753
|
+
debug_info_ = Handle<DebugInfo>::cast(
|
754
|
+
(global_handles->Create(debug_info)));
|
755
|
+
global_handles->MakeWeak(
|
756
|
+
reinterpret_cast<Object**>(debug_info_.location()),
|
757
|
+
this,
|
758
|
+
Debug::HandleWeakDebugInfo);
|
745
759
|
}
|
746
760
|
|
747
761
|
|
748
762
|
DebugInfoListNode::~DebugInfoListNode() {
|
749
|
-
|
763
|
+
Isolate::Current()->global_handles()->Destroy(
|
764
|
+
reinterpret_cast<Object**>(debug_info_.location()));
|
750
765
|
}
|
751
766
|
|
752
767
|
|
753
768
|
bool Debug::CompileDebuggerScript(int index) {
|
754
|
-
|
769
|
+
Isolate* isolate = Isolate::Current();
|
770
|
+
Factory* factory = isolate->factory();
|
771
|
+
HandleScope scope(isolate);
|
755
772
|
|
756
773
|
// Bail out if the index is invalid.
|
757
774
|
if (index == -1) {
|
@@ -759,33 +776,31 @@ bool Debug::CompileDebuggerScript(int index) {
|
|
759
776
|
}
|
760
777
|
|
761
778
|
// Find source and name for the requested script.
|
762
|
-
Handle<String> source_code =
|
779
|
+
Handle<String> source_code =
|
780
|
+
isolate->bootstrapper()->NativesSourceLookup(index);
|
763
781
|
Vector<const char> name = Natives::GetScriptName(index);
|
764
|
-
Handle<String> script_name =
|
782
|
+
Handle<String> script_name = factory->NewStringFromAscii(name);
|
765
783
|
|
766
784
|
// Compile the script.
|
767
|
-
bool allow_natives_syntax = FLAG_allow_natives_syntax;
|
768
|
-
FLAG_allow_natives_syntax = true;
|
769
785
|
Handle<SharedFunctionInfo> function_info;
|
770
786
|
function_info = Compiler::Compile(source_code,
|
771
787
|
script_name,
|
772
788
|
0, 0, NULL, NULL,
|
773
789
|
Handle<String>::null(),
|
774
790
|
NATIVES_CODE);
|
775
|
-
FLAG_allow_natives_syntax = allow_natives_syntax;
|
776
791
|
|
777
792
|
// Silently ignore stack overflows during compilation.
|
778
793
|
if (function_info.is_null()) {
|
779
|
-
ASSERT(
|
780
|
-
|
794
|
+
ASSERT(isolate->has_pending_exception());
|
795
|
+
isolate->clear_pending_exception();
|
781
796
|
return false;
|
782
797
|
}
|
783
798
|
|
784
799
|
// Execute the shared function in the debugger context.
|
785
|
-
Handle<Context> context =
|
800
|
+
Handle<Context> context = isolate->global_context();
|
786
801
|
bool caught_exception = false;
|
787
802
|
Handle<JSFunction> function =
|
788
|
-
|
803
|
+
factory->NewFunctionFromSharedFunctionInfo(function_info, context);
|
789
804
|
Handle<Object> result =
|
790
805
|
Execution::TryCall(function, Handle<Object>(context->global()),
|
791
806
|
0, NULL, &caught_exception);
|
@@ -810,37 +825,44 @@ bool Debug::Load() {
|
|
810
825
|
// Return if debugger is already loaded.
|
811
826
|
if (IsLoaded()) return true;
|
812
827
|
|
828
|
+
ASSERT(Isolate::Current() == isolate_);
|
829
|
+
Debugger* debugger = isolate_->debugger();
|
830
|
+
|
813
831
|
// Bail out if we're already in the process of compiling the native
|
814
832
|
// JavaScript source code for the debugger.
|
815
|
-
if (
|
833
|
+
if (debugger->compiling_natives() ||
|
834
|
+
debugger->is_loading_debugger())
|
816
835
|
return false;
|
817
|
-
|
836
|
+
debugger->set_loading_debugger(true);
|
818
837
|
|
819
838
|
// Disable breakpoints and interrupts while compiling and running the
|
820
839
|
// debugger scripts including the context creation code.
|
821
840
|
DisableBreak disable(true);
|
822
|
-
PostponeInterruptsScope postpone;
|
841
|
+
PostponeInterruptsScope postpone(isolate_);
|
823
842
|
|
824
843
|
// Create the debugger context.
|
825
|
-
HandleScope scope;
|
844
|
+
HandleScope scope(isolate_);
|
826
845
|
Handle<Context> context =
|
827
|
-
|
828
|
-
|
829
|
-
|
846
|
+
isolate_->bootstrapper()->CreateEnvironment(
|
847
|
+
Handle<Object>::null(),
|
848
|
+
v8::Handle<ObjectTemplate>(),
|
849
|
+
NULL);
|
830
850
|
|
831
851
|
// Use the debugger context.
|
832
|
-
SaveContext save;
|
833
|
-
|
852
|
+
SaveContext save(isolate_);
|
853
|
+
isolate_->set_context(*context);
|
834
854
|
|
835
855
|
// Expose the builtins object in the debugger context.
|
836
|
-
Handle<String> key =
|
856
|
+
Handle<String> key = isolate_->factory()->LookupAsciiSymbol("builtins");
|
837
857
|
Handle<GlobalObject> global = Handle<GlobalObject>(context->global());
|
838
858
|
RETURN_IF_EMPTY_HANDLE_VALUE(
|
839
|
-
|
859
|
+
isolate_,
|
860
|
+
SetProperty(global, key, Handle<Object>(global->builtins()),
|
861
|
+
NONE, kNonStrictMode),
|
840
862
|
false);
|
841
863
|
|
842
864
|
// Compile the JavaScript for the debugger in the debugger context.
|
843
|
-
|
865
|
+
debugger->set_compiling_natives(true);
|
844
866
|
bool caught_exception =
|
845
867
|
!CompileDebuggerScript(Natives::GetIndex("mirror")) ||
|
846
868
|
!CompileDebuggerScript(Natives::GetIndex("debug"));
|
@@ -850,11 +872,11 @@ bool Debug::Load() {
|
|
850
872
|
!CompileDebuggerScript(Natives::GetIndex("liveedit"));
|
851
873
|
}
|
852
874
|
|
853
|
-
|
875
|
+
debugger->set_compiling_natives(false);
|
854
876
|
|
855
877
|
// Make sure we mark the debugger as not loading before we might
|
856
878
|
// return.
|
857
|
-
|
879
|
+
debugger->set_loading_debugger(false);
|
858
880
|
|
859
881
|
// Check for caught exceptions.
|
860
882
|
if (caught_exception) return false;
|
@@ -876,7 +898,8 @@ void Debug::Unload() {
|
|
876
898
|
DestroyScriptCache();
|
877
899
|
|
878
900
|
// Clear debugger context global handle.
|
879
|
-
|
901
|
+
Isolate::Current()->global_handles()->Destroy(
|
902
|
+
reinterpret_cast<Object**>(debug_context_.location()));
|
880
903
|
debug_context_ = Handle<Context>();
|
881
904
|
}
|
882
905
|
|
@@ -895,7 +918,8 @@ void Debug::Iterate(ObjectVisitor* v) {
|
|
895
918
|
|
896
919
|
|
897
920
|
Object* Debug::Break(Arguments args) {
|
898
|
-
|
921
|
+
Heap* heap = isolate_->heap();
|
922
|
+
HandleScope scope(isolate_);
|
899
923
|
ASSERT(args.length() == 0);
|
900
924
|
|
901
925
|
thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED;
|
@@ -907,17 +931,17 @@ Object* Debug::Break(Arguments args) {
|
|
907
931
|
// Just continue if breaks are disabled or debugger cannot be loaded.
|
908
932
|
if (disable_break() || !Load()) {
|
909
933
|
SetAfterBreakTarget(frame);
|
910
|
-
return
|
934
|
+
return heap->undefined_value();
|
911
935
|
}
|
912
936
|
|
913
937
|
// Enter the debugger.
|
914
938
|
EnterDebugger debugger;
|
915
939
|
if (debugger.FailedToEnter()) {
|
916
|
-
return
|
940
|
+
return heap->undefined_value();
|
917
941
|
}
|
918
942
|
|
919
943
|
// Postpone interrupt during breakpoint processing.
|
920
|
-
PostponeInterruptsScope postpone;
|
944
|
+
PostponeInterruptsScope postpone(isolate_);
|
921
945
|
|
922
946
|
// Get the debug info (create it if it does not exist).
|
923
947
|
Handle<SharedFunctionInfo> shared =
|
@@ -939,7 +963,7 @@ Object* Debug::Break(Arguments args) {
|
|
939
963
|
|
940
964
|
// If there is one or more real break points check whether any of these are
|
941
965
|
// triggered.
|
942
|
-
Handle<Object> break_points_hit(
|
966
|
+
Handle<Object> break_points_hit(heap->undefined_value());
|
943
967
|
if (break_location_iterator.HasBreakPoint()) {
|
944
968
|
Handle<Object> break_point_objects =
|
945
969
|
Handle<Object>(break_location_iterator.BreakPointObjects());
|
@@ -948,7 +972,7 @@ Object* Debug::Break(Arguments args) {
|
|
948
972
|
|
949
973
|
// If step out is active skip everything until the frame where we need to step
|
950
974
|
// out to is reached, unless real breakpoint is hit.
|
951
|
-
if (
|
975
|
+
if (StepOutActive() && frame->fp() != step_out_fp() &&
|
952
976
|
break_points_hit->IsUndefined() ) {
|
953
977
|
// Step count should always be 0 for StepOut.
|
954
978
|
ASSERT(thread_local_.step_count_ == 0);
|
@@ -962,7 +986,7 @@ Object* Debug::Break(Arguments args) {
|
|
962
986
|
ClearStepping();
|
963
987
|
|
964
988
|
// Notify the debug event listeners.
|
965
|
-
|
989
|
+
isolate_->debugger()->OnDebugBreak(break_points_hit, false);
|
966
990
|
} else if (thread_local_.last_step_action_ != StepNone) {
|
967
991
|
// Hold on to last step action as it is cleared by the call to
|
968
992
|
// ClearStepping.
|
@@ -978,23 +1002,32 @@ Object* Debug::Break(Arguments args) {
|
|
978
1002
|
|
979
1003
|
if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) {
|
980
1004
|
SetAfterBreakTarget(frame);
|
981
|
-
} else if (thread_local_.frame_drop_mode_ ==
|
1005
|
+
} else if (thread_local_.frame_drop_mode_ ==
|
1006
|
+
FRAME_DROPPED_IN_IC_CALL) {
|
982
1007
|
// We must have been calling IC stub. Do not go there anymore.
|
983
|
-
Code* plain_return =
|
1008
|
+
Code* plain_return = isolate_->builtins()->builtin(
|
1009
|
+
Builtins::kPlainReturn_LiveEdit);
|
984
1010
|
thread_local_.after_break_target_ = plain_return->entry();
|
985
1011
|
} else if (thread_local_.frame_drop_mode_ ==
|
986
1012
|
FRAME_DROPPED_IN_DEBUG_SLOT_CALL) {
|
987
1013
|
// Debug break slot stub does not return normally, instead it manually
|
988
1014
|
// cleans the stack and jumps. We should patch the jump address.
|
989
|
-
Code* plain_return =
|
1015
|
+
Code* plain_return = isolate_->builtins()->builtin(
|
1016
|
+
Builtins::kFrameDropper_LiveEdit);
|
990
1017
|
thread_local_.after_break_target_ = plain_return->entry();
|
991
|
-
} else if (thread_local_.frame_drop_mode_ ==
|
1018
|
+
} else if (thread_local_.frame_drop_mode_ ==
|
1019
|
+
FRAME_DROPPED_IN_DIRECT_CALL) {
|
992
1020
|
// Nothing to do, after_break_target is not used here.
|
993
1021
|
} else {
|
994
1022
|
UNREACHABLE();
|
995
1023
|
}
|
996
1024
|
|
997
|
-
return
|
1025
|
+
return heap->undefined_value();
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
|
1029
|
+
RUNTIME_FUNCTION(Object*, Debug_Break) {
|
1030
|
+
return isolate->debug()->Break(args);
|
998
1031
|
}
|
999
1032
|
|
1000
1033
|
|
@@ -1002,52 +1035,59 @@ Object* Debug::Break(Arguments args) {
|
|
1002
1035
|
// triggered. This function returns a JSArray with the break point objects
|
1003
1036
|
// which is triggered.
|
1004
1037
|
Handle<Object> Debug::CheckBreakPoints(Handle<Object> break_point_objects) {
|
1005
|
-
|
1006
|
-
Handle<JSArray> break_points_hit = Factory::NewJSArray(1);
|
1038
|
+
Factory* factory = isolate_->factory();
|
1007
1039
|
|
1008
|
-
//
|
1040
|
+
// Count the number of break points hit. If there are multiple break points
|
1041
|
+
// they are in a FixedArray.
|
1042
|
+
Handle<FixedArray> break_points_hit;
|
1043
|
+
int break_points_hit_count = 0;
|
1009
1044
|
ASSERT(!break_point_objects->IsUndefined());
|
1010
1045
|
if (break_point_objects->IsFixedArray()) {
|
1011
1046
|
Handle<FixedArray> array(FixedArray::cast(*break_point_objects));
|
1047
|
+
break_points_hit = factory->NewFixedArray(array->length());
|
1012
1048
|
for (int i = 0; i < array->length(); i++) {
|
1013
1049
|
Handle<Object> o(array->get(i));
|
1014
1050
|
if (CheckBreakPoint(o)) {
|
1015
|
-
|
1051
|
+
break_points_hit->set(break_points_hit_count++, *o);
|
1016
1052
|
}
|
1017
1053
|
}
|
1018
1054
|
} else {
|
1055
|
+
break_points_hit = factory->NewFixedArray(1);
|
1019
1056
|
if (CheckBreakPoint(break_point_objects)) {
|
1020
|
-
|
1021
|
-
break_points_hit_count++,
|
1022
|
-
break_point_objects);
|
1057
|
+
break_points_hit->set(break_points_hit_count++, *break_point_objects);
|
1023
1058
|
}
|
1024
1059
|
}
|
1025
1060
|
|
1026
1061
|
// Return undefined if no break points were triggered.
|
1027
1062
|
if (break_points_hit_count == 0) {
|
1028
|
-
return
|
1063
|
+
return factory->undefined_value();
|
1029
1064
|
}
|
1030
|
-
|
1065
|
+
// Return break points hit as a JSArray.
|
1066
|
+
Handle<JSArray> result = factory->NewJSArrayWithElements(break_points_hit);
|
1067
|
+
result->set_length(Smi::FromInt(break_points_hit_count));
|
1068
|
+
return result;
|
1031
1069
|
}
|
1032
1070
|
|
1033
1071
|
|
1034
1072
|
// Check whether a single break point object is triggered.
|
1035
1073
|
bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
|
1036
|
-
|
1074
|
+
ASSERT(Isolate::Current() == isolate_);
|
1075
|
+
Factory* factory = isolate_->factory();
|
1076
|
+
HandleScope scope(isolate_);
|
1037
1077
|
|
1038
1078
|
// Ignore check if break point object is not a JSObject.
|
1039
1079
|
if (!break_point_object->IsJSObject()) return true;
|
1040
1080
|
|
1041
|
-
// Get the function
|
1081
|
+
// Get the function IsBreakPointTriggered (defined in debug-debugger.js).
|
1042
1082
|
Handle<String> is_break_point_triggered_symbol =
|
1043
|
-
|
1083
|
+
factory->LookupAsciiSymbol("IsBreakPointTriggered");
|
1044
1084
|
Handle<JSFunction> check_break_point =
|
1045
1085
|
Handle<JSFunction>(JSFunction::cast(
|
1046
1086
|
debug_context()->global()->GetPropertyNoExceptionThrown(
|
1047
1087
|
*is_break_point_triggered_symbol)));
|
1048
1088
|
|
1049
1089
|
// Get the break id as an object.
|
1050
|
-
Handle<Object> break_id =
|
1090
|
+
Handle<Object> break_id = factory->NewNumberFromInt(Debug::break_id());
|
1051
1091
|
|
1052
1092
|
// Call HandleBreakPointx.
|
1053
1093
|
bool caught_exception = false;
|
@@ -1057,8 +1097,7 @@ bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
|
|
1057
1097
|
reinterpret_cast<Object**>(break_point_object.location())
|
1058
1098
|
};
|
1059
1099
|
Handle<Object> result = Execution::TryCall(check_break_point,
|
1060
|
-
|
1061
|
-
&caught_exception);
|
1100
|
+
isolate_->js_builtins_object(), argc, argv, &caught_exception);
|
1062
1101
|
|
1063
1102
|
// If exception or non boolean result handle as not triggered
|
1064
1103
|
if (caught_exception || !result->IsBoolean()) {
|
@@ -1066,7 +1105,8 @@ bool Debug::CheckBreakPoint(Handle<Object> break_point_object) {
|
|
1066
1105
|
}
|
1067
1106
|
|
1068
1107
|
// Return whether the break point is triggered.
|
1069
|
-
|
1108
|
+
ASSERT(!result.is_null());
|
1109
|
+
return (*result)->IsTrue();
|
1070
1110
|
}
|
1071
1111
|
|
1072
1112
|
|
@@ -1087,7 +1127,7 @@ Handle<DebugInfo> Debug::GetDebugInfo(Handle<SharedFunctionInfo> shared) {
|
|
1087
1127
|
void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
|
1088
1128
|
Handle<Object> break_point_object,
|
1089
1129
|
int* source_position) {
|
1090
|
-
HandleScope scope;
|
1130
|
+
HandleScope scope(isolate_);
|
1091
1131
|
|
1092
1132
|
if (!EnsureDebugInfo(shared)) {
|
1093
1133
|
// Return if retrieving debug info failed.
|
@@ -1111,7 +1151,7 @@ void Debug::SetBreakPoint(Handle<SharedFunctionInfo> shared,
|
|
1111
1151
|
|
1112
1152
|
|
1113
1153
|
void Debug::ClearBreakPoint(Handle<Object> break_point_object) {
|
1114
|
-
HandleScope scope;
|
1154
|
+
HandleScope scope(isolate_);
|
1115
1155
|
|
1116
1156
|
DebugInfoListNode* node = debug_info_list_;
|
1117
1157
|
while (node != NULL) {
|
@@ -1217,7 +1257,8 @@ bool Debug::IsBreakOnException(ExceptionBreakType type) {
|
|
1217
1257
|
|
1218
1258
|
|
1219
1259
|
void Debug::PrepareStep(StepAction step_action, int step_count) {
|
1220
|
-
|
1260
|
+
ASSERT(Isolate::Current() == isolate_);
|
1261
|
+
HandleScope scope(isolate_);
|
1221
1262
|
ASSERT(Debug::InDebugger());
|
1222
1263
|
|
1223
1264
|
// Remember this step action and count.
|
@@ -1365,8 +1406,10 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
|
|
1365
1406
|
// Reverse lookup required as the minor key cannot be retrieved
|
1366
1407
|
// from the code object.
|
1367
1408
|
Handle<Object> obj(
|
1368
|
-
|
1369
|
-
|
1409
|
+
isolate_->heap()->code_stubs()->SlowReverseLookup(
|
1410
|
+
*call_function_stub));
|
1411
|
+
ASSERT(!obj.is_null());
|
1412
|
+
ASSERT(!(*obj)->IsUndefined());
|
1370
1413
|
ASSERT(obj->IsSmi());
|
1371
1414
|
// Get the STUB key and extract major and minor key.
|
1372
1415
|
uint32_t key = Smi::cast(*obj)->value();
|
@@ -1484,18 +1527,16 @@ Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
|
|
1484
1527
|
return ComputeCallDebugBreak(code->arguments_count(), code->kind());
|
1485
1528
|
|
1486
1529
|
case Code::LOAD_IC:
|
1487
|
-
return
|
1530
|
+
return Isolate::Current()->builtins()->LoadIC_DebugBreak();
|
1488
1531
|
|
1489
1532
|
case Code::STORE_IC:
|
1490
|
-
return
|
1533
|
+
return Isolate::Current()->builtins()->StoreIC_DebugBreak();
|
1491
1534
|
|
1492
1535
|
case Code::KEYED_LOAD_IC:
|
1493
|
-
return
|
1494
|
-
Builtins::builtin(Builtins::KeyedLoadIC_DebugBreak));
|
1536
|
+
return Isolate::Current()->builtins()->KeyedLoadIC_DebugBreak();
|
1495
1537
|
|
1496
1538
|
case Code::KEYED_STORE_IC:
|
1497
|
-
return
|
1498
|
-
Builtins::builtin(Builtins::KeyedStoreIC_DebugBreak));
|
1539
|
+
return Isolate::Current()->builtins()->KeyedStoreIC_DebugBreak();
|
1499
1540
|
|
1500
1541
|
default:
|
1501
1542
|
UNREACHABLE();
|
@@ -1503,13 +1544,13 @@ Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
|
|
1503
1544
|
}
|
1504
1545
|
if (RelocInfo::IsConstructCall(mode)) {
|
1505
1546
|
Handle<Code> result =
|
1506
|
-
|
1547
|
+
Isolate::Current()->builtins()->ConstructCall_DebugBreak();
|
1507
1548
|
return result;
|
1508
1549
|
}
|
1509
1550
|
if (code->kind() == Code::STUB) {
|
1510
1551
|
ASSERT(code->major_key() == CodeStub::CallFunction);
|
1511
1552
|
Handle<Code> result =
|
1512
|
-
|
1553
|
+
Isolate::Current()->builtins()->StubNoRegisters_DebugBreak();
|
1513
1554
|
return result;
|
1514
1555
|
}
|
1515
1556
|
|
@@ -1521,13 +1562,15 @@ Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) {
|
|
1521
1562
|
// Simple function for returning the source positions for active break points.
|
1522
1563
|
Handle<Object> Debug::GetSourceBreakLocations(
|
1523
1564
|
Handle<SharedFunctionInfo> shared) {
|
1524
|
-
|
1565
|
+
Isolate* isolate = Isolate::Current();
|
1566
|
+
Heap* heap = isolate->heap();
|
1567
|
+
if (!HasDebugInfo(shared)) return Handle<Object>(heap->undefined_value());
|
1525
1568
|
Handle<DebugInfo> debug_info = GetDebugInfo(shared);
|
1526
1569
|
if (debug_info->GetBreakPointCount() == 0) {
|
1527
|
-
return Handle<Object>(
|
1570
|
+
return Handle<Object>(heap->undefined_value());
|
1528
1571
|
}
|
1529
1572
|
Handle<FixedArray> locations =
|
1530
|
-
|
1573
|
+
isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
|
1531
1574
|
int count = 0;
|
1532
1575
|
for (int i = 0; i < debug_info->break_points()->length(); i++) {
|
1533
1576
|
if (!debug_info->break_points()->get(i)->IsUndefined()) {
|
@@ -1573,13 +1616,13 @@ void Debug::HandleStepIn(Handle<JSFunction> function,
|
|
1573
1616
|
|
1574
1617
|
// Flood the function with one-shot break points if it is called from where
|
1575
1618
|
// step into was requested.
|
1576
|
-
if (fp ==
|
1619
|
+
if (fp == step_in_fp()) {
|
1577
1620
|
// Don't allow step into functions in the native context.
|
1578
1621
|
if (!function->IsBuiltin()) {
|
1579
1622
|
if (function->shared()->code() ==
|
1580
|
-
|
1623
|
+
Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply) ||
|
1581
1624
|
function->shared()->code() ==
|
1582
|
-
|
1625
|
+
Isolate::Current()->builtins()->builtin(Builtins::kFunctionCall)) {
|
1583
1626
|
// Handle function.apply and function.call separately to flood the
|
1584
1627
|
// function to be called and not the code for Builtins::FunctionApply or
|
1585
1628
|
// Builtins::FunctionCall. The receiver of call/apply is the target
|
@@ -1673,7 +1716,7 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared) {
|
|
1673
1716
|
}
|
1674
1717
|
|
1675
1718
|
// Create the debug info object.
|
1676
|
-
Handle<DebugInfo> debug_info =
|
1719
|
+
Handle<DebugInfo> debug_info = FACTORY->NewDebugInfo(shared);
|
1677
1720
|
|
1678
1721
|
// Add debug info to the list.
|
1679
1722
|
DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
|
@@ -1700,7 +1743,8 @@ void Debug::RemoveDebugInfo(Handle<DebugInfo> debug_info) {
|
|
1700
1743
|
} else {
|
1701
1744
|
prev->set_next(current->next());
|
1702
1745
|
}
|
1703
|
-
current->debug_info()->shared()->set_debug_info(
|
1746
|
+
current->debug_info()->shared()->set_debug_info(
|
1747
|
+
isolate_->heap()->undefined_value());
|
1704
1748
|
delete current;
|
1705
1749
|
|
1706
1750
|
// If there are no more debug info objects there are not more break
|
@@ -1718,7 +1762,8 @@ void Debug::RemoveDebugInfo(Handle<DebugInfo> debug_info) {
|
|
1718
1762
|
|
1719
1763
|
|
1720
1764
|
void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
|
1721
|
-
|
1765
|
+
ASSERT(Isolate::Current() == isolate_);
|
1766
|
+
HandleScope scope(isolate_);
|
1722
1767
|
|
1723
1768
|
// Get the executing function in which the debug break occurred.
|
1724
1769
|
Handle<SharedFunctionInfo> shared =
|
@@ -1732,7 +1777,7 @@ void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
|
|
1732
1777
|
Handle<Code> original_code(debug_info->original_code());
|
1733
1778
|
#ifdef DEBUG
|
1734
1779
|
// Get the code which is actually executing.
|
1735
|
-
Handle<Code> frame_code(frame->
|
1780
|
+
Handle<Code> frame_code(frame->LookupCode(isolate_));
|
1736
1781
|
ASSERT(frame_code.is_identical_to(code));
|
1737
1782
|
#endif
|
1738
1783
|
|
@@ -1801,7 +1846,7 @@ void Debug::SetAfterBreakTarget(JavaScriptFrame* frame) {
|
|
1801
1846
|
|
1802
1847
|
|
1803
1848
|
bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
|
1804
|
-
HandleScope scope;
|
1849
|
+
HandleScope scope(isolate_);
|
1805
1850
|
|
1806
1851
|
// Get the executing function in which the debug break occurred.
|
1807
1852
|
Handle<SharedFunctionInfo> shared =
|
@@ -1814,7 +1859,7 @@ bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
|
|
1814
1859
|
Handle<Code> code(debug_info->code());
|
1815
1860
|
#ifdef DEBUG
|
1816
1861
|
// Get the code which is actually executing.
|
1817
|
-
Handle<Code> frame_code(frame->
|
1862
|
+
Handle<Code> frame_code(frame->LookupCode(Isolate::Current()));
|
1818
1863
|
ASSERT(frame_code.is_identical_to(code));
|
1819
1864
|
#endif
|
1820
1865
|
|
@@ -1845,19 +1890,20 @@ void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
|
|
1845
1890
|
|
1846
1891
|
|
1847
1892
|
bool Debug::IsDebugGlobal(GlobalObject* global) {
|
1848
|
-
return IsLoaded() && global ==
|
1893
|
+
return IsLoaded() && global == debug_context()->global();
|
1849
1894
|
}
|
1850
1895
|
|
1851
1896
|
|
1852
1897
|
void Debug::ClearMirrorCache() {
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1898
|
+
ASSERT(Isolate::Current() == isolate_);
|
1899
|
+
PostponeInterruptsScope postpone(isolate_);
|
1900
|
+
HandleScope scope(isolate_);
|
1901
|
+
ASSERT(isolate_->context() == *Debug::debug_context());
|
1856
1902
|
|
1857
1903
|
// Clear the mirror cache.
|
1858
1904
|
Handle<String> function_name =
|
1859
|
-
|
1860
|
-
Handle<Object> fun(
|
1905
|
+
isolate_->factory()->LookupSymbol(CStrVector("ClearMirrorCache"));
|
1906
|
+
Handle<Object> fun(Isolate::Current()->global()->GetPropertyNoExceptionThrown(
|
1861
1907
|
*function_name));
|
1862
1908
|
ASSERT(fun->IsJSFunction());
|
1863
1909
|
bool caught_exception;
|
@@ -1869,13 +1915,15 @@ void Debug::ClearMirrorCache() {
|
|
1869
1915
|
|
1870
1916
|
|
1871
1917
|
void Debug::CreateScriptCache() {
|
1872
|
-
|
1918
|
+
ASSERT(Isolate::Current() == isolate_);
|
1919
|
+
Heap* heap = isolate_->heap();
|
1920
|
+
HandleScope scope(isolate_);
|
1873
1921
|
|
1874
1922
|
// Perform two GCs to get rid of all unreferenced scripts. The first GC gets
|
1875
1923
|
// rid of all the cached script wrappers and the second gets rid of the
|
1876
1924
|
// scripts which are no longer referenced.
|
1877
|
-
|
1878
|
-
|
1925
|
+
heap->CollectAllGarbage(false);
|
1926
|
+
heap->CollectAllGarbage(false);
|
1879
1927
|
|
1880
1928
|
ASSERT(script_cache_ == NULL);
|
1881
1929
|
script_cache_ = new ScriptCache();
|
@@ -1909,6 +1957,7 @@ void Debug::AddScriptToScriptCache(Handle<Script> script) {
|
|
1909
1957
|
|
1910
1958
|
|
1911
1959
|
Handle<FixedArray> Debug::GetLoadedScripts() {
|
1960
|
+
ASSERT(Isolate::Current() == isolate_);
|
1912
1961
|
// Create and fill the script cache when the loaded scripts is requested for
|
1913
1962
|
// the first time.
|
1914
1963
|
if (script_cache_ == NULL) {
|
@@ -1918,12 +1967,12 @@ Handle<FixedArray> Debug::GetLoadedScripts() {
|
|
1918
1967
|
// If the script cache is not active just return an empty array.
|
1919
1968
|
ASSERT(script_cache_ != NULL);
|
1920
1969
|
if (script_cache_ == NULL) {
|
1921
|
-
|
1970
|
+
isolate_->factory()->NewFixedArray(0);
|
1922
1971
|
}
|
1923
1972
|
|
1924
1973
|
// Perform GC to get unreferenced scripts evicted from the cache before
|
1925
1974
|
// returning the content.
|
1926
|
-
|
1975
|
+
isolate_->heap()->CollectAllGarbage(false);
|
1927
1976
|
|
1928
1977
|
// Get the scripts from the cache.
|
1929
1978
|
return script_cache_->GetScripts();
|
@@ -1938,51 +1987,66 @@ void Debug::AfterGarbageCollection() {
|
|
1938
1987
|
}
|
1939
1988
|
|
1940
1989
|
|
1941
|
-
|
1942
|
-
|
1943
|
-
Handle<Object>
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1990
|
+
Debugger::Debugger()
|
1991
|
+
: debugger_access_(OS::CreateMutex()),
|
1992
|
+
event_listener_(Handle<Object>()),
|
1993
|
+
event_listener_data_(Handle<Object>()),
|
1994
|
+
compiling_natives_(false),
|
1995
|
+
is_loading_debugger_(false),
|
1996
|
+
never_unload_debugger_(false),
|
1997
|
+
message_handler_(NULL),
|
1998
|
+
debugger_unload_pending_(false),
|
1999
|
+
host_dispatch_handler_(NULL),
|
2000
|
+
dispatch_handler_access_(OS::CreateMutex()),
|
2001
|
+
debug_message_dispatch_handler_(NULL),
|
2002
|
+
message_dispatch_helper_thread_(NULL),
|
2003
|
+
host_dispatch_micros_(100 * 1000),
|
2004
|
+
agent_(NULL),
|
2005
|
+
command_queue_(kQueueInitialSize),
|
2006
|
+
command_received_(OS::CreateSemaphore(0)),
|
2007
|
+
event_command_queue_(kQueueInitialSize) {
|
2008
|
+
}
|
2009
|
+
|
2010
|
+
|
2011
|
+
Debugger::~Debugger() {
|
2012
|
+
delete debugger_access_;
|
2013
|
+
debugger_access_ = 0;
|
2014
|
+
delete dispatch_handler_access_;
|
2015
|
+
dispatch_handler_access_ = 0;
|
2016
|
+
delete command_received_;
|
2017
|
+
command_received_ = 0;
|
2018
|
+
}
|
1959
2019
|
|
1960
2020
|
|
1961
2021
|
Handle<Object> Debugger::MakeJSObject(Vector<const char> constructor_name,
|
1962
2022
|
int argc, Object*** argv,
|
1963
2023
|
bool* caught_exception) {
|
1964
|
-
ASSERT(
|
2024
|
+
ASSERT(Isolate::Current() == isolate_);
|
2025
|
+
ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
|
1965
2026
|
|
1966
2027
|
// Create the execution state object.
|
1967
|
-
Handle<String> constructor_str =
|
1968
|
-
|
1969
|
-
|
2028
|
+
Handle<String> constructor_str =
|
2029
|
+
isolate_->factory()->LookupSymbol(constructor_name);
|
2030
|
+
Handle<Object> constructor(
|
2031
|
+
isolate_->global()->GetPropertyNoExceptionThrown(*constructor_str));
|
1970
2032
|
ASSERT(constructor->IsJSFunction());
|
1971
2033
|
if (!constructor->IsJSFunction()) {
|
1972
2034
|
*caught_exception = true;
|
1973
|
-
return
|
2035
|
+
return isolate_->factory()->undefined_value();
|
1974
2036
|
}
|
1975
2037
|
Handle<Object> js_object = Execution::TryCall(
|
1976
2038
|
Handle<JSFunction>::cast(constructor),
|
1977
|
-
Handle<JSObject>(
|
1978
|
-
caught_exception);
|
2039
|
+
Handle<JSObject>(isolate_->debug()->debug_context()->global()),
|
2040
|
+
argc, argv, caught_exception);
|
1979
2041
|
return js_object;
|
1980
2042
|
}
|
1981
2043
|
|
1982
2044
|
|
1983
2045
|
Handle<Object> Debugger::MakeExecutionState(bool* caught_exception) {
|
2046
|
+
ASSERT(Isolate::Current() == isolate_);
|
1984
2047
|
// Create the execution state object.
|
1985
|
-
Handle<Object> break_id =
|
2048
|
+
Handle<Object> break_id = isolate_->factory()->NewNumberFromInt(
|
2049
|
+
isolate_->debug()->break_id());
|
1986
2050
|
const int argc = 1;
|
1987
2051
|
Object** argv[argc] = { break_id.location() };
|
1988
2052
|
return MakeJSObject(CStrVector("MakeExecutionState"),
|
@@ -1993,6 +2057,7 @@ Handle<Object> Debugger::MakeExecutionState(bool* caught_exception) {
|
|
1993
2057
|
Handle<Object> Debugger::MakeBreakEvent(Handle<Object> exec_state,
|
1994
2058
|
Handle<Object> break_points_hit,
|
1995
2059
|
bool* caught_exception) {
|
2060
|
+
ASSERT(Isolate::Current() == isolate_);
|
1996
2061
|
// Create the new break event object.
|
1997
2062
|
const int argc = 2;
|
1998
2063
|
Object** argv[argc] = { exec_state.location(),
|
@@ -2008,12 +2073,14 @@ Handle<Object> Debugger::MakeExceptionEvent(Handle<Object> exec_state,
|
|
2008
2073
|
Handle<Object> exception,
|
2009
2074
|
bool uncaught,
|
2010
2075
|
bool* caught_exception) {
|
2076
|
+
ASSERT(Isolate::Current() == isolate_);
|
2077
|
+
Factory* factory = isolate_->factory();
|
2011
2078
|
// Create the new exception event object.
|
2012
2079
|
const int argc = 3;
|
2013
2080
|
Object** argv[argc] = { exec_state.location(),
|
2014
2081
|
exception.location(),
|
2015
|
-
uncaught ?
|
2016
|
-
|
2082
|
+
uncaught ? factory->true_value().location() :
|
2083
|
+
factory->false_value().location()};
|
2017
2084
|
return MakeJSObject(CStrVector("MakeExceptionEvent"),
|
2018
2085
|
argc, argv, caught_exception);
|
2019
2086
|
}
|
@@ -2021,6 +2088,7 @@ Handle<Object> Debugger::MakeExceptionEvent(Handle<Object> exec_state,
|
|
2021
2088
|
|
2022
2089
|
Handle<Object> Debugger::MakeNewFunctionEvent(Handle<Object> function,
|
2023
2090
|
bool* caught_exception) {
|
2091
|
+
ASSERT(Isolate::Current() == isolate_);
|
2024
2092
|
// Create the new function event object.
|
2025
2093
|
const int argc = 1;
|
2026
2094
|
Object** argv[argc] = { function.location() };
|
@@ -2032,14 +2100,16 @@ Handle<Object> Debugger::MakeNewFunctionEvent(Handle<Object> function,
|
|
2032
2100
|
Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script,
|
2033
2101
|
bool before,
|
2034
2102
|
bool* caught_exception) {
|
2103
|
+
ASSERT(Isolate::Current() == isolate_);
|
2104
|
+
Factory* factory = isolate_->factory();
|
2035
2105
|
// Create the compile event object.
|
2036
2106
|
Handle<Object> exec_state = MakeExecutionState(caught_exception);
|
2037
2107
|
Handle<Object> script_wrapper = GetScriptWrapper(script);
|
2038
2108
|
const int argc = 3;
|
2039
2109
|
Object** argv[argc] = { exec_state.location(),
|
2040
2110
|
script_wrapper.location(),
|
2041
|
-
before ?
|
2042
|
-
|
2111
|
+
before ? factory->true_value().location() :
|
2112
|
+
factory->false_value().location() };
|
2043
2113
|
|
2044
2114
|
return MakeJSObject(CStrVector("MakeCompileEvent"),
|
2045
2115
|
argc,
|
@@ -2050,6 +2120,7 @@ Handle<Object> Debugger::MakeCompileEvent(Handle<Script> script,
|
|
2050
2120
|
|
2051
2121
|
Handle<Object> Debugger::MakeScriptCollectedEvent(int id,
|
2052
2122
|
bool* caught_exception) {
|
2123
|
+
ASSERT(Isolate::Current() == isolate_);
|
2053
2124
|
// Create the script collected event object.
|
2054
2125
|
Handle<Object> exec_state = MakeExecutionState(caught_exception);
|
2055
2126
|
Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id));
|
@@ -2064,20 +2135,22 @@ Handle<Object> Debugger::MakeScriptCollectedEvent(int id,
|
|
2064
2135
|
|
2065
2136
|
|
2066
2137
|
void Debugger::OnException(Handle<Object> exception, bool uncaught) {
|
2067
|
-
|
2138
|
+
ASSERT(Isolate::Current() == isolate_);
|
2139
|
+
HandleScope scope(isolate_);
|
2140
|
+
Debug* debug = isolate_->debug();
|
2068
2141
|
|
2069
2142
|
// Bail out based on state or if there is no listener for this event
|
2070
|
-
if (
|
2143
|
+
if (debug->InDebugger()) return;
|
2071
2144
|
if (!Debugger::EventActive(v8::Exception)) return;
|
2072
2145
|
|
2073
2146
|
// Bail out if exception breaks are not active
|
2074
2147
|
if (uncaught) {
|
2075
2148
|
// Uncaught exceptions are reported by either flags.
|
2076
|
-
if (!(
|
2077
|
-
|
2149
|
+
if (!(debug->break_on_uncaught_exception() ||
|
2150
|
+
debug->break_on_exception())) return;
|
2078
2151
|
} else {
|
2079
2152
|
// Caught exceptions are reported is activated.
|
2080
|
-
if (!
|
2153
|
+
if (!debug->break_on_exception()) return;
|
2081
2154
|
}
|
2082
2155
|
|
2083
2156
|
// Enter the debugger.
|
@@ -2085,7 +2158,7 @@ void Debugger::OnException(Handle<Object> exception, bool uncaught) {
|
|
2085
2158
|
if (debugger.FailedToEnter()) return;
|
2086
2159
|
|
2087
2160
|
// Clear all current stepping setup.
|
2088
|
-
|
2161
|
+
debug->ClearStepping();
|
2089
2162
|
// Create the event data object.
|
2090
2163
|
bool caught_exception = false;
|
2091
2164
|
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
|
@@ -2107,16 +2180,17 @@ void Debugger::OnException(Handle<Object> exception, bool uncaught) {
|
|
2107
2180
|
|
2108
2181
|
void Debugger::OnDebugBreak(Handle<Object> break_points_hit,
|
2109
2182
|
bool auto_continue) {
|
2110
|
-
|
2183
|
+
ASSERT(Isolate::Current() == isolate_);
|
2184
|
+
HandleScope scope(isolate_);
|
2111
2185
|
|
2112
2186
|
// Debugger has already been entered by caller.
|
2113
|
-
ASSERT(
|
2187
|
+
ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
|
2114
2188
|
|
2115
2189
|
// Bail out if there is no listener for this event
|
2116
2190
|
if (!Debugger::EventActive(v8::Break)) return;
|
2117
2191
|
|
2118
2192
|
// Debugger must be entered in advance.
|
2119
|
-
ASSERT(
|
2193
|
+
ASSERT(Isolate::Current()->context() == *isolate_->debug()->debug_context());
|
2120
2194
|
|
2121
2195
|
// Create the event data object.
|
2122
2196
|
bool caught_exception = false;
|
@@ -2139,10 +2213,11 @@ void Debugger::OnDebugBreak(Handle<Object> break_points_hit,
|
|
2139
2213
|
|
2140
2214
|
|
2141
2215
|
void Debugger::OnBeforeCompile(Handle<Script> script) {
|
2142
|
-
|
2216
|
+
ASSERT(Isolate::Current() == isolate_);
|
2217
|
+
HandleScope scope(isolate_);
|
2143
2218
|
|
2144
2219
|
// Bail out based on state or if there is no listener for this event
|
2145
|
-
if (
|
2220
|
+
if (isolate_->debug()->InDebugger()) return;
|
2146
2221
|
if (compiling_natives()) return;
|
2147
2222
|
if (!EventActive(v8::BeforeCompile)) return;
|
2148
2223
|
|
@@ -2168,10 +2243,12 @@ void Debugger::OnBeforeCompile(Handle<Script> script) {
|
|
2168
2243
|
// Handle debugger actions when a new script is compiled.
|
2169
2244
|
void Debugger::OnAfterCompile(Handle<Script> script,
|
2170
2245
|
AfterCompileFlags after_compile_flags) {
|
2171
|
-
|
2246
|
+
ASSERT(Isolate::Current() == isolate_);
|
2247
|
+
HandleScope scope(isolate_);
|
2248
|
+
Debug* debug = isolate_->debug();
|
2172
2249
|
|
2173
2250
|
// Add the newly compiled script to the script cache.
|
2174
|
-
|
2251
|
+
debug->AddScriptToScriptCache(script);
|
2175
2252
|
|
2176
2253
|
// No more to do if not debugging.
|
2177
2254
|
if (!IsDebuggerActive()) return;
|
@@ -2180,7 +2257,7 @@ void Debugger::OnAfterCompile(Handle<Script> script,
|
|
2180
2257
|
if (compiling_natives()) return;
|
2181
2258
|
|
2182
2259
|
// Store whether in debugger before entering debugger.
|
2183
|
-
bool in_debugger =
|
2260
|
+
bool in_debugger = debug->InDebugger();
|
2184
2261
|
|
2185
2262
|
// Enter the debugger.
|
2186
2263
|
EnterDebugger debugger;
|
@@ -2191,9 +2268,9 @@ void Debugger::OnAfterCompile(Handle<Script> script,
|
|
2191
2268
|
|
2192
2269
|
// Get the function UpdateScriptBreakPoints (defined in debug-debugger.js).
|
2193
2270
|
Handle<String> update_script_break_points_symbol =
|
2194
|
-
|
2271
|
+
isolate_->factory()->LookupAsciiSymbol("UpdateScriptBreakPoints");
|
2195
2272
|
Handle<Object> update_script_break_points =
|
2196
|
-
Handle<Object>(
|
2273
|
+
Handle<Object>(debug->debug_context()->global()->
|
2197
2274
|
GetPropertyNoExceptionThrown(*update_script_break_points_symbol));
|
2198
2275
|
if (!update_script_break_points->IsJSFunction()) {
|
2199
2276
|
return;
|
@@ -2210,7 +2287,7 @@ void Debugger::OnAfterCompile(Handle<Script> script,
|
|
2210
2287
|
Object** argv[argc] = { reinterpret_cast<Object**>(wrapper.location()) };
|
2211
2288
|
Handle<Object> result = Execution::TryCall(
|
2212
2289
|
Handle<JSFunction>::cast(update_script_break_points),
|
2213
|
-
|
2290
|
+
Isolate::Current()->js_builtins_object(), argc, argv,
|
2214
2291
|
&caught_exception);
|
2215
2292
|
if (caught_exception) {
|
2216
2293
|
return;
|
@@ -2235,7 +2312,8 @@ void Debugger::OnAfterCompile(Handle<Script> script,
|
|
2235
2312
|
|
2236
2313
|
|
2237
2314
|
void Debugger::OnScriptCollected(int id) {
|
2238
|
-
|
2315
|
+
ASSERT(Isolate::Current() == isolate_);
|
2316
|
+
HandleScope scope(isolate_);
|
2239
2317
|
|
2240
2318
|
// No more to do if not debugging.
|
2241
2319
|
if (!IsDebuggerActive()) return;
|
@@ -2264,11 +2342,12 @@ void Debugger::OnScriptCollected(int id) {
|
|
2264
2342
|
void Debugger::ProcessDebugEvent(v8::DebugEvent event,
|
2265
2343
|
Handle<JSObject> event_data,
|
2266
2344
|
bool auto_continue) {
|
2267
|
-
|
2345
|
+
ASSERT(Isolate::Current() == isolate_);
|
2346
|
+
HandleScope scope(isolate_);
|
2268
2347
|
|
2269
2348
|
// Clear any pending debug break if this is a real break.
|
2270
2349
|
if (!auto_continue) {
|
2271
|
-
|
2350
|
+
isolate_->debug()->clear_interrupt_pending(DEBUGBREAK);
|
2272
2351
|
}
|
2273
2352
|
|
2274
2353
|
// Create the execution state.
|
@@ -2339,6 +2418,7 @@ void Debugger::CallJSEventCallback(v8::DebugEvent event,
|
|
2339
2418
|
Handle<Object> exec_state,
|
2340
2419
|
Handle<Object> event_data) {
|
2341
2420
|
ASSERT(event_listener_->IsJSFunction());
|
2421
|
+
ASSERT(Isolate::Current() == isolate_);
|
2342
2422
|
Handle<JSFunction> fun(Handle<JSFunction>::cast(event_listener_));
|
2343
2423
|
|
2344
2424
|
// Invoke the JavaScript debug event listener.
|
@@ -2348,25 +2428,29 @@ void Debugger::CallJSEventCallback(v8::DebugEvent event,
|
|
2348
2428
|
Handle<Object>::cast(event_data).location(),
|
2349
2429
|
event_listener_data_.location() };
|
2350
2430
|
bool caught_exception = false;
|
2351
|
-
Execution::TryCall(fun,
|
2431
|
+
Execution::TryCall(fun, isolate_->global(), argc, argv, &caught_exception);
|
2352
2432
|
// Silently ignore exceptions from debug event listeners.
|
2353
2433
|
}
|
2354
2434
|
|
2355
2435
|
|
2356
2436
|
Handle<Context> Debugger::GetDebugContext() {
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2437
|
+
ASSERT(Isolate::Current() == isolate_);
|
2438
|
+
never_unload_debugger_ = true;
|
2439
|
+
EnterDebugger debugger;
|
2440
|
+
return isolate_->debug()->debug_context();
|
2360
2441
|
}
|
2361
2442
|
|
2362
2443
|
|
2363
2444
|
void Debugger::UnloadDebugger() {
|
2445
|
+
ASSERT(Isolate::Current() == isolate_);
|
2446
|
+
Debug* debug = isolate_->debug();
|
2447
|
+
|
2364
2448
|
// Make sure that there are no breakpoints left.
|
2365
|
-
|
2449
|
+
debug->ClearAllBreakPoints();
|
2366
2450
|
|
2367
2451
|
// Unload the debugger if feasible.
|
2368
2452
|
if (!never_unload_debugger_) {
|
2369
|
-
|
2453
|
+
debug->Unload();
|
2370
2454
|
}
|
2371
2455
|
|
2372
2456
|
// Clear the flag indicating that the debugger should be unloaded.
|
@@ -2378,9 +2462,10 @@ void Debugger::NotifyMessageHandler(v8::DebugEvent event,
|
|
2378
2462
|
Handle<JSObject> exec_state,
|
2379
2463
|
Handle<JSObject> event_data,
|
2380
2464
|
bool auto_continue) {
|
2381
|
-
|
2465
|
+
ASSERT(Isolate::Current() == isolate_);
|
2466
|
+
HandleScope scope(isolate_);
|
2382
2467
|
|
2383
|
-
if (!
|
2468
|
+
if (!isolate_->debug()->Load()) return;
|
2384
2469
|
|
2385
2470
|
// Process the individual events.
|
2386
2471
|
bool sendEventMessage = false;
|
@@ -2409,8 +2494,8 @@ void Debugger::NotifyMessageHandler(v8::DebugEvent event,
|
|
2409
2494
|
// The debug command interrupt flag might have been set when the command was
|
2410
2495
|
// added. It should be enough to clear the flag only once while we are in the
|
2411
2496
|
// debugger.
|
2412
|
-
ASSERT(
|
2413
|
-
|
2497
|
+
ASSERT(isolate_->debug()->InDebugger());
|
2498
|
+
isolate_->stack_guard()->Continue(DEBUGCOMMAND);
|
2414
2499
|
|
2415
2500
|
// Notify the debugger that a debug event has occurred unless auto continue is
|
2416
2501
|
// active in which case no event is send.
|
@@ -2473,7 +2558,7 @@ void Debugger::NotifyMessageHandler(v8::DebugEvent event,
|
|
2473
2558
|
|
2474
2559
|
// Get the command from the queue.
|
2475
2560
|
CommandMessage command = command_queue_.Get();
|
2476
|
-
|
2561
|
+
LOGGER->DebugTag("Got request from command queue, in interactive loop.");
|
2477
2562
|
if (!Debugger::IsDebuggerActive()) {
|
2478
2563
|
// Delete command text and user data.
|
2479
2564
|
command.Dispose();
|
@@ -2547,17 +2632,19 @@ void Debugger::NotifyMessageHandler(v8::DebugEvent event,
|
|
2547
2632
|
|
2548
2633
|
void Debugger::SetEventListener(Handle<Object> callback,
|
2549
2634
|
Handle<Object> data) {
|
2550
|
-
|
2635
|
+
ASSERT(Isolate::Current() == isolate_);
|
2636
|
+
HandleScope scope(isolate_);
|
2637
|
+
GlobalHandles* global_handles = isolate_->global_handles();
|
2551
2638
|
|
2552
2639
|
// Clear the global handles for the event listener and the event listener data
|
2553
2640
|
// object.
|
2554
2641
|
if (!event_listener_.is_null()) {
|
2555
|
-
|
2642
|
+
global_handles->Destroy(
|
2556
2643
|
reinterpret_cast<Object**>(event_listener_.location()));
|
2557
2644
|
event_listener_ = Handle<Object>();
|
2558
2645
|
}
|
2559
2646
|
if (!event_listener_data_.is_null()) {
|
2560
|
-
|
2647
|
+
global_handles->Destroy(
|
2561
2648
|
reinterpret_cast<Object**>(event_listener_data_.location()));
|
2562
2649
|
event_listener_data_ = Handle<Object>();
|
2563
2650
|
}
|
@@ -2565,11 +2652,13 @@ void Debugger::SetEventListener(Handle<Object> callback,
|
|
2565
2652
|
// If there is a new debug event listener register it together with its data
|
2566
2653
|
// object.
|
2567
2654
|
if (!callback->IsUndefined() && !callback->IsNull()) {
|
2568
|
-
event_listener_ = Handle<Object>::cast(
|
2655
|
+
event_listener_ = Handle<Object>::cast(
|
2656
|
+
global_handles->Create(*callback));
|
2569
2657
|
if (data.is_null()) {
|
2570
|
-
data =
|
2658
|
+
data = isolate_->factory()->undefined_value();
|
2571
2659
|
}
|
2572
|
-
event_listener_data_ = Handle<Object>::cast(
|
2660
|
+
event_listener_data_ = Handle<Object>::cast(
|
2661
|
+
global_handles->Create(*data));
|
2573
2662
|
}
|
2574
2663
|
|
2575
2664
|
ListenersChanged();
|
@@ -2577,6 +2666,7 @@ void Debugger::SetEventListener(Handle<Object> callback,
|
|
2577
2666
|
|
2578
2667
|
|
2579
2668
|
void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
|
2669
|
+
ASSERT(Isolate::Current() == isolate_);
|
2580
2670
|
ScopedLock with(debugger_access_);
|
2581
2671
|
|
2582
2672
|
message_handler_ = handler;
|
@@ -2584,7 +2674,7 @@ void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
|
|
2584
2674
|
if (handler == NULL) {
|
2585
2675
|
// Send an empty command to the debugger if in a break to make JavaScript
|
2586
2676
|
// run again if the debugger is closed.
|
2587
|
-
if (
|
2677
|
+
if (isolate_->debug()->InDebugger()) {
|
2588
2678
|
ProcessCommand(Vector<const uint16_t>::empty());
|
2589
2679
|
}
|
2590
2680
|
}
|
@@ -2592,12 +2682,13 @@ void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
|
|
2592
2682
|
|
2593
2683
|
|
2594
2684
|
void Debugger::ListenersChanged() {
|
2685
|
+
ASSERT(Isolate::Current() == isolate_);
|
2595
2686
|
if (IsDebuggerActive()) {
|
2596
2687
|
// Disable the compilation cache when the debugger is active.
|
2597
|
-
|
2688
|
+
isolate_->compilation_cache()->Disable();
|
2598
2689
|
debugger_unload_pending_ = false;
|
2599
2690
|
} else {
|
2600
|
-
|
2691
|
+
isolate_->compilation_cache()->Enable();
|
2601
2692
|
// Unload the debugger if event listener and message handler cleared.
|
2602
2693
|
// Schedule this for later, because we may be in non-V8 thread.
|
2603
2694
|
debugger_unload_pending_ = true;
|
@@ -2607,6 +2698,7 @@ void Debugger::ListenersChanged() {
|
|
2607
2698
|
|
2608
2699
|
void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
|
2609
2700
|
int period) {
|
2701
|
+
ASSERT(Isolate::Current() == isolate_);
|
2610
2702
|
host_dispatch_handler_ = handler;
|
2611
2703
|
host_dispatch_micros_ = period * 1000;
|
2612
2704
|
}
|
@@ -2614,11 +2706,12 @@ void Debugger::SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler,
|
|
2614
2706
|
|
2615
2707
|
void Debugger::SetDebugMessageDispatchHandler(
|
2616
2708
|
v8::Debug::DebugMessageDispatchHandler handler, bool provide_locker) {
|
2709
|
+
ASSERT(Isolate::Current() == isolate_);
|
2617
2710
|
ScopedLock with(dispatch_handler_access_);
|
2618
2711
|
debug_message_dispatch_handler_ = handler;
|
2619
2712
|
|
2620
2713
|
if (provide_locker && message_dispatch_helper_thread_ == NULL) {
|
2621
|
-
message_dispatch_helper_thread_ = new MessageDispatchHelperThread;
|
2714
|
+
message_dispatch_helper_thread_ = new MessageDispatchHelperThread(isolate_);
|
2622
2715
|
message_dispatch_helper_thread_->Start();
|
2623
2716
|
}
|
2624
2717
|
}
|
@@ -2627,6 +2720,7 @@ void Debugger::SetDebugMessageDispatchHandler(
|
|
2627
2720
|
// Calls the registered debug message handler. This callback is part of the
|
2628
2721
|
// public API.
|
2629
2722
|
void Debugger::InvokeMessageHandler(MessageImpl message) {
|
2723
|
+
ASSERT(Isolate::Current() == isolate_);
|
2630
2724
|
ScopedLock with(debugger_access_);
|
2631
2725
|
|
2632
2726
|
if (message_handler_ != NULL) {
|
@@ -2641,18 +2735,19 @@ void Debugger::InvokeMessageHandler(MessageImpl message) {
|
|
2641
2735
|
// by the API client thread.
|
2642
2736
|
void Debugger::ProcessCommand(Vector<const uint16_t> command,
|
2643
2737
|
v8::Debug::ClientData* client_data) {
|
2738
|
+
ASSERT(Isolate::Current() == isolate_);
|
2644
2739
|
// Need to cast away const.
|
2645
2740
|
CommandMessage message = CommandMessage::New(
|
2646
2741
|
Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
|
2647
2742
|
command.length()),
|
2648
2743
|
client_data);
|
2649
|
-
|
2744
|
+
LOGGER->DebugTag("Put command on command_queue.");
|
2650
2745
|
command_queue_.Put(message);
|
2651
2746
|
command_received_->Signal();
|
2652
2747
|
|
2653
2748
|
// Set the debug command break flag to have the command processed.
|
2654
|
-
if (!
|
2655
|
-
|
2749
|
+
if (!isolate_->debug()->InDebugger()) {
|
2750
|
+
isolate_->stack_guard()->DebugCommand();
|
2656
2751
|
}
|
2657
2752
|
|
2658
2753
|
MessageDispatchHelperThread* dispatch_thread;
|
@@ -2670,22 +2765,25 @@ void Debugger::ProcessCommand(Vector<const uint16_t> command,
|
|
2670
2765
|
|
2671
2766
|
|
2672
2767
|
bool Debugger::HasCommands() {
|
2768
|
+
ASSERT(Isolate::Current() == isolate_);
|
2673
2769
|
return !command_queue_.IsEmpty();
|
2674
2770
|
}
|
2675
2771
|
|
2676
2772
|
|
2677
2773
|
void Debugger::EnqueueDebugCommand(v8::Debug::ClientData* client_data) {
|
2774
|
+
ASSERT(Isolate::Current() == isolate_);
|
2678
2775
|
CommandMessage message = CommandMessage::New(Vector<uint16_t>(), client_data);
|
2679
2776
|
event_command_queue_.Put(message);
|
2680
2777
|
|
2681
2778
|
// Set the debug command break flag to have the command processed.
|
2682
|
-
if (!
|
2683
|
-
|
2779
|
+
if (!isolate_->debug()->InDebugger()) {
|
2780
|
+
isolate_->stack_guard()->DebugCommand();
|
2684
2781
|
}
|
2685
2782
|
}
|
2686
2783
|
|
2687
2784
|
|
2688
2785
|
bool Debugger::IsDebuggerActive() {
|
2786
|
+
ASSERT(Isolate::Current() == isolate_);
|
2689
2787
|
ScopedLock with(debugger_access_);
|
2690
2788
|
|
2691
2789
|
return message_handler_ != NULL || !event_listener_.is_null();
|
@@ -2695,27 +2793,28 @@ bool Debugger::IsDebuggerActive() {
|
|
2695
2793
|
Handle<Object> Debugger::Call(Handle<JSFunction> fun,
|
2696
2794
|
Handle<Object> data,
|
2697
2795
|
bool* pending_exception) {
|
2796
|
+
ASSERT(Isolate::Current() == isolate_);
|
2698
2797
|
// When calling functions in the debugger prevent it from beeing unloaded.
|
2699
2798
|
Debugger::never_unload_debugger_ = true;
|
2700
2799
|
|
2701
2800
|
// Enter the debugger.
|
2702
2801
|
EnterDebugger debugger;
|
2703
2802
|
if (debugger.FailedToEnter()) {
|
2704
|
-
return
|
2803
|
+
return isolate_->factory()->undefined_value();
|
2705
2804
|
}
|
2706
2805
|
|
2707
2806
|
// Create the execution state.
|
2708
2807
|
bool caught_exception = false;
|
2709
2808
|
Handle<Object> exec_state = MakeExecutionState(&caught_exception);
|
2710
2809
|
if (caught_exception) {
|
2711
|
-
return
|
2810
|
+
return isolate_->factory()->undefined_value();
|
2712
2811
|
}
|
2713
2812
|
|
2714
2813
|
static const int kArgc = 2;
|
2715
2814
|
Object** argv[kArgc] = { exec_state.location(), data.location() };
|
2716
2815
|
Handle<Object> result = Execution::Call(
|
2717
2816
|
fun,
|
2718
|
-
Handle<Object>(
|
2817
|
+
Handle<Object>(isolate_->debug()->debug_context_->global_proxy()),
|
2719
2818
|
kArgc,
|
2720
2819
|
argv,
|
2721
2820
|
pending_exception);
|
@@ -2730,6 +2829,7 @@ static void StubMessageHandler2(const v8::Debug::Message& message) {
|
|
2730
2829
|
|
2731
2830
|
bool Debugger::StartAgent(const char* name, int port,
|
2732
2831
|
bool wait_for_connection) {
|
2832
|
+
ASSERT(Isolate::Current() == isolate_);
|
2733
2833
|
if (wait_for_connection) {
|
2734
2834
|
// Suspend V8 if it is already running or set V8 to suspend whenever
|
2735
2835
|
// it starts.
|
@@ -2743,7 +2843,7 @@ bool Debugger::StartAgent(const char* name, int port,
|
|
2743
2843
|
|
2744
2844
|
if (Socket::Setup()) {
|
2745
2845
|
if (agent_ == NULL) {
|
2746
|
-
agent_ = new DebuggerAgent(name, port);
|
2846
|
+
agent_ = new DebuggerAgent(isolate_, name, port);
|
2747
2847
|
agent_->Start();
|
2748
2848
|
}
|
2749
2849
|
return true;
|
@@ -2754,6 +2854,7 @@ bool Debugger::StartAgent(const char* name, int port,
|
|
2754
2854
|
|
2755
2855
|
|
2756
2856
|
void Debugger::StopAgent() {
|
2857
|
+
ASSERT(Isolate::Current() == isolate_);
|
2757
2858
|
if (agent_ != NULL) {
|
2758
2859
|
agent_->Shutdown();
|
2759
2860
|
agent_->Join();
|
@@ -2764,12 +2865,14 @@ void Debugger::StopAgent() {
|
|
2764
2865
|
|
2765
2866
|
|
2766
2867
|
void Debugger::WaitForAgent() {
|
2868
|
+
ASSERT(Isolate::Current() == isolate_);
|
2767
2869
|
if (agent_ != NULL)
|
2768
2870
|
agent_->WaitUntilListening();
|
2769
2871
|
}
|
2770
2872
|
|
2771
2873
|
|
2772
2874
|
void Debugger::CallMessageDispatchHandler() {
|
2875
|
+
ASSERT(Isolate::Current() == isolate_);
|
2773
2876
|
v8::Debug::DebugMessageDispatchHandler handler;
|
2774
2877
|
{
|
2775
2878
|
ScopedLock with(dispatch_handler_access_);
|
@@ -2873,10 +2976,11 @@ v8::Handle<v8::String> MessageImpl::GetJSON() const {
|
|
2873
2976
|
|
2874
2977
|
|
2875
2978
|
v8::Handle<v8::Context> MessageImpl::GetEventContext() const {
|
2876
|
-
|
2877
|
-
|
2979
|
+
Isolate* isolate = Isolate::Current();
|
2980
|
+
v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
|
2981
|
+
// Isolate::context() may be NULL when "script collected" event occures.
|
2878
2982
|
ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
|
2879
|
-
return GetDebugEventContext();
|
2983
|
+
return GetDebugEventContext(isolate);
|
2880
2984
|
}
|
2881
2985
|
|
2882
2986
|
|
@@ -2913,7 +3017,7 @@ v8::Handle<v8::Object> EventDetailsImpl::GetEventData() const {
|
|
2913
3017
|
|
2914
3018
|
|
2915
3019
|
v8::Handle<v8::Context> EventDetailsImpl::GetEventContext() const {
|
2916
|
-
return GetDebugEventContext();
|
3020
|
+
return GetDebugEventContext(Isolate::Current());
|
2917
3021
|
}
|
2918
3022
|
|
2919
3023
|
|
@@ -3022,7 +3126,7 @@ bool LockingCommandMessageQueue::IsEmpty() const {
|
|
3022
3126
|
CommandMessage LockingCommandMessageQueue::Get() {
|
3023
3127
|
ScopedLock sl(lock_);
|
3024
3128
|
CommandMessage result = queue_.Get();
|
3025
|
-
|
3129
|
+
LOGGER->DebugEvent("Get", result.text());
|
3026
3130
|
return result;
|
3027
3131
|
}
|
3028
3132
|
|
@@ -3030,7 +3134,7 @@ CommandMessage LockingCommandMessageQueue::Get() {
|
|
3030
3134
|
void LockingCommandMessageQueue::Put(const CommandMessage& message) {
|
3031
3135
|
ScopedLock sl(lock_);
|
3032
3136
|
queue_.Put(message);
|
3033
|
-
|
3137
|
+
LOGGER->DebugEvent("Put", message.text());
|
3034
3138
|
}
|
3035
3139
|
|
3036
3140
|
|
@@ -3040,8 +3144,8 @@ void LockingCommandMessageQueue::Clear() {
|
|
3040
3144
|
}
|
3041
3145
|
|
3042
3146
|
|
3043
|
-
MessageDispatchHelperThread::MessageDispatchHelperThread()
|
3044
|
-
: Thread("v8:MsgDispHelpr"),
|
3147
|
+
MessageDispatchHelperThread::MessageDispatchHelperThread(Isolate* isolate)
|
3148
|
+
: Thread(isolate, "v8:MsgDispHelpr"),
|
3045
3149
|
sem_(OS::CreateSemaphore(0)), mutex_(OS::CreateMutex()),
|
3046
3150
|
already_signalled_(false) {
|
3047
3151
|
}
|
@@ -3074,7 +3178,7 @@ void MessageDispatchHelperThread::Run() {
|
|
3074
3178
|
}
|
3075
3179
|
{
|
3076
3180
|
Locker locker;
|
3077
|
-
|
3181
|
+
Isolate::Current()->debugger()->CallMessageDispatchHandler();
|
3078
3182
|
}
|
3079
3183
|
}
|
3080
3184
|
}
|