libv8-sgonyea 3.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/README.md +76 -0
- data/Rakefile +113 -0
- data/ext/libv8/extconf.rb +28 -0
- data/lib/libv8.rb +15 -0
- data/lib/libv8/Makefile +30 -0
- data/lib/libv8/detect_cpu.rb +27 -0
- data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
- data/lib/libv8/v8/.gitignore +35 -0
- data/lib/libv8/v8/AUTHORS +44 -0
- data/lib/libv8/v8/ChangeLog +2839 -0
- data/lib/libv8/v8/LICENSE +52 -0
- data/lib/libv8/v8/LICENSE.strongtalk +29 -0
- data/lib/libv8/v8/LICENSE.v8 +26 -0
- data/lib/libv8/v8/LICENSE.valgrind +45 -0
- data/lib/libv8/v8/SConstruct +1478 -0
- data/lib/libv8/v8/build/README.txt +49 -0
- data/lib/libv8/v8/build/all.gyp +18 -0
- data/lib/libv8/v8/build/armu.gypi +32 -0
- data/lib/libv8/v8/build/common.gypi +144 -0
- data/lib/libv8/v8/build/gyp_v8 +145 -0
- data/lib/libv8/v8/include/v8-debug.h +395 -0
- data/lib/libv8/v8/include/v8-preparser.h +117 -0
- data/lib/libv8/v8/include/v8-profiler.h +505 -0
- data/lib/libv8/v8/include/v8-testing.h +104 -0
- data/lib/libv8/v8/include/v8.h +4124 -0
- data/lib/libv8/v8/include/v8stdint.h +53 -0
- data/lib/libv8/v8/preparser/SConscript +38 -0
- data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
- data/lib/libv8/v8/src/SConscript +368 -0
- data/lib/libv8/v8/src/accessors.cc +767 -0
- data/lib/libv8/v8/src/accessors.h +123 -0
- data/lib/libv8/v8/src/allocation-inl.h +49 -0
- data/lib/libv8/v8/src/allocation.cc +122 -0
- data/lib/libv8/v8/src/allocation.h +143 -0
- data/lib/libv8/v8/src/api.cc +5845 -0
- data/lib/libv8/v8/src/api.h +574 -0
- data/lib/libv8/v8/src/apinatives.js +110 -0
- data/lib/libv8/v8/src/apiutils.h +73 -0
- data/lib/libv8/v8/src/arguments.h +118 -0
- data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
- data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
- data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
- data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
- data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
- data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
- data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
- data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
- data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
- data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
- data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
- data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
- data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
- data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
- data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
- data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
- data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
- data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
- data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
- data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
- data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
- data/lib/libv8/v8/src/array.js +1366 -0
- data/lib/libv8/v8/src/assembler.cc +1207 -0
- data/lib/libv8/v8/src/assembler.h +858 -0
- data/lib/libv8/v8/src/ast-inl.h +112 -0
- data/lib/libv8/v8/src/ast.cc +1146 -0
- data/lib/libv8/v8/src/ast.h +2188 -0
- data/lib/libv8/v8/src/atomicops.h +167 -0
- data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
- data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
- data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
- data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
- data/lib/libv8/v8/src/bignum.cc +768 -0
- data/lib/libv8/v8/src/bignum.h +140 -0
- data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
- data/lib/libv8/v8/src/bootstrapper.h +188 -0
- data/lib/libv8/v8/src/builtins.cc +1707 -0
- data/lib/libv8/v8/src/builtins.h +371 -0
- data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
- data/lib/libv8/v8/src/cached-powers.cc +177 -0
- data/lib/libv8/v8/src/cached-powers.h +65 -0
- data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
- data/lib/libv8/v8/src/char-predicates.h +67 -0
- data/lib/libv8/v8/src/checks.cc +110 -0
- data/lib/libv8/v8/src/checks.h +296 -0
- data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
- data/lib/libv8/v8/src/circular-queue.cc +122 -0
- data/lib/libv8/v8/src/circular-queue.h +103 -0
- data/lib/libv8/v8/src/code-stubs.cc +267 -0
- data/lib/libv8/v8/src/code-stubs.h +1011 -0
- data/lib/libv8/v8/src/code.h +70 -0
- data/lib/libv8/v8/src/codegen.cc +231 -0
- data/lib/libv8/v8/src/codegen.h +84 -0
- data/lib/libv8/v8/src/compilation-cache.cc +540 -0
- data/lib/libv8/v8/src/compilation-cache.h +287 -0
- data/lib/libv8/v8/src/compiler.cc +786 -0
- data/lib/libv8/v8/src/compiler.h +312 -0
- data/lib/libv8/v8/src/contexts.cc +347 -0
- data/lib/libv8/v8/src/contexts.h +391 -0
- data/lib/libv8/v8/src/conversions-inl.h +106 -0
- data/lib/libv8/v8/src/conversions.cc +1131 -0
- data/lib/libv8/v8/src/conversions.h +135 -0
- data/lib/libv8/v8/src/counters.cc +93 -0
- data/lib/libv8/v8/src/counters.h +254 -0
- data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
- data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
- data/lib/libv8/v8/src/cpu-profiler.h +302 -0
- data/lib/libv8/v8/src/cpu.h +69 -0
- data/lib/libv8/v8/src/d8-debug.cc +367 -0
- data/lib/libv8/v8/src/d8-debug.h +158 -0
- data/lib/libv8/v8/src/d8-posix.cc +695 -0
- data/lib/libv8/v8/src/d8-readline.cc +130 -0
- data/lib/libv8/v8/src/d8-windows.cc +42 -0
- data/lib/libv8/v8/src/d8.cc +803 -0
- data/lib/libv8/v8/src/d8.gyp +91 -0
- data/lib/libv8/v8/src/d8.h +235 -0
- data/lib/libv8/v8/src/d8.js +2798 -0
- data/lib/libv8/v8/src/data-flow.cc +66 -0
- data/lib/libv8/v8/src/data-flow.h +205 -0
- data/lib/libv8/v8/src/date.js +1103 -0
- data/lib/libv8/v8/src/dateparser-inl.h +127 -0
- data/lib/libv8/v8/src/dateparser.cc +178 -0
- data/lib/libv8/v8/src/dateparser.h +266 -0
- data/lib/libv8/v8/src/debug-agent.cc +447 -0
- data/lib/libv8/v8/src/debug-agent.h +129 -0
- data/lib/libv8/v8/src/debug-debugger.js +2569 -0
- data/lib/libv8/v8/src/debug.cc +3165 -0
- data/lib/libv8/v8/src/debug.h +1057 -0
- data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
- data/lib/libv8/v8/src/deoptimizer.h +602 -0
- data/lib/libv8/v8/src/disasm.h +80 -0
- data/lib/libv8/v8/src/disassembler.cc +343 -0
- data/lib/libv8/v8/src/disassembler.h +58 -0
- data/lib/libv8/v8/src/diy-fp.cc +58 -0
- data/lib/libv8/v8/src/diy-fp.h +117 -0
- data/lib/libv8/v8/src/double.h +238 -0
- data/lib/libv8/v8/src/dtoa.cc +103 -0
- data/lib/libv8/v8/src/dtoa.h +85 -0
- data/lib/libv8/v8/src/execution.cc +849 -0
- data/lib/libv8/v8/src/execution.h +297 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
- data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
- data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
- data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
- data/lib/libv8/v8/src/factory.cc +1222 -0
- data/lib/libv8/v8/src/factory.h +442 -0
- data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
- data/lib/libv8/v8/src/fast-dtoa.h +83 -0
- data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
- data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
- data/lib/libv8/v8/src/flag-definitions.h +560 -0
- data/lib/libv8/v8/src/flags.cc +551 -0
- data/lib/libv8/v8/src/flags.h +79 -0
- data/lib/libv8/v8/src/frames-inl.h +247 -0
- data/lib/libv8/v8/src/frames.cc +1243 -0
- data/lib/libv8/v8/src/frames.h +870 -0
- data/lib/libv8/v8/src/full-codegen.cc +1374 -0
- data/lib/libv8/v8/src/full-codegen.h +771 -0
- data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
- data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
- data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
- data/lib/libv8/v8/src/gdb-jit.h +143 -0
- data/lib/libv8/v8/src/global-handles.cc +665 -0
- data/lib/libv8/v8/src/global-handles.h +284 -0
- data/lib/libv8/v8/src/globals.h +325 -0
- data/lib/libv8/v8/src/handles-inl.h +177 -0
- data/lib/libv8/v8/src/handles.cc +987 -0
- data/lib/libv8/v8/src/handles.h +382 -0
- data/lib/libv8/v8/src/hashmap.cc +230 -0
- data/lib/libv8/v8/src/hashmap.h +123 -0
- data/lib/libv8/v8/src/heap-inl.h +704 -0
- data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
- data/lib/libv8/v8/src/heap-profiler.h +397 -0
- data/lib/libv8/v8/src/heap.cc +5930 -0
- data/lib/libv8/v8/src/heap.h +2268 -0
- data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
- data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
- data/lib/libv8/v8/src/hydrogen.cc +6239 -0
- data/lib/libv8/v8/src/hydrogen.h +1202 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
- data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
- data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
- data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
- data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
- data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
- data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
- data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
- data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
- data/lib/libv8/v8/src/ic-inl.h +130 -0
- data/lib/libv8/v8/src/ic.cc +2577 -0
- data/lib/libv8/v8/src/ic.h +736 -0
- data/lib/libv8/v8/src/inspector.cc +63 -0
- data/lib/libv8/v8/src/inspector.h +62 -0
- data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
- data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
- data/lib/libv8/v8/src/isolate-inl.h +50 -0
- data/lib/libv8/v8/src/isolate.cc +1869 -0
- data/lib/libv8/v8/src/isolate.h +1382 -0
- data/lib/libv8/v8/src/json-parser.cc +504 -0
- data/lib/libv8/v8/src/json-parser.h +161 -0
- data/lib/libv8/v8/src/json.js +342 -0
- data/lib/libv8/v8/src/jsregexp.cc +5385 -0
- data/lib/libv8/v8/src/jsregexp.h +1492 -0
- data/lib/libv8/v8/src/list-inl.h +212 -0
- data/lib/libv8/v8/src/list.h +174 -0
- data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
- data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
- data/lib/libv8/v8/src/lithium-allocator.h +630 -0
- data/lib/libv8/v8/src/lithium.cc +190 -0
- data/lib/libv8/v8/src/lithium.h +597 -0
- data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
- data/lib/libv8/v8/src/liveedit.cc +1691 -0
- data/lib/libv8/v8/src/liveedit.h +180 -0
- data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
- data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
- data/lib/libv8/v8/src/liveobjectlist.h +322 -0
- data/lib/libv8/v8/src/log-inl.h +59 -0
- data/lib/libv8/v8/src/log-utils.cc +428 -0
- data/lib/libv8/v8/src/log-utils.h +231 -0
- data/lib/libv8/v8/src/log.cc +1993 -0
- data/lib/libv8/v8/src/log.h +476 -0
- data/lib/libv8/v8/src/macro-assembler.h +120 -0
- data/lib/libv8/v8/src/macros.py +178 -0
- data/lib/libv8/v8/src/mark-compact.cc +3143 -0
- data/lib/libv8/v8/src/mark-compact.h +506 -0
- data/lib/libv8/v8/src/math.js +264 -0
- data/lib/libv8/v8/src/messages.cc +179 -0
- data/lib/libv8/v8/src/messages.h +113 -0
- data/lib/libv8/v8/src/messages.js +1096 -0
- data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
- data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
- data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
- data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
- data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
- data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
- data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
- data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
- data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
- data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
- data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
- data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
- data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
- data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
- data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
- data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
- data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
- data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
- data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
- data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
- data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
- data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
- data/lib/libv8/v8/src/mksnapshot.cc +328 -0
- data/lib/libv8/v8/src/natives.h +64 -0
- data/lib/libv8/v8/src/objects-debug.cc +738 -0
- data/lib/libv8/v8/src/objects-inl.h +4323 -0
- data/lib/libv8/v8/src/objects-printer.cc +829 -0
- data/lib/libv8/v8/src/objects-visiting.cc +148 -0
- data/lib/libv8/v8/src/objects-visiting.h +424 -0
- data/lib/libv8/v8/src/objects.cc +10585 -0
- data/lib/libv8/v8/src/objects.h +6838 -0
- data/lib/libv8/v8/src/parser.cc +4997 -0
- data/lib/libv8/v8/src/parser.h +765 -0
- data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
- data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
- data/lib/libv8/v8/src/platform-linux.cc +1149 -0
- data/lib/libv8/v8/src/platform-macos.cc +830 -0
- data/lib/libv8/v8/src/platform-nullos.cc +479 -0
- data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
- data/lib/libv8/v8/src/platform-posix.cc +424 -0
- data/lib/libv8/v8/src/platform-solaris.cc +762 -0
- data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
- data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
- data/lib/libv8/v8/src/platform-tls.h +50 -0
- data/lib/libv8/v8/src/platform-win32.cc +2021 -0
- data/lib/libv8/v8/src/platform.h +667 -0
- data/lib/libv8/v8/src/preparse-data-format.h +62 -0
- data/lib/libv8/v8/src/preparse-data.cc +183 -0
- data/lib/libv8/v8/src/preparse-data.h +225 -0
- data/lib/libv8/v8/src/preparser-api.cc +220 -0
- data/lib/libv8/v8/src/preparser.cc +1450 -0
- data/lib/libv8/v8/src/preparser.h +493 -0
- data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
- data/lib/libv8/v8/src/prettyprinter.h +223 -0
- data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
- data/lib/libv8/v8/src/profile-generator.cc +3098 -0
- data/lib/libv8/v8/src/profile-generator.h +1126 -0
- data/lib/libv8/v8/src/property.cc +105 -0
- data/lib/libv8/v8/src/property.h +365 -0
- data/lib/libv8/v8/src/proxy.js +83 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
- data/lib/libv8/v8/src/regexp-stack.cc +111 -0
- data/lib/libv8/v8/src/regexp-stack.h +147 -0
- data/lib/libv8/v8/src/regexp.js +483 -0
- data/lib/libv8/v8/src/rewriter.cc +360 -0
- data/lib/libv8/v8/src/rewriter.h +50 -0
- data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
- data/lib/libv8/v8/src/runtime-profiler.h +201 -0
- data/lib/libv8/v8/src/runtime.cc +12227 -0
- data/lib/libv8/v8/src/runtime.h +652 -0
- data/lib/libv8/v8/src/runtime.js +649 -0
- data/lib/libv8/v8/src/safepoint-table.cc +256 -0
- data/lib/libv8/v8/src/safepoint-table.h +270 -0
- data/lib/libv8/v8/src/scanner-base.cc +952 -0
- data/lib/libv8/v8/src/scanner-base.h +670 -0
- data/lib/libv8/v8/src/scanner.cc +345 -0
- data/lib/libv8/v8/src/scanner.h +146 -0
- data/lib/libv8/v8/src/scopeinfo.cc +646 -0
- data/lib/libv8/v8/src/scopeinfo.h +254 -0
- data/lib/libv8/v8/src/scopes.cc +1150 -0
- data/lib/libv8/v8/src/scopes.h +507 -0
- data/lib/libv8/v8/src/serialize.cc +1574 -0
- data/lib/libv8/v8/src/serialize.h +589 -0
- data/lib/libv8/v8/src/shell.h +55 -0
- data/lib/libv8/v8/src/simulator.h +43 -0
- data/lib/libv8/v8/src/small-pointer-list.h +163 -0
- data/lib/libv8/v8/src/smart-pointer.h +109 -0
- data/lib/libv8/v8/src/snapshot-common.cc +83 -0
- data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
- data/lib/libv8/v8/src/snapshot.h +91 -0
- data/lib/libv8/v8/src/spaces-inl.h +529 -0
- data/lib/libv8/v8/src/spaces.cc +3145 -0
- data/lib/libv8/v8/src/spaces.h +2369 -0
- data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
- data/lib/libv8/v8/src/splay-tree.h +205 -0
- data/lib/libv8/v8/src/string-search.cc +41 -0
- data/lib/libv8/v8/src/string-search.h +568 -0
- data/lib/libv8/v8/src/string-stream.cc +592 -0
- data/lib/libv8/v8/src/string-stream.h +191 -0
- data/lib/libv8/v8/src/string.js +994 -0
- data/lib/libv8/v8/src/strtod.cc +440 -0
- data/lib/libv8/v8/src/strtod.h +40 -0
- data/lib/libv8/v8/src/stub-cache.cc +1965 -0
- data/lib/libv8/v8/src/stub-cache.h +924 -0
- data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
- data/lib/libv8/v8/src/token.cc +63 -0
- data/lib/libv8/v8/src/token.h +288 -0
- data/lib/libv8/v8/src/type-info.cc +507 -0
- data/lib/libv8/v8/src/type-info.h +272 -0
- data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
- data/lib/libv8/v8/src/unbound-queue.h +69 -0
- data/lib/libv8/v8/src/unicode-inl.h +238 -0
- data/lib/libv8/v8/src/unicode.cc +1624 -0
- data/lib/libv8/v8/src/unicode.h +280 -0
- data/lib/libv8/v8/src/uri.js +408 -0
- data/lib/libv8/v8/src/utils-inl.h +48 -0
- data/lib/libv8/v8/src/utils.cc +371 -0
- data/lib/libv8/v8/src/utils.h +800 -0
- data/lib/libv8/v8/src/v8-counters.cc +62 -0
- data/lib/libv8/v8/src/v8-counters.h +314 -0
- data/lib/libv8/v8/src/v8.cc +213 -0
- data/lib/libv8/v8/src/v8.h +131 -0
- data/lib/libv8/v8/src/v8checks.h +64 -0
- data/lib/libv8/v8/src/v8dll-main.cc +44 -0
- data/lib/libv8/v8/src/v8globals.h +512 -0
- data/lib/libv8/v8/src/v8memory.h +82 -0
- data/lib/libv8/v8/src/v8natives.js +1310 -0
- data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
- data/lib/libv8/v8/src/v8threads.cc +464 -0
- data/lib/libv8/v8/src/v8threads.h +165 -0
- data/lib/libv8/v8/src/v8utils.h +319 -0
- data/lib/libv8/v8/src/variables.cc +114 -0
- data/lib/libv8/v8/src/variables.h +167 -0
- data/lib/libv8/v8/src/version.cc +116 -0
- data/lib/libv8/v8/src/version.h +68 -0
- data/lib/libv8/v8/src/vm-state-inl.h +138 -0
- data/lib/libv8/v8/src/vm-state.h +71 -0
- data/lib/libv8/v8/src/win32-headers.h +96 -0
- data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
- data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
- data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
- data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
- data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
- data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
- data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
- data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
- data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
- data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
- data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
- data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
- data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
- data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
- data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
- data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
- data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
- data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
- data/lib/libv8/v8/src/zone-inl.h +140 -0
- data/lib/libv8/v8/src/zone.cc +196 -0
- data/lib/libv8/v8/src/zone.h +240 -0
- data/lib/libv8/v8/tools/codemap.js +265 -0
- data/lib/libv8/v8/tools/consarray.js +93 -0
- data/lib/libv8/v8/tools/csvparser.js +78 -0
- data/lib/libv8/v8/tools/disasm.py +92 -0
- data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
- data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
- data/lib/libv8/v8/tools/gcmole/README +62 -0
- data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
- data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
- data/lib/libv8/v8/tools/grokdump.py +841 -0
- data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
- data/lib/libv8/v8/tools/js2c.py +364 -0
- data/lib/libv8/v8/tools/jsmin.py +280 -0
- data/lib/libv8/v8/tools/linux-tick-processor +35 -0
- data/lib/libv8/v8/tools/ll_prof.py +942 -0
- data/lib/libv8/v8/tools/logreader.js +185 -0
- data/lib/libv8/v8/tools/mac-nm +18 -0
- data/lib/libv8/v8/tools/mac-tick-processor +6 -0
- data/lib/libv8/v8/tools/oom_dump/README +31 -0
- data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
- data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
- data/lib/libv8/v8/tools/presubmit.py +305 -0
- data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
- data/lib/libv8/v8/tools/profile.js +751 -0
- data/lib/libv8/v8/tools/profile_view.js +219 -0
- data/lib/libv8/v8/tools/run-valgrind.py +77 -0
- data/lib/libv8/v8/tools/splaytree.js +316 -0
- data/lib/libv8/v8/tools/stats-viewer.py +468 -0
- data/lib/libv8/v8/tools/test.py +1510 -0
- data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
- data/lib/libv8/v8/tools/tickprocessor.js +877 -0
- data/lib/libv8/v8/tools/utils.py +96 -0
- data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
- data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
- data/lib/libv8/version.rb +5 -0
- data/libv8.gemspec +36 -0
- metadata +578 -0
@@ -0,0 +1,1126 @@
|
|
1
|
+
// Copyright 2010 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#ifndef V8_PROFILE_GENERATOR_H_
|
29
|
+
#define V8_PROFILE_GENERATOR_H_
|
30
|
+
|
31
|
+
#ifdef ENABLE_LOGGING_AND_PROFILING
|
32
|
+
|
33
|
+
#include "allocation.h"
|
34
|
+
#include "hashmap.h"
|
35
|
+
#include "../include/v8-profiler.h"
|
36
|
+
|
37
|
+
namespace v8 {
|
38
|
+
namespace internal {
|
39
|
+
|
40
|
+
class TokenEnumerator {
|
41
|
+
public:
|
42
|
+
TokenEnumerator();
|
43
|
+
~TokenEnumerator();
|
44
|
+
int GetTokenId(Object* token);
|
45
|
+
|
46
|
+
static const int kNoSecurityToken = -1;
|
47
|
+
static const int kInheritsSecurityToken = -2;
|
48
|
+
|
49
|
+
private:
|
50
|
+
static void TokenRemovedCallback(v8::Persistent<v8::Value> handle,
|
51
|
+
void* parameter);
|
52
|
+
void TokenRemoved(Object** token_location);
|
53
|
+
|
54
|
+
List<Object**> token_locations_;
|
55
|
+
List<bool> token_removed_;
|
56
|
+
|
57
|
+
friend class TokenEnumeratorTester;
|
58
|
+
|
59
|
+
DISALLOW_COPY_AND_ASSIGN(TokenEnumerator);
|
60
|
+
};
|
61
|
+
|
62
|
+
|
63
|
+
// Provides a storage of strings allocated in C++ heap, to hold them
|
64
|
+
// forever, even if they disappear from JS heap or external storage.
|
65
|
+
class StringsStorage {
|
66
|
+
public:
|
67
|
+
StringsStorage();
|
68
|
+
~StringsStorage();
|
69
|
+
|
70
|
+
const char* GetCopy(const char* src);
|
71
|
+
const char* GetFormatted(const char* format, ...);
|
72
|
+
const char* GetVFormatted(const char* format, va_list args);
|
73
|
+
const char* GetName(String* name);
|
74
|
+
const char* GetName(int index);
|
75
|
+
inline const char* GetFunctionName(String* name);
|
76
|
+
inline const char* GetFunctionName(const char* name);
|
77
|
+
|
78
|
+
private:
|
79
|
+
INLINE(static bool StringsMatch(void* key1, void* key2)) {
|
80
|
+
return strcmp(reinterpret_cast<char*>(key1),
|
81
|
+
reinterpret_cast<char*>(key2)) == 0;
|
82
|
+
}
|
83
|
+
const char* AddOrDisposeString(char* str, uint32_t hash);
|
84
|
+
|
85
|
+
// Mapping of strings by String::Hash to const char* strings.
|
86
|
+
HashMap names_;
|
87
|
+
|
88
|
+
DISALLOW_COPY_AND_ASSIGN(StringsStorage);
|
89
|
+
};
|
90
|
+
|
91
|
+
|
92
|
+
class CodeEntry {
|
93
|
+
public:
|
94
|
+
// CodeEntry doesn't own name strings, just references them.
|
95
|
+
INLINE(CodeEntry(Logger::LogEventsAndTags tag,
|
96
|
+
const char* name_prefix,
|
97
|
+
const char* name,
|
98
|
+
const char* resource_name,
|
99
|
+
int line_number,
|
100
|
+
int security_token_id));
|
101
|
+
|
102
|
+
INLINE(bool is_js_function() const) { return is_js_function_tag(tag_); }
|
103
|
+
INLINE(const char* name_prefix() const) { return name_prefix_; }
|
104
|
+
INLINE(bool has_name_prefix() const) { return name_prefix_[0] != '\0'; }
|
105
|
+
INLINE(const char* name() const) { return name_; }
|
106
|
+
INLINE(const char* resource_name() const) { return resource_name_; }
|
107
|
+
INLINE(int line_number() const) { return line_number_; }
|
108
|
+
INLINE(int shared_id() const) { return shared_id_; }
|
109
|
+
INLINE(void set_shared_id(int shared_id)) { shared_id_ = shared_id; }
|
110
|
+
INLINE(int security_token_id() const) { return security_token_id_; }
|
111
|
+
|
112
|
+
INLINE(static bool is_js_function_tag(Logger::LogEventsAndTags tag));
|
113
|
+
|
114
|
+
void CopyData(const CodeEntry& source);
|
115
|
+
uint32_t GetCallUid() const;
|
116
|
+
bool IsSameAs(CodeEntry* entry) const;
|
117
|
+
|
118
|
+
static const char* const kEmptyNamePrefix;
|
119
|
+
|
120
|
+
private:
|
121
|
+
Logger::LogEventsAndTags tag_;
|
122
|
+
const char* name_prefix_;
|
123
|
+
const char* name_;
|
124
|
+
const char* resource_name_;
|
125
|
+
int line_number_;
|
126
|
+
int shared_id_;
|
127
|
+
int security_token_id_;
|
128
|
+
|
129
|
+
DISALLOW_COPY_AND_ASSIGN(CodeEntry);
|
130
|
+
};
|
131
|
+
|
132
|
+
|
133
|
+
class ProfileTree;
|
134
|
+
|
135
|
+
class ProfileNode {
|
136
|
+
public:
|
137
|
+
INLINE(ProfileNode(ProfileTree* tree, CodeEntry* entry));
|
138
|
+
|
139
|
+
ProfileNode* FindChild(CodeEntry* entry);
|
140
|
+
ProfileNode* FindOrAddChild(CodeEntry* entry);
|
141
|
+
INLINE(void IncrementSelfTicks()) { ++self_ticks_; }
|
142
|
+
INLINE(void IncreaseSelfTicks(unsigned amount)) { self_ticks_ += amount; }
|
143
|
+
INLINE(void IncreaseTotalTicks(unsigned amount)) { total_ticks_ += amount; }
|
144
|
+
|
145
|
+
INLINE(CodeEntry* entry() const) { return entry_; }
|
146
|
+
INLINE(unsigned self_ticks() const) { return self_ticks_; }
|
147
|
+
INLINE(unsigned total_ticks() const) { return total_ticks_; }
|
148
|
+
INLINE(const List<ProfileNode*>* children() const) { return &children_list_; }
|
149
|
+
double GetSelfMillis() const;
|
150
|
+
double GetTotalMillis() const;
|
151
|
+
|
152
|
+
void Print(int indent);
|
153
|
+
|
154
|
+
private:
|
155
|
+
INLINE(static bool CodeEntriesMatch(void* entry1, void* entry2)) {
|
156
|
+
return reinterpret_cast<CodeEntry*>(entry1)->IsSameAs(
|
157
|
+
reinterpret_cast<CodeEntry*>(entry2));
|
158
|
+
}
|
159
|
+
|
160
|
+
INLINE(static uint32_t CodeEntryHash(CodeEntry* entry)) {
|
161
|
+
return entry->GetCallUid();
|
162
|
+
}
|
163
|
+
|
164
|
+
ProfileTree* tree_;
|
165
|
+
CodeEntry* entry_;
|
166
|
+
unsigned total_ticks_;
|
167
|
+
unsigned self_ticks_;
|
168
|
+
// Mapping from CodeEntry* to ProfileNode*
|
169
|
+
HashMap children_;
|
170
|
+
List<ProfileNode*> children_list_;
|
171
|
+
|
172
|
+
DISALLOW_COPY_AND_ASSIGN(ProfileNode);
|
173
|
+
};
|
174
|
+
|
175
|
+
|
176
|
+
class ProfileTree {
|
177
|
+
public:
|
178
|
+
ProfileTree();
|
179
|
+
~ProfileTree();
|
180
|
+
|
181
|
+
void AddPathFromEnd(const Vector<CodeEntry*>& path);
|
182
|
+
void AddPathFromStart(const Vector<CodeEntry*>& path);
|
183
|
+
void CalculateTotalTicks();
|
184
|
+
void FilteredClone(ProfileTree* src, int security_token_id);
|
185
|
+
|
186
|
+
double TicksToMillis(unsigned ticks) const {
|
187
|
+
return ticks * ms_to_ticks_scale_;
|
188
|
+
}
|
189
|
+
ProfileNode* root() const { return root_; }
|
190
|
+
void SetTickRatePerMs(double ticks_per_ms);
|
191
|
+
|
192
|
+
void ShortPrint();
|
193
|
+
void Print() {
|
194
|
+
root_->Print(0);
|
195
|
+
}
|
196
|
+
|
197
|
+
private:
|
198
|
+
template <typename Callback>
|
199
|
+
void TraverseDepthFirst(Callback* callback);
|
200
|
+
|
201
|
+
CodeEntry root_entry_;
|
202
|
+
ProfileNode* root_;
|
203
|
+
double ms_to_ticks_scale_;
|
204
|
+
|
205
|
+
DISALLOW_COPY_AND_ASSIGN(ProfileTree);
|
206
|
+
};
|
207
|
+
|
208
|
+
|
209
|
+
class CpuProfile {
|
210
|
+
public:
|
211
|
+
CpuProfile(const char* title, unsigned uid)
|
212
|
+
: title_(title), uid_(uid) { }
|
213
|
+
|
214
|
+
// Add pc -> ... -> main() call path to the profile.
|
215
|
+
void AddPath(const Vector<CodeEntry*>& path);
|
216
|
+
void CalculateTotalTicks();
|
217
|
+
void SetActualSamplingRate(double actual_sampling_rate);
|
218
|
+
CpuProfile* FilteredClone(int security_token_id);
|
219
|
+
|
220
|
+
INLINE(const char* title() const) { return title_; }
|
221
|
+
INLINE(unsigned uid() const) { return uid_; }
|
222
|
+
INLINE(const ProfileTree* top_down() const) { return &top_down_; }
|
223
|
+
INLINE(const ProfileTree* bottom_up() const) { return &bottom_up_; }
|
224
|
+
|
225
|
+
void UpdateTicksScale();
|
226
|
+
|
227
|
+
void ShortPrint();
|
228
|
+
void Print();
|
229
|
+
|
230
|
+
private:
|
231
|
+
const char* title_;
|
232
|
+
unsigned uid_;
|
233
|
+
ProfileTree top_down_;
|
234
|
+
ProfileTree bottom_up_;
|
235
|
+
|
236
|
+
DISALLOW_COPY_AND_ASSIGN(CpuProfile);
|
237
|
+
};
|
238
|
+
|
239
|
+
|
240
|
+
class CodeMap {
|
241
|
+
public:
|
242
|
+
CodeMap() : next_shared_id_(1) { }
|
243
|
+
INLINE(void AddCode(Address addr, CodeEntry* entry, unsigned size));
|
244
|
+
INLINE(void MoveCode(Address from, Address to));
|
245
|
+
INLINE(void DeleteCode(Address addr));
|
246
|
+
CodeEntry* FindEntry(Address addr);
|
247
|
+
int GetSharedId(Address addr);
|
248
|
+
|
249
|
+
void Print();
|
250
|
+
|
251
|
+
private:
|
252
|
+
struct CodeEntryInfo {
|
253
|
+
CodeEntryInfo(CodeEntry* an_entry, unsigned a_size)
|
254
|
+
: entry(an_entry), size(a_size) { }
|
255
|
+
CodeEntry* entry;
|
256
|
+
unsigned size;
|
257
|
+
};
|
258
|
+
|
259
|
+
struct CodeTreeConfig {
|
260
|
+
typedef Address Key;
|
261
|
+
typedef CodeEntryInfo Value;
|
262
|
+
static const Key kNoKey;
|
263
|
+
static const Value kNoValue;
|
264
|
+
static int Compare(const Key& a, const Key& b) {
|
265
|
+
return a < b ? -1 : (a > b ? 1 : 0);
|
266
|
+
}
|
267
|
+
};
|
268
|
+
typedef SplayTree<CodeTreeConfig> CodeTree;
|
269
|
+
|
270
|
+
class CodeTreePrinter {
|
271
|
+
public:
|
272
|
+
void Call(const Address& key, const CodeEntryInfo& value);
|
273
|
+
};
|
274
|
+
|
275
|
+
// Fake CodeEntry pointer to distinguish shared function entries.
|
276
|
+
static CodeEntry* const kSharedFunctionCodeEntry;
|
277
|
+
|
278
|
+
CodeTree tree_;
|
279
|
+
int next_shared_id_;
|
280
|
+
|
281
|
+
DISALLOW_COPY_AND_ASSIGN(CodeMap);
|
282
|
+
};
|
283
|
+
|
284
|
+
|
285
|
+
class CpuProfilesCollection {
|
286
|
+
public:
|
287
|
+
CpuProfilesCollection();
|
288
|
+
~CpuProfilesCollection();
|
289
|
+
|
290
|
+
bool StartProfiling(const char* title, unsigned uid);
|
291
|
+
bool StartProfiling(String* title, unsigned uid);
|
292
|
+
CpuProfile* StopProfiling(int security_token_id,
|
293
|
+
const char* title,
|
294
|
+
double actual_sampling_rate);
|
295
|
+
List<CpuProfile*>* Profiles(int security_token_id);
|
296
|
+
const char* GetName(String* name) {
|
297
|
+
return function_and_resource_names_.GetName(name);
|
298
|
+
}
|
299
|
+
const char* GetName(int args_count) {
|
300
|
+
return function_and_resource_names_.GetName(args_count);
|
301
|
+
}
|
302
|
+
CpuProfile* GetProfile(int security_token_id, unsigned uid);
|
303
|
+
bool IsLastProfile(const char* title);
|
304
|
+
void RemoveProfile(CpuProfile* profile);
|
305
|
+
bool HasDetachedProfiles() { return detached_profiles_.length() > 0; }
|
306
|
+
|
307
|
+
CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag,
|
308
|
+
String* name, String* resource_name, int line_number);
|
309
|
+
CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, const char* name);
|
310
|
+
CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag,
|
311
|
+
const char* name_prefix, String* name);
|
312
|
+
CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag, int args_count);
|
313
|
+
CodeEntry* NewCodeEntry(int security_token_id);
|
314
|
+
|
315
|
+
// Called from profile generator thread.
|
316
|
+
void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path);
|
317
|
+
|
318
|
+
// Limits the number of profiles that can be simultaneously collected.
|
319
|
+
static const int kMaxSimultaneousProfiles = 100;
|
320
|
+
|
321
|
+
private:
|
322
|
+
const char* GetFunctionName(String* name) {
|
323
|
+
return function_and_resource_names_.GetFunctionName(name);
|
324
|
+
}
|
325
|
+
const char* GetFunctionName(const char* name) {
|
326
|
+
return function_and_resource_names_.GetFunctionName(name);
|
327
|
+
}
|
328
|
+
int GetProfileIndex(unsigned uid);
|
329
|
+
List<CpuProfile*>* GetProfilesList(int security_token_id);
|
330
|
+
int TokenToIndex(int security_token_id);
|
331
|
+
|
332
|
+
INLINE(static bool UidsMatch(void* key1, void* key2)) {
|
333
|
+
return key1 == key2;
|
334
|
+
}
|
335
|
+
|
336
|
+
StringsStorage function_and_resource_names_;
|
337
|
+
List<CodeEntry*> code_entries_;
|
338
|
+
List<List<CpuProfile*>* > profiles_by_token_;
|
339
|
+
// Mapping from profiles' uids to indexes in the second nested list
|
340
|
+
// of profiles_by_token_.
|
341
|
+
HashMap profiles_uids_;
|
342
|
+
List<CpuProfile*> detached_profiles_;
|
343
|
+
|
344
|
+
// Accessed by VM thread and profile generator thread.
|
345
|
+
List<CpuProfile*> current_profiles_;
|
346
|
+
Semaphore* current_profiles_semaphore_;
|
347
|
+
|
348
|
+
DISALLOW_COPY_AND_ASSIGN(CpuProfilesCollection);
|
349
|
+
};
|
350
|
+
|
351
|
+
|
352
|
+
class SampleRateCalculator {
|
353
|
+
public:
|
354
|
+
SampleRateCalculator()
|
355
|
+
: result_(Logger::kSamplingIntervalMs * kResultScale),
|
356
|
+
ticks_per_ms_(Logger::kSamplingIntervalMs),
|
357
|
+
measurements_count_(0),
|
358
|
+
wall_time_query_countdown_(1) {
|
359
|
+
}
|
360
|
+
|
361
|
+
double ticks_per_ms() {
|
362
|
+
return result_ / static_cast<double>(kResultScale);
|
363
|
+
}
|
364
|
+
void Tick();
|
365
|
+
void UpdateMeasurements(double current_time);
|
366
|
+
|
367
|
+
// Instead of querying current wall time each tick,
|
368
|
+
// we use this constant to control query intervals.
|
369
|
+
static const unsigned kWallTimeQueryIntervalMs = 100;
|
370
|
+
|
371
|
+
private:
|
372
|
+
// As the result needs to be accessed from a different thread, we
|
373
|
+
// use type that guarantees atomic writes to memory. There should
|
374
|
+
// be <= 1000 ticks per second, thus storing a value of a 10 ** 5
|
375
|
+
// order should provide enough precision while keeping away from a
|
376
|
+
// potential overflow.
|
377
|
+
static const int kResultScale = 100000;
|
378
|
+
|
379
|
+
AtomicWord result_;
|
380
|
+
// All other fields are accessed only from the sampler thread.
|
381
|
+
double ticks_per_ms_;
|
382
|
+
unsigned measurements_count_;
|
383
|
+
unsigned wall_time_query_countdown_;
|
384
|
+
double last_wall_time_;
|
385
|
+
|
386
|
+
DISALLOW_COPY_AND_ASSIGN(SampleRateCalculator);
|
387
|
+
};
|
388
|
+
|
389
|
+
|
390
|
+
class ProfileGenerator {
|
391
|
+
public:
|
392
|
+
explicit ProfileGenerator(CpuProfilesCollection* profiles);
|
393
|
+
|
394
|
+
INLINE(CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag,
|
395
|
+
String* name,
|
396
|
+
String* resource_name,
|
397
|
+
int line_number)) {
|
398
|
+
return profiles_->NewCodeEntry(tag, name, resource_name, line_number);
|
399
|
+
}
|
400
|
+
|
401
|
+
INLINE(CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag,
|
402
|
+
const char* name)) {
|
403
|
+
return profiles_->NewCodeEntry(tag, name);
|
404
|
+
}
|
405
|
+
|
406
|
+
INLINE(CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag,
|
407
|
+
const char* name_prefix,
|
408
|
+
String* name)) {
|
409
|
+
return profiles_->NewCodeEntry(tag, name_prefix, name);
|
410
|
+
}
|
411
|
+
|
412
|
+
INLINE(CodeEntry* NewCodeEntry(Logger::LogEventsAndTags tag,
|
413
|
+
int args_count)) {
|
414
|
+
return profiles_->NewCodeEntry(tag, args_count);
|
415
|
+
}
|
416
|
+
|
417
|
+
INLINE(CodeEntry* NewCodeEntry(int security_token_id)) {
|
418
|
+
return profiles_->NewCodeEntry(security_token_id);
|
419
|
+
}
|
420
|
+
|
421
|
+
void RecordTickSample(const TickSample& sample);
|
422
|
+
|
423
|
+
INLINE(CodeMap* code_map()) { return &code_map_; }
|
424
|
+
|
425
|
+
INLINE(void Tick()) { sample_rate_calc_.Tick(); }
|
426
|
+
INLINE(double actual_sampling_rate()) {
|
427
|
+
return sample_rate_calc_.ticks_per_ms();
|
428
|
+
}
|
429
|
+
|
430
|
+
static const char* const kAnonymousFunctionName;
|
431
|
+
static const char* const kProgramEntryName;
|
432
|
+
static const char* const kGarbageCollectorEntryName;
|
433
|
+
|
434
|
+
private:
|
435
|
+
INLINE(CodeEntry* EntryForVMState(StateTag tag));
|
436
|
+
|
437
|
+
CpuProfilesCollection* profiles_;
|
438
|
+
CodeMap code_map_;
|
439
|
+
CodeEntry* program_entry_;
|
440
|
+
CodeEntry* gc_entry_;
|
441
|
+
SampleRateCalculator sample_rate_calc_;
|
442
|
+
|
443
|
+
DISALLOW_COPY_AND_ASSIGN(ProfileGenerator);
|
444
|
+
};
|
445
|
+
|
446
|
+
|
447
|
+
class HeapEntry;
|
448
|
+
|
449
|
+
class HeapGraphEdge BASE_EMBEDDED {
|
450
|
+
public:
|
451
|
+
enum Type {
|
452
|
+
kContextVariable = v8::HeapGraphEdge::kContextVariable,
|
453
|
+
kElement = v8::HeapGraphEdge::kElement,
|
454
|
+
kProperty = v8::HeapGraphEdge::kProperty,
|
455
|
+
kInternal = v8::HeapGraphEdge::kInternal,
|
456
|
+
kHidden = v8::HeapGraphEdge::kHidden,
|
457
|
+
kShortcut = v8::HeapGraphEdge::kShortcut
|
458
|
+
};
|
459
|
+
|
460
|
+
HeapGraphEdge() { }
|
461
|
+
void Init(int child_index, Type type, const char* name, HeapEntry* to);
|
462
|
+
void Init(int child_index, Type type, int index, HeapEntry* to);
|
463
|
+
void Init(int child_index, int index, HeapEntry* to);
|
464
|
+
|
465
|
+
Type type() { return static_cast<Type>(type_); }
|
466
|
+
int index() {
|
467
|
+
ASSERT(type_ == kElement || type_ == kHidden);
|
468
|
+
return index_;
|
469
|
+
}
|
470
|
+
const char* name() {
|
471
|
+
ASSERT(type_ == kContextVariable
|
472
|
+
|| type_ == kProperty
|
473
|
+
|| type_ == kInternal
|
474
|
+
|| type_ == kShortcut);
|
475
|
+
return name_;
|
476
|
+
}
|
477
|
+
HeapEntry* to() { return to_; }
|
478
|
+
|
479
|
+
HeapEntry* From();
|
480
|
+
|
481
|
+
private:
|
482
|
+
int child_index_ : 29;
|
483
|
+
unsigned type_ : 3;
|
484
|
+
union {
|
485
|
+
int index_;
|
486
|
+
const char* name_;
|
487
|
+
};
|
488
|
+
HeapEntry* to_;
|
489
|
+
|
490
|
+
DISALLOW_COPY_AND_ASSIGN(HeapGraphEdge);
|
491
|
+
};
|
492
|
+
|
493
|
+
|
494
|
+
class HeapSnapshot;
|
495
|
+
|
496
|
+
// HeapEntry instances represent an entity from the heap (or a special
|
497
|
+
// virtual node, e.g. root). To make heap snapshots more compact,
|
498
|
+
// HeapEntries has a special memory layout (no Vectors or Lists used):
|
499
|
+
//
|
500
|
+
// +-----------------+
|
501
|
+
// HeapEntry
|
502
|
+
// +-----------------+
|
503
|
+
// HeapGraphEdge |
|
504
|
+
// ... } children_count
|
505
|
+
// HeapGraphEdge |
|
506
|
+
// +-----------------+
|
507
|
+
// HeapGraphEdge* |
|
508
|
+
// ... } retainers_count
|
509
|
+
// HeapGraphEdge* |
|
510
|
+
// +-----------------+
|
511
|
+
//
|
512
|
+
// In a HeapSnapshot, all entries are hand-allocated in a continuous array
|
513
|
+
// of raw bytes.
|
514
|
+
//
|
515
|
+
class HeapEntry BASE_EMBEDDED {
|
516
|
+
public:
|
517
|
+
enum Type {
|
518
|
+
kHidden = v8::HeapGraphNode::kHidden,
|
519
|
+
kArray = v8::HeapGraphNode::kArray,
|
520
|
+
kString = v8::HeapGraphNode::kString,
|
521
|
+
kObject = v8::HeapGraphNode::kObject,
|
522
|
+
kCode = v8::HeapGraphNode::kCode,
|
523
|
+
kClosure = v8::HeapGraphNode::kClosure,
|
524
|
+
kRegExp = v8::HeapGraphNode::kRegExp,
|
525
|
+
kHeapNumber = v8::HeapGraphNode::kHeapNumber,
|
526
|
+
kNative = v8::HeapGraphNode::kNative
|
527
|
+
};
|
528
|
+
|
529
|
+
HeapEntry() { }
|
530
|
+
void Init(HeapSnapshot* snapshot,
|
531
|
+
Type type,
|
532
|
+
const char* name,
|
533
|
+
uint64_t id,
|
534
|
+
int self_size,
|
535
|
+
int children_count,
|
536
|
+
int retainers_count);
|
537
|
+
|
538
|
+
HeapSnapshot* snapshot() { return snapshot_; }
|
539
|
+
Type type() { return static_cast<Type>(type_); }
|
540
|
+
const char* name() { return name_; }
|
541
|
+
inline uint64_t id();
|
542
|
+
int self_size() { return self_size_; }
|
543
|
+
int retained_size() { return retained_size_; }
|
544
|
+
void add_retained_size(int size) { retained_size_ += size; }
|
545
|
+
void set_retained_size(int value) { retained_size_ = value; }
|
546
|
+
int ordered_index() { return ordered_index_; }
|
547
|
+
void set_ordered_index(int value) { ordered_index_ = value; }
|
548
|
+
|
549
|
+
Vector<HeapGraphEdge> children() {
|
550
|
+
return Vector<HeapGraphEdge>(children_arr(), children_count_); }
|
551
|
+
Vector<HeapGraphEdge*> retainers() {
|
552
|
+
return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); }
|
553
|
+
HeapEntry* dominator() { return dominator_; }
|
554
|
+
void set_dominator(HeapEntry* entry) { dominator_ = entry; }
|
555
|
+
|
556
|
+
void clear_paint() { painted_ = kUnpainted; }
|
557
|
+
bool painted_reachable() { return painted_ == kPainted; }
|
558
|
+
void paint_reachable() {
|
559
|
+
ASSERT(painted_ == kUnpainted);
|
560
|
+
painted_ = kPainted;
|
561
|
+
}
|
562
|
+
bool not_painted_reachable_from_others() {
|
563
|
+
return painted_ != kPaintedReachableFromOthers;
|
564
|
+
}
|
565
|
+
void paint_reachable_from_others() {
|
566
|
+
painted_ = kPaintedReachableFromOthers;
|
567
|
+
}
|
568
|
+
template<class Visitor>
|
569
|
+
void ApplyAndPaintAllReachable(Visitor* visitor);
|
570
|
+
void PaintAllReachable();
|
571
|
+
|
572
|
+
void SetIndexedReference(HeapGraphEdge::Type type,
|
573
|
+
int child_index,
|
574
|
+
int index,
|
575
|
+
HeapEntry* entry,
|
576
|
+
int retainer_index);
|
577
|
+
void SetNamedReference(HeapGraphEdge::Type type,
|
578
|
+
int child_index,
|
579
|
+
const char* name,
|
580
|
+
HeapEntry* entry,
|
581
|
+
int retainer_index);
|
582
|
+
void SetUnidirElementReference(int child_index, int index, HeapEntry* entry);
|
583
|
+
|
584
|
+
int EntrySize() { return EntriesSize(1, children_count_, retainers_count_); }
|
585
|
+
int RetainedSize(bool exact);
|
586
|
+
|
587
|
+
void Print(int max_depth, int indent);
|
588
|
+
|
589
|
+
static int EntriesSize(int entries_count,
|
590
|
+
int children_count,
|
591
|
+
int retainers_count);
|
592
|
+
|
593
|
+
private:
|
594
|
+
HeapGraphEdge* children_arr() {
|
595
|
+
return reinterpret_cast<HeapGraphEdge*>(this + 1);
|
596
|
+
}
|
597
|
+
HeapGraphEdge** retainers_arr() {
|
598
|
+
return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_);
|
599
|
+
}
|
600
|
+
void CalculateExactRetainedSize();
|
601
|
+
const char* TypeAsString();
|
602
|
+
|
603
|
+
unsigned painted_: 2;
|
604
|
+
unsigned type_: 4;
|
605
|
+
int children_count_: 26;
|
606
|
+
int retainers_count_;
|
607
|
+
int self_size_;
|
608
|
+
union {
|
609
|
+
int ordered_index_; // Used during dominator tree building.
|
610
|
+
int retained_size_; // At that moment, there is no retained size yet.
|
611
|
+
};
|
612
|
+
HeapEntry* dominator_;
|
613
|
+
HeapSnapshot* snapshot_;
|
614
|
+
struct Id {
|
615
|
+
uint32_t id1_;
|
616
|
+
uint32_t id2_;
|
617
|
+
} id_; // This is to avoid extra padding of 64-bit value.
|
618
|
+
const char* name_;
|
619
|
+
|
620
|
+
// Paints used for exact retained sizes calculation.
|
621
|
+
static const unsigned kUnpainted = 0;
|
622
|
+
static const unsigned kPainted = 1;
|
623
|
+
static const unsigned kPaintedReachableFromOthers = 2;
|
624
|
+
|
625
|
+
static const int kExactRetainedSizeTag = 1;
|
626
|
+
|
627
|
+
DISALLOW_COPY_AND_ASSIGN(HeapEntry);
|
628
|
+
};
|
629
|
+
|
630
|
+
|
631
|
+
class HeapSnapshotsCollection;
|
632
|
+
|
633
|
+
// HeapSnapshot represents a single heap snapshot. It is stored in
|
634
|
+
// HeapSnapshotsCollection, which is also a factory for
|
635
|
+
// HeapSnapshots. All HeapSnapshots share strings copied from JS heap
|
636
|
+
// to be able to return them even if they were collected.
|
637
|
+
// HeapSnapshotGenerator fills in a HeapSnapshot.
|
638
|
+
class HeapSnapshot {
|
639
|
+
public:
|
640
|
+
enum Type {
|
641
|
+
kFull = v8::HeapSnapshot::kFull,
|
642
|
+
kAggregated = v8::HeapSnapshot::kAggregated
|
643
|
+
};
|
644
|
+
|
645
|
+
HeapSnapshot(HeapSnapshotsCollection* collection,
|
646
|
+
Type type,
|
647
|
+
const char* title,
|
648
|
+
unsigned uid);
|
649
|
+
~HeapSnapshot();
|
650
|
+
void Delete();
|
651
|
+
|
652
|
+
HeapSnapshotsCollection* collection() { return collection_; }
|
653
|
+
Type type() { return type_; }
|
654
|
+
const char* title() { return title_; }
|
655
|
+
unsigned uid() { return uid_; }
|
656
|
+
HeapEntry* root() { return root_entry_; }
|
657
|
+
HeapEntry* gc_roots() { return gc_roots_entry_; }
|
658
|
+
HeapEntry* natives_root() { return natives_root_entry_; }
|
659
|
+
List<HeapEntry*>* entries() { return &entries_; }
|
660
|
+
|
661
|
+
void AllocateEntries(
|
662
|
+
int entries_count, int children_count, int retainers_count);
|
663
|
+
HeapEntry* AddEntry(HeapEntry::Type type,
|
664
|
+
const char* name,
|
665
|
+
uint64_t id,
|
666
|
+
int size,
|
667
|
+
int children_count,
|
668
|
+
int retainers_count);
|
669
|
+
HeapEntry* AddRootEntry(int children_count);
|
670
|
+
HeapEntry* AddGcRootsEntry(int children_count, int retainers_count);
|
671
|
+
HeapEntry* AddNativesRootEntry(int children_count, int retainers_count);
|
672
|
+
void ClearPaint();
|
673
|
+
HeapEntry* GetEntryById(uint64_t id);
|
674
|
+
List<HeapEntry*>* GetSortedEntriesList();
|
675
|
+
template<class Visitor>
|
676
|
+
void IterateEntries(Visitor* visitor) { entries_.Iterate(visitor); }
|
677
|
+
void SetDominatorsToSelf();
|
678
|
+
|
679
|
+
void Print(int max_depth);
|
680
|
+
void PrintEntriesSize();
|
681
|
+
|
682
|
+
private:
|
683
|
+
HeapEntry* GetNextEntryToInit();
|
684
|
+
|
685
|
+
HeapSnapshotsCollection* collection_;
|
686
|
+
Type type_;
|
687
|
+
const char* title_;
|
688
|
+
unsigned uid_;
|
689
|
+
HeapEntry* root_entry_;
|
690
|
+
HeapEntry* gc_roots_entry_;
|
691
|
+
HeapEntry* natives_root_entry_;
|
692
|
+
char* raw_entries_;
|
693
|
+
List<HeapEntry*> entries_;
|
694
|
+
bool entries_sorted_;
|
695
|
+
#ifdef DEBUG
|
696
|
+
int raw_entries_size_;
|
697
|
+
#endif
|
698
|
+
|
699
|
+
friend class HeapSnapshotTester;
|
700
|
+
|
701
|
+
DISALLOW_COPY_AND_ASSIGN(HeapSnapshot);
|
702
|
+
};
|
703
|
+
|
704
|
+
|
705
|
+
class HeapObjectsMap {
|
706
|
+
public:
|
707
|
+
HeapObjectsMap();
|
708
|
+
~HeapObjectsMap();
|
709
|
+
|
710
|
+
void SnapshotGenerationFinished();
|
711
|
+
uint64_t FindObject(Address addr);
|
712
|
+
void MoveObject(Address from, Address to);
|
713
|
+
|
714
|
+
static uint64_t GenerateId(v8::RetainedObjectInfo* info);
|
715
|
+
|
716
|
+
static const uint64_t kInternalRootObjectId;
|
717
|
+
static const uint64_t kGcRootsObjectId;
|
718
|
+
static const uint64_t kNativesRootObjectId;
|
719
|
+
static const uint64_t kFirstAvailableObjectId;
|
720
|
+
|
721
|
+
private:
|
722
|
+
struct EntryInfo {
|
723
|
+
explicit EntryInfo(uint64_t id) : id(id), accessed(true) { }
|
724
|
+
EntryInfo(uint64_t id, bool accessed) : id(id), accessed(accessed) { }
|
725
|
+
uint64_t id;
|
726
|
+
bool accessed;
|
727
|
+
};
|
728
|
+
|
729
|
+
void AddEntry(Address addr, uint64_t id);
|
730
|
+
uint64_t FindEntry(Address addr);
|
731
|
+
void RemoveDeadEntries();
|
732
|
+
|
733
|
+
static bool AddressesMatch(void* key1, void* key2) {
|
734
|
+
return key1 == key2;
|
735
|
+
}
|
736
|
+
|
737
|
+
static uint32_t AddressHash(Address addr) {
|
738
|
+
return ComputeIntegerHash(
|
739
|
+
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)));
|
740
|
+
}
|
741
|
+
|
742
|
+
bool initial_fill_mode_;
|
743
|
+
uint64_t next_id_;
|
744
|
+
HashMap entries_map_;
|
745
|
+
List<EntryInfo>* entries_;
|
746
|
+
|
747
|
+
DISALLOW_COPY_AND_ASSIGN(HeapObjectsMap);
|
748
|
+
};
|
749
|
+
|
750
|
+
|
751
|
+
class HeapSnapshotsCollection {
|
752
|
+
public:
|
753
|
+
HeapSnapshotsCollection();
|
754
|
+
~HeapSnapshotsCollection();
|
755
|
+
|
756
|
+
bool is_tracking_objects() { return is_tracking_objects_; }
|
757
|
+
|
758
|
+
HeapSnapshot* NewSnapshot(
|
759
|
+
HeapSnapshot::Type type, const char* name, unsigned uid);
|
760
|
+
void SnapshotGenerationFinished(HeapSnapshot* snapshot);
|
761
|
+
List<HeapSnapshot*>* snapshots() { return &snapshots_; }
|
762
|
+
HeapSnapshot* GetSnapshot(unsigned uid);
|
763
|
+
void RemoveSnapshot(HeapSnapshot* snapshot);
|
764
|
+
|
765
|
+
StringsStorage* names() { return &names_; }
|
766
|
+
TokenEnumerator* token_enumerator() { return token_enumerator_; }
|
767
|
+
|
768
|
+
uint64_t GetObjectId(Address addr) { return ids_.FindObject(addr); }
|
769
|
+
void ObjectMoveEvent(Address from, Address to) { ids_.MoveObject(from, to); }
|
770
|
+
|
771
|
+
private:
|
772
|
+
INLINE(static bool HeapSnapshotsMatch(void* key1, void* key2)) {
|
773
|
+
return key1 == key2;
|
774
|
+
}
|
775
|
+
|
776
|
+
bool is_tracking_objects_; // Whether tracking object moves is needed.
|
777
|
+
List<HeapSnapshot*> snapshots_;
|
778
|
+
// Mapping from snapshots' uids to HeapSnapshot* pointers.
|
779
|
+
HashMap snapshots_uids_;
|
780
|
+
StringsStorage names_;
|
781
|
+
TokenEnumerator* token_enumerator_;
|
782
|
+
// Mapping from HeapObject addresses to objects' uids.
|
783
|
+
HeapObjectsMap ids_;
|
784
|
+
|
785
|
+
DISALLOW_COPY_AND_ASSIGN(HeapSnapshotsCollection);
|
786
|
+
};
|
787
|
+
|
788
|
+
|
789
|
+
// A typedef for referencing anything that can be snapshotted living
|
790
|
+
// in any kind of heap memory.
|
791
|
+
typedef void* HeapThing;
|
792
|
+
|
793
|
+
|
794
|
+
// An interface that creates HeapEntries by HeapThings.
|
795
|
+
class HeapEntriesAllocator {
|
796
|
+
public:
|
797
|
+
virtual ~HeapEntriesAllocator() { }
|
798
|
+
virtual HeapEntry* AllocateEntry(
|
799
|
+
HeapThing ptr, int children_count, int retainers_count) = 0;
|
800
|
+
};
|
801
|
+
|
802
|
+
|
803
|
+
// The HeapEntriesMap instance is used to track a mapping between
|
804
|
+
// real heap objects and their representations in heap snapshots.
|
805
|
+
class HeapEntriesMap {
|
806
|
+
public:
|
807
|
+
HeapEntriesMap();
|
808
|
+
~HeapEntriesMap();
|
809
|
+
|
810
|
+
void AllocateEntries();
|
811
|
+
HeapEntry* Map(HeapThing thing);
|
812
|
+
void Pair(HeapThing thing, HeapEntriesAllocator* allocator, HeapEntry* entry);
|
813
|
+
void CountReference(HeapThing from, HeapThing to,
|
814
|
+
int* prev_children_count = NULL,
|
815
|
+
int* prev_retainers_count = NULL);
|
816
|
+
|
817
|
+
int entries_count() { return entries_count_; }
|
818
|
+
int total_children_count() { return total_children_count_; }
|
819
|
+
int total_retainers_count() { return total_retainers_count_; }
|
820
|
+
|
821
|
+
static HeapEntry *const kHeapEntryPlaceholder;
|
822
|
+
|
823
|
+
private:
|
824
|
+
struct EntryInfo {
|
825
|
+
EntryInfo(HeapEntry* entry, HeapEntriesAllocator* allocator)
|
826
|
+
: entry(entry),
|
827
|
+
allocator(allocator),
|
828
|
+
children_count(0),
|
829
|
+
retainers_count(0) {
|
830
|
+
}
|
831
|
+
HeapEntry* entry;
|
832
|
+
HeapEntriesAllocator* allocator;
|
833
|
+
int children_count;
|
834
|
+
int retainers_count;
|
835
|
+
};
|
836
|
+
|
837
|
+
static uint32_t Hash(HeapThing thing) {
|
838
|
+
return ComputeIntegerHash(
|
839
|
+
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(thing)));
|
840
|
+
}
|
841
|
+
static bool HeapThingsMatch(HeapThing key1, HeapThing key2) {
|
842
|
+
return key1 == key2;
|
843
|
+
}
|
844
|
+
|
845
|
+
HashMap entries_;
|
846
|
+
int entries_count_;
|
847
|
+
int total_children_count_;
|
848
|
+
int total_retainers_count_;
|
849
|
+
|
850
|
+
friend class HeapObjectsSet;
|
851
|
+
|
852
|
+
DISALLOW_COPY_AND_ASSIGN(HeapEntriesMap);
|
853
|
+
};
|
854
|
+
|
855
|
+
|
856
|
+
class HeapObjectsSet {
|
857
|
+
public:
|
858
|
+
HeapObjectsSet();
|
859
|
+
void Clear();
|
860
|
+
bool Contains(Object* object);
|
861
|
+
void Insert(Object* obj);
|
862
|
+
|
863
|
+
private:
|
864
|
+
HashMap entries_;
|
865
|
+
|
866
|
+
DISALLOW_COPY_AND_ASSIGN(HeapObjectsSet);
|
867
|
+
};
|
868
|
+
|
869
|
+
|
870
|
+
// An interface used to populate a snapshot with nodes and edges.
|
871
|
+
class SnapshotFillerInterface {
|
872
|
+
public:
|
873
|
+
virtual ~SnapshotFillerInterface() { }
|
874
|
+
virtual HeapEntry* AddEntry(HeapThing ptr,
|
875
|
+
HeapEntriesAllocator* allocator) = 0;
|
876
|
+
virtual HeapEntry* FindEntry(HeapThing ptr) = 0;
|
877
|
+
virtual HeapEntry* FindOrAddEntry(HeapThing ptr,
|
878
|
+
HeapEntriesAllocator* allocator) = 0;
|
879
|
+
virtual void SetIndexedReference(HeapGraphEdge::Type type,
|
880
|
+
HeapThing parent_ptr,
|
881
|
+
HeapEntry* parent_entry,
|
882
|
+
int index,
|
883
|
+
HeapThing child_ptr,
|
884
|
+
HeapEntry* child_entry) = 0;
|
885
|
+
virtual void SetIndexedAutoIndexReference(HeapGraphEdge::Type type,
|
886
|
+
HeapThing parent_ptr,
|
887
|
+
HeapEntry* parent_entry,
|
888
|
+
HeapThing child_ptr,
|
889
|
+
HeapEntry* child_entry) = 0;
|
890
|
+
virtual void SetNamedReference(HeapGraphEdge::Type type,
|
891
|
+
HeapThing parent_ptr,
|
892
|
+
HeapEntry* parent_entry,
|
893
|
+
const char* reference_name,
|
894
|
+
HeapThing child_ptr,
|
895
|
+
HeapEntry* child_entry) = 0;
|
896
|
+
virtual void SetNamedAutoIndexReference(HeapGraphEdge::Type type,
|
897
|
+
HeapThing parent_ptr,
|
898
|
+
HeapEntry* parent_entry,
|
899
|
+
HeapThing child_ptr,
|
900
|
+
HeapEntry* child_entry) = 0;
|
901
|
+
};
|
902
|
+
|
903
|
+
|
904
|
+
class SnapshottingProgressReportingInterface {
|
905
|
+
public:
|
906
|
+
virtual ~SnapshottingProgressReportingInterface() { }
|
907
|
+
virtual void ProgressStep() = 0;
|
908
|
+
virtual bool ProgressReport(bool force) = 0;
|
909
|
+
};
|
910
|
+
|
911
|
+
|
912
|
+
// An implementation of V8 heap graph extractor.
|
913
|
+
class V8HeapExplorer : public HeapEntriesAllocator {
|
914
|
+
public:
|
915
|
+
V8HeapExplorer(HeapSnapshot* snapshot,
|
916
|
+
SnapshottingProgressReportingInterface* progress);
|
917
|
+
virtual ~V8HeapExplorer();
|
918
|
+
virtual HeapEntry* AllocateEntry(
|
919
|
+
HeapThing ptr, int children_count, int retainers_count);
|
920
|
+
void AddRootEntries(SnapshotFillerInterface* filler);
|
921
|
+
int EstimateObjectsCount();
|
922
|
+
bool IterateAndExtractReferences(SnapshotFillerInterface* filler);
|
923
|
+
|
924
|
+
static HeapObject* const kInternalRootObject;
|
925
|
+
|
926
|
+
private:
|
927
|
+
HeapEntry* AddEntry(
|
928
|
+
HeapObject* object, int children_count, int retainers_count);
|
929
|
+
HeapEntry* AddEntry(HeapObject* object,
|
930
|
+
HeapEntry::Type type,
|
931
|
+
const char* name,
|
932
|
+
int children_count,
|
933
|
+
int retainers_count);
|
934
|
+
const char* GetSystemEntryName(HeapObject* object);
|
935
|
+
void ExtractReferences(HeapObject* obj);
|
936
|
+
void ExtractClosureReferences(JSObject* js_obj, HeapEntry* entry);
|
937
|
+
void ExtractPropertyReferences(JSObject* js_obj, HeapEntry* entry);
|
938
|
+
void ExtractElementReferences(JSObject* js_obj, HeapEntry* entry);
|
939
|
+
void ExtractInternalReferences(JSObject* js_obj, HeapEntry* entry);
|
940
|
+
void SetClosureReference(HeapObject* parent_obj,
|
941
|
+
HeapEntry* parent,
|
942
|
+
String* reference_name,
|
943
|
+
Object* child);
|
944
|
+
void SetElementReference(HeapObject* parent_obj,
|
945
|
+
HeapEntry* parent,
|
946
|
+
int index,
|
947
|
+
Object* child);
|
948
|
+
void SetInternalReference(HeapObject* parent_obj,
|
949
|
+
HeapEntry* parent,
|
950
|
+
const char* reference_name,
|
951
|
+
Object* child,
|
952
|
+
int field_offset = -1);
|
953
|
+
void SetInternalReference(HeapObject* parent_obj,
|
954
|
+
HeapEntry* parent,
|
955
|
+
int index,
|
956
|
+
Object* child,
|
957
|
+
int field_offset = -1);
|
958
|
+
void SetHiddenReference(HeapObject* parent_obj,
|
959
|
+
HeapEntry* parent,
|
960
|
+
int index,
|
961
|
+
Object* child);
|
962
|
+
void SetPropertyReference(HeapObject* parent_obj,
|
963
|
+
HeapEntry* parent,
|
964
|
+
String* reference_name,
|
965
|
+
Object* child,
|
966
|
+
int field_offset = -1);
|
967
|
+
void SetPropertyShortcutReference(HeapObject* parent_obj,
|
968
|
+
HeapEntry* parent,
|
969
|
+
String* reference_name,
|
970
|
+
Object* child);
|
971
|
+
void SetRootShortcutReference(Object* child);
|
972
|
+
void SetRootGcRootsReference();
|
973
|
+
void SetGcRootsReference(Object* child);
|
974
|
+
|
975
|
+
HeapEntry* GetEntry(Object* obj);
|
976
|
+
|
977
|
+
HeapSnapshot* snapshot_;
|
978
|
+
HeapSnapshotsCollection* collection_;
|
979
|
+
SnapshottingProgressReportingInterface* progress_;
|
980
|
+
SnapshotFillerInterface* filler_;
|
981
|
+
|
982
|
+
static HeapObject* const kGcRootsObject;
|
983
|
+
|
984
|
+
friend class IndexedReferencesExtractor;
|
985
|
+
friend class RootsReferencesExtractor;
|
986
|
+
|
987
|
+
DISALLOW_COPY_AND_ASSIGN(V8HeapExplorer);
|
988
|
+
};
|
989
|
+
|
990
|
+
|
991
|
+
// An implementation of retained native objects extractor.
|
992
|
+
class NativeObjectsExplorer : public HeapEntriesAllocator {
|
993
|
+
public:
|
994
|
+
NativeObjectsExplorer(HeapSnapshot* snapshot,
|
995
|
+
SnapshottingProgressReportingInterface* progress);
|
996
|
+
virtual ~NativeObjectsExplorer();
|
997
|
+
virtual HeapEntry* AllocateEntry(
|
998
|
+
HeapThing ptr, int children_count, int retainers_count);
|
999
|
+
void AddRootEntries(SnapshotFillerInterface* filler);
|
1000
|
+
int EstimateObjectsCount();
|
1001
|
+
bool IterateAndExtractReferences(SnapshotFillerInterface* filler);
|
1002
|
+
|
1003
|
+
private:
|
1004
|
+
void FillRetainedObjects();
|
1005
|
+
List<HeapObject*>* GetListMaybeDisposeInfo(v8::RetainedObjectInfo* info);
|
1006
|
+
void SetNativeRootReference(v8::RetainedObjectInfo* info);
|
1007
|
+
void SetRootNativesRootReference();
|
1008
|
+
void SetWrapperNativeReferences(HeapObject* wrapper,
|
1009
|
+
v8::RetainedObjectInfo* info);
|
1010
|
+
void VisitSubtreeWrapper(Object** p, uint16_t class_id);
|
1011
|
+
|
1012
|
+
static uint32_t InfoHash(v8::RetainedObjectInfo* info) {
|
1013
|
+
return ComputeIntegerHash(static_cast<uint32_t>(info->GetHash()));
|
1014
|
+
}
|
1015
|
+
static bool RetainedInfosMatch(void* key1, void* key2) {
|
1016
|
+
return key1 == key2 ||
|
1017
|
+
(reinterpret_cast<v8::RetainedObjectInfo*>(key1))->IsEquivalent(
|
1018
|
+
reinterpret_cast<v8::RetainedObjectInfo*>(key2));
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
HeapSnapshot* snapshot_;
|
1022
|
+
HeapSnapshotsCollection* collection_;
|
1023
|
+
SnapshottingProgressReportingInterface* progress_;
|
1024
|
+
bool embedder_queried_;
|
1025
|
+
HeapObjectsSet in_groups_;
|
1026
|
+
// RetainedObjectInfo* -> List<HeapObject*>*
|
1027
|
+
HashMap objects_by_info_;
|
1028
|
+
// Used during references extraction.
|
1029
|
+
SnapshotFillerInterface* filler_;
|
1030
|
+
|
1031
|
+
static HeapThing const kNativesRootObject;
|
1032
|
+
|
1033
|
+
friend class GlobalHandlesExtractor;
|
1034
|
+
|
1035
|
+
DISALLOW_COPY_AND_ASSIGN(NativeObjectsExplorer);
|
1036
|
+
};
|
1037
|
+
|
1038
|
+
|
1039
|
+
class HeapSnapshotGenerator : public SnapshottingProgressReportingInterface {
|
1040
|
+
public:
|
1041
|
+
HeapSnapshotGenerator(HeapSnapshot* snapshot,
|
1042
|
+
v8::ActivityControl* control);
|
1043
|
+
bool GenerateSnapshot();
|
1044
|
+
|
1045
|
+
private:
|
1046
|
+
bool ApproximateRetainedSizes();
|
1047
|
+
bool BuildDominatorTree(const Vector<HeapEntry*>& entries,
|
1048
|
+
Vector<HeapEntry*>* dominators);
|
1049
|
+
bool CountEntriesAndReferences();
|
1050
|
+
bool FillReferences();
|
1051
|
+
void FillReversePostorderIndexes(Vector<HeapEntry*>* entries);
|
1052
|
+
void ProgressStep();
|
1053
|
+
bool ProgressReport(bool force = false);
|
1054
|
+
bool SetEntriesDominators();
|
1055
|
+
void SetProgressTotal(int iterations_count);
|
1056
|
+
|
1057
|
+
HeapSnapshot* snapshot_;
|
1058
|
+
v8::ActivityControl* control_;
|
1059
|
+
V8HeapExplorer v8_heap_explorer_;
|
1060
|
+
NativeObjectsExplorer dom_explorer_;
|
1061
|
+
// Mapping from HeapThing pointers to HeapEntry* pointers.
|
1062
|
+
HeapEntriesMap entries_;
|
1063
|
+
// Used during snapshot generation.
|
1064
|
+
int progress_counter_;
|
1065
|
+
int progress_total_;
|
1066
|
+
|
1067
|
+
DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator);
|
1068
|
+
};
|
1069
|
+
|
1070
|
+
class OutputStreamWriter;
|
1071
|
+
|
1072
|
+
class HeapSnapshotJSONSerializer {
|
1073
|
+
public:
|
1074
|
+
explicit HeapSnapshotJSONSerializer(HeapSnapshot* snapshot)
|
1075
|
+
: snapshot_(snapshot),
|
1076
|
+
nodes_(ObjectsMatch),
|
1077
|
+
strings_(ObjectsMatch),
|
1078
|
+
next_node_id_(1),
|
1079
|
+
next_string_id_(1),
|
1080
|
+
writer_(NULL) {
|
1081
|
+
}
|
1082
|
+
void Serialize(v8::OutputStream* stream);
|
1083
|
+
|
1084
|
+
private:
|
1085
|
+
INLINE(static bool ObjectsMatch(void* key1, void* key2)) {
|
1086
|
+
return key1 == key2;
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
INLINE(static uint32_t ObjectHash(const void* key)) {
|
1090
|
+
return ComputeIntegerHash(
|
1091
|
+
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)));
|
1092
|
+
}
|
1093
|
+
|
1094
|
+
void EnumerateNodes();
|
1095
|
+
int GetNodeId(HeapEntry* entry);
|
1096
|
+
int GetStringId(const char* s);
|
1097
|
+
void SerializeEdge(HeapGraphEdge* edge);
|
1098
|
+
void SerializeImpl();
|
1099
|
+
void SerializeNode(HeapEntry* entry);
|
1100
|
+
void SerializeNodes();
|
1101
|
+
void SerializeSnapshot();
|
1102
|
+
void SerializeString(const unsigned char* s);
|
1103
|
+
void SerializeStrings();
|
1104
|
+
void SortHashMap(HashMap* map, List<HashMap::Entry*>* sorted_entries);
|
1105
|
+
|
1106
|
+
HeapSnapshot* snapshot_;
|
1107
|
+
HashMap nodes_;
|
1108
|
+
HashMap strings_;
|
1109
|
+
int next_node_id_;
|
1110
|
+
int next_string_id_;
|
1111
|
+
OutputStreamWriter* writer_;
|
1112
|
+
|
1113
|
+
friend class HeapSnapshotJSONSerializerEnumerator;
|
1114
|
+
friend class HeapSnapshotJSONSerializerIterator;
|
1115
|
+
|
1116
|
+
DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer);
|
1117
|
+
};
|
1118
|
+
|
1119
|
+
|
1120
|
+
String* GetConstructorNameForHeapProfile(JSObject* object);
|
1121
|
+
|
1122
|
+
} } // namespace v8::internal
|
1123
|
+
|
1124
|
+
#endif // ENABLE_LOGGING_AND_PROFILING
|
1125
|
+
|
1126
|
+
#endif // V8_PROFILE_GENERATOR_H_
|