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,2268 @@
|
|
1
|
+
// Copyright 2011 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#ifndef V8_HEAP_H_
|
29
|
+
#define V8_HEAP_H_
|
30
|
+
|
31
|
+
#include <math.h>
|
32
|
+
|
33
|
+
#include "allocation.h"
|
34
|
+
#include "globals.h"
|
35
|
+
#include "list.h"
|
36
|
+
#include "mark-compact.h"
|
37
|
+
#include "spaces.h"
|
38
|
+
#include "splay-tree-inl.h"
|
39
|
+
#include "v8-counters.h"
|
40
|
+
|
41
|
+
namespace v8 {
|
42
|
+
namespace internal {
|
43
|
+
|
44
|
+
// TODO(isolates): remove HEAP here
|
45
|
+
#define HEAP (_inline_get_heap_())
|
46
|
+
class Heap;
|
47
|
+
inline Heap* _inline_get_heap_();
|
48
|
+
|
49
|
+
|
50
|
+
// Defines all the roots in Heap.
|
51
|
+
#define STRONG_ROOT_LIST(V) \
|
52
|
+
/* Put the byte array map early. We need it to be in place by the time */ \
|
53
|
+
/* the deserializer hits the next page, since it wants to put a byte */ \
|
54
|
+
/* array in the unused space at the end of the page. */ \
|
55
|
+
V(Map, byte_array_map, ByteArrayMap) \
|
56
|
+
V(Map, one_pointer_filler_map, OnePointerFillerMap) \
|
57
|
+
V(Map, two_pointer_filler_map, TwoPointerFillerMap) \
|
58
|
+
/* Cluster the most popular ones in a few cache lines here at the top. */ \
|
59
|
+
V(Object, undefined_value, UndefinedValue) \
|
60
|
+
V(Object, the_hole_value, TheHoleValue) \
|
61
|
+
V(Object, null_value, NullValue) \
|
62
|
+
V(Object, true_value, TrueValue) \
|
63
|
+
V(Object, false_value, FalseValue) \
|
64
|
+
V(Object, arguments_marker, ArgumentsMarker) \
|
65
|
+
V(Map, heap_number_map, HeapNumberMap) \
|
66
|
+
V(Map, global_context_map, GlobalContextMap) \
|
67
|
+
V(Map, fixed_array_map, FixedArrayMap) \
|
68
|
+
V(Map, fixed_cow_array_map, FixedCOWArrayMap) \
|
69
|
+
V(Object, no_interceptor_result_sentinel, NoInterceptorResultSentinel) \
|
70
|
+
V(Map, meta_map, MetaMap) \
|
71
|
+
V(Map, hash_table_map, HashTableMap) \
|
72
|
+
V(Smi, stack_limit, StackLimit) \
|
73
|
+
V(FixedArray, number_string_cache, NumberStringCache) \
|
74
|
+
V(Object, instanceof_cache_function, InstanceofCacheFunction) \
|
75
|
+
V(Object, instanceof_cache_map, InstanceofCacheMap) \
|
76
|
+
V(Object, instanceof_cache_answer, InstanceofCacheAnswer) \
|
77
|
+
V(FixedArray, single_character_string_cache, SingleCharacterStringCache) \
|
78
|
+
V(Object, termination_exception, TerminationException) \
|
79
|
+
V(FixedArray, empty_fixed_array, EmptyFixedArray) \
|
80
|
+
V(ByteArray, empty_byte_array, EmptyByteArray) \
|
81
|
+
V(String, empty_string, EmptyString) \
|
82
|
+
V(DescriptorArray, empty_descriptor_array, EmptyDescriptorArray) \
|
83
|
+
V(Map, string_map, StringMap) \
|
84
|
+
V(Map, ascii_string_map, AsciiStringMap) \
|
85
|
+
V(Map, symbol_map, SymbolMap) \
|
86
|
+
V(Map, cons_string_map, ConsStringMap) \
|
87
|
+
V(Map, cons_ascii_string_map, ConsAsciiStringMap) \
|
88
|
+
V(Map, ascii_symbol_map, AsciiSymbolMap) \
|
89
|
+
V(Map, cons_symbol_map, ConsSymbolMap) \
|
90
|
+
V(Map, cons_ascii_symbol_map, ConsAsciiSymbolMap) \
|
91
|
+
V(Map, external_symbol_map, ExternalSymbolMap) \
|
92
|
+
V(Map, external_symbol_with_ascii_data_map, ExternalSymbolWithAsciiDataMap) \
|
93
|
+
V(Map, external_ascii_symbol_map, ExternalAsciiSymbolMap) \
|
94
|
+
V(Map, external_string_map, ExternalStringMap) \
|
95
|
+
V(Map, external_string_with_ascii_data_map, ExternalStringWithAsciiDataMap) \
|
96
|
+
V(Map, external_ascii_string_map, ExternalAsciiStringMap) \
|
97
|
+
V(Map, undetectable_string_map, UndetectableStringMap) \
|
98
|
+
V(Map, undetectable_ascii_string_map, UndetectableAsciiStringMap) \
|
99
|
+
V(Map, external_pixel_array_map, ExternalPixelArrayMap) \
|
100
|
+
V(Map, external_byte_array_map, ExternalByteArrayMap) \
|
101
|
+
V(Map, external_unsigned_byte_array_map, ExternalUnsignedByteArrayMap) \
|
102
|
+
V(Map, external_short_array_map, ExternalShortArrayMap) \
|
103
|
+
V(Map, external_unsigned_short_array_map, ExternalUnsignedShortArrayMap) \
|
104
|
+
V(Map, external_int_array_map, ExternalIntArrayMap) \
|
105
|
+
V(Map, external_unsigned_int_array_map, ExternalUnsignedIntArrayMap) \
|
106
|
+
V(Map, external_float_array_map, ExternalFloatArrayMap) \
|
107
|
+
V(Map, external_double_array_map, ExternalDoubleArrayMap) \
|
108
|
+
V(Map, context_map, ContextMap) \
|
109
|
+
V(Map, catch_context_map, CatchContextMap) \
|
110
|
+
V(Map, code_map, CodeMap) \
|
111
|
+
V(Map, oddball_map, OddballMap) \
|
112
|
+
V(Map, global_property_cell_map, GlobalPropertyCellMap) \
|
113
|
+
V(Map, shared_function_info_map, SharedFunctionInfoMap) \
|
114
|
+
V(Map, message_object_map, JSMessageObjectMap) \
|
115
|
+
V(Map, foreign_map, ForeignMap) \
|
116
|
+
V(Object, nan_value, NanValue) \
|
117
|
+
V(Object, minus_zero_value, MinusZeroValue) \
|
118
|
+
V(Map, neander_map, NeanderMap) \
|
119
|
+
V(JSObject, message_listeners, MessageListeners) \
|
120
|
+
V(Foreign, prototype_accessors, PrototypeAccessors) \
|
121
|
+
V(NumberDictionary, code_stubs, CodeStubs) \
|
122
|
+
V(NumberDictionary, non_monomorphic_cache, NonMonomorphicCache) \
|
123
|
+
V(Code, js_entry_code, JsEntryCode) \
|
124
|
+
V(Code, js_construct_entry_code, JsConstructEntryCode) \
|
125
|
+
V(FixedArray, natives_source_cache, NativesSourceCache) \
|
126
|
+
V(Object, last_script_id, LastScriptId) \
|
127
|
+
V(Script, empty_script, EmptyScript) \
|
128
|
+
V(Smi, real_stack_limit, RealStackLimit) \
|
129
|
+
V(StringDictionary, intrinsic_function_names, IntrinsicFunctionNames) \
|
130
|
+
|
131
|
+
#define ROOT_LIST(V) \
|
132
|
+
STRONG_ROOT_LIST(V) \
|
133
|
+
V(SymbolTable, symbol_table, SymbolTable)
|
134
|
+
|
135
|
+
#define SYMBOL_LIST(V) \
|
136
|
+
V(Array_symbol, "Array") \
|
137
|
+
V(Object_symbol, "Object") \
|
138
|
+
V(Proto_symbol, "__proto__") \
|
139
|
+
V(StringImpl_symbol, "StringImpl") \
|
140
|
+
V(arguments_symbol, "arguments") \
|
141
|
+
V(Arguments_symbol, "Arguments") \
|
142
|
+
V(arguments_shadow_symbol, ".arguments") \
|
143
|
+
V(call_symbol, "call") \
|
144
|
+
V(apply_symbol, "apply") \
|
145
|
+
V(caller_symbol, "caller") \
|
146
|
+
V(boolean_symbol, "boolean") \
|
147
|
+
V(Boolean_symbol, "Boolean") \
|
148
|
+
V(callee_symbol, "callee") \
|
149
|
+
V(constructor_symbol, "constructor") \
|
150
|
+
V(code_symbol, ".code") \
|
151
|
+
V(result_symbol, ".result") \
|
152
|
+
V(catch_var_symbol, ".catch-var") \
|
153
|
+
V(empty_symbol, "") \
|
154
|
+
V(eval_symbol, "eval") \
|
155
|
+
V(function_symbol, "function") \
|
156
|
+
V(length_symbol, "length") \
|
157
|
+
V(name_symbol, "name") \
|
158
|
+
V(number_symbol, "number") \
|
159
|
+
V(Number_symbol, "Number") \
|
160
|
+
V(nan_symbol, "NaN") \
|
161
|
+
V(RegExp_symbol, "RegExp") \
|
162
|
+
V(source_symbol, "source") \
|
163
|
+
V(global_symbol, "global") \
|
164
|
+
V(ignore_case_symbol, "ignoreCase") \
|
165
|
+
V(multiline_symbol, "multiline") \
|
166
|
+
V(input_symbol, "input") \
|
167
|
+
V(index_symbol, "index") \
|
168
|
+
V(last_index_symbol, "lastIndex") \
|
169
|
+
V(object_symbol, "object") \
|
170
|
+
V(prototype_symbol, "prototype") \
|
171
|
+
V(string_symbol, "string") \
|
172
|
+
V(String_symbol, "String") \
|
173
|
+
V(Date_symbol, "Date") \
|
174
|
+
V(this_symbol, "this") \
|
175
|
+
V(to_string_symbol, "toString") \
|
176
|
+
V(char_at_symbol, "CharAt") \
|
177
|
+
V(undefined_symbol, "undefined") \
|
178
|
+
V(value_of_symbol, "valueOf") \
|
179
|
+
V(InitializeVarGlobal_symbol, "InitializeVarGlobal") \
|
180
|
+
V(InitializeConstGlobal_symbol, "InitializeConstGlobal") \
|
181
|
+
V(KeyedLoadSpecializedMonomorphic_symbol, \
|
182
|
+
"KeyedLoadSpecializedMonomorphic") \
|
183
|
+
V(KeyedLoadSpecializedPolymorphic_symbol, \
|
184
|
+
"KeyedLoadSpecializedPolymorphic") \
|
185
|
+
V(KeyedStoreSpecializedMonomorphic_symbol, \
|
186
|
+
"KeyedStoreSpecializedMonomorphic") \
|
187
|
+
V(KeyedStoreSpecializedPolymorphic_symbol, \
|
188
|
+
"KeyedStoreSpecializedPolymorphic") \
|
189
|
+
V(stack_overflow_symbol, "kStackOverflowBoilerplate") \
|
190
|
+
V(illegal_access_symbol, "illegal access") \
|
191
|
+
V(out_of_memory_symbol, "out-of-memory") \
|
192
|
+
V(illegal_execution_state_symbol, "illegal execution state") \
|
193
|
+
V(get_symbol, "get") \
|
194
|
+
V(set_symbol, "set") \
|
195
|
+
V(function_class_symbol, "Function") \
|
196
|
+
V(illegal_argument_symbol, "illegal argument") \
|
197
|
+
V(MakeReferenceError_symbol, "MakeReferenceError") \
|
198
|
+
V(MakeSyntaxError_symbol, "MakeSyntaxError") \
|
199
|
+
V(MakeTypeError_symbol, "MakeTypeError") \
|
200
|
+
V(invalid_lhs_in_assignment_symbol, "invalid_lhs_in_assignment") \
|
201
|
+
V(invalid_lhs_in_for_in_symbol, "invalid_lhs_in_for_in") \
|
202
|
+
V(invalid_lhs_in_postfix_op_symbol, "invalid_lhs_in_postfix_op") \
|
203
|
+
V(invalid_lhs_in_prefix_op_symbol, "invalid_lhs_in_prefix_op") \
|
204
|
+
V(illegal_return_symbol, "illegal_return") \
|
205
|
+
V(illegal_break_symbol, "illegal_break") \
|
206
|
+
V(illegal_continue_symbol, "illegal_continue") \
|
207
|
+
V(unknown_label_symbol, "unknown_label") \
|
208
|
+
V(redeclaration_symbol, "redeclaration") \
|
209
|
+
V(failure_symbol, "<failure>") \
|
210
|
+
V(space_symbol, " ") \
|
211
|
+
V(exec_symbol, "exec") \
|
212
|
+
V(zero_symbol, "0") \
|
213
|
+
V(global_eval_symbol, "GlobalEval") \
|
214
|
+
V(identity_hash_symbol, "v8::IdentityHash") \
|
215
|
+
V(closure_symbol, "(closure)") \
|
216
|
+
V(use_strict, "use strict")
|
217
|
+
|
218
|
+
// Forward declarations.
|
219
|
+
class GCTracer;
|
220
|
+
class HeapStats;
|
221
|
+
class Isolate;
|
222
|
+
class WeakObjectRetainer;
|
223
|
+
|
224
|
+
|
225
|
+
typedef String* (*ExternalStringTableUpdaterCallback)(Heap* heap,
|
226
|
+
Object** pointer);
|
227
|
+
|
228
|
+
typedef bool (*DirtyRegionCallback)(Heap* heap,
|
229
|
+
Address start,
|
230
|
+
Address end,
|
231
|
+
ObjectSlotCallback copy_object_func);
|
232
|
+
|
233
|
+
|
234
|
+
// The all static Heap captures the interface to the global object heap.
|
235
|
+
// All JavaScript contexts by this process share the same object heap.
|
236
|
+
|
237
|
+
#ifdef DEBUG
|
238
|
+
class HeapDebugUtils;
|
239
|
+
#endif
|
240
|
+
|
241
|
+
|
242
|
+
// A queue of objects promoted during scavenge. Each object is accompanied
|
243
|
+
// by it's size to avoid dereferencing a map pointer for scanning.
|
244
|
+
class PromotionQueue {
|
245
|
+
public:
|
246
|
+
PromotionQueue() : front_(NULL), rear_(NULL) { }
|
247
|
+
|
248
|
+
void Initialize(Address start_address) {
|
249
|
+
front_ = rear_ = reinterpret_cast<intptr_t*>(start_address);
|
250
|
+
}
|
251
|
+
|
252
|
+
bool is_empty() { return front_ <= rear_; }
|
253
|
+
|
254
|
+
inline void insert(HeapObject* target, int size);
|
255
|
+
|
256
|
+
void remove(HeapObject** target, int* size) {
|
257
|
+
*target = reinterpret_cast<HeapObject*>(*(--front_));
|
258
|
+
*size = static_cast<int>(*(--front_));
|
259
|
+
// Assert no underflow.
|
260
|
+
ASSERT(front_ >= rear_);
|
261
|
+
}
|
262
|
+
|
263
|
+
private:
|
264
|
+
// The front of the queue is higher in memory than the rear.
|
265
|
+
intptr_t* front_;
|
266
|
+
intptr_t* rear_;
|
267
|
+
|
268
|
+
DISALLOW_COPY_AND_ASSIGN(PromotionQueue);
|
269
|
+
};
|
270
|
+
|
271
|
+
|
272
|
+
// External strings table is a place where all external strings are
|
273
|
+
// registered. We need to keep track of such strings to properly
|
274
|
+
// finalize them.
|
275
|
+
class ExternalStringTable {
|
276
|
+
public:
|
277
|
+
// Registers an external string.
|
278
|
+
inline void AddString(String* string);
|
279
|
+
|
280
|
+
inline void Iterate(ObjectVisitor* v);
|
281
|
+
|
282
|
+
// Restores internal invariant and gets rid of collected strings.
|
283
|
+
// Must be called after each Iterate() that modified the strings.
|
284
|
+
void CleanUp();
|
285
|
+
|
286
|
+
// Destroys all allocated memory.
|
287
|
+
void TearDown();
|
288
|
+
|
289
|
+
private:
|
290
|
+
ExternalStringTable() { }
|
291
|
+
|
292
|
+
friend class Heap;
|
293
|
+
|
294
|
+
inline void Verify();
|
295
|
+
|
296
|
+
inline void AddOldString(String* string);
|
297
|
+
|
298
|
+
// Notifies the table that only a prefix of the new list is valid.
|
299
|
+
inline void ShrinkNewStrings(int position);
|
300
|
+
|
301
|
+
// To speed up scavenge collections new space string are kept
|
302
|
+
// separate from old space strings.
|
303
|
+
List<Object*> new_space_strings_;
|
304
|
+
List<Object*> old_space_strings_;
|
305
|
+
|
306
|
+
Heap* heap_;
|
307
|
+
|
308
|
+
DISALLOW_COPY_AND_ASSIGN(ExternalStringTable);
|
309
|
+
};
|
310
|
+
|
311
|
+
|
312
|
+
class Heap {
|
313
|
+
public:
|
314
|
+
// Configure heap size before setup. Return false if the heap has been
|
315
|
+
// setup already.
|
316
|
+
bool ConfigureHeap(int max_semispace_size,
|
317
|
+
int max_old_gen_size,
|
318
|
+
int max_executable_size);
|
319
|
+
bool ConfigureHeapDefault();
|
320
|
+
|
321
|
+
// Initializes the global object heap. If create_heap_objects is true,
|
322
|
+
// also creates the basic non-mutable objects.
|
323
|
+
// Returns whether it succeeded.
|
324
|
+
bool Setup(bool create_heap_objects);
|
325
|
+
|
326
|
+
// Destroys all memory allocated by the heap.
|
327
|
+
void TearDown();
|
328
|
+
|
329
|
+
// Set the stack limit in the roots_ array. Some architectures generate
|
330
|
+
// code that looks here, because it is faster than loading from the static
|
331
|
+
// jslimit_/real_jslimit_ variable in the StackGuard.
|
332
|
+
void SetStackLimits();
|
333
|
+
|
334
|
+
// Returns whether Setup has been called.
|
335
|
+
bool HasBeenSetup();
|
336
|
+
|
337
|
+
// Returns the maximum amount of memory reserved for the heap. For
|
338
|
+
// the young generation, we reserve 4 times the amount needed for a
|
339
|
+
// semi space. The young generation consists of two semi spaces and
|
340
|
+
// we reserve twice the amount needed for those in order to ensure
|
341
|
+
// that new space can be aligned to its size.
|
342
|
+
intptr_t MaxReserved() {
|
343
|
+
return 4 * reserved_semispace_size_ + max_old_generation_size_;
|
344
|
+
}
|
345
|
+
int MaxSemiSpaceSize() { return max_semispace_size_; }
|
346
|
+
int ReservedSemiSpaceSize() { return reserved_semispace_size_; }
|
347
|
+
int InitialSemiSpaceSize() { return initial_semispace_size_; }
|
348
|
+
intptr_t MaxOldGenerationSize() { return max_old_generation_size_; }
|
349
|
+
intptr_t MaxExecutableSize() { return max_executable_size_; }
|
350
|
+
|
351
|
+
// Returns the capacity of the heap in bytes w/o growing. Heap grows when
|
352
|
+
// more spaces are needed until it reaches the limit.
|
353
|
+
intptr_t Capacity();
|
354
|
+
|
355
|
+
// Returns the amount of memory currently committed for the heap.
|
356
|
+
intptr_t CommittedMemory();
|
357
|
+
|
358
|
+
// Returns the amount of executable memory currently committed for the heap.
|
359
|
+
intptr_t CommittedMemoryExecutable();
|
360
|
+
|
361
|
+
// Returns the available bytes in space w/o growing.
|
362
|
+
// Heap doesn't guarantee that it can allocate an object that requires
|
363
|
+
// all available bytes. Check MaxHeapObjectSize() instead.
|
364
|
+
intptr_t Available();
|
365
|
+
|
366
|
+
// Returns the maximum object size in paged space.
|
367
|
+
inline int MaxObjectSizeInPagedSpace();
|
368
|
+
|
369
|
+
// Returns of size of all objects residing in the heap.
|
370
|
+
intptr_t SizeOfObjects();
|
371
|
+
|
372
|
+
// Return the starting address and a mask for the new space. And-masking an
|
373
|
+
// address with the mask will result in the start address of the new space
|
374
|
+
// for all addresses in either semispace.
|
375
|
+
Address NewSpaceStart() { return new_space_.start(); }
|
376
|
+
uintptr_t NewSpaceMask() { return new_space_.mask(); }
|
377
|
+
Address NewSpaceTop() { return new_space_.top(); }
|
378
|
+
|
379
|
+
NewSpace* new_space() { return &new_space_; }
|
380
|
+
OldSpace* old_pointer_space() { return old_pointer_space_; }
|
381
|
+
OldSpace* old_data_space() { return old_data_space_; }
|
382
|
+
OldSpace* code_space() { return code_space_; }
|
383
|
+
MapSpace* map_space() { return map_space_; }
|
384
|
+
CellSpace* cell_space() { return cell_space_; }
|
385
|
+
LargeObjectSpace* lo_space() { return lo_space_; }
|
386
|
+
|
387
|
+
bool always_allocate() { return always_allocate_scope_depth_ != 0; }
|
388
|
+
Address always_allocate_scope_depth_address() {
|
389
|
+
return reinterpret_cast<Address>(&always_allocate_scope_depth_);
|
390
|
+
}
|
391
|
+
bool linear_allocation() {
|
392
|
+
return linear_allocation_scope_depth_ != 0;
|
393
|
+
}
|
394
|
+
|
395
|
+
Address* NewSpaceAllocationTopAddress() {
|
396
|
+
return new_space_.allocation_top_address();
|
397
|
+
}
|
398
|
+
Address* NewSpaceAllocationLimitAddress() {
|
399
|
+
return new_space_.allocation_limit_address();
|
400
|
+
}
|
401
|
+
|
402
|
+
// Uncommit unused semi space.
|
403
|
+
bool UncommitFromSpace() { return new_space_.UncommitFromSpace(); }
|
404
|
+
|
405
|
+
#ifdef ENABLE_HEAP_PROTECTION
|
406
|
+
// Protect/unprotect the heap by marking all spaces read-only/writable.
|
407
|
+
void Protect();
|
408
|
+
void Unprotect();
|
409
|
+
#endif
|
410
|
+
|
411
|
+
// Allocates and initializes a new JavaScript object based on a
|
412
|
+
// constructor.
|
413
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
414
|
+
// failed.
|
415
|
+
// Please note this does not perform a garbage collection.
|
416
|
+
MUST_USE_RESULT MaybeObject* AllocateJSObject(
|
417
|
+
JSFunction* constructor, PretenureFlag pretenure = NOT_TENURED);
|
418
|
+
|
419
|
+
// Allocates and initializes a new global object based on a constructor.
|
420
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
421
|
+
// failed.
|
422
|
+
// Please note this does not perform a garbage collection.
|
423
|
+
MUST_USE_RESULT MaybeObject* AllocateGlobalObject(JSFunction* constructor);
|
424
|
+
|
425
|
+
// Returns a deep copy of the JavaScript object.
|
426
|
+
// Properties and elements are copied too.
|
427
|
+
// Returns failure if allocation failed.
|
428
|
+
MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source);
|
429
|
+
|
430
|
+
// Allocates the function prototype.
|
431
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
432
|
+
// failed.
|
433
|
+
// Please note this does not perform a garbage collection.
|
434
|
+
MUST_USE_RESULT MaybeObject* AllocateFunctionPrototype(JSFunction* function);
|
435
|
+
|
436
|
+
// Allocates a Harmony Proxy.
|
437
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
438
|
+
// failed.
|
439
|
+
// Please note this does not perform a garbage collection.
|
440
|
+
MUST_USE_RESULT MaybeObject* AllocateJSProxy(Object* handler,
|
441
|
+
Object* prototype);
|
442
|
+
|
443
|
+
// Reinitialize an JSGlobalProxy based on a constructor. The object
|
444
|
+
// must have the same size as objects allocated using the
|
445
|
+
// constructor. The object is reinitialized and behaves as an
|
446
|
+
// object that has been freshly allocated using the constructor.
|
447
|
+
MUST_USE_RESULT MaybeObject* ReinitializeJSGlobalProxy(
|
448
|
+
JSFunction* constructor, JSGlobalProxy* global);
|
449
|
+
|
450
|
+
// Allocates and initializes a new JavaScript object based on a map.
|
451
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
452
|
+
// failed.
|
453
|
+
// Please note this does not perform a garbage collection.
|
454
|
+
MUST_USE_RESULT MaybeObject* AllocateJSObjectFromMap(
|
455
|
+
Map* map, PretenureFlag pretenure = NOT_TENURED);
|
456
|
+
|
457
|
+
// Allocates a heap object based on the map.
|
458
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
459
|
+
// failed.
|
460
|
+
// Please note this function does not perform a garbage collection.
|
461
|
+
MUST_USE_RESULT MaybeObject* Allocate(Map* map, AllocationSpace space);
|
462
|
+
|
463
|
+
// Allocates a JS Map in the heap.
|
464
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
465
|
+
// failed.
|
466
|
+
// Please note this function does not perform a garbage collection.
|
467
|
+
MUST_USE_RESULT MaybeObject* AllocateMap(InstanceType instance_type,
|
468
|
+
int instance_size);
|
469
|
+
|
470
|
+
// Allocates a partial map for bootstrapping.
|
471
|
+
MUST_USE_RESULT MaybeObject* AllocatePartialMap(InstanceType instance_type,
|
472
|
+
int instance_size);
|
473
|
+
|
474
|
+
// Allocate a map for the specified function
|
475
|
+
MUST_USE_RESULT MaybeObject* AllocateInitialMap(JSFunction* fun);
|
476
|
+
|
477
|
+
// Allocates an empty code cache.
|
478
|
+
MUST_USE_RESULT MaybeObject* AllocateCodeCache();
|
479
|
+
|
480
|
+
// Clear the Instanceof cache (used when a prototype changes).
|
481
|
+
inline void ClearInstanceofCache();
|
482
|
+
|
483
|
+
// Allocates and fully initializes a String. There are two String
|
484
|
+
// encodings: ASCII and two byte. One should choose between the three string
|
485
|
+
// allocation functions based on the encoding of the string buffer used to
|
486
|
+
// initialized the string.
|
487
|
+
// - ...FromAscii initializes the string from a buffer that is ASCII
|
488
|
+
// encoded (it does not check that the buffer is ASCII encoded) and the
|
489
|
+
// result will be ASCII encoded.
|
490
|
+
// - ...FromUTF8 initializes the string from a buffer that is UTF-8
|
491
|
+
// encoded. If the characters are all single-byte characters, the
|
492
|
+
// result will be ASCII encoded, otherwise it will converted to two
|
493
|
+
// byte.
|
494
|
+
// - ...FromTwoByte initializes the string from a buffer that is two-byte
|
495
|
+
// encoded. If the characters are all single-byte characters, the
|
496
|
+
// result will be converted to ASCII, otherwise it will be left as
|
497
|
+
// two-byte.
|
498
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
499
|
+
// failed.
|
500
|
+
// Please note this does not perform a garbage collection.
|
501
|
+
MUST_USE_RESULT MaybeObject* AllocateStringFromAscii(
|
502
|
+
Vector<const char> str,
|
503
|
+
PretenureFlag pretenure = NOT_TENURED);
|
504
|
+
MUST_USE_RESULT inline MaybeObject* AllocateStringFromUtf8(
|
505
|
+
Vector<const char> str,
|
506
|
+
PretenureFlag pretenure = NOT_TENURED);
|
507
|
+
MUST_USE_RESULT MaybeObject* AllocateStringFromUtf8Slow(
|
508
|
+
Vector<const char> str,
|
509
|
+
PretenureFlag pretenure = NOT_TENURED);
|
510
|
+
MUST_USE_RESULT MaybeObject* AllocateStringFromTwoByte(
|
511
|
+
Vector<const uc16> str,
|
512
|
+
PretenureFlag pretenure = NOT_TENURED);
|
513
|
+
|
514
|
+
// Allocates a symbol in old space based on the character stream.
|
515
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
516
|
+
// failed.
|
517
|
+
// Please note this function does not perform a garbage collection.
|
518
|
+
MUST_USE_RESULT inline MaybeObject* AllocateSymbol(Vector<const char> str,
|
519
|
+
int chars,
|
520
|
+
uint32_t hash_field);
|
521
|
+
|
522
|
+
MUST_USE_RESULT inline MaybeObject* AllocateAsciiSymbol(
|
523
|
+
Vector<const char> str,
|
524
|
+
uint32_t hash_field);
|
525
|
+
|
526
|
+
MUST_USE_RESULT inline MaybeObject* AllocateTwoByteSymbol(
|
527
|
+
Vector<const uc16> str,
|
528
|
+
uint32_t hash_field);
|
529
|
+
|
530
|
+
MUST_USE_RESULT MaybeObject* AllocateInternalSymbol(
|
531
|
+
unibrow::CharacterStream* buffer, int chars, uint32_t hash_field);
|
532
|
+
|
533
|
+
MUST_USE_RESULT MaybeObject* AllocateExternalSymbol(
|
534
|
+
Vector<const char> str,
|
535
|
+
int chars);
|
536
|
+
|
537
|
+
// Allocates and partially initializes a String. There are two String
|
538
|
+
// encodings: ASCII and two byte. These functions allocate a string of the
|
539
|
+
// given length and set its map and length fields. The characters of the
|
540
|
+
// string are uninitialized.
|
541
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
542
|
+
// failed.
|
543
|
+
// Please note this does not perform a garbage collection.
|
544
|
+
MUST_USE_RESULT MaybeObject* AllocateRawAsciiString(
|
545
|
+
int length,
|
546
|
+
PretenureFlag pretenure = NOT_TENURED);
|
547
|
+
MUST_USE_RESULT MaybeObject* AllocateRawTwoByteString(
|
548
|
+
int length,
|
549
|
+
PretenureFlag pretenure = NOT_TENURED);
|
550
|
+
|
551
|
+
// Computes a single character string where the character has code.
|
552
|
+
// A cache is used for ascii codes.
|
553
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
554
|
+
// failed. Please note this does not perform a garbage collection.
|
555
|
+
MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode(
|
556
|
+
uint16_t code);
|
557
|
+
|
558
|
+
// Allocate a byte array of the specified length
|
559
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
560
|
+
// failed.
|
561
|
+
// Please note this does not perform a garbage collection.
|
562
|
+
MUST_USE_RESULT MaybeObject* AllocateByteArray(int length,
|
563
|
+
PretenureFlag pretenure);
|
564
|
+
|
565
|
+
// Allocate a non-tenured byte array of the specified length
|
566
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
567
|
+
// failed.
|
568
|
+
// Please note this does not perform a garbage collection.
|
569
|
+
MUST_USE_RESULT MaybeObject* AllocateByteArray(int length);
|
570
|
+
|
571
|
+
// Allocates an external array of the specified length and type.
|
572
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
573
|
+
// failed.
|
574
|
+
// Please note this does not perform a garbage collection.
|
575
|
+
MUST_USE_RESULT MaybeObject* AllocateExternalArray(
|
576
|
+
int length,
|
577
|
+
ExternalArrayType array_type,
|
578
|
+
void* external_pointer,
|
579
|
+
PretenureFlag pretenure);
|
580
|
+
|
581
|
+
// Allocate a tenured JS global property cell.
|
582
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
583
|
+
// failed.
|
584
|
+
// Please note this does not perform a garbage collection.
|
585
|
+
MUST_USE_RESULT MaybeObject* AllocateJSGlobalPropertyCell(Object* value);
|
586
|
+
|
587
|
+
// Allocates a fixed array initialized with undefined values
|
588
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
589
|
+
// failed.
|
590
|
+
// Please note this does not perform a garbage collection.
|
591
|
+
MUST_USE_RESULT MaybeObject* AllocateFixedArray(int length,
|
592
|
+
PretenureFlag pretenure);
|
593
|
+
// Allocates a fixed array initialized with undefined values
|
594
|
+
MUST_USE_RESULT MaybeObject* AllocateFixedArray(int length);
|
595
|
+
|
596
|
+
// Allocates an uninitialized fixed array. It must be filled by the caller.
|
597
|
+
//
|
598
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
599
|
+
// failed.
|
600
|
+
// Please note this does not perform a garbage collection.
|
601
|
+
MUST_USE_RESULT MaybeObject* AllocateUninitializedFixedArray(int length);
|
602
|
+
|
603
|
+
// Make a copy of src and return it. Returns
|
604
|
+
// Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
|
605
|
+
MUST_USE_RESULT inline MaybeObject* CopyFixedArray(FixedArray* src);
|
606
|
+
|
607
|
+
// Make a copy of src, set the map, and return the copy. Returns
|
608
|
+
// Failure::RetryAfterGC(requested_bytes, space) if the allocation failed.
|
609
|
+
MUST_USE_RESULT MaybeObject* CopyFixedArrayWithMap(FixedArray* src, Map* map);
|
610
|
+
|
611
|
+
// Allocates a fixed array initialized with the hole values.
|
612
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
613
|
+
// failed.
|
614
|
+
// Please note this does not perform a garbage collection.
|
615
|
+
MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithHoles(
|
616
|
+
int length,
|
617
|
+
PretenureFlag pretenure = NOT_TENURED);
|
618
|
+
|
619
|
+
// AllocateHashTable is identical to AllocateFixedArray except
|
620
|
+
// that the resulting object has hash_table_map as map.
|
621
|
+
MUST_USE_RESULT MaybeObject* AllocateHashTable(
|
622
|
+
int length, PretenureFlag pretenure = NOT_TENURED);
|
623
|
+
|
624
|
+
// Allocate a global (but otherwise uninitialized) context.
|
625
|
+
MUST_USE_RESULT MaybeObject* AllocateGlobalContext();
|
626
|
+
|
627
|
+
// Allocate a function context.
|
628
|
+
MUST_USE_RESULT MaybeObject* AllocateFunctionContext(int length,
|
629
|
+
JSFunction* closure);
|
630
|
+
|
631
|
+
// Allocate a 'with' context.
|
632
|
+
MUST_USE_RESULT MaybeObject* AllocateWithContext(Context* previous,
|
633
|
+
JSObject* extension,
|
634
|
+
bool is_catch_context);
|
635
|
+
|
636
|
+
// Allocates a new utility object in the old generation.
|
637
|
+
MUST_USE_RESULT MaybeObject* AllocateStruct(InstanceType type);
|
638
|
+
|
639
|
+
// Allocates a function initialized with a shared part.
|
640
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
641
|
+
// failed.
|
642
|
+
// Please note this does not perform a garbage collection.
|
643
|
+
MUST_USE_RESULT MaybeObject* AllocateFunction(
|
644
|
+
Map* function_map,
|
645
|
+
SharedFunctionInfo* shared,
|
646
|
+
Object* prototype,
|
647
|
+
PretenureFlag pretenure = TENURED);
|
648
|
+
|
649
|
+
// Arguments object size.
|
650
|
+
static const int kArgumentsObjectSize =
|
651
|
+
JSObject::kHeaderSize + 2 * kPointerSize;
|
652
|
+
// Strict mode arguments has no callee so it is smaller.
|
653
|
+
static const int kArgumentsObjectSizeStrict =
|
654
|
+
JSObject::kHeaderSize + 1 * kPointerSize;
|
655
|
+
// Indicies for direct access into argument objects.
|
656
|
+
static const int kArgumentsLengthIndex = 0;
|
657
|
+
// callee is only valid in non-strict mode.
|
658
|
+
static const int kArgumentsCalleeIndex = 1;
|
659
|
+
|
660
|
+
// Allocates an arguments object - optionally with an elements array.
|
661
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
662
|
+
// failed.
|
663
|
+
// Please note this does not perform a garbage collection.
|
664
|
+
MUST_USE_RESULT MaybeObject* AllocateArgumentsObject(
|
665
|
+
Object* callee, int length);
|
666
|
+
|
667
|
+
// Same as NewNumberFromDouble, but may return a preallocated/immutable
|
668
|
+
// number object (e.g., minus_zero_value_, nan_value_)
|
669
|
+
MUST_USE_RESULT MaybeObject* NumberFromDouble(
|
670
|
+
double value, PretenureFlag pretenure = NOT_TENURED);
|
671
|
+
|
672
|
+
// Allocated a HeapNumber from value.
|
673
|
+
MUST_USE_RESULT MaybeObject* AllocateHeapNumber(
|
674
|
+
double value,
|
675
|
+
PretenureFlag pretenure);
|
676
|
+
// pretenure = NOT_TENURED
|
677
|
+
MUST_USE_RESULT MaybeObject* AllocateHeapNumber(double value);
|
678
|
+
|
679
|
+
// Converts an int into either a Smi or a HeapNumber object.
|
680
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
681
|
+
// failed.
|
682
|
+
// Please note this does not perform a garbage collection.
|
683
|
+
MUST_USE_RESULT inline MaybeObject* NumberFromInt32(int32_t value);
|
684
|
+
|
685
|
+
// Converts an int into either a Smi or a HeapNumber object.
|
686
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
687
|
+
// failed.
|
688
|
+
// Please note this does not perform a garbage collection.
|
689
|
+
MUST_USE_RESULT inline MaybeObject* NumberFromUint32(uint32_t value);
|
690
|
+
|
691
|
+
// Allocates a new foreign object.
|
692
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
693
|
+
// failed.
|
694
|
+
// Please note this does not perform a garbage collection.
|
695
|
+
MUST_USE_RESULT MaybeObject* AllocateForeign(
|
696
|
+
Address address, PretenureFlag pretenure = NOT_TENURED);
|
697
|
+
|
698
|
+
// Allocates a new SharedFunctionInfo object.
|
699
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
700
|
+
// failed.
|
701
|
+
// Please note this does not perform a garbage collection.
|
702
|
+
MUST_USE_RESULT MaybeObject* AllocateSharedFunctionInfo(Object* name);
|
703
|
+
|
704
|
+
// Allocates a new JSMessageObject object.
|
705
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
706
|
+
// failed.
|
707
|
+
// Please note that this does not perform a garbage collection.
|
708
|
+
MUST_USE_RESULT MaybeObject* AllocateJSMessageObject(
|
709
|
+
String* type,
|
710
|
+
JSArray* arguments,
|
711
|
+
int start_position,
|
712
|
+
int end_position,
|
713
|
+
Object* script,
|
714
|
+
Object* stack_trace,
|
715
|
+
Object* stack_frames);
|
716
|
+
|
717
|
+
// Allocates a new cons string object.
|
718
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
719
|
+
// failed.
|
720
|
+
// Please note this does not perform a garbage collection.
|
721
|
+
MUST_USE_RESULT MaybeObject* AllocateConsString(String* first,
|
722
|
+
String* second);
|
723
|
+
|
724
|
+
// Allocates a new sub string object which is a substring of an underlying
|
725
|
+
// string buffer stretching from the index start (inclusive) to the index
|
726
|
+
// end (exclusive).
|
727
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
728
|
+
// failed.
|
729
|
+
// Please note this does not perform a garbage collection.
|
730
|
+
MUST_USE_RESULT MaybeObject* AllocateSubString(
|
731
|
+
String* buffer,
|
732
|
+
int start,
|
733
|
+
int end,
|
734
|
+
PretenureFlag pretenure = NOT_TENURED);
|
735
|
+
|
736
|
+
// Allocate a new external string object, which is backed by a string
|
737
|
+
// resource that resides outside the V8 heap.
|
738
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
739
|
+
// failed.
|
740
|
+
// Please note this does not perform a garbage collection.
|
741
|
+
MUST_USE_RESULT MaybeObject* AllocateExternalStringFromAscii(
|
742
|
+
ExternalAsciiString::Resource* resource);
|
743
|
+
MUST_USE_RESULT MaybeObject* AllocateExternalStringFromTwoByte(
|
744
|
+
ExternalTwoByteString::Resource* resource);
|
745
|
+
|
746
|
+
// Finalizes an external string by deleting the associated external
|
747
|
+
// data and clearing the resource pointer.
|
748
|
+
inline void FinalizeExternalString(String* string);
|
749
|
+
|
750
|
+
// Allocates an uninitialized object. The memory is non-executable if the
|
751
|
+
// hardware and OS allow.
|
752
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
753
|
+
// failed.
|
754
|
+
// Please note this function does not perform a garbage collection.
|
755
|
+
MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes,
|
756
|
+
AllocationSpace space,
|
757
|
+
AllocationSpace retry_space);
|
758
|
+
|
759
|
+
// Initialize a filler object to keep the ability to iterate over the heap
|
760
|
+
// when shortening objects.
|
761
|
+
void CreateFillerObjectAt(Address addr, int size);
|
762
|
+
|
763
|
+
// Makes a new native code object
|
764
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
765
|
+
// failed. On success, the pointer to the Code object is stored in the
|
766
|
+
// self_reference. This allows generated code to reference its own Code
|
767
|
+
// object by containing this pointer.
|
768
|
+
// Please note this function does not perform a garbage collection.
|
769
|
+
MUST_USE_RESULT MaybeObject* CreateCode(const CodeDesc& desc,
|
770
|
+
Code::Flags flags,
|
771
|
+
Handle<Object> self_reference,
|
772
|
+
bool immovable = false);
|
773
|
+
|
774
|
+
MUST_USE_RESULT MaybeObject* CopyCode(Code* code);
|
775
|
+
|
776
|
+
// Copy the code and scope info part of the code object, but insert
|
777
|
+
// the provided data as the relocation information.
|
778
|
+
MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info);
|
779
|
+
|
780
|
+
// Finds the symbol for string in the symbol table.
|
781
|
+
// If not found, a new symbol is added to the table and returned.
|
782
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if allocation
|
783
|
+
// failed.
|
784
|
+
// Please note this function does not perform a garbage collection.
|
785
|
+
MUST_USE_RESULT MaybeObject* LookupSymbol(Vector<const char> str);
|
786
|
+
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Vector<const char> str);
|
787
|
+
MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(
|
788
|
+
Vector<const uc16> str);
|
789
|
+
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(const char* str) {
|
790
|
+
return LookupSymbol(CStrVector(str));
|
791
|
+
}
|
792
|
+
MUST_USE_RESULT MaybeObject* LookupSymbol(String* str);
|
793
|
+
MUST_USE_RESULT MaybeObject* LookupAsciiSymbol(Handle<SeqAsciiString> string,
|
794
|
+
int from,
|
795
|
+
int length);
|
796
|
+
|
797
|
+
bool LookupSymbolIfExists(String* str, String** symbol);
|
798
|
+
bool LookupTwoCharsSymbolIfExists(String* str, String** symbol);
|
799
|
+
|
800
|
+
// Compute the matching symbol map for a string if possible.
|
801
|
+
// NULL is returned if string is in new space or not flattened.
|
802
|
+
Map* SymbolMapForString(String* str);
|
803
|
+
|
804
|
+
// Tries to flatten a string before compare operation.
|
805
|
+
//
|
806
|
+
// Returns a failure in case it was decided that flattening was
|
807
|
+
// necessary and failed. Note, if flattening is not necessary the
|
808
|
+
// string might stay non-flat even when not a failure is returned.
|
809
|
+
//
|
810
|
+
// Please note this function does not perform a garbage collection.
|
811
|
+
MUST_USE_RESULT inline MaybeObject* PrepareForCompare(String* str);
|
812
|
+
|
813
|
+
// Converts the given boolean condition to JavaScript boolean value.
|
814
|
+
inline Object* ToBoolean(bool condition);
|
815
|
+
|
816
|
+
// Code that should be run before and after each GC. Includes some
|
817
|
+
// reporting/verification activities when compiled with DEBUG set.
|
818
|
+
void GarbageCollectionPrologue();
|
819
|
+
void GarbageCollectionEpilogue();
|
820
|
+
|
821
|
+
// Performs garbage collection operation.
|
822
|
+
// Returns whether there is a chance that another major GC could
|
823
|
+
// collect more garbage.
|
824
|
+
bool CollectGarbage(AllocationSpace space, GarbageCollector collector);
|
825
|
+
|
826
|
+
// Performs garbage collection operation.
|
827
|
+
// Returns whether there is a chance that another major GC could
|
828
|
+
// collect more garbage.
|
829
|
+
inline bool CollectGarbage(AllocationSpace space);
|
830
|
+
|
831
|
+
// Performs a full garbage collection. Force compaction if the
|
832
|
+
// parameter is true.
|
833
|
+
void CollectAllGarbage(bool force_compaction);
|
834
|
+
|
835
|
+
// Last hope GC, should try to squeeze as much as possible.
|
836
|
+
void CollectAllAvailableGarbage();
|
837
|
+
|
838
|
+
// Notify the heap that a context has been disposed.
|
839
|
+
int NotifyContextDisposed() { return ++contexts_disposed_; }
|
840
|
+
|
841
|
+
// Utility to invoke the scavenger. This is needed in test code to
|
842
|
+
// ensure correct callback for weak global handles.
|
843
|
+
void PerformScavenge();
|
844
|
+
|
845
|
+
PromotionQueue* promotion_queue() { return &promotion_queue_; }
|
846
|
+
|
847
|
+
#ifdef DEBUG
|
848
|
+
// Utility used with flag gc-greedy.
|
849
|
+
void GarbageCollectionGreedyCheck();
|
850
|
+
#endif
|
851
|
+
|
852
|
+
void AddGCPrologueCallback(
|
853
|
+
GCEpilogueCallback callback, GCType gc_type_filter);
|
854
|
+
void RemoveGCPrologueCallback(GCEpilogueCallback callback);
|
855
|
+
|
856
|
+
void AddGCEpilogueCallback(
|
857
|
+
GCEpilogueCallback callback, GCType gc_type_filter);
|
858
|
+
void RemoveGCEpilogueCallback(GCEpilogueCallback callback);
|
859
|
+
|
860
|
+
void SetGlobalGCPrologueCallback(GCCallback callback) {
|
861
|
+
ASSERT((callback == NULL) ^ (global_gc_prologue_callback_ == NULL));
|
862
|
+
global_gc_prologue_callback_ = callback;
|
863
|
+
}
|
864
|
+
void SetGlobalGCEpilogueCallback(GCCallback callback) {
|
865
|
+
ASSERT((callback == NULL) ^ (global_gc_epilogue_callback_ == NULL));
|
866
|
+
global_gc_epilogue_callback_ = callback;
|
867
|
+
}
|
868
|
+
|
869
|
+
// Heap root getters. We have versions with and without type::cast() here.
|
870
|
+
// You can't use type::cast during GC because the assert fails.
|
871
|
+
#define ROOT_ACCESSOR(type, name, camel_name) \
|
872
|
+
type* name() { \
|
873
|
+
return type::cast(roots_[k##camel_name##RootIndex]); \
|
874
|
+
} \
|
875
|
+
type* raw_unchecked_##name() { \
|
876
|
+
return reinterpret_cast<type*>(roots_[k##camel_name##RootIndex]); \
|
877
|
+
}
|
878
|
+
ROOT_LIST(ROOT_ACCESSOR)
|
879
|
+
#undef ROOT_ACCESSOR
|
880
|
+
|
881
|
+
// Utility type maps
|
882
|
+
#define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
|
883
|
+
Map* name##_map() { \
|
884
|
+
return Map::cast(roots_[k##Name##MapRootIndex]); \
|
885
|
+
}
|
886
|
+
STRUCT_LIST(STRUCT_MAP_ACCESSOR)
|
887
|
+
#undef STRUCT_MAP_ACCESSOR
|
888
|
+
|
889
|
+
#define SYMBOL_ACCESSOR(name, str) String* name() { \
|
890
|
+
return String::cast(roots_[k##name##RootIndex]); \
|
891
|
+
}
|
892
|
+
SYMBOL_LIST(SYMBOL_ACCESSOR)
|
893
|
+
#undef SYMBOL_ACCESSOR
|
894
|
+
|
895
|
+
// The hidden_symbol is special because it is the empty string, but does
|
896
|
+
// not match the empty string.
|
897
|
+
String* hidden_symbol() { return hidden_symbol_; }
|
898
|
+
|
899
|
+
void set_global_contexts_list(Object* object) {
|
900
|
+
global_contexts_list_ = object;
|
901
|
+
}
|
902
|
+
Object* global_contexts_list() { return global_contexts_list_; }
|
903
|
+
|
904
|
+
// Iterates over all roots in the heap.
|
905
|
+
void IterateRoots(ObjectVisitor* v, VisitMode mode);
|
906
|
+
// Iterates over all strong roots in the heap.
|
907
|
+
void IterateStrongRoots(ObjectVisitor* v, VisitMode mode);
|
908
|
+
// Iterates over all the other roots in the heap.
|
909
|
+
void IterateWeakRoots(ObjectVisitor* v, VisitMode mode);
|
910
|
+
|
911
|
+
enum ExpectedPageWatermarkState {
|
912
|
+
WATERMARK_SHOULD_BE_VALID,
|
913
|
+
WATERMARK_CAN_BE_INVALID
|
914
|
+
};
|
915
|
+
|
916
|
+
// For each dirty region on a page in use from an old space call
|
917
|
+
// visit_dirty_region callback.
|
918
|
+
// If either visit_dirty_region or callback can cause an allocation
|
919
|
+
// in old space and changes in allocation watermark then
|
920
|
+
// can_preallocate_during_iteration should be set to true.
|
921
|
+
// All pages will be marked as having invalid watermark upon
|
922
|
+
// iteration completion.
|
923
|
+
void IterateDirtyRegions(
|
924
|
+
PagedSpace* space,
|
925
|
+
DirtyRegionCallback visit_dirty_region,
|
926
|
+
ObjectSlotCallback callback,
|
927
|
+
ExpectedPageWatermarkState expected_page_watermark_state);
|
928
|
+
|
929
|
+
// Interpret marks as a bitvector of dirty marks for regions of size
|
930
|
+
// Page::kRegionSize aligned by Page::kRegionAlignmentMask and covering
|
931
|
+
// memory interval from start to top. For each dirty region call a
|
932
|
+
// visit_dirty_region callback. Return updated bitvector of dirty marks.
|
933
|
+
uint32_t IterateDirtyRegions(uint32_t marks,
|
934
|
+
Address start,
|
935
|
+
Address end,
|
936
|
+
DirtyRegionCallback visit_dirty_region,
|
937
|
+
ObjectSlotCallback callback);
|
938
|
+
|
939
|
+
// Iterate pointers to from semispace of new space found in memory interval
|
940
|
+
// from start to end.
|
941
|
+
// Update dirty marks for page containing start address.
|
942
|
+
void IterateAndMarkPointersToFromSpace(Address start,
|
943
|
+
Address end,
|
944
|
+
ObjectSlotCallback callback);
|
945
|
+
|
946
|
+
// Iterate pointers to new space found in memory interval from start to end.
|
947
|
+
// Return true if pointers to new space was found.
|
948
|
+
static bool IteratePointersInDirtyRegion(Heap* heap,
|
949
|
+
Address start,
|
950
|
+
Address end,
|
951
|
+
ObjectSlotCallback callback);
|
952
|
+
|
953
|
+
|
954
|
+
// Iterate pointers to new space found in memory interval from start to end.
|
955
|
+
// This interval is considered to belong to the map space.
|
956
|
+
// Return true if pointers to new space was found.
|
957
|
+
static bool IteratePointersInDirtyMapsRegion(Heap* heap,
|
958
|
+
Address start,
|
959
|
+
Address end,
|
960
|
+
ObjectSlotCallback callback);
|
961
|
+
|
962
|
+
|
963
|
+
// Returns whether the object resides in new space.
|
964
|
+
inline bool InNewSpace(Object* object);
|
965
|
+
inline bool InFromSpace(Object* object);
|
966
|
+
inline bool InToSpace(Object* object);
|
967
|
+
|
968
|
+
// Checks whether an address/object in the heap (including auxiliary
|
969
|
+
// area and unused area).
|
970
|
+
bool Contains(Address addr);
|
971
|
+
bool Contains(HeapObject* value);
|
972
|
+
|
973
|
+
// Checks whether an address/object in a space.
|
974
|
+
// Currently used by tests, serialization and heap verification only.
|
975
|
+
bool InSpace(Address addr, AllocationSpace space);
|
976
|
+
bool InSpace(HeapObject* value, AllocationSpace space);
|
977
|
+
|
978
|
+
// Finds out which space an object should get promoted to based on its type.
|
979
|
+
inline OldSpace* TargetSpace(HeapObject* object);
|
980
|
+
inline AllocationSpace TargetSpaceId(InstanceType type);
|
981
|
+
|
982
|
+
// Sets the stub_cache_ (only used when expanding the dictionary).
|
983
|
+
void public_set_code_stubs(NumberDictionary* value) {
|
984
|
+
roots_[kCodeStubsRootIndex] = value;
|
985
|
+
}
|
986
|
+
|
987
|
+
// Support for computing object sizes for old objects during GCs. Returns
|
988
|
+
// a function that is guaranteed to be safe for computing object sizes in
|
989
|
+
// the current GC phase.
|
990
|
+
HeapObjectCallback GcSafeSizeOfOldObjectFunction() {
|
991
|
+
return gc_safe_size_of_old_object_;
|
992
|
+
}
|
993
|
+
|
994
|
+
// Sets the non_monomorphic_cache_ (only used when expanding the dictionary).
|
995
|
+
void public_set_non_monomorphic_cache(NumberDictionary* value) {
|
996
|
+
roots_[kNonMonomorphicCacheRootIndex] = value;
|
997
|
+
}
|
998
|
+
|
999
|
+
void public_set_empty_script(Script* script) {
|
1000
|
+
roots_[kEmptyScriptRootIndex] = script;
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
// Update the next script id.
|
1004
|
+
inline void SetLastScriptId(Object* last_script_id);
|
1005
|
+
|
1006
|
+
// Generated code can embed this address to get access to the roots.
|
1007
|
+
Object** roots_address() { return roots_; }
|
1008
|
+
|
1009
|
+
// Get address of global contexts list for serialization support.
|
1010
|
+
Object** global_contexts_list_address() {
|
1011
|
+
return &global_contexts_list_;
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
#ifdef DEBUG
|
1015
|
+
void Print();
|
1016
|
+
void PrintHandles();
|
1017
|
+
|
1018
|
+
// Verify the heap is in its normal state before or after a GC.
|
1019
|
+
void Verify();
|
1020
|
+
|
1021
|
+
// Report heap statistics.
|
1022
|
+
void ReportHeapStatistics(const char* title);
|
1023
|
+
void ReportCodeStatistics(const char* title);
|
1024
|
+
|
1025
|
+
// Fill in bogus values in from space
|
1026
|
+
void ZapFromSpace();
|
1027
|
+
#endif
|
1028
|
+
|
1029
|
+
#if defined(ENABLE_LOGGING_AND_PROFILING)
|
1030
|
+
// Print short heap statistics.
|
1031
|
+
void PrintShortHeapStatistics();
|
1032
|
+
#endif
|
1033
|
+
|
1034
|
+
// Makes a new symbol object
|
1035
|
+
// Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation
|
1036
|
+
// failed.
|
1037
|
+
// Please note this function does not perform a garbage collection.
|
1038
|
+
MUST_USE_RESULT MaybeObject* CreateSymbol(
|
1039
|
+
const char* str, int length, int hash);
|
1040
|
+
MUST_USE_RESULT MaybeObject* CreateSymbol(String* str);
|
1041
|
+
|
1042
|
+
// Write barrier support for address[offset] = o.
|
1043
|
+
inline void RecordWrite(Address address, int offset);
|
1044
|
+
|
1045
|
+
// Write barrier support for address[start : start + len[ = o.
|
1046
|
+
inline void RecordWrites(Address address, int start, int len);
|
1047
|
+
|
1048
|
+
// Given an address occupied by a live code object, return that object.
|
1049
|
+
Object* FindCodeObject(Address a);
|
1050
|
+
|
1051
|
+
// Invoke Shrink on shrinkable spaces.
|
1052
|
+
void Shrink();
|
1053
|
+
|
1054
|
+
enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT };
|
1055
|
+
inline HeapState gc_state() { return gc_state_; }
|
1056
|
+
|
1057
|
+
#ifdef DEBUG
|
1058
|
+
bool IsAllocationAllowed() { return allocation_allowed_; }
|
1059
|
+
inline bool allow_allocation(bool enable);
|
1060
|
+
|
1061
|
+
bool disallow_allocation_failure() {
|
1062
|
+
return disallow_allocation_failure_;
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
void TracePathToObject(Object* target);
|
1066
|
+
void TracePathToGlobal();
|
1067
|
+
#endif
|
1068
|
+
|
1069
|
+
// Callback function passed to Heap::Iterate etc. Copies an object if
|
1070
|
+
// necessary, the object might be promoted to an old space. The caller must
|
1071
|
+
// ensure the precondition that the object is (a) a heap object and (b) in
|
1072
|
+
// the heap's from space.
|
1073
|
+
static inline void ScavengePointer(HeapObject** p);
|
1074
|
+
static inline void ScavengeObject(HeapObject** p, HeapObject* object);
|
1075
|
+
|
1076
|
+
// Commits from space if it is uncommitted.
|
1077
|
+
void EnsureFromSpaceIsCommitted();
|
1078
|
+
|
1079
|
+
// Support for partial snapshots. After calling this we can allocate a
|
1080
|
+
// certain number of bytes using only linear allocation (with a
|
1081
|
+
// LinearAllocationScope and an AlwaysAllocateScope) without using freelists
|
1082
|
+
// or causing a GC. It returns true of space was reserved or false if a GC is
|
1083
|
+
// needed. For paged spaces the space requested must include the space wasted
|
1084
|
+
// at the end of each page when allocating linearly.
|
1085
|
+
void ReserveSpace(
|
1086
|
+
int new_space_size,
|
1087
|
+
int pointer_space_size,
|
1088
|
+
int data_space_size,
|
1089
|
+
int code_space_size,
|
1090
|
+
int map_space_size,
|
1091
|
+
int cell_space_size,
|
1092
|
+
int large_object_size);
|
1093
|
+
|
1094
|
+
//
|
1095
|
+
// Support for the API.
|
1096
|
+
//
|
1097
|
+
|
1098
|
+
bool CreateApiObjects();
|
1099
|
+
|
1100
|
+
// Attempt to find the number in a small cache. If we finds it, return
|
1101
|
+
// the string representation of the number. Otherwise return undefined.
|
1102
|
+
Object* GetNumberStringCache(Object* number);
|
1103
|
+
|
1104
|
+
// Update the cache with a new number-string pair.
|
1105
|
+
void SetNumberStringCache(Object* number, String* str);
|
1106
|
+
|
1107
|
+
// Adjusts the amount of registered external memory.
|
1108
|
+
// Returns the adjusted value.
|
1109
|
+
inline int AdjustAmountOfExternalAllocatedMemory(int change_in_bytes);
|
1110
|
+
|
1111
|
+
// Allocate uninitialized fixed array.
|
1112
|
+
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length);
|
1113
|
+
MUST_USE_RESULT MaybeObject* AllocateRawFixedArray(int length,
|
1114
|
+
PretenureFlag pretenure);
|
1115
|
+
|
1116
|
+
// True if we have reached the allocation limit in the old generation that
|
1117
|
+
// should force the next GC (caused normally) to be a full one.
|
1118
|
+
bool OldGenerationPromotionLimitReached() {
|
1119
|
+
return (PromotedSpaceSize() + PromotedExternalMemorySize())
|
1120
|
+
> old_gen_promotion_limit_;
|
1121
|
+
}
|
1122
|
+
|
1123
|
+
intptr_t OldGenerationSpaceAvailable() {
|
1124
|
+
return old_gen_allocation_limit_ -
|
1125
|
+
(PromotedSpaceSize() + PromotedExternalMemorySize());
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
// True if we have reached the allocation limit in the old generation that
|
1129
|
+
// should artificially cause a GC right now.
|
1130
|
+
bool OldGenerationAllocationLimitReached() {
|
1131
|
+
return OldGenerationSpaceAvailable() < 0;
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
// Can be called when the embedding application is idle.
|
1135
|
+
bool IdleNotification();
|
1136
|
+
|
1137
|
+
// Declare all the root indices.
|
1138
|
+
enum RootListIndex {
|
1139
|
+
#define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex,
|
1140
|
+
STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION)
|
1141
|
+
#undef ROOT_INDEX_DECLARATION
|
1142
|
+
|
1143
|
+
// Utility type maps
|
1144
|
+
#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex,
|
1145
|
+
STRUCT_LIST(DECLARE_STRUCT_MAP)
|
1146
|
+
#undef DECLARE_STRUCT_MAP
|
1147
|
+
|
1148
|
+
#define SYMBOL_INDEX_DECLARATION(name, str) k##name##RootIndex,
|
1149
|
+
SYMBOL_LIST(SYMBOL_INDEX_DECLARATION)
|
1150
|
+
#undef SYMBOL_DECLARATION
|
1151
|
+
|
1152
|
+
kSymbolTableRootIndex,
|
1153
|
+
kStrongRootListLength = kSymbolTableRootIndex,
|
1154
|
+
kRootListLength
|
1155
|
+
};
|
1156
|
+
|
1157
|
+
MUST_USE_RESULT MaybeObject* NumberToString(
|
1158
|
+
Object* number, bool check_number_string_cache = true);
|
1159
|
+
|
1160
|
+
Map* MapForExternalArrayType(ExternalArrayType array_type);
|
1161
|
+
RootListIndex RootIndexForExternalArrayType(
|
1162
|
+
ExternalArrayType array_type);
|
1163
|
+
|
1164
|
+
void RecordStats(HeapStats* stats, bool take_snapshot = false);
|
1165
|
+
|
1166
|
+
// Copy block of memory from src to dst. Size of block should be aligned
|
1167
|
+
// by pointer size.
|
1168
|
+
static inline void CopyBlock(Address dst, Address src, int byte_size);
|
1169
|
+
|
1170
|
+
inline void CopyBlockToOldSpaceAndUpdateRegionMarks(Address dst,
|
1171
|
+
Address src,
|
1172
|
+
int byte_size);
|
1173
|
+
|
1174
|
+
// Optimized version of memmove for blocks with pointer size aligned sizes and
|
1175
|
+
// pointer size aligned addresses.
|
1176
|
+
static inline void MoveBlock(Address dst, Address src, int byte_size);
|
1177
|
+
|
1178
|
+
inline void MoveBlockToOldSpaceAndUpdateRegionMarks(Address dst,
|
1179
|
+
Address src,
|
1180
|
+
int byte_size);
|
1181
|
+
|
1182
|
+
// Check new space expansion criteria and expand semispaces if it was hit.
|
1183
|
+
void CheckNewSpaceExpansionCriteria();
|
1184
|
+
|
1185
|
+
inline void IncrementYoungSurvivorsCounter(int survived) {
|
1186
|
+
young_survivors_after_last_gc_ = survived;
|
1187
|
+
survived_since_last_expansion_ += survived;
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
void UpdateNewSpaceReferencesInExternalStringTable(
|
1191
|
+
ExternalStringTableUpdaterCallback updater_func);
|
1192
|
+
|
1193
|
+
void ProcessWeakReferences(WeakObjectRetainer* retainer);
|
1194
|
+
|
1195
|
+
// Helper function that governs the promotion policy from new space to
|
1196
|
+
// old. If the object's old address lies below the new space's age
|
1197
|
+
// mark or if we've already filled the bottom 1/16th of the to space,
|
1198
|
+
// we try to promote this object.
|
1199
|
+
inline bool ShouldBePromoted(Address old_address, int object_size);
|
1200
|
+
|
1201
|
+
int MaxObjectSizeInNewSpace() { return kMaxObjectSizeInNewSpace; }
|
1202
|
+
|
1203
|
+
void ClearJSFunctionResultCaches();
|
1204
|
+
|
1205
|
+
void ClearNormalizedMapCaches();
|
1206
|
+
|
1207
|
+
GCTracer* tracer() { return tracer_; }
|
1208
|
+
|
1209
|
+
double total_regexp_code_generated() { return total_regexp_code_generated_; }
|
1210
|
+
void IncreaseTotalRegexpCodeGenerated(int size) {
|
1211
|
+
total_regexp_code_generated_ += size;
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
// Returns maximum GC pause.
|
1215
|
+
int get_max_gc_pause() { return max_gc_pause_; }
|
1216
|
+
|
1217
|
+
// Returns maximum size of objects alive after GC.
|
1218
|
+
intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; }
|
1219
|
+
|
1220
|
+
// Returns minimal interval between two subsequent collections.
|
1221
|
+
int get_min_in_mutator() { return min_in_mutator_; }
|
1222
|
+
|
1223
|
+
MarkCompactCollector* mark_compact_collector() {
|
1224
|
+
return &mark_compact_collector_;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
ExternalStringTable* external_string_table() {
|
1228
|
+
return &external_string_table_;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
inline Isolate* isolate();
|
1232
|
+
bool is_safe_to_read_maps() { return is_safe_to_read_maps_; }
|
1233
|
+
|
1234
|
+
void CallGlobalGCPrologueCallback() {
|
1235
|
+
if (global_gc_prologue_callback_ != NULL) global_gc_prologue_callback_();
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
void CallGlobalGCEpilogueCallback() {
|
1239
|
+
if (global_gc_epilogue_callback_ != NULL) global_gc_epilogue_callback_();
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
private:
|
1243
|
+
Heap();
|
1244
|
+
|
1245
|
+
// This can be calculated directly from a pointer to the heap; however, it is
|
1246
|
+
// more expedient to get at the isolate directly from within Heap methods.
|
1247
|
+
Isolate* isolate_;
|
1248
|
+
|
1249
|
+
int reserved_semispace_size_;
|
1250
|
+
int max_semispace_size_;
|
1251
|
+
int initial_semispace_size_;
|
1252
|
+
intptr_t max_old_generation_size_;
|
1253
|
+
intptr_t max_executable_size_;
|
1254
|
+
intptr_t code_range_size_;
|
1255
|
+
|
1256
|
+
// For keeping track of how much data has survived
|
1257
|
+
// scavenge since last new space expansion.
|
1258
|
+
int survived_since_last_expansion_;
|
1259
|
+
|
1260
|
+
int always_allocate_scope_depth_;
|
1261
|
+
int linear_allocation_scope_depth_;
|
1262
|
+
|
1263
|
+
// For keeping track of context disposals.
|
1264
|
+
int contexts_disposed_;
|
1265
|
+
|
1266
|
+
#if defined(V8_TARGET_ARCH_X64)
|
1267
|
+
static const int kMaxObjectSizeInNewSpace = 1024*KB;
|
1268
|
+
#else
|
1269
|
+
static const int kMaxObjectSizeInNewSpace = 512*KB;
|
1270
|
+
#endif
|
1271
|
+
|
1272
|
+
NewSpace new_space_;
|
1273
|
+
OldSpace* old_pointer_space_;
|
1274
|
+
OldSpace* old_data_space_;
|
1275
|
+
OldSpace* code_space_;
|
1276
|
+
MapSpace* map_space_;
|
1277
|
+
CellSpace* cell_space_;
|
1278
|
+
LargeObjectSpace* lo_space_;
|
1279
|
+
HeapState gc_state_;
|
1280
|
+
|
1281
|
+
// Returns the size of object residing in non new spaces.
|
1282
|
+
intptr_t PromotedSpaceSize();
|
1283
|
+
|
1284
|
+
// Returns the amount of external memory registered since last global gc.
|
1285
|
+
int PromotedExternalMemorySize();
|
1286
|
+
|
1287
|
+
int mc_count_; // how many mark-compact collections happened
|
1288
|
+
int ms_count_; // how many mark-sweep collections happened
|
1289
|
+
unsigned int gc_count_; // how many gc happened
|
1290
|
+
|
1291
|
+
// Total length of the strings we failed to flatten since the last GC.
|
1292
|
+
int unflattened_strings_length_;
|
1293
|
+
|
1294
|
+
#define ROOT_ACCESSOR(type, name, camel_name) \
|
1295
|
+
inline void set_##name(type* value) { \
|
1296
|
+
roots_[k##camel_name##RootIndex] = value; \
|
1297
|
+
}
|
1298
|
+
ROOT_LIST(ROOT_ACCESSOR)
|
1299
|
+
#undef ROOT_ACCESSOR
|
1300
|
+
|
1301
|
+
#ifdef DEBUG
|
1302
|
+
bool allocation_allowed_;
|
1303
|
+
|
1304
|
+
// If the --gc-interval flag is set to a positive value, this
|
1305
|
+
// variable holds the value indicating the number of allocations
|
1306
|
+
// remain until the next failure and garbage collection.
|
1307
|
+
int allocation_timeout_;
|
1308
|
+
|
1309
|
+
// Do we expect to be able to handle allocation failure at this
|
1310
|
+
// time?
|
1311
|
+
bool disallow_allocation_failure_;
|
1312
|
+
|
1313
|
+
HeapDebugUtils* debug_utils_;
|
1314
|
+
#endif // DEBUG
|
1315
|
+
|
1316
|
+
// Limit that triggers a global GC on the next (normally caused) GC. This
|
1317
|
+
// is checked when we have already decided to do a GC to help determine
|
1318
|
+
// which collector to invoke.
|
1319
|
+
intptr_t old_gen_promotion_limit_;
|
1320
|
+
|
1321
|
+
// Limit that triggers a global GC as soon as is reasonable. This is
|
1322
|
+
// checked before expanding a paged space in the old generation and on
|
1323
|
+
// every allocation in large object space.
|
1324
|
+
intptr_t old_gen_allocation_limit_;
|
1325
|
+
|
1326
|
+
// Limit on the amount of externally allocated memory allowed
|
1327
|
+
// between global GCs. If reached a global GC is forced.
|
1328
|
+
intptr_t external_allocation_limit_;
|
1329
|
+
|
1330
|
+
// The amount of external memory registered through the API kept alive
|
1331
|
+
// by global handles
|
1332
|
+
int amount_of_external_allocated_memory_;
|
1333
|
+
|
1334
|
+
// Caches the amount of external memory registered at the last global gc.
|
1335
|
+
int amount_of_external_allocated_memory_at_last_global_gc_;
|
1336
|
+
|
1337
|
+
// Indicates that an allocation has failed in the old generation since the
|
1338
|
+
// last GC.
|
1339
|
+
int old_gen_exhausted_;
|
1340
|
+
|
1341
|
+
Object* roots_[kRootListLength];
|
1342
|
+
|
1343
|
+
Object* global_contexts_list_;
|
1344
|
+
|
1345
|
+
struct StringTypeTable {
|
1346
|
+
InstanceType type;
|
1347
|
+
int size;
|
1348
|
+
RootListIndex index;
|
1349
|
+
};
|
1350
|
+
|
1351
|
+
struct ConstantSymbolTable {
|
1352
|
+
const char* contents;
|
1353
|
+
RootListIndex index;
|
1354
|
+
};
|
1355
|
+
|
1356
|
+
struct StructTable {
|
1357
|
+
InstanceType type;
|
1358
|
+
int size;
|
1359
|
+
RootListIndex index;
|
1360
|
+
};
|
1361
|
+
|
1362
|
+
static const StringTypeTable string_type_table[];
|
1363
|
+
static const ConstantSymbolTable constant_symbol_table[];
|
1364
|
+
static const StructTable struct_table[];
|
1365
|
+
|
1366
|
+
// The special hidden symbol which is an empty string, but does not match
|
1367
|
+
// any string when looked up in properties.
|
1368
|
+
String* hidden_symbol_;
|
1369
|
+
|
1370
|
+
// GC callback function, called before and after mark-compact GC.
|
1371
|
+
// Allocations in the callback function are disallowed.
|
1372
|
+
struct GCPrologueCallbackPair {
|
1373
|
+
GCPrologueCallbackPair(GCPrologueCallback callback, GCType gc_type)
|
1374
|
+
: callback(callback), gc_type(gc_type) {
|
1375
|
+
}
|
1376
|
+
bool operator==(const GCPrologueCallbackPair& pair) const {
|
1377
|
+
return pair.callback == callback;
|
1378
|
+
}
|
1379
|
+
GCPrologueCallback callback;
|
1380
|
+
GCType gc_type;
|
1381
|
+
};
|
1382
|
+
List<GCPrologueCallbackPair> gc_prologue_callbacks_;
|
1383
|
+
|
1384
|
+
struct GCEpilogueCallbackPair {
|
1385
|
+
GCEpilogueCallbackPair(GCEpilogueCallback callback, GCType gc_type)
|
1386
|
+
: callback(callback), gc_type(gc_type) {
|
1387
|
+
}
|
1388
|
+
bool operator==(const GCEpilogueCallbackPair& pair) const {
|
1389
|
+
return pair.callback == callback;
|
1390
|
+
}
|
1391
|
+
GCEpilogueCallback callback;
|
1392
|
+
GCType gc_type;
|
1393
|
+
};
|
1394
|
+
List<GCEpilogueCallbackPair> gc_epilogue_callbacks_;
|
1395
|
+
|
1396
|
+
GCCallback global_gc_prologue_callback_;
|
1397
|
+
GCCallback global_gc_epilogue_callback_;
|
1398
|
+
|
1399
|
+
// Support for computing object sizes during GC.
|
1400
|
+
HeapObjectCallback gc_safe_size_of_old_object_;
|
1401
|
+
static int GcSafeSizeOfOldObject(HeapObject* object);
|
1402
|
+
static int GcSafeSizeOfOldObjectWithEncodedMap(HeapObject* object);
|
1403
|
+
|
1404
|
+
// Update the GC state. Called from the mark-compact collector.
|
1405
|
+
void MarkMapPointersAsEncoded(bool encoded) {
|
1406
|
+
gc_safe_size_of_old_object_ = encoded
|
1407
|
+
? &GcSafeSizeOfOldObjectWithEncodedMap
|
1408
|
+
: &GcSafeSizeOfOldObject;
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
// Checks whether a global GC is necessary
|
1412
|
+
GarbageCollector SelectGarbageCollector(AllocationSpace space);
|
1413
|
+
|
1414
|
+
// Performs garbage collection
|
1415
|
+
// Returns whether there is a chance another major GC could
|
1416
|
+
// collect more garbage.
|
1417
|
+
bool PerformGarbageCollection(GarbageCollector collector,
|
1418
|
+
GCTracer* tracer);
|
1419
|
+
|
1420
|
+
static const intptr_t kMinimumPromotionLimit = 2 * MB;
|
1421
|
+
static const intptr_t kMinimumAllocationLimit = 8 * MB;
|
1422
|
+
|
1423
|
+
inline void UpdateOldSpaceLimits();
|
1424
|
+
|
1425
|
+
// Allocate an uninitialized object in map space. The behavior is identical
|
1426
|
+
// to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't
|
1427
|
+
// have to test the allocation space argument and (b) can reduce code size
|
1428
|
+
// (since both AllocateRaw and AllocateRawMap are inlined).
|
1429
|
+
MUST_USE_RESULT inline MaybeObject* AllocateRawMap();
|
1430
|
+
|
1431
|
+
// Allocate an uninitialized object in the global property cell space.
|
1432
|
+
MUST_USE_RESULT inline MaybeObject* AllocateRawCell();
|
1433
|
+
|
1434
|
+
// Initializes a JSObject based on its map.
|
1435
|
+
void InitializeJSObjectFromMap(JSObject* obj,
|
1436
|
+
FixedArray* properties,
|
1437
|
+
Map* map);
|
1438
|
+
|
1439
|
+
bool CreateInitialMaps();
|
1440
|
+
bool CreateInitialObjects();
|
1441
|
+
|
1442
|
+
// These five Create*EntryStub functions are here and forced to not be inlined
|
1443
|
+
// because of a gcc-4.4 bug that assigns wrong vtable entries.
|
1444
|
+
NO_INLINE(void CreateJSEntryStub());
|
1445
|
+
NO_INLINE(void CreateJSConstructEntryStub());
|
1446
|
+
|
1447
|
+
void CreateFixedStubs();
|
1448
|
+
|
1449
|
+
MaybeObject* CreateOddball(const char* to_string,
|
1450
|
+
Object* to_number,
|
1451
|
+
byte kind);
|
1452
|
+
|
1453
|
+
// Allocate empty fixed array.
|
1454
|
+
MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray();
|
1455
|
+
|
1456
|
+
void SwitchScavengingVisitorsTableIfProfilingWasEnabled();
|
1457
|
+
|
1458
|
+
// Performs a minor collection in new generation.
|
1459
|
+
void Scavenge();
|
1460
|
+
|
1461
|
+
static String* UpdateNewSpaceReferenceInExternalStringTableEntry(
|
1462
|
+
Heap* heap,
|
1463
|
+
Object** pointer);
|
1464
|
+
|
1465
|
+
Address DoScavenge(ObjectVisitor* scavenge_visitor, Address new_space_front);
|
1466
|
+
|
1467
|
+
// Performs a major collection in the whole heap.
|
1468
|
+
void MarkCompact(GCTracer* tracer);
|
1469
|
+
|
1470
|
+
// Code to be run before and after mark-compact.
|
1471
|
+
void MarkCompactPrologue(bool is_compacting);
|
1472
|
+
|
1473
|
+
// Completely clear the Instanceof cache (to stop it keeping objects alive
|
1474
|
+
// around a GC).
|
1475
|
+
inline void CompletelyClearInstanceofCache();
|
1476
|
+
|
1477
|
+
#if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
|
1478
|
+
// Record statistics before and after garbage collection.
|
1479
|
+
void ReportStatisticsBeforeGC();
|
1480
|
+
void ReportStatisticsAfterGC();
|
1481
|
+
#endif
|
1482
|
+
|
1483
|
+
// Slow part of scavenge object.
|
1484
|
+
static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
|
1485
|
+
|
1486
|
+
// Initializes a function with a shared part and prototype.
|
1487
|
+
// Returns the function.
|
1488
|
+
// Note: this code was factored out of AllocateFunction such that
|
1489
|
+
// other parts of the VM could use it. Specifically, a function that creates
|
1490
|
+
// instances of type JS_FUNCTION_TYPE benefit from the use of this function.
|
1491
|
+
// Please note this does not perform a garbage collection.
|
1492
|
+
MUST_USE_RESULT inline MaybeObject* InitializeFunction(
|
1493
|
+
JSFunction* function,
|
1494
|
+
SharedFunctionInfo* shared,
|
1495
|
+
Object* prototype);
|
1496
|
+
|
1497
|
+
// Total RegExp code ever generated
|
1498
|
+
double total_regexp_code_generated_;
|
1499
|
+
|
1500
|
+
GCTracer* tracer_;
|
1501
|
+
|
1502
|
+
|
1503
|
+
// Initializes the number to string cache based on the max semispace size.
|
1504
|
+
MUST_USE_RESULT MaybeObject* InitializeNumberStringCache();
|
1505
|
+
// Flush the number to string cache.
|
1506
|
+
void FlushNumberStringCache();
|
1507
|
+
|
1508
|
+
void UpdateSurvivalRateTrend(int start_new_space_size);
|
1509
|
+
|
1510
|
+
enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING };
|
1511
|
+
|
1512
|
+
static const int kYoungSurvivalRateThreshold = 90;
|
1513
|
+
static const int kYoungSurvivalRateAllowedDeviation = 15;
|
1514
|
+
|
1515
|
+
int young_survivors_after_last_gc_;
|
1516
|
+
int high_survival_rate_period_length_;
|
1517
|
+
double survival_rate_;
|
1518
|
+
SurvivalRateTrend previous_survival_rate_trend_;
|
1519
|
+
SurvivalRateTrend survival_rate_trend_;
|
1520
|
+
|
1521
|
+
void set_survival_rate_trend(SurvivalRateTrend survival_rate_trend) {
|
1522
|
+
ASSERT(survival_rate_trend != FLUCTUATING);
|
1523
|
+
previous_survival_rate_trend_ = survival_rate_trend_;
|
1524
|
+
survival_rate_trend_ = survival_rate_trend;
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
SurvivalRateTrend survival_rate_trend() {
|
1528
|
+
if (survival_rate_trend_ == STABLE) {
|
1529
|
+
return STABLE;
|
1530
|
+
} else if (previous_survival_rate_trend_ == STABLE) {
|
1531
|
+
return survival_rate_trend_;
|
1532
|
+
} else if (survival_rate_trend_ != previous_survival_rate_trend_) {
|
1533
|
+
return FLUCTUATING;
|
1534
|
+
} else {
|
1535
|
+
return survival_rate_trend_;
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
|
1539
|
+
bool IsStableOrIncreasingSurvivalTrend() {
|
1540
|
+
switch (survival_rate_trend()) {
|
1541
|
+
case STABLE:
|
1542
|
+
case INCREASING:
|
1543
|
+
return true;
|
1544
|
+
default:
|
1545
|
+
return false;
|
1546
|
+
}
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
bool IsIncreasingSurvivalTrend() {
|
1550
|
+
return survival_rate_trend() == INCREASING;
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
bool IsHighSurvivalRate() {
|
1554
|
+
return high_survival_rate_period_length_ > 0;
|
1555
|
+
}
|
1556
|
+
|
1557
|
+
static const int kInitialSymbolTableSize = 2048;
|
1558
|
+
static const int kInitialEvalCacheSize = 64;
|
1559
|
+
|
1560
|
+
// Maximum GC pause.
|
1561
|
+
int max_gc_pause_;
|
1562
|
+
|
1563
|
+
// Maximum size of objects alive after GC.
|
1564
|
+
intptr_t max_alive_after_gc_;
|
1565
|
+
|
1566
|
+
// Minimal interval between two subsequent collections.
|
1567
|
+
int min_in_mutator_;
|
1568
|
+
|
1569
|
+
// Size of objects alive after last GC.
|
1570
|
+
intptr_t alive_after_last_gc_;
|
1571
|
+
|
1572
|
+
double last_gc_end_timestamp_;
|
1573
|
+
|
1574
|
+
MarkCompactCollector mark_compact_collector_;
|
1575
|
+
|
1576
|
+
// This field contains the meaning of the WATERMARK_INVALIDATED flag.
|
1577
|
+
// Instead of clearing this flag from all pages we just flip
|
1578
|
+
// its meaning at the beginning of a scavenge.
|
1579
|
+
intptr_t page_watermark_invalidated_mark_;
|
1580
|
+
|
1581
|
+
int number_idle_notifications_;
|
1582
|
+
unsigned int last_idle_notification_gc_count_;
|
1583
|
+
bool last_idle_notification_gc_count_init_;
|
1584
|
+
|
1585
|
+
// Shared state read by the scavenge collector and set by ScavengeObject.
|
1586
|
+
PromotionQueue promotion_queue_;
|
1587
|
+
|
1588
|
+
// Flag is set when the heap has been configured. The heap can be repeatedly
|
1589
|
+
// configured through the API until it is setup.
|
1590
|
+
bool configured_;
|
1591
|
+
|
1592
|
+
ExternalStringTable external_string_table_;
|
1593
|
+
|
1594
|
+
bool is_safe_to_read_maps_;
|
1595
|
+
|
1596
|
+
friend class Factory;
|
1597
|
+
friend class GCTracer;
|
1598
|
+
friend class DisallowAllocationFailure;
|
1599
|
+
friend class AlwaysAllocateScope;
|
1600
|
+
friend class LinearAllocationScope;
|
1601
|
+
friend class Page;
|
1602
|
+
friend class Isolate;
|
1603
|
+
friend class MarkCompactCollector;
|
1604
|
+
friend class MapCompact;
|
1605
|
+
|
1606
|
+
DISALLOW_COPY_AND_ASSIGN(Heap);
|
1607
|
+
};
|
1608
|
+
|
1609
|
+
|
1610
|
+
class HeapStats {
|
1611
|
+
public:
|
1612
|
+
static const int kStartMarker = 0xDECADE00;
|
1613
|
+
static const int kEndMarker = 0xDECADE01;
|
1614
|
+
|
1615
|
+
int* start_marker; // 0
|
1616
|
+
int* new_space_size; // 1
|
1617
|
+
int* new_space_capacity; // 2
|
1618
|
+
intptr_t* old_pointer_space_size; // 3
|
1619
|
+
intptr_t* old_pointer_space_capacity; // 4
|
1620
|
+
intptr_t* old_data_space_size; // 5
|
1621
|
+
intptr_t* old_data_space_capacity; // 6
|
1622
|
+
intptr_t* code_space_size; // 7
|
1623
|
+
intptr_t* code_space_capacity; // 8
|
1624
|
+
intptr_t* map_space_size; // 9
|
1625
|
+
intptr_t* map_space_capacity; // 10
|
1626
|
+
intptr_t* cell_space_size; // 11
|
1627
|
+
intptr_t* cell_space_capacity; // 12
|
1628
|
+
intptr_t* lo_space_size; // 13
|
1629
|
+
int* global_handle_count; // 14
|
1630
|
+
int* weak_global_handle_count; // 15
|
1631
|
+
int* pending_global_handle_count; // 16
|
1632
|
+
int* near_death_global_handle_count; // 17
|
1633
|
+
int* destroyed_global_handle_count; // 18
|
1634
|
+
intptr_t* memory_allocator_size; // 19
|
1635
|
+
intptr_t* memory_allocator_capacity; // 20
|
1636
|
+
int* objects_per_type; // 21
|
1637
|
+
int* size_per_type; // 22
|
1638
|
+
int* os_error; // 23
|
1639
|
+
int* end_marker; // 24
|
1640
|
+
};
|
1641
|
+
|
1642
|
+
|
1643
|
+
class AlwaysAllocateScope {
|
1644
|
+
public:
|
1645
|
+
AlwaysAllocateScope() {
|
1646
|
+
// We shouldn't hit any nested scopes, because that requires
|
1647
|
+
// non-handle code to call handle code. The code still works but
|
1648
|
+
// performance will degrade, so we want to catch this situation
|
1649
|
+
// in debug mode.
|
1650
|
+
ASSERT(HEAP->always_allocate_scope_depth_ == 0);
|
1651
|
+
HEAP->always_allocate_scope_depth_++;
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
~AlwaysAllocateScope() {
|
1655
|
+
HEAP->always_allocate_scope_depth_--;
|
1656
|
+
ASSERT(HEAP->always_allocate_scope_depth_ == 0);
|
1657
|
+
}
|
1658
|
+
};
|
1659
|
+
|
1660
|
+
|
1661
|
+
class LinearAllocationScope {
|
1662
|
+
public:
|
1663
|
+
LinearAllocationScope() {
|
1664
|
+
HEAP->linear_allocation_scope_depth_++;
|
1665
|
+
}
|
1666
|
+
|
1667
|
+
~LinearAllocationScope() {
|
1668
|
+
HEAP->linear_allocation_scope_depth_--;
|
1669
|
+
ASSERT(HEAP->linear_allocation_scope_depth_ >= 0);
|
1670
|
+
}
|
1671
|
+
};
|
1672
|
+
|
1673
|
+
|
1674
|
+
#ifdef DEBUG
|
1675
|
+
// Visitor class to verify interior pointers in spaces that do not contain
|
1676
|
+
// or care about intergenerational references. All heap object pointers have to
|
1677
|
+
// point into the heap to a location that has a map pointer at its first word.
|
1678
|
+
// Caveat: Heap::Contains is an approximation because it can return true for
|
1679
|
+
// objects in a heap space but above the allocation pointer.
|
1680
|
+
class VerifyPointersVisitor: public ObjectVisitor {
|
1681
|
+
public:
|
1682
|
+
void VisitPointers(Object** start, Object** end) {
|
1683
|
+
for (Object** current = start; current < end; current++) {
|
1684
|
+
if ((*current)->IsHeapObject()) {
|
1685
|
+
HeapObject* object = HeapObject::cast(*current);
|
1686
|
+
ASSERT(HEAP->Contains(object));
|
1687
|
+
ASSERT(object->map()->IsMap());
|
1688
|
+
}
|
1689
|
+
}
|
1690
|
+
}
|
1691
|
+
};
|
1692
|
+
|
1693
|
+
|
1694
|
+
// Visitor class to verify interior pointers in spaces that use region marks
|
1695
|
+
// to keep track of intergenerational references.
|
1696
|
+
// As VerifyPointersVisitor but also checks that dirty marks are set
|
1697
|
+
// for regions covering intergenerational references.
|
1698
|
+
class VerifyPointersAndDirtyRegionsVisitor: public ObjectVisitor {
|
1699
|
+
public:
|
1700
|
+
void VisitPointers(Object** start, Object** end) {
|
1701
|
+
for (Object** current = start; current < end; current++) {
|
1702
|
+
if ((*current)->IsHeapObject()) {
|
1703
|
+
HeapObject* object = HeapObject::cast(*current);
|
1704
|
+
ASSERT(HEAP->Contains(object));
|
1705
|
+
ASSERT(object->map()->IsMap());
|
1706
|
+
if (HEAP->InNewSpace(object)) {
|
1707
|
+
ASSERT(HEAP->InToSpace(object));
|
1708
|
+
Address addr = reinterpret_cast<Address>(current);
|
1709
|
+
ASSERT(Page::FromAddress(addr)->IsRegionDirty(addr));
|
1710
|
+
}
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
}
|
1714
|
+
};
|
1715
|
+
#endif
|
1716
|
+
|
1717
|
+
|
1718
|
+
// Space iterator for iterating over all spaces of the heap.
|
1719
|
+
// Returns each space in turn, and null when it is done.
|
1720
|
+
class AllSpaces BASE_EMBEDDED {
|
1721
|
+
public:
|
1722
|
+
Space* next();
|
1723
|
+
AllSpaces() { counter_ = FIRST_SPACE; }
|
1724
|
+
private:
|
1725
|
+
int counter_;
|
1726
|
+
};
|
1727
|
+
|
1728
|
+
|
1729
|
+
// Space iterator for iterating over all old spaces of the heap: Old pointer
|
1730
|
+
// space, old data space and code space.
|
1731
|
+
// Returns each space in turn, and null when it is done.
|
1732
|
+
class OldSpaces BASE_EMBEDDED {
|
1733
|
+
public:
|
1734
|
+
OldSpace* next();
|
1735
|
+
OldSpaces() { counter_ = OLD_POINTER_SPACE; }
|
1736
|
+
private:
|
1737
|
+
int counter_;
|
1738
|
+
};
|
1739
|
+
|
1740
|
+
|
1741
|
+
// Space iterator for iterating over all the paged spaces of the heap:
|
1742
|
+
// Map space, old pointer space, old data space, code space and cell space.
|
1743
|
+
// Returns each space in turn, and null when it is done.
|
1744
|
+
class PagedSpaces BASE_EMBEDDED {
|
1745
|
+
public:
|
1746
|
+
PagedSpace* next();
|
1747
|
+
PagedSpaces() { counter_ = OLD_POINTER_SPACE; }
|
1748
|
+
private:
|
1749
|
+
int counter_;
|
1750
|
+
};
|
1751
|
+
|
1752
|
+
|
1753
|
+
// Space iterator for iterating over all spaces of the heap.
|
1754
|
+
// For each space an object iterator is provided. The deallocation of the
|
1755
|
+
// returned object iterators is handled by the space iterator.
|
1756
|
+
class SpaceIterator : public Malloced {
|
1757
|
+
public:
|
1758
|
+
SpaceIterator();
|
1759
|
+
explicit SpaceIterator(HeapObjectCallback size_func);
|
1760
|
+
virtual ~SpaceIterator();
|
1761
|
+
|
1762
|
+
bool has_next();
|
1763
|
+
ObjectIterator* next();
|
1764
|
+
|
1765
|
+
private:
|
1766
|
+
ObjectIterator* CreateIterator();
|
1767
|
+
|
1768
|
+
int current_space_; // from enum AllocationSpace.
|
1769
|
+
ObjectIterator* iterator_; // object iterator for the current space.
|
1770
|
+
HeapObjectCallback size_func_;
|
1771
|
+
};
|
1772
|
+
|
1773
|
+
|
1774
|
+
// A HeapIterator provides iteration over the whole heap. It
|
1775
|
+
// aggregates the specific iterators for the different spaces as
|
1776
|
+
// these can only iterate over one space only.
|
1777
|
+
//
|
1778
|
+
// HeapIterator can skip free list nodes (that is, de-allocated heap
|
1779
|
+
// objects that still remain in the heap). As implementation of free
|
1780
|
+
// nodes filtering uses GC marks, it can't be used during MS/MC GC
|
1781
|
+
// phases. Also, it is forbidden to interrupt iteration in this mode,
|
1782
|
+
// as this will leave heap objects marked (and thus, unusable).
|
1783
|
+
class HeapObjectsFilter;
|
1784
|
+
|
1785
|
+
class HeapIterator BASE_EMBEDDED {
|
1786
|
+
public:
|
1787
|
+
enum HeapObjectsFiltering {
|
1788
|
+
kNoFiltering,
|
1789
|
+
kFilterFreeListNodes,
|
1790
|
+
kFilterUnreachable
|
1791
|
+
};
|
1792
|
+
|
1793
|
+
HeapIterator();
|
1794
|
+
explicit HeapIterator(HeapObjectsFiltering filtering);
|
1795
|
+
~HeapIterator();
|
1796
|
+
|
1797
|
+
HeapObject* next();
|
1798
|
+
void reset();
|
1799
|
+
|
1800
|
+
private:
|
1801
|
+
// Perform the initialization.
|
1802
|
+
void Init();
|
1803
|
+
// Perform all necessary shutdown (destruction) work.
|
1804
|
+
void Shutdown();
|
1805
|
+
HeapObject* NextObject();
|
1806
|
+
|
1807
|
+
HeapObjectsFiltering filtering_;
|
1808
|
+
HeapObjectsFilter* filter_;
|
1809
|
+
// Space iterator for iterating all the spaces.
|
1810
|
+
SpaceIterator* space_iterator_;
|
1811
|
+
// Object iterator for the space currently being iterated.
|
1812
|
+
ObjectIterator* object_iterator_;
|
1813
|
+
};
|
1814
|
+
|
1815
|
+
|
1816
|
+
// Cache for mapping (map, property name) into field offset.
|
1817
|
+
// Cleared at startup and prior to mark sweep collection.
|
1818
|
+
class KeyedLookupCache {
|
1819
|
+
public:
|
1820
|
+
// Lookup field offset for (map, name). If absent, -1 is returned.
|
1821
|
+
int Lookup(Map* map, String* name);
|
1822
|
+
|
1823
|
+
// Update an element in the cache.
|
1824
|
+
void Update(Map* map, String* name, int field_offset);
|
1825
|
+
|
1826
|
+
// Clear the cache.
|
1827
|
+
void Clear();
|
1828
|
+
|
1829
|
+
static const int kLength = 64;
|
1830
|
+
static const int kCapacityMask = kLength - 1;
|
1831
|
+
static const int kMapHashShift = 2;
|
1832
|
+
static const int kNotFound = -1;
|
1833
|
+
|
1834
|
+
private:
|
1835
|
+
KeyedLookupCache() {
|
1836
|
+
for (int i = 0; i < kLength; ++i) {
|
1837
|
+
keys_[i].map = NULL;
|
1838
|
+
keys_[i].name = NULL;
|
1839
|
+
field_offsets_[i] = kNotFound;
|
1840
|
+
}
|
1841
|
+
}
|
1842
|
+
|
1843
|
+
static inline int Hash(Map* map, String* name);
|
1844
|
+
|
1845
|
+
// Get the address of the keys and field_offsets arrays. Used in
|
1846
|
+
// generated code to perform cache lookups.
|
1847
|
+
Address keys_address() {
|
1848
|
+
return reinterpret_cast<Address>(&keys_);
|
1849
|
+
}
|
1850
|
+
|
1851
|
+
Address field_offsets_address() {
|
1852
|
+
return reinterpret_cast<Address>(&field_offsets_);
|
1853
|
+
}
|
1854
|
+
|
1855
|
+
struct Key {
|
1856
|
+
Map* map;
|
1857
|
+
String* name;
|
1858
|
+
};
|
1859
|
+
|
1860
|
+
Key keys_[kLength];
|
1861
|
+
int field_offsets_[kLength];
|
1862
|
+
|
1863
|
+
friend class ExternalReference;
|
1864
|
+
friend class Isolate;
|
1865
|
+
DISALLOW_COPY_AND_ASSIGN(KeyedLookupCache);
|
1866
|
+
};
|
1867
|
+
|
1868
|
+
|
1869
|
+
// Cache for mapping (array, property name) into descriptor index.
|
1870
|
+
// The cache contains both positive and negative results.
|
1871
|
+
// Descriptor index equals kNotFound means the property is absent.
|
1872
|
+
// Cleared at startup and prior to any gc.
|
1873
|
+
class DescriptorLookupCache {
|
1874
|
+
public:
|
1875
|
+
// Lookup descriptor index for (map, name).
|
1876
|
+
// If absent, kAbsent is returned.
|
1877
|
+
int Lookup(DescriptorArray* array, String* name) {
|
1878
|
+
if (!StringShape(name).IsSymbol()) return kAbsent;
|
1879
|
+
int index = Hash(array, name);
|
1880
|
+
Key& key = keys_[index];
|
1881
|
+
if ((key.array == array) && (key.name == name)) return results_[index];
|
1882
|
+
return kAbsent;
|
1883
|
+
}
|
1884
|
+
|
1885
|
+
// Update an element in the cache.
|
1886
|
+
void Update(DescriptorArray* array, String* name, int result) {
|
1887
|
+
ASSERT(result != kAbsent);
|
1888
|
+
if (StringShape(name).IsSymbol()) {
|
1889
|
+
int index = Hash(array, name);
|
1890
|
+
Key& key = keys_[index];
|
1891
|
+
key.array = array;
|
1892
|
+
key.name = name;
|
1893
|
+
results_[index] = result;
|
1894
|
+
}
|
1895
|
+
}
|
1896
|
+
|
1897
|
+
// Clear the cache.
|
1898
|
+
void Clear();
|
1899
|
+
|
1900
|
+
static const int kAbsent = -2;
|
1901
|
+
private:
|
1902
|
+
DescriptorLookupCache() {
|
1903
|
+
for (int i = 0; i < kLength; ++i) {
|
1904
|
+
keys_[i].array = NULL;
|
1905
|
+
keys_[i].name = NULL;
|
1906
|
+
results_[i] = kAbsent;
|
1907
|
+
}
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
static int Hash(DescriptorArray* array, String* name) {
|
1911
|
+
// Uses only lower 32 bits if pointers are larger.
|
1912
|
+
uint32_t array_hash =
|
1913
|
+
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(array)) >> 2;
|
1914
|
+
uint32_t name_hash =
|
1915
|
+
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)) >> 2;
|
1916
|
+
return (array_hash ^ name_hash) % kLength;
|
1917
|
+
}
|
1918
|
+
|
1919
|
+
static const int kLength = 64;
|
1920
|
+
struct Key {
|
1921
|
+
DescriptorArray* array;
|
1922
|
+
String* name;
|
1923
|
+
};
|
1924
|
+
|
1925
|
+
Key keys_[kLength];
|
1926
|
+
int results_[kLength];
|
1927
|
+
|
1928
|
+
friend class Isolate;
|
1929
|
+
DISALLOW_COPY_AND_ASSIGN(DescriptorLookupCache);
|
1930
|
+
};
|
1931
|
+
|
1932
|
+
|
1933
|
+
// A helper class to document/test C++ scopes where we do not
|
1934
|
+
// expect a GC. Usage:
|
1935
|
+
//
|
1936
|
+
// /* Allocation not allowed: we cannot handle a GC in this scope. */
|
1937
|
+
// { AssertNoAllocation nogc;
|
1938
|
+
// ...
|
1939
|
+
// }
|
1940
|
+
|
1941
|
+
#ifdef DEBUG
|
1942
|
+
|
1943
|
+
class DisallowAllocationFailure {
|
1944
|
+
public:
|
1945
|
+
DisallowAllocationFailure() {
|
1946
|
+
old_state_ = HEAP->disallow_allocation_failure_;
|
1947
|
+
HEAP->disallow_allocation_failure_ = true;
|
1948
|
+
}
|
1949
|
+
~DisallowAllocationFailure() {
|
1950
|
+
HEAP->disallow_allocation_failure_ = old_state_;
|
1951
|
+
}
|
1952
|
+
private:
|
1953
|
+
bool old_state_;
|
1954
|
+
};
|
1955
|
+
|
1956
|
+
class AssertNoAllocation {
|
1957
|
+
public:
|
1958
|
+
AssertNoAllocation() {
|
1959
|
+
old_state_ = HEAP->allow_allocation(false);
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
~AssertNoAllocation() {
|
1963
|
+
HEAP->allow_allocation(old_state_);
|
1964
|
+
}
|
1965
|
+
|
1966
|
+
private:
|
1967
|
+
bool old_state_;
|
1968
|
+
};
|
1969
|
+
|
1970
|
+
class DisableAssertNoAllocation {
|
1971
|
+
public:
|
1972
|
+
DisableAssertNoAllocation() {
|
1973
|
+
old_state_ = HEAP->allow_allocation(true);
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
~DisableAssertNoAllocation() {
|
1977
|
+
HEAP->allow_allocation(old_state_);
|
1978
|
+
}
|
1979
|
+
|
1980
|
+
private:
|
1981
|
+
bool old_state_;
|
1982
|
+
};
|
1983
|
+
|
1984
|
+
#else // ndef DEBUG
|
1985
|
+
|
1986
|
+
class AssertNoAllocation {
|
1987
|
+
public:
|
1988
|
+
AssertNoAllocation() { }
|
1989
|
+
~AssertNoAllocation() { }
|
1990
|
+
};
|
1991
|
+
|
1992
|
+
class DisableAssertNoAllocation {
|
1993
|
+
public:
|
1994
|
+
DisableAssertNoAllocation() { }
|
1995
|
+
~DisableAssertNoAllocation() { }
|
1996
|
+
};
|
1997
|
+
|
1998
|
+
#endif
|
1999
|
+
|
2000
|
+
// GCTracer collects and prints ONE line after each garbage collector
|
2001
|
+
// invocation IFF --trace_gc is used.
|
2002
|
+
|
2003
|
+
class GCTracer BASE_EMBEDDED {
|
2004
|
+
public:
|
2005
|
+
class Scope BASE_EMBEDDED {
|
2006
|
+
public:
|
2007
|
+
enum ScopeId {
|
2008
|
+
EXTERNAL,
|
2009
|
+
MC_MARK,
|
2010
|
+
MC_SWEEP,
|
2011
|
+
MC_SWEEP_NEWSPACE,
|
2012
|
+
MC_COMPACT,
|
2013
|
+
MC_FLUSH_CODE,
|
2014
|
+
kNumberOfScopes
|
2015
|
+
};
|
2016
|
+
|
2017
|
+
Scope(GCTracer* tracer, ScopeId scope)
|
2018
|
+
: tracer_(tracer),
|
2019
|
+
scope_(scope) {
|
2020
|
+
start_time_ = OS::TimeCurrentMillis();
|
2021
|
+
}
|
2022
|
+
|
2023
|
+
~Scope() {
|
2024
|
+
ASSERT(scope_ < kNumberOfScopes); // scope_ is unsigned.
|
2025
|
+
tracer_->scopes_[scope_] += OS::TimeCurrentMillis() - start_time_;
|
2026
|
+
}
|
2027
|
+
|
2028
|
+
private:
|
2029
|
+
GCTracer* tracer_;
|
2030
|
+
ScopeId scope_;
|
2031
|
+
double start_time_;
|
2032
|
+
};
|
2033
|
+
|
2034
|
+
explicit GCTracer(Heap* heap);
|
2035
|
+
~GCTracer();
|
2036
|
+
|
2037
|
+
// Sets the collector.
|
2038
|
+
void set_collector(GarbageCollector collector) { collector_ = collector; }
|
2039
|
+
|
2040
|
+
// Sets the GC count.
|
2041
|
+
void set_gc_count(unsigned int count) { gc_count_ = count; }
|
2042
|
+
|
2043
|
+
// Sets the full GC count.
|
2044
|
+
void set_full_gc_count(int count) { full_gc_count_ = count; }
|
2045
|
+
|
2046
|
+
// Sets the flag that this is a compacting full GC.
|
2047
|
+
void set_is_compacting() { is_compacting_ = true; }
|
2048
|
+
bool is_compacting() const { return is_compacting_; }
|
2049
|
+
|
2050
|
+
// Increment and decrement the count of marked objects.
|
2051
|
+
void increment_marked_count() { ++marked_count_; }
|
2052
|
+
void decrement_marked_count() { --marked_count_; }
|
2053
|
+
|
2054
|
+
int marked_count() { return marked_count_; }
|
2055
|
+
|
2056
|
+
void increment_promoted_objects_size(int object_size) {
|
2057
|
+
promoted_objects_size_ += object_size;
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
private:
|
2061
|
+
// Returns a string matching the collector.
|
2062
|
+
const char* CollectorString();
|
2063
|
+
|
2064
|
+
// Returns size of object in heap (in MB).
|
2065
|
+
double SizeOfHeapObjects() {
|
2066
|
+
return (static_cast<double>(HEAP->SizeOfObjects())) / MB;
|
2067
|
+
}
|
2068
|
+
|
2069
|
+
double start_time_; // Timestamp set in the constructor.
|
2070
|
+
intptr_t start_size_; // Size of objects in heap set in constructor.
|
2071
|
+
GarbageCollector collector_; // Type of collector.
|
2072
|
+
|
2073
|
+
// A count (including this one, eg, the first collection is 1) of the
|
2074
|
+
// number of garbage collections.
|
2075
|
+
unsigned int gc_count_;
|
2076
|
+
|
2077
|
+
// A count (including this one) of the number of full garbage collections.
|
2078
|
+
int full_gc_count_;
|
2079
|
+
|
2080
|
+
// True if the current GC is a compacting full collection, false
|
2081
|
+
// otherwise.
|
2082
|
+
bool is_compacting_;
|
2083
|
+
|
2084
|
+
// True if the *previous* full GC cwas a compacting collection (will be
|
2085
|
+
// false if there has not been a previous full GC).
|
2086
|
+
bool previous_has_compacted_;
|
2087
|
+
|
2088
|
+
// On a full GC, a count of the number of marked objects. Incremented
|
2089
|
+
// when an object is marked and decremented when an object's mark bit is
|
2090
|
+
// cleared. Will be zero on a scavenge collection.
|
2091
|
+
int marked_count_;
|
2092
|
+
|
2093
|
+
// The count from the end of the previous full GC. Will be zero if there
|
2094
|
+
// was no previous full GC.
|
2095
|
+
int previous_marked_count_;
|
2096
|
+
|
2097
|
+
// Amounts of time spent in different scopes during GC.
|
2098
|
+
double scopes_[Scope::kNumberOfScopes];
|
2099
|
+
|
2100
|
+
// Total amount of space either wasted or contained in one of free lists
|
2101
|
+
// before the current GC.
|
2102
|
+
intptr_t in_free_list_or_wasted_before_gc_;
|
2103
|
+
|
2104
|
+
// Difference between space used in the heap at the beginning of the current
|
2105
|
+
// collection and the end of the previous collection.
|
2106
|
+
intptr_t allocated_since_last_gc_;
|
2107
|
+
|
2108
|
+
// Amount of time spent in mutator that is time elapsed between end of the
|
2109
|
+
// previous collection and the beginning of the current one.
|
2110
|
+
double spent_in_mutator_;
|
2111
|
+
|
2112
|
+
// Size of objects promoted during the current collection.
|
2113
|
+
intptr_t promoted_objects_size_;
|
2114
|
+
|
2115
|
+
Heap* heap_;
|
2116
|
+
};
|
2117
|
+
|
2118
|
+
|
2119
|
+
class TranscendentalCache {
|
2120
|
+
public:
|
2121
|
+
enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches};
|
2122
|
+
static const int kTranscendentalTypeBits = 3;
|
2123
|
+
STATIC_ASSERT((1 << kTranscendentalTypeBits) >= kNumberOfCaches);
|
2124
|
+
|
2125
|
+
// Returns a heap number with f(input), where f is a math function specified
|
2126
|
+
// by the 'type' argument.
|
2127
|
+
MUST_USE_RESULT inline MaybeObject* Get(Type type, double input);
|
2128
|
+
|
2129
|
+
// The cache contains raw Object pointers. This method disposes of
|
2130
|
+
// them before a garbage collection.
|
2131
|
+
void Clear();
|
2132
|
+
|
2133
|
+
private:
|
2134
|
+
class SubCache {
|
2135
|
+
static const int kCacheSize = 512;
|
2136
|
+
|
2137
|
+
explicit SubCache(Type t);
|
2138
|
+
|
2139
|
+
MUST_USE_RESULT inline MaybeObject* Get(double input);
|
2140
|
+
|
2141
|
+
inline double Calculate(double input);
|
2142
|
+
|
2143
|
+
struct Element {
|
2144
|
+
uint32_t in[2];
|
2145
|
+
Object* output;
|
2146
|
+
};
|
2147
|
+
|
2148
|
+
union Converter {
|
2149
|
+
double dbl;
|
2150
|
+
uint32_t integers[2];
|
2151
|
+
};
|
2152
|
+
|
2153
|
+
inline static int Hash(const Converter& c) {
|
2154
|
+
uint32_t hash = (c.integers[0] ^ c.integers[1]);
|
2155
|
+
hash ^= static_cast<int32_t>(hash) >> 16;
|
2156
|
+
hash ^= static_cast<int32_t>(hash) >> 8;
|
2157
|
+
return (hash & (kCacheSize - 1));
|
2158
|
+
}
|
2159
|
+
|
2160
|
+
Element elements_[kCacheSize];
|
2161
|
+
Type type_;
|
2162
|
+
Isolate* isolate_;
|
2163
|
+
|
2164
|
+
// Allow access to the caches_ array as an ExternalReference.
|
2165
|
+
friend class ExternalReference;
|
2166
|
+
// Inline implementation of the cache.
|
2167
|
+
friend class TranscendentalCacheStub;
|
2168
|
+
// For evaluating value.
|
2169
|
+
friend class TranscendentalCache;
|
2170
|
+
|
2171
|
+
DISALLOW_COPY_AND_ASSIGN(SubCache);
|
2172
|
+
};
|
2173
|
+
|
2174
|
+
TranscendentalCache() {
|
2175
|
+
for (int i = 0; i < kNumberOfCaches; ++i) caches_[i] = NULL;
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
// Used to create an external reference.
|
2179
|
+
inline Address cache_array_address();
|
2180
|
+
|
2181
|
+
// Instantiation
|
2182
|
+
friend class Isolate;
|
2183
|
+
// Inline implementation of the caching.
|
2184
|
+
friend class TranscendentalCacheStub;
|
2185
|
+
// Allow access to the caches_ array as an ExternalReference.
|
2186
|
+
friend class ExternalReference;
|
2187
|
+
|
2188
|
+
SubCache* caches_[kNumberOfCaches];
|
2189
|
+
DISALLOW_COPY_AND_ASSIGN(TranscendentalCache);
|
2190
|
+
};
|
2191
|
+
|
2192
|
+
|
2193
|
+
// Abstract base class for checking whether a weak object should be retained.
|
2194
|
+
class WeakObjectRetainer {
|
2195
|
+
public:
|
2196
|
+
virtual ~WeakObjectRetainer() {}
|
2197
|
+
|
2198
|
+
// Return whether this object should be retained. If NULL is returned the
|
2199
|
+
// object has no references. Otherwise the address of the retained object
|
2200
|
+
// should be returned as in some GC situations the object has been moved.
|
2201
|
+
virtual Object* RetainAs(Object* object) = 0;
|
2202
|
+
};
|
2203
|
+
|
2204
|
+
|
2205
|
+
#if defined(DEBUG) || defined(LIVE_OBJECT_LIST)
|
2206
|
+
// Helper class for tracing paths to a search target Object from all roots.
|
2207
|
+
// The TracePathFrom() method can be used to trace paths from a specific
|
2208
|
+
// object to the search target object.
|
2209
|
+
class PathTracer : public ObjectVisitor {
|
2210
|
+
public:
|
2211
|
+
enum WhatToFind {
|
2212
|
+
FIND_ALL, // Will find all matches.
|
2213
|
+
FIND_FIRST // Will stop the search after first match.
|
2214
|
+
};
|
2215
|
+
|
2216
|
+
// For the WhatToFind arg, if FIND_FIRST is specified, tracing will stop
|
2217
|
+
// after the first match. If FIND_ALL is specified, then tracing will be
|
2218
|
+
// done for all matches.
|
2219
|
+
PathTracer(Object* search_target,
|
2220
|
+
WhatToFind what_to_find,
|
2221
|
+
VisitMode visit_mode)
|
2222
|
+
: search_target_(search_target),
|
2223
|
+
found_target_(false),
|
2224
|
+
found_target_in_trace_(false),
|
2225
|
+
what_to_find_(what_to_find),
|
2226
|
+
visit_mode_(visit_mode),
|
2227
|
+
object_stack_(20),
|
2228
|
+
no_alloc() {}
|
2229
|
+
|
2230
|
+
virtual void VisitPointers(Object** start, Object** end);
|
2231
|
+
|
2232
|
+
void Reset();
|
2233
|
+
void TracePathFrom(Object** root);
|
2234
|
+
|
2235
|
+
bool found() const { return found_target_; }
|
2236
|
+
|
2237
|
+
static Object* const kAnyGlobalObject;
|
2238
|
+
|
2239
|
+
protected:
|
2240
|
+
class MarkVisitor;
|
2241
|
+
class UnmarkVisitor;
|
2242
|
+
|
2243
|
+
void MarkRecursively(Object** p, MarkVisitor* mark_visitor);
|
2244
|
+
void UnmarkRecursively(Object** p, UnmarkVisitor* unmark_visitor);
|
2245
|
+
virtual void ProcessResults();
|
2246
|
+
|
2247
|
+
// Tags 0, 1, and 3 are used. Use 2 for marking visited HeapObject.
|
2248
|
+
static const int kMarkTag = 2;
|
2249
|
+
|
2250
|
+
Object* search_target_;
|
2251
|
+
bool found_target_;
|
2252
|
+
bool found_target_in_trace_;
|
2253
|
+
WhatToFind what_to_find_;
|
2254
|
+
VisitMode visit_mode_;
|
2255
|
+
List<Object*> object_stack_;
|
2256
|
+
|
2257
|
+
AssertNoAllocation no_alloc; // i.e. no gc allowed.
|
2258
|
+
|
2259
|
+
DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
|
2260
|
+
};
|
2261
|
+
#endif // DEBUG || LIVE_OBJECT_LIST
|
2262
|
+
|
2263
|
+
|
2264
|
+
} } // namespace v8::internal
|
2265
|
+
|
2266
|
+
#undef HEAP
|
2267
|
+
|
2268
|
+
#endif // V8_HEAP_H_
|