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,103 @@
|
|
1
|
+
// Copyright 2010 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#ifndef V8_CIRCULAR_QUEUE_H_
|
29
|
+
#define V8_CIRCULAR_QUEUE_H_
|
30
|
+
|
31
|
+
namespace v8 {
|
32
|
+
namespace internal {
|
33
|
+
|
34
|
+
|
35
|
+
// Lock-free cache-friendly sampling circular queue for large
|
36
|
+
// records. Intended for fast transfer of large records between a
|
37
|
+
// single producer and a single consumer. If the queue is full,
|
38
|
+
// previous unread records are overwritten. The queue is designed with
|
39
|
+
// a goal in mind to evade cache lines thrashing by preventing
|
40
|
+
// simultaneous reads and writes to adjanced memory locations.
|
41
|
+
//
|
42
|
+
// IMPORTANT: as a producer never checks for chunks cleanness, it is
|
43
|
+
// possible that it can catch up and overwrite a chunk that a consumer
|
44
|
+
// is currently reading, resulting in a corrupt record being read.
|
45
|
+
class SamplingCircularQueue {
|
46
|
+
public:
|
47
|
+
// Executed on the application thread.
|
48
|
+
SamplingCircularQueue(int record_size_in_bytes,
|
49
|
+
int desired_chunk_size_in_bytes,
|
50
|
+
int buffer_size_in_chunks);
|
51
|
+
~SamplingCircularQueue();
|
52
|
+
|
53
|
+
// Enqueue returns a pointer to a memory location for storing the next
|
54
|
+
// record.
|
55
|
+
INLINE(void* Enqueue());
|
56
|
+
|
57
|
+
// Executed on the consumer (analyzer) thread.
|
58
|
+
// StartDequeue returns a pointer to a memory location for retrieving
|
59
|
+
// the next record. After the record had been read by a consumer,
|
60
|
+
// FinishDequeue must be called. Until that moment, subsequent calls
|
61
|
+
// to StartDequeue will return the same pointer.
|
62
|
+
void* StartDequeue();
|
63
|
+
void FinishDequeue();
|
64
|
+
// Due to a presence of slipping between the producer and the consumer,
|
65
|
+
// the queue must be notified whether producing has been finished in order
|
66
|
+
// to process remaining records from the buffer.
|
67
|
+
void FlushResidualRecords();
|
68
|
+
|
69
|
+
typedef AtomicWord Cell;
|
70
|
+
// Reserved values for the first cell of a record.
|
71
|
+
static const Cell kClear = 0; // Marks clean (processed) chunks.
|
72
|
+
static const Cell kEnd = -1; // Marks the end of the buffer.
|
73
|
+
|
74
|
+
private:
|
75
|
+
struct ProducerPosition {
|
76
|
+
Cell* enqueue_pos;
|
77
|
+
};
|
78
|
+
struct ConsumerPosition {
|
79
|
+
Cell* dequeue_chunk_pos;
|
80
|
+
Cell* dequeue_chunk_poll_pos;
|
81
|
+
Cell* dequeue_pos;
|
82
|
+
Cell* dequeue_end_pos;
|
83
|
+
};
|
84
|
+
|
85
|
+
INLINE(void WrapPositionIfNeeded(Cell** pos));
|
86
|
+
|
87
|
+
const int record_size_;
|
88
|
+
const int chunk_size_in_bytes_;
|
89
|
+
const int chunk_size_;
|
90
|
+
const int buffer_size_;
|
91
|
+
const int producer_consumer_distance_;
|
92
|
+
Cell* buffer_;
|
93
|
+
byte* positions_;
|
94
|
+
ProducerPosition* producer_pos_;
|
95
|
+
ConsumerPosition* consumer_pos_;
|
96
|
+
|
97
|
+
DISALLOW_COPY_AND_ASSIGN(SamplingCircularQueue);
|
98
|
+
};
|
99
|
+
|
100
|
+
|
101
|
+
} } // namespace v8::internal
|
102
|
+
|
103
|
+
#endif // V8_CIRCULAR_QUEUE_H_
|
@@ -0,0 +1,267 @@
|
|
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
|
+
#include "v8.h"
|
29
|
+
|
30
|
+
#include "bootstrapper.h"
|
31
|
+
#include "code-stubs.h"
|
32
|
+
#include "stub-cache.h"
|
33
|
+
#include "factory.h"
|
34
|
+
#include "gdb-jit.h"
|
35
|
+
#include "macro-assembler.h"
|
36
|
+
|
37
|
+
namespace v8 {
|
38
|
+
namespace internal {
|
39
|
+
|
40
|
+
bool CodeStub::FindCodeInCache(Code** code_out) {
|
41
|
+
Heap* heap = Isolate::Current()->heap();
|
42
|
+
int index = heap->code_stubs()->FindEntry(GetKey());
|
43
|
+
if (index != NumberDictionary::kNotFound) {
|
44
|
+
*code_out = Code::cast(heap->code_stubs()->ValueAt(index));
|
45
|
+
return true;
|
46
|
+
}
|
47
|
+
return false;
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
void CodeStub::GenerateCode(MacroAssembler* masm) {
|
52
|
+
// Update the static counter each time a new code stub is generated.
|
53
|
+
masm->isolate()->counters()->code_stubs()->Increment();
|
54
|
+
|
55
|
+
// Nested stubs are not allowed for leafs.
|
56
|
+
AllowStubCallsScope allow_scope(masm, AllowsStubCalls());
|
57
|
+
|
58
|
+
// Generate the code for the stub.
|
59
|
+
masm->set_generating_stub(true);
|
60
|
+
Generate(masm);
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
void CodeStub::RecordCodeGeneration(Code* code, MacroAssembler* masm) {
|
65
|
+
code->set_major_key(MajorKey());
|
66
|
+
|
67
|
+
Isolate* isolate = masm->isolate();
|
68
|
+
PROFILE(isolate, CodeCreateEvent(Logger::STUB_TAG, code, GetName()));
|
69
|
+
GDBJIT(AddCode(GDBJITInterface::STUB, GetName(), code));
|
70
|
+
Counters* counters = isolate->counters();
|
71
|
+
counters->total_stubs_code_size()->Increment(code->instruction_size());
|
72
|
+
|
73
|
+
#ifdef ENABLE_DISASSEMBLER
|
74
|
+
if (FLAG_print_code_stubs) {
|
75
|
+
#ifdef DEBUG
|
76
|
+
Print();
|
77
|
+
#endif
|
78
|
+
code->Disassemble(GetName());
|
79
|
+
PrintF("\n");
|
80
|
+
}
|
81
|
+
#endif
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
int CodeStub::GetCodeKind() {
|
86
|
+
return Code::STUB;
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
Handle<Code> CodeStub::GetCode() {
|
91
|
+
Isolate* isolate = Isolate::Current();
|
92
|
+
Factory* factory = isolate->factory();
|
93
|
+
Heap* heap = isolate->heap();
|
94
|
+
Code* code;
|
95
|
+
if (!FindCodeInCache(&code)) {
|
96
|
+
HandleScope scope(isolate);
|
97
|
+
|
98
|
+
// Generate the new code.
|
99
|
+
MacroAssembler masm(isolate, NULL, 256);
|
100
|
+
GenerateCode(&masm);
|
101
|
+
|
102
|
+
// Create the code object.
|
103
|
+
CodeDesc desc;
|
104
|
+
masm.GetCode(&desc);
|
105
|
+
|
106
|
+
// Copy the generated code into a heap object.
|
107
|
+
Code::Flags flags = Code::ComputeFlags(
|
108
|
+
static_cast<Code::Kind>(GetCodeKind()),
|
109
|
+
InLoop(),
|
110
|
+
GetICState());
|
111
|
+
Handle<Code> new_object = factory->NewCode(
|
112
|
+
desc, flags, masm.CodeObject(), NeedsImmovableCode());
|
113
|
+
RecordCodeGeneration(*new_object, &masm);
|
114
|
+
FinishCode(*new_object);
|
115
|
+
|
116
|
+
// Update the dictionary and the root in Heap.
|
117
|
+
Handle<NumberDictionary> dict =
|
118
|
+
factory->DictionaryAtNumberPut(
|
119
|
+
Handle<NumberDictionary>(heap->code_stubs()),
|
120
|
+
GetKey(),
|
121
|
+
new_object);
|
122
|
+
heap->public_set_code_stubs(*dict);
|
123
|
+
|
124
|
+
code = *new_object;
|
125
|
+
}
|
126
|
+
|
127
|
+
ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code));
|
128
|
+
return Handle<Code>(code, isolate);
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
MaybeObject* CodeStub::TryGetCode() {
|
133
|
+
Code* code;
|
134
|
+
if (!FindCodeInCache(&code)) {
|
135
|
+
// Generate the new code.
|
136
|
+
MacroAssembler masm(Isolate::Current(), NULL, 256);
|
137
|
+
GenerateCode(&masm);
|
138
|
+
Heap* heap = masm.isolate()->heap();
|
139
|
+
|
140
|
+
// Create the code object.
|
141
|
+
CodeDesc desc;
|
142
|
+
masm.GetCode(&desc);
|
143
|
+
|
144
|
+
// Try to copy the generated code into a heap object.
|
145
|
+
Code::Flags flags = Code::ComputeFlags(
|
146
|
+
static_cast<Code::Kind>(GetCodeKind()),
|
147
|
+
InLoop(),
|
148
|
+
GetICState());
|
149
|
+
Object* new_object;
|
150
|
+
{ MaybeObject* maybe_new_object =
|
151
|
+
heap->CreateCode(desc, flags, masm.CodeObject());
|
152
|
+
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
|
153
|
+
}
|
154
|
+
code = Code::cast(new_object);
|
155
|
+
RecordCodeGeneration(code, &masm);
|
156
|
+
FinishCode(code);
|
157
|
+
|
158
|
+
// Try to update the code cache but do not fail if unable.
|
159
|
+
MaybeObject* maybe_new_object =
|
160
|
+
heap->code_stubs()->AtNumberPut(GetKey(), code);
|
161
|
+
if (maybe_new_object->ToObject(&new_object)) {
|
162
|
+
heap->public_set_code_stubs(NumberDictionary::cast(new_object));
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
return code;
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
const char* CodeStub::MajorName(CodeStub::Major major_key,
|
171
|
+
bool allow_unknown_keys) {
|
172
|
+
switch (major_key) {
|
173
|
+
#define DEF_CASE(name) case name: return #name;
|
174
|
+
CODE_STUB_LIST(DEF_CASE)
|
175
|
+
#undef DEF_CASE
|
176
|
+
default:
|
177
|
+
if (!allow_unknown_keys) {
|
178
|
+
UNREACHABLE();
|
179
|
+
}
|
180
|
+
return NULL;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
|
185
|
+
int ICCompareStub::MinorKey() {
|
186
|
+
return OpField::encode(op_ - Token::EQ) | StateField::encode(state_);
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
void ICCompareStub::Generate(MacroAssembler* masm) {
|
191
|
+
switch (state_) {
|
192
|
+
case CompareIC::UNINITIALIZED:
|
193
|
+
GenerateMiss(masm);
|
194
|
+
break;
|
195
|
+
case CompareIC::SMIS:
|
196
|
+
GenerateSmis(masm);
|
197
|
+
break;
|
198
|
+
case CompareIC::HEAP_NUMBERS:
|
199
|
+
GenerateHeapNumbers(masm);
|
200
|
+
break;
|
201
|
+
case CompareIC::STRINGS:
|
202
|
+
GenerateStrings(masm);
|
203
|
+
break;
|
204
|
+
case CompareIC::SYMBOLS:
|
205
|
+
GenerateSymbols(masm);
|
206
|
+
break;
|
207
|
+
case CompareIC::OBJECTS:
|
208
|
+
GenerateObjects(masm);
|
209
|
+
break;
|
210
|
+
default:
|
211
|
+
UNREACHABLE();
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
const char* InstanceofStub::GetName() {
|
217
|
+
if (name_ != NULL) return name_;
|
218
|
+
const int kMaxNameLength = 100;
|
219
|
+
name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
|
220
|
+
kMaxNameLength);
|
221
|
+
if (name_ == NULL) return "OOM";
|
222
|
+
|
223
|
+
const char* args = "";
|
224
|
+
if (HasArgsInRegisters()) {
|
225
|
+
args = "_REGS";
|
226
|
+
}
|
227
|
+
|
228
|
+
const char* inline_check = "";
|
229
|
+
if (HasCallSiteInlineCheck()) {
|
230
|
+
inline_check = "_INLINE";
|
231
|
+
}
|
232
|
+
|
233
|
+
const char* return_true_false_object = "";
|
234
|
+
if (ReturnTrueFalseObject()) {
|
235
|
+
return_true_false_object = "_TRUEFALSE";
|
236
|
+
}
|
237
|
+
|
238
|
+
OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
|
239
|
+
"InstanceofStub%s%s%s",
|
240
|
+
args,
|
241
|
+
inline_check,
|
242
|
+
return_true_false_object);
|
243
|
+
return name_;
|
244
|
+
}
|
245
|
+
|
246
|
+
|
247
|
+
void KeyedLoadFastElementStub::Generate(MacroAssembler* masm) {
|
248
|
+
KeyedLoadStubCompiler::GenerateLoadFastElement(masm);
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
void KeyedStoreFastElementStub::Generate(MacroAssembler* masm) {
|
253
|
+
KeyedStoreStubCompiler::GenerateStoreFastElement(masm, is_js_array_);
|
254
|
+
}
|
255
|
+
|
256
|
+
|
257
|
+
void KeyedLoadExternalArrayStub::Generate(MacroAssembler* masm) {
|
258
|
+
KeyedLoadStubCompiler::GenerateLoadExternalArray(masm, array_type_);
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
void KeyedStoreExternalArrayStub::Generate(MacroAssembler* masm) {
|
263
|
+
KeyedStoreStubCompiler::GenerateStoreExternalArray(masm, array_type_);
|
264
|
+
}
|
265
|
+
|
266
|
+
|
267
|
+
} } // namespace v8::internal
|
@@ -0,0 +1,1011 @@
|
|
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_CODE_STUBS_H_
|
29
|
+
#define V8_CODE_STUBS_H_
|
30
|
+
|
31
|
+
#include "allocation.h"
|
32
|
+
#include "globals.h"
|
33
|
+
|
34
|
+
namespace v8 {
|
35
|
+
namespace internal {
|
36
|
+
|
37
|
+
// List of code stubs used on all platforms. The order in this list is important
|
38
|
+
// as only the stubs up to and including Instanceof allows nested stub calls.
|
39
|
+
#define CODE_STUB_LIST_ALL_PLATFORMS(V) \
|
40
|
+
V(CallFunction) \
|
41
|
+
V(UnaryOp) \
|
42
|
+
V(BinaryOp) \
|
43
|
+
V(StringAdd) \
|
44
|
+
V(SubString) \
|
45
|
+
V(StringCompare) \
|
46
|
+
V(SmiOp) \
|
47
|
+
V(Compare) \
|
48
|
+
V(CompareIC) \
|
49
|
+
V(MathPow) \
|
50
|
+
V(TranscendentalCache) \
|
51
|
+
V(Instanceof) \
|
52
|
+
V(ConvertToDouble) \
|
53
|
+
V(WriteInt32ToHeapNumber) \
|
54
|
+
V(StackCheck) \
|
55
|
+
V(FastNewClosure) \
|
56
|
+
V(FastNewContext) \
|
57
|
+
V(FastCloneShallowArray) \
|
58
|
+
V(RevertToNumber) \
|
59
|
+
V(ToBoolean) \
|
60
|
+
V(ToNumber) \
|
61
|
+
V(CounterOp) \
|
62
|
+
V(ArgumentsAccess) \
|
63
|
+
V(RegExpExec) \
|
64
|
+
V(RegExpConstructResult) \
|
65
|
+
V(NumberToString) \
|
66
|
+
V(CEntry) \
|
67
|
+
V(JSEntry) \
|
68
|
+
V(KeyedLoadFastElement) \
|
69
|
+
V(KeyedStoreFastElement) \
|
70
|
+
V(KeyedLoadExternalArray) \
|
71
|
+
V(KeyedStoreExternalArray) \
|
72
|
+
V(DebuggerStatement) \
|
73
|
+
V(StringDictionaryNegativeLookup)
|
74
|
+
|
75
|
+
// List of code stubs only used on ARM platforms.
|
76
|
+
#ifdef V8_TARGET_ARCH_ARM
|
77
|
+
#define CODE_STUB_LIST_ARM(V) \
|
78
|
+
V(GetProperty) \
|
79
|
+
V(SetProperty) \
|
80
|
+
V(InvokeBuiltin) \
|
81
|
+
V(RegExpCEntry) \
|
82
|
+
V(DirectCEntry)
|
83
|
+
#else
|
84
|
+
#define CODE_STUB_LIST_ARM(V)
|
85
|
+
#endif
|
86
|
+
|
87
|
+
// List of code stubs only used on MIPS platforms.
|
88
|
+
#ifdef V8_TARGET_ARCH_MIPS
|
89
|
+
#define CODE_STUB_LIST_MIPS(V) \
|
90
|
+
V(RegExpCEntry) \
|
91
|
+
V(DirectCEntry)
|
92
|
+
#else
|
93
|
+
#define CODE_STUB_LIST_MIPS(V)
|
94
|
+
#endif
|
95
|
+
|
96
|
+
// Combined list of code stubs.
|
97
|
+
#define CODE_STUB_LIST(V) \
|
98
|
+
CODE_STUB_LIST_ALL_PLATFORMS(V) \
|
99
|
+
CODE_STUB_LIST_ARM(V) \
|
100
|
+
CODE_STUB_LIST_MIPS(V)
|
101
|
+
|
102
|
+
// Mode to overwrite BinaryExpression values.
|
103
|
+
enum OverwriteMode { NO_OVERWRITE, OVERWRITE_LEFT, OVERWRITE_RIGHT };
|
104
|
+
enum UnaryOverwriteMode { UNARY_OVERWRITE, UNARY_NO_OVERWRITE };
|
105
|
+
|
106
|
+
|
107
|
+
// Stub is base classes of all stubs.
|
108
|
+
class CodeStub BASE_EMBEDDED {
|
109
|
+
public:
|
110
|
+
enum Major {
|
111
|
+
#define DEF_ENUM(name) name,
|
112
|
+
CODE_STUB_LIST(DEF_ENUM)
|
113
|
+
#undef DEF_ENUM
|
114
|
+
NoCache, // marker for stubs that do custom caching
|
115
|
+
NUMBER_OF_IDS
|
116
|
+
};
|
117
|
+
|
118
|
+
// Retrieve the code for the stub. Generate the code if needed.
|
119
|
+
Handle<Code> GetCode();
|
120
|
+
|
121
|
+
// Retrieve the code for the stub if already generated. Do not
|
122
|
+
// generate the code if not already generated and instead return a
|
123
|
+
// retry after GC Failure object.
|
124
|
+
MUST_USE_RESULT MaybeObject* TryGetCode();
|
125
|
+
|
126
|
+
static Major MajorKeyFromKey(uint32_t key) {
|
127
|
+
return static_cast<Major>(MajorKeyBits::decode(key));
|
128
|
+
}
|
129
|
+
static int MinorKeyFromKey(uint32_t key) {
|
130
|
+
return MinorKeyBits::decode(key);
|
131
|
+
}
|
132
|
+
|
133
|
+
// Gets the major key from a code object that is a code stub or binary op IC.
|
134
|
+
static Major GetMajorKey(Code* code_stub) {
|
135
|
+
return static_cast<Major>(code_stub->major_key());
|
136
|
+
}
|
137
|
+
|
138
|
+
static const char* MajorName(Major major_key, bool allow_unknown_keys);
|
139
|
+
|
140
|
+
virtual ~CodeStub() {}
|
141
|
+
|
142
|
+
protected:
|
143
|
+
static const int kMajorBits = 6;
|
144
|
+
static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits;
|
145
|
+
|
146
|
+
private:
|
147
|
+
// Lookup the code in the (possibly custom) cache.
|
148
|
+
bool FindCodeInCache(Code** code_out);
|
149
|
+
|
150
|
+
// Nonvirtual wrapper around the stub-specific Generate function. Call
|
151
|
+
// this function to set up the macro assembler and generate the code.
|
152
|
+
void GenerateCode(MacroAssembler* masm);
|
153
|
+
|
154
|
+
// Generates the assembler code for the stub.
|
155
|
+
virtual void Generate(MacroAssembler* masm) = 0;
|
156
|
+
|
157
|
+
// Perform bookkeeping required after code generation when stub code is
|
158
|
+
// initially generated.
|
159
|
+
void RecordCodeGeneration(Code* code, MacroAssembler* masm);
|
160
|
+
|
161
|
+
// Finish the code object after it has been generated.
|
162
|
+
virtual void FinishCode(Code* code) { }
|
163
|
+
|
164
|
+
// Returns information for computing the number key.
|
165
|
+
virtual Major MajorKey() = 0;
|
166
|
+
virtual int MinorKey() = 0;
|
167
|
+
|
168
|
+
// The CallFunctionStub needs to override this so it can encode whether a
|
169
|
+
// lazily generated function should be fully optimized or not.
|
170
|
+
virtual InLoopFlag InLoop() { return NOT_IN_LOOP; }
|
171
|
+
|
172
|
+
// BinaryOpStub needs to override this.
|
173
|
+
virtual int GetCodeKind();
|
174
|
+
|
175
|
+
// BinaryOpStub needs to override this.
|
176
|
+
virtual InlineCacheState GetICState() {
|
177
|
+
return UNINITIALIZED;
|
178
|
+
}
|
179
|
+
|
180
|
+
// Returns a name for logging/debugging purposes.
|
181
|
+
virtual const char* GetName() { return MajorName(MajorKey(), false); }
|
182
|
+
|
183
|
+
// Returns whether the code generated for this stub needs to be allocated as
|
184
|
+
// a fixed (non-moveable) code object.
|
185
|
+
virtual bool NeedsImmovableCode() { return false; }
|
186
|
+
|
187
|
+
#ifdef DEBUG
|
188
|
+
virtual void Print() { PrintF("%s\n", GetName()); }
|
189
|
+
#endif
|
190
|
+
|
191
|
+
// Computes the key based on major and minor.
|
192
|
+
uint32_t GetKey() {
|
193
|
+
ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
|
194
|
+
return MinorKeyBits::encode(MinorKey()) |
|
195
|
+
MajorKeyBits::encode(MajorKey());
|
196
|
+
}
|
197
|
+
|
198
|
+
bool AllowsStubCalls() { return MajorKey() <= Instanceof; }
|
199
|
+
|
200
|
+
class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {};
|
201
|
+
class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {};
|
202
|
+
|
203
|
+
friend class BreakPointIterator;
|
204
|
+
};
|
205
|
+
|
206
|
+
|
207
|
+
// Helper interface to prepare to/restore after making runtime calls.
|
208
|
+
class RuntimeCallHelper {
|
209
|
+
public:
|
210
|
+
virtual ~RuntimeCallHelper() {}
|
211
|
+
|
212
|
+
virtual void BeforeCall(MacroAssembler* masm) const = 0;
|
213
|
+
|
214
|
+
virtual void AfterCall(MacroAssembler* masm) const = 0;
|
215
|
+
|
216
|
+
protected:
|
217
|
+
RuntimeCallHelper() {}
|
218
|
+
|
219
|
+
private:
|
220
|
+
DISALLOW_COPY_AND_ASSIGN(RuntimeCallHelper);
|
221
|
+
};
|
222
|
+
|
223
|
+
} } // namespace v8::internal
|
224
|
+
|
225
|
+
#if V8_TARGET_ARCH_IA32
|
226
|
+
#include "ia32/code-stubs-ia32.h"
|
227
|
+
#elif V8_TARGET_ARCH_X64
|
228
|
+
#include "x64/code-stubs-x64.h"
|
229
|
+
#elif V8_TARGET_ARCH_ARM
|
230
|
+
#include "arm/code-stubs-arm.h"
|
231
|
+
#elif V8_TARGET_ARCH_MIPS
|
232
|
+
#include "mips/code-stubs-mips.h"
|
233
|
+
#else
|
234
|
+
#error Unsupported target architecture.
|
235
|
+
#endif
|
236
|
+
|
237
|
+
namespace v8 {
|
238
|
+
namespace internal {
|
239
|
+
|
240
|
+
|
241
|
+
// RuntimeCallHelper implementation used in stubs: enters/leaves a
|
242
|
+
// newly created internal frame before/after the runtime call.
|
243
|
+
class StubRuntimeCallHelper : public RuntimeCallHelper {
|
244
|
+
public:
|
245
|
+
StubRuntimeCallHelper() {}
|
246
|
+
|
247
|
+
virtual void BeforeCall(MacroAssembler* masm) const;
|
248
|
+
|
249
|
+
virtual void AfterCall(MacroAssembler* masm) const;
|
250
|
+
};
|
251
|
+
|
252
|
+
|
253
|
+
// Trivial RuntimeCallHelper implementation.
|
254
|
+
class NopRuntimeCallHelper : public RuntimeCallHelper {
|
255
|
+
public:
|
256
|
+
NopRuntimeCallHelper() {}
|
257
|
+
|
258
|
+
virtual void BeforeCall(MacroAssembler* masm) const {}
|
259
|
+
|
260
|
+
virtual void AfterCall(MacroAssembler* masm) const {}
|
261
|
+
};
|
262
|
+
|
263
|
+
|
264
|
+
class StackCheckStub : public CodeStub {
|
265
|
+
public:
|
266
|
+
StackCheckStub() { }
|
267
|
+
|
268
|
+
void Generate(MacroAssembler* masm);
|
269
|
+
|
270
|
+
private:
|
271
|
+
|
272
|
+
const char* GetName() { return "StackCheckStub"; }
|
273
|
+
|
274
|
+
Major MajorKey() { return StackCheck; }
|
275
|
+
int MinorKey() { return 0; }
|
276
|
+
};
|
277
|
+
|
278
|
+
|
279
|
+
class ToNumberStub: public CodeStub {
|
280
|
+
public:
|
281
|
+
ToNumberStub() { }
|
282
|
+
|
283
|
+
void Generate(MacroAssembler* masm);
|
284
|
+
|
285
|
+
private:
|
286
|
+
Major MajorKey() { return ToNumber; }
|
287
|
+
int MinorKey() { return 0; }
|
288
|
+
const char* GetName() { return "ToNumberStub"; }
|
289
|
+
};
|
290
|
+
|
291
|
+
|
292
|
+
class FastNewClosureStub : public CodeStub {
|
293
|
+
public:
|
294
|
+
explicit FastNewClosureStub(StrictModeFlag strict_mode)
|
295
|
+
: strict_mode_(strict_mode) { }
|
296
|
+
|
297
|
+
void Generate(MacroAssembler* masm);
|
298
|
+
|
299
|
+
private:
|
300
|
+
const char* GetName() { return "FastNewClosureStub"; }
|
301
|
+
Major MajorKey() { return FastNewClosure; }
|
302
|
+
int MinorKey() { return strict_mode_; }
|
303
|
+
|
304
|
+
StrictModeFlag strict_mode_;
|
305
|
+
};
|
306
|
+
|
307
|
+
|
308
|
+
class FastNewContextStub : public CodeStub {
|
309
|
+
public:
|
310
|
+
static const int kMaximumSlots = 64;
|
311
|
+
|
312
|
+
explicit FastNewContextStub(int slots) : slots_(slots) {
|
313
|
+
ASSERT(slots_ > 0 && slots <= kMaximumSlots);
|
314
|
+
}
|
315
|
+
|
316
|
+
void Generate(MacroAssembler* masm);
|
317
|
+
|
318
|
+
private:
|
319
|
+
int slots_;
|
320
|
+
|
321
|
+
const char* GetName() { return "FastNewContextStub"; }
|
322
|
+
Major MajorKey() { return FastNewContext; }
|
323
|
+
int MinorKey() { return slots_; }
|
324
|
+
};
|
325
|
+
|
326
|
+
|
327
|
+
class FastCloneShallowArrayStub : public CodeStub {
|
328
|
+
public:
|
329
|
+
// Maximum length of copied elements array.
|
330
|
+
static const int kMaximumClonedLength = 8;
|
331
|
+
|
332
|
+
enum Mode {
|
333
|
+
CLONE_ELEMENTS,
|
334
|
+
COPY_ON_WRITE_ELEMENTS
|
335
|
+
};
|
336
|
+
|
337
|
+
FastCloneShallowArrayStub(Mode mode, int length)
|
338
|
+
: mode_(mode),
|
339
|
+
length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
|
340
|
+
ASSERT(length_ >= 0);
|
341
|
+
ASSERT(length_ <= kMaximumClonedLength);
|
342
|
+
}
|
343
|
+
|
344
|
+
void Generate(MacroAssembler* masm);
|
345
|
+
|
346
|
+
private:
|
347
|
+
Mode mode_;
|
348
|
+
int length_;
|
349
|
+
|
350
|
+
const char* GetName() { return "FastCloneShallowArrayStub"; }
|
351
|
+
Major MajorKey() { return FastCloneShallowArray; }
|
352
|
+
int MinorKey() {
|
353
|
+
ASSERT(mode_ == 0 || mode_ == 1);
|
354
|
+
return (length_ << 1) | mode_;
|
355
|
+
}
|
356
|
+
};
|
357
|
+
|
358
|
+
|
359
|
+
class InstanceofStub: public CodeStub {
|
360
|
+
public:
|
361
|
+
enum Flags {
|
362
|
+
kNoFlags = 0,
|
363
|
+
kArgsInRegisters = 1 << 0,
|
364
|
+
kCallSiteInlineCheck = 1 << 1,
|
365
|
+
kReturnTrueFalseObject = 1 << 2
|
366
|
+
};
|
367
|
+
|
368
|
+
explicit InstanceofStub(Flags flags) : flags_(flags), name_(NULL) { }
|
369
|
+
|
370
|
+
static Register left();
|
371
|
+
static Register right();
|
372
|
+
|
373
|
+
void Generate(MacroAssembler* masm);
|
374
|
+
|
375
|
+
private:
|
376
|
+
Major MajorKey() { return Instanceof; }
|
377
|
+
int MinorKey() { return static_cast<int>(flags_); }
|
378
|
+
|
379
|
+
bool HasArgsInRegisters() const {
|
380
|
+
return (flags_ & kArgsInRegisters) != 0;
|
381
|
+
}
|
382
|
+
|
383
|
+
bool HasCallSiteInlineCheck() const {
|
384
|
+
return (flags_ & kCallSiteInlineCheck) != 0;
|
385
|
+
}
|
386
|
+
|
387
|
+
bool ReturnTrueFalseObject() const {
|
388
|
+
return (flags_ & kReturnTrueFalseObject) != 0;
|
389
|
+
}
|
390
|
+
|
391
|
+
const char* GetName();
|
392
|
+
|
393
|
+
Flags flags_;
|
394
|
+
char* name_;
|
395
|
+
};
|
396
|
+
|
397
|
+
|
398
|
+
class MathPowStub: public CodeStub {
|
399
|
+
public:
|
400
|
+
MathPowStub() {}
|
401
|
+
virtual void Generate(MacroAssembler* masm);
|
402
|
+
|
403
|
+
private:
|
404
|
+
virtual CodeStub::Major MajorKey() { return MathPow; }
|
405
|
+
virtual int MinorKey() { return 0; }
|
406
|
+
|
407
|
+
const char* GetName() { return "MathPowStub"; }
|
408
|
+
};
|
409
|
+
|
410
|
+
|
411
|
+
class ICCompareStub: public CodeStub {
|
412
|
+
public:
|
413
|
+
ICCompareStub(Token::Value op, CompareIC::State state)
|
414
|
+
: op_(op), state_(state) {
|
415
|
+
ASSERT(Token::IsCompareOp(op));
|
416
|
+
}
|
417
|
+
|
418
|
+
virtual void Generate(MacroAssembler* masm);
|
419
|
+
|
420
|
+
private:
|
421
|
+
class OpField: public BitField<int, 0, 3> { };
|
422
|
+
class StateField: public BitField<int, 3, 5> { };
|
423
|
+
|
424
|
+
virtual void FinishCode(Code* code) { code->set_compare_state(state_); }
|
425
|
+
|
426
|
+
virtual CodeStub::Major MajorKey() { return CompareIC; }
|
427
|
+
virtual int MinorKey();
|
428
|
+
|
429
|
+
virtual int GetCodeKind() { return Code::COMPARE_IC; }
|
430
|
+
|
431
|
+
void GenerateSmis(MacroAssembler* masm);
|
432
|
+
void GenerateHeapNumbers(MacroAssembler* masm);
|
433
|
+
void GenerateSymbols(MacroAssembler* masm);
|
434
|
+
void GenerateStrings(MacroAssembler* masm);
|
435
|
+
void GenerateObjects(MacroAssembler* masm);
|
436
|
+
void GenerateMiss(MacroAssembler* masm);
|
437
|
+
|
438
|
+
bool strict() const { return op_ == Token::EQ_STRICT; }
|
439
|
+
Condition GetCondition() const { return CompareIC::ComputeCondition(op_); }
|
440
|
+
|
441
|
+
Token::Value op_;
|
442
|
+
CompareIC::State state_;
|
443
|
+
};
|
444
|
+
|
445
|
+
|
446
|
+
// Flags that control the compare stub code generation.
|
447
|
+
enum CompareFlags {
|
448
|
+
NO_COMPARE_FLAGS = 0,
|
449
|
+
NO_SMI_COMPARE_IN_STUB = 1 << 0,
|
450
|
+
NO_NUMBER_COMPARE_IN_STUB = 1 << 1,
|
451
|
+
CANT_BOTH_BE_NAN = 1 << 2
|
452
|
+
};
|
453
|
+
|
454
|
+
|
455
|
+
enum NaNInformation {
|
456
|
+
kBothCouldBeNaN,
|
457
|
+
kCantBothBeNaN
|
458
|
+
};
|
459
|
+
|
460
|
+
|
461
|
+
class CompareStub: public CodeStub {
|
462
|
+
public:
|
463
|
+
CompareStub(Condition cc,
|
464
|
+
bool strict,
|
465
|
+
CompareFlags flags,
|
466
|
+
Register lhs,
|
467
|
+
Register rhs) :
|
468
|
+
cc_(cc),
|
469
|
+
strict_(strict),
|
470
|
+
never_nan_nan_((flags & CANT_BOTH_BE_NAN) != 0),
|
471
|
+
include_number_compare_((flags & NO_NUMBER_COMPARE_IN_STUB) == 0),
|
472
|
+
include_smi_compare_((flags & NO_SMI_COMPARE_IN_STUB) == 0),
|
473
|
+
lhs_(lhs),
|
474
|
+
rhs_(rhs),
|
475
|
+
name_(NULL) { }
|
476
|
+
|
477
|
+
CompareStub(Condition cc,
|
478
|
+
bool strict,
|
479
|
+
CompareFlags flags) :
|
480
|
+
cc_(cc),
|
481
|
+
strict_(strict),
|
482
|
+
never_nan_nan_((flags & CANT_BOTH_BE_NAN) != 0),
|
483
|
+
include_number_compare_((flags & NO_NUMBER_COMPARE_IN_STUB) == 0),
|
484
|
+
include_smi_compare_((flags & NO_SMI_COMPARE_IN_STUB) == 0),
|
485
|
+
lhs_(no_reg),
|
486
|
+
rhs_(no_reg),
|
487
|
+
name_(NULL) { }
|
488
|
+
|
489
|
+
void Generate(MacroAssembler* masm);
|
490
|
+
|
491
|
+
private:
|
492
|
+
Condition cc_;
|
493
|
+
bool strict_;
|
494
|
+
// Only used for 'equal' comparisons. Tells the stub that we already know
|
495
|
+
// that at least one side of the comparison is not NaN. This allows the
|
496
|
+
// stub to use object identity in the positive case. We ignore it when
|
497
|
+
// generating the minor key for other comparisons to avoid creating more
|
498
|
+
// stubs.
|
499
|
+
bool never_nan_nan_;
|
500
|
+
// Do generate the number comparison code in the stub. Stubs without number
|
501
|
+
// comparison code is used when the number comparison has been inlined, and
|
502
|
+
// the stub will be called if one of the operands is not a number.
|
503
|
+
bool include_number_compare_;
|
504
|
+
|
505
|
+
// Generate the comparison code for two smi operands in the stub.
|
506
|
+
bool include_smi_compare_;
|
507
|
+
|
508
|
+
// Register holding the left hand side of the comparison if the stub gives
|
509
|
+
// a choice, no_reg otherwise.
|
510
|
+
|
511
|
+
Register lhs_;
|
512
|
+
// Register holding the right hand side of the comparison if the stub gives
|
513
|
+
// a choice, no_reg otherwise.
|
514
|
+
Register rhs_;
|
515
|
+
|
516
|
+
// Encoding of the minor key in 16 bits.
|
517
|
+
class StrictField: public BitField<bool, 0, 1> {};
|
518
|
+
class NeverNanNanField: public BitField<bool, 1, 1> {};
|
519
|
+
class IncludeNumberCompareField: public BitField<bool, 2, 1> {};
|
520
|
+
class IncludeSmiCompareField: public BitField<bool, 3, 1> {};
|
521
|
+
class RegisterField: public BitField<bool, 4, 1> {};
|
522
|
+
class ConditionField: public BitField<int, 5, 11> {};
|
523
|
+
|
524
|
+
Major MajorKey() { return Compare; }
|
525
|
+
|
526
|
+
int MinorKey();
|
527
|
+
|
528
|
+
virtual int GetCodeKind() { return Code::COMPARE_IC; }
|
529
|
+
virtual void FinishCode(Code* code) {
|
530
|
+
code->set_compare_state(CompareIC::GENERIC);
|
531
|
+
}
|
532
|
+
|
533
|
+
// Branch to the label if the given object isn't a symbol.
|
534
|
+
void BranchIfNonSymbol(MacroAssembler* masm,
|
535
|
+
Label* label,
|
536
|
+
Register object,
|
537
|
+
Register scratch);
|
538
|
+
|
539
|
+
// Unfortunately you have to run without snapshots to see most of these
|
540
|
+
// names in the profile since most compare stubs end up in the snapshot.
|
541
|
+
char* name_;
|
542
|
+
const char* GetName();
|
543
|
+
#ifdef DEBUG
|
544
|
+
void Print() {
|
545
|
+
PrintF("CompareStub (minor %d) (cc %d), (strict %s), "
|
546
|
+
"(never_nan_nan %s), (smi_compare %s) (number_compare %s) ",
|
547
|
+
MinorKey(),
|
548
|
+
static_cast<int>(cc_),
|
549
|
+
strict_ ? "true" : "false",
|
550
|
+
never_nan_nan_ ? "true" : "false",
|
551
|
+
include_smi_compare_ ? "inluded" : "not included",
|
552
|
+
include_number_compare_ ? "included" : "not included");
|
553
|
+
|
554
|
+
if (!lhs_.is(no_reg) && !rhs_.is(no_reg)) {
|
555
|
+
PrintF("(lhs r%d), (rhs r%d)\n", lhs_.code(), rhs_.code());
|
556
|
+
} else {
|
557
|
+
PrintF("\n");
|
558
|
+
}
|
559
|
+
}
|
560
|
+
#endif
|
561
|
+
};
|
562
|
+
|
563
|
+
|
564
|
+
class CEntryStub : public CodeStub {
|
565
|
+
public:
|
566
|
+
explicit CEntryStub(int result_size)
|
567
|
+
: result_size_(result_size), save_doubles_(false) { }
|
568
|
+
|
569
|
+
void Generate(MacroAssembler* masm);
|
570
|
+
void SaveDoubles() { save_doubles_ = true; }
|
571
|
+
|
572
|
+
private:
|
573
|
+
void GenerateCore(MacroAssembler* masm,
|
574
|
+
Label* throw_normal_exception,
|
575
|
+
Label* throw_termination_exception,
|
576
|
+
Label* throw_out_of_memory_exception,
|
577
|
+
bool do_gc,
|
578
|
+
bool always_allocate_scope);
|
579
|
+
void GenerateThrowTOS(MacroAssembler* masm);
|
580
|
+
void GenerateThrowUncatchable(MacroAssembler* masm,
|
581
|
+
UncatchableExceptionType type);
|
582
|
+
|
583
|
+
// Number of pointers/values returned.
|
584
|
+
const int result_size_;
|
585
|
+
bool save_doubles_;
|
586
|
+
|
587
|
+
Major MajorKey() { return CEntry; }
|
588
|
+
int MinorKey();
|
589
|
+
|
590
|
+
bool NeedsImmovableCode();
|
591
|
+
|
592
|
+
const char* GetName() { return "CEntryStub"; }
|
593
|
+
};
|
594
|
+
|
595
|
+
|
596
|
+
class JSEntryStub : public CodeStub {
|
597
|
+
public:
|
598
|
+
JSEntryStub() { }
|
599
|
+
|
600
|
+
void Generate(MacroAssembler* masm) { GenerateBody(masm, false); }
|
601
|
+
|
602
|
+
protected:
|
603
|
+
void GenerateBody(MacroAssembler* masm, bool is_construct);
|
604
|
+
|
605
|
+
private:
|
606
|
+
Major MajorKey() { return JSEntry; }
|
607
|
+
int MinorKey() { return 0; }
|
608
|
+
|
609
|
+
const char* GetName() { return "JSEntryStub"; }
|
610
|
+
};
|
611
|
+
|
612
|
+
|
613
|
+
class JSConstructEntryStub : public JSEntryStub {
|
614
|
+
public:
|
615
|
+
JSConstructEntryStub() { }
|
616
|
+
|
617
|
+
void Generate(MacroAssembler* masm) { GenerateBody(masm, true); }
|
618
|
+
|
619
|
+
private:
|
620
|
+
int MinorKey() { return 1; }
|
621
|
+
|
622
|
+
const char* GetName() { return "JSConstructEntryStub"; }
|
623
|
+
};
|
624
|
+
|
625
|
+
|
626
|
+
class ArgumentsAccessStub: public CodeStub {
|
627
|
+
public:
|
628
|
+
enum Type {
|
629
|
+
READ_ELEMENT,
|
630
|
+
NEW_NON_STRICT,
|
631
|
+
NEW_STRICT
|
632
|
+
};
|
633
|
+
|
634
|
+
explicit ArgumentsAccessStub(Type type) : type_(type) { }
|
635
|
+
|
636
|
+
private:
|
637
|
+
Type type_;
|
638
|
+
|
639
|
+
Major MajorKey() { return ArgumentsAccess; }
|
640
|
+
int MinorKey() { return type_; }
|
641
|
+
|
642
|
+
void Generate(MacroAssembler* masm);
|
643
|
+
void GenerateReadElement(MacroAssembler* masm);
|
644
|
+
void GenerateNewObject(MacroAssembler* masm);
|
645
|
+
|
646
|
+
int GetArgumentsBoilerplateIndex() const {
|
647
|
+
return (type_ == NEW_STRICT)
|
648
|
+
? Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX
|
649
|
+
: Context::ARGUMENTS_BOILERPLATE_INDEX;
|
650
|
+
}
|
651
|
+
|
652
|
+
int GetArgumentsObjectSize() const {
|
653
|
+
if (type_ == NEW_STRICT)
|
654
|
+
return Heap::kArgumentsObjectSizeStrict;
|
655
|
+
else
|
656
|
+
return Heap::kArgumentsObjectSize;
|
657
|
+
}
|
658
|
+
|
659
|
+
const char* GetName() { return "ArgumentsAccessStub"; }
|
660
|
+
|
661
|
+
#ifdef DEBUG
|
662
|
+
void Print() {
|
663
|
+
PrintF("ArgumentsAccessStub (type %d)\n", type_);
|
664
|
+
}
|
665
|
+
#endif
|
666
|
+
};
|
667
|
+
|
668
|
+
|
669
|
+
class RegExpExecStub: public CodeStub {
|
670
|
+
public:
|
671
|
+
RegExpExecStub() { }
|
672
|
+
|
673
|
+
private:
|
674
|
+
Major MajorKey() { return RegExpExec; }
|
675
|
+
int MinorKey() { return 0; }
|
676
|
+
|
677
|
+
void Generate(MacroAssembler* masm);
|
678
|
+
|
679
|
+
const char* GetName() { return "RegExpExecStub"; }
|
680
|
+
|
681
|
+
#ifdef DEBUG
|
682
|
+
void Print() {
|
683
|
+
PrintF("RegExpExecStub\n");
|
684
|
+
}
|
685
|
+
#endif
|
686
|
+
};
|
687
|
+
|
688
|
+
|
689
|
+
class RegExpConstructResultStub: public CodeStub {
|
690
|
+
public:
|
691
|
+
RegExpConstructResultStub() { }
|
692
|
+
|
693
|
+
private:
|
694
|
+
Major MajorKey() { return RegExpConstructResult; }
|
695
|
+
int MinorKey() { return 0; }
|
696
|
+
|
697
|
+
void Generate(MacroAssembler* masm);
|
698
|
+
|
699
|
+
const char* GetName() { return "RegExpConstructResultStub"; }
|
700
|
+
|
701
|
+
#ifdef DEBUG
|
702
|
+
void Print() {
|
703
|
+
PrintF("RegExpConstructResultStub\n");
|
704
|
+
}
|
705
|
+
#endif
|
706
|
+
};
|
707
|
+
|
708
|
+
|
709
|
+
class CallFunctionStub: public CodeStub {
|
710
|
+
public:
|
711
|
+
CallFunctionStub(int argc, InLoopFlag in_loop, CallFunctionFlags flags)
|
712
|
+
: argc_(argc), in_loop_(in_loop), flags_(flags) { }
|
713
|
+
|
714
|
+
void Generate(MacroAssembler* masm);
|
715
|
+
|
716
|
+
static int ExtractArgcFromMinorKey(int minor_key) {
|
717
|
+
return ArgcBits::decode(minor_key);
|
718
|
+
}
|
719
|
+
|
720
|
+
private:
|
721
|
+
int argc_;
|
722
|
+
InLoopFlag in_loop_;
|
723
|
+
CallFunctionFlags flags_;
|
724
|
+
|
725
|
+
#ifdef DEBUG
|
726
|
+
void Print() {
|
727
|
+
PrintF("CallFunctionStub (args %d, in_loop %d, flags %d)\n",
|
728
|
+
argc_,
|
729
|
+
static_cast<int>(in_loop_),
|
730
|
+
static_cast<int>(flags_));
|
731
|
+
}
|
732
|
+
#endif
|
733
|
+
|
734
|
+
// Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
|
735
|
+
class InLoopBits: public BitField<InLoopFlag, 0, 1> {};
|
736
|
+
class FlagBits: public BitField<CallFunctionFlags, 1, 1> {};
|
737
|
+
class ArgcBits: public BitField<int, 2, 32 - 2> {};
|
738
|
+
|
739
|
+
Major MajorKey() { return CallFunction; }
|
740
|
+
int MinorKey() {
|
741
|
+
// Encode the parameters in a unique 32 bit value.
|
742
|
+
return InLoopBits::encode(in_loop_)
|
743
|
+
| FlagBits::encode(flags_)
|
744
|
+
| ArgcBits::encode(argc_);
|
745
|
+
}
|
746
|
+
|
747
|
+
InLoopFlag InLoop() { return in_loop_; }
|
748
|
+
|
749
|
+
bool ReceiverMightBeImplicit() {
|
750
|
+
return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0;
|
751
|
+
}
|
752
|
+
};
|
753
|
+
|
754
|
+
|
755
|
+
enum StringIndexFlags {
|
756
|
+
// Accepts smis or heap numbers.
|
757
|
+
STRING_INDEX_IS_NUMBER,
|
758
|
+
|
759
|
+
// Accepts smis or heap numbers that are valid array indices
|
760
|
+
// (ECMA-262 15.4). Invalid indices are reported as being out of
|
761
|
+
// range.
|
762
|
+
STRING_INDEX_IS_ARRAY_INDEX
|
763
|
+
};
|
764
|
+
|
765
|
+
|
766
|
+
// Generates code implementing String.prototype.charCodeAt.
|
767
|
+
//
|
768
|
+
// Only supports the case when the receiver is a string and the index
|
769
|
+
// is a number (smi or heap number) that is a valid index into the
|
770
|
+
// string. Additional index constraints are specified by the
|
771
|
+
// flags. Otherwise, bails out to the provided labels.
|
772
|
+
//
|
773
|
+
// Register usage: |object| may be changed to another string in a way
|
774
|
+
// that doesn't affect charCodeAt/charAt semantics, |index| is
|
775
|
+
// preserved, |scratch| and |result| are clobbered.
|
776
|
+
class StringCharCodeAtGenerator {
|
777
|
+
public:
|
778
|
+
StringCharCodeAtGenerator(Register object,
|
779
|
+
Register index,
|
780
|
+
Register scratch,
|
781
|
+
Register result,
|
782
|
+
Label* receiver_not_string,
|
783
|
+
Label* index_not_number,
|
784
|
+
Label* index_out_of_range,
|
785
|
+
StringIndexFlags index_flags)
|
786
|
+
: object_(object),
|
787
|
+
index_(index),
|
788
|
+
scratch_(scratch),
|
789
|
+
result_(result),
|
790
|
+
receiver_not_string_(receiver_not_string),
|
791
|
+
index_not_number_(index_not_number),
|
792
|
+
index_out_of_range_(index_out_of_range),
|
793
|
+
index_flags_(index_flags) {
|
794
|
+
ASSERT(!scratch_.is(object_));
|
795
|
+
ASSERT(!scratch_.is(index_));
|
796
|
+
ASSERT(!scratch_.is(result_));
|
797
|
+
ASSERT(!result_.is(object_));
|
798
|
+
ASSERT(!result_.is(index_));
|
799
|
+
}
|
800
|
+
|
801
|
+
// Generates the fast case code. On the fallthrough path |result|
|
802
|
+
// register contains the result.
|
803
|
+
void GenerateFast(MacroAssembler* masm);
|
804
|
+
|
805
|
+
// Generates the slow case code. Must not be naturally
|
806
|
+
// reachable. Expected to be put after a ret instruction (e.g., in
|
807
|
+
// deferred code). Always jumps back to the fast case.
|
808
|
+
void GenerateSlow(MacroAssembler* masm,
|
809
|
+
const RuntimeCallHelper& call_helper);
|
810
|
+
|
811
|
+
private:
|
812
|
+
Register object_;
|
813
|
+
Register index_;
|
814
|
+
Register scratch_;
|
815
|
+
Register result_;
|
816
|
+
|
817
|
+
Label* receiver_not_string_;
|
818
|
+
Label* index_not_number_;
|
819
|
+
Label* index_out_of_range_;
|
820
|
+
|
821
|
+
StringIndexFlags index_flags_;
|
822
|
+
|
823
|
+
Label call_runtime_;
|
824
|
+
Label index_not_smi_;
|
825
|
+
Label got_smi_index_;
|
826
|
+
Label exit_;
|
827
|
+
|
828
|
+
DISALLOW_COPY_AND_ASSIGN(StringCharCodeAtGenerator);
|
829
|
+
};
|
830
|
+
|
831
|
+
|
832
|
+
// Generates code for creating a one-char string from a char code.
|
833
|
+
class StringCharFromCodeGenerator {
|
834
|
+
public:
|
835
|
+
StringCharFromCodeGenerator(Register code,
|
836
|
+
Register result)
|
837
|
+
: code_(code),
|
838
|
+
result_(result) {
|
839
|
+
ASSERT(!code_.is(result_));
|
840
|
+
}
|
841
|
+
|
842
|
+
// Generates the fast case code. On the fallthrough path |result|
|
843
|
+
// register contains the result.
|
844
|
+
void GenerateFast(MacroAssembler* masm);
|
845
|
+
|
846
|
+
// Generates the slow case code. Must not be naturally
|
847
|
+
// reachable. Expected to be put after a ret instruction (e.g., in
|
848
|
+
// deferred code). Always jumps back to the fast case.
|
849
|
+
void GenerateSlow(MacroAssembler* masm,
|
850
|
+
const RuntimeCallHelper& call_helper);
|
851
|
+
|
852
|
+
private:
|
853
|
+
Register code_;
|
854
|
+
Register result_;
|
855
|
+
|
856
|
+
Label slow_case_;
|
857
|
+
Label exit_;
|
858
|
+
|
859
|
+
DISALLOW_COPY_AND_ASSIGN(StringCharFromCodeGenerator);
|
860
|
+
};
|
861
|
+
|
862
|
+
|
863
|
+
// Generates code implementing String.prototype.charAt.
|
864
|
+
//
|
865
|
+
// Only supports the case when the receiver is a string and the index
|
866
|
+
// is a number (smi or heap number) that is a valid index into the
|
867
|
+
// string. Additional index constraints are specified by the
|
868
|
+
// flags. Otherwise, bails out to the provided labels.
|
869
|
+
//
|
870
|
+
// Register usage: |object| may be changed to another string in a way
|
871
|
+
// that doesn't affect charCodeAt/charAt semantics, |index| is
|
872
|
+
// preserved, |scratch1|, |scratch2|, and |result| are clobbered.
|
873
|
+
class StringCharAtGenerator {
|
874
|
+
public:
|
875
|
+
StringCharAtGenerator(Register object,
|
876
|
+
Register index,
|
877
|
+
Register scratch1,
|
878
|
+
Register scratch2,
|
879
|
+
Register result,
|
880
|
+
Label* receiver_not_string,
|
881
|
+
Label* index_not_number,
|
882
|
+
Label* index_out_of_range,
|
883
|
+
StringIndexFlags index_flags)
|
884
|
+
: char_code_at_generator_(object,
|
885
|
+
index,
|
886
|
+
scratch1,
|
887
|
+
scratch2,
|
888
|
+
receiver_not_string,
|
889
|
+
index_not_number,
|
890
|
+
index_out_of_range,
|
891
|
+
index_flags),
|
892
|
+
char_from_code_generator_(scratch2, result) {}
|
893
|
+
|
894
|
+
// Generates the fast case code. On the fallthrough path |result|
|
895
|
+
// register contains the result.
|
896
|
+
void GenerateFast(MacroAssembler* masm);
|
897
|
+
|
898
|
+
// Generates the slow case code. Must not be naturally
|
899
|
+
// reachable. Expected to be put after a ret instruction (e.g., in
|
900
|
+
// deferred code). Always jumps back to the fast case.
|
901
|
+
void GenerateSlow(MacroAssembler* masm,
|
902
|
+
const RuntimeCallHelper& call_helper);
|
903
|
+
|
904
|
+
private:
|
905
|
+
StringCharCodeAtGenerator char_code_at_generator_;
|
906
|
+
StringCharFromCodeGenerator char_from_code_generator_;
|
907
|
+
|
908
|
+
DISALLOW_COPY_AND_ASSIGN(StringCharAtGenerator);
|
909
|
+
};
|
910
|
+
|
911
|
+
|
912
|
+
class AllowStubCallsScope {
|
913
|
+
public:
|
914
|
+
AllowStubCallsScope(MacroAssembler* masm, bool allow)
|
915
|
+
: masm_(masm), previous_allow_(masm->allow_stub_calls()) {
|
916
|
+
masm_->set_allow_stub_calls(allow);
|
917
|
+
}
|
918
|
+
~AllowStubCallsScope() {
|
919
|
+
masm_->set_allow_stub_calls(previous_allow_);
|
920
|
+
}
|
921
|
+
|
922
|
+
private:
|
923
|
+
MacroAssembler* masm_;
|
924
|
+
bool previous_allow_;
|
925
|
+
|
926
|
+
DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope);
|
927
|
+
};
|
928
|
+
|
929
|
+
#ifdef DEBUG
|
930
|
+
#define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); }
|
931
|
+
#else
|
932
|
+
#define DECLARE_ARRAY_STUB_PRINT(name)
|
933
|
+
#endif
|
934
|
+
|
935
|
+
|
936
|
+
class KeyedLoadFastElementStub : public CodeStub {
|
937
|
+
public:
|
938
|
+
explicit KeyedLoadFastElementStub() {
|
939
|
+
}
|
940
|
+
|
941
|
+
Major MajorKey() { return KeyedLoadFastElement; }
|
942
|
+
int MinorKey() { return 0; }
|
943
|
+
|
944
|
+
void Generate(MacroAssembler* masm);
|
945
|
+
|
946
|
+
const char* GetName() { return "KeyedLoadFastElementStub"; }
|
947
|
+
|
948
|
+
DECLARE_ARRAY_STUB_PRINT(KeyedLoadFastElementStub)
|
949
|
+
};
|
950
|
+
|
951
|
+
|
952
|
+
class KeyedStoreFastElementStub : public CodeStub {
|
953
|
+
public:
|
954
|
+
explicit KeyedStoreFastElementStub(bool is_js_array)
|
955
|
+
: is_js_array_(is_js_array) { }
|
956
|
+
|
957
|
+
Major MajorKey() { return KeyedStoreFastElement; }
|
958
|
+
int MinorKey() { return is_js_array_ ? 1 : 0; }
|
959
|
+
|
960
|
+
void Generate(MacroAssembler* masm);
|
961
|
+
|
962
|
+
const char* GetName() { return "KeyedStoreFastElementStub"; }
|
963
|
+
|
964
|
+
DECLARE_ARRAY_STUB_PRINT(KeyedStoreFastElementStub)
|
965
|
+
|
966
|
+
private:
|
967
|
+
bool is_js_array_;
|
968
|
+
};
|
969
|
+
|
970
|
+
|
971
|
+
class KeyedLoadExternalArrayStub : public CodeStub {
|
972
|
+
public:
|
973
|
+
explicit KeyedLoadExternalArrayStub(ExternalArrayType array_type)
|
974
|
+
: array_type_(array_type) { }
|
975
|
+
|
976
|
+
Major MajorKey() { return KeyedLoadExternalArray; }
|
977
|
+
int MinorKey() { return array_type_; }
|
978
|
+
|
979
|
+
void Generate(MacroAssembler* masm);
|
980
|
+
|
981
|
+
const char* GetName() { return "KeyedLoadExternalArrayStub"; }
|
982
|
+
|
983
|
+
DECLARE_ARRAY_STUB_PRINT(KeyedLoadExternalArrayStub)
|
984
|
+
|
985
|
+
protected:
|
986
|
+
ExternalArrayType array_type_;
|
987
|
+
};
|
988
|
+
|
989
|
+
|
990
|
+
class KeyedStoreExternalArrayStub : public CodeStub {
|
991
|
+
public:
|
992
|
+
explicit KeyedStoreExternalArrayStub(ExternalArrayType array_type)
|
993
|
+
: array_type_(array_type) { }
|
994
|
+
|
995
|
+
Major MajorKey() { return KeyedStoreExternalArray; }
|
996
|
+
int MinorKey() { return array_type_; }
|
997
|
+
|
998
|
+
void Generate(MacroAssembler* masm);
|
999
|
+
|
1000
|
+
const char* GetName() { return "KeyedStoreExternalArrayStub"; }
|
1001
|
+
|
1002
|
+
DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub)
|
1003
|
+
|
1004
|
+
protected:
|
1005
|
+
ExternalArrayType array_type_;
|
1006
|
+
};
|
1007
|
+
|
1008
|
+
|
1009
|
+
} } // namespace v8::internal
|
1010
|
+
|
1011
|
+
#endif // V8_CODE_STUBS_H_
|