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,1597 @@
|
|
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
|
+
#if defined(V8_TARGET_ARCH_IA32)
|
31
|
+
|
32
|
+
#include "codegen.h"
|
33
|
+
#include "ic-inl.h"
|
34
|
+
#include "runtime.h"
|
35
|
+
#include "stub-cache.h"
|
36
|
+
|
37
|
+
namespace v8 {
|
38
|
+
namespace internal {
|
39
|
+
|
40
|
+
// ----------------------------------------------------------------------------
|
41
|
+
// Static IC stub generators.
|
42
|
+
//
|
43
|
+
|
44
|
+
#define __ ACCESS_MASM(masm)
|
45
|
+
|
46
|
+
|
47
|
+
static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm,
|
48
|
+
Register type,
|
49
|
+
Label* global_object) {
|
50
|
+
// Register usage:
|
51
|
+
// type: holds the receiver instance type on entry.
|
52
|
+
__ cmp(type, JS_GLOBAL_OBJECT_TYPE);
|
53
|
+
__ j(equal, global_object);
|
54
|
+
__ cmp(type, JS_BUILTINS_OBJECT_TYPE);
|
55
|
+
__ j(equal, global_object);
|
56
|
+
__ cmp(type, JS_GLOBAL_PROXY_TYPE);
|
57
|
+
__ j(equal, global_object);
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
// Generated code falls through if the receiver is a regular non-global
|
62
|
+
// JS object with slow properties and no interceptors.
|
63
|
+
static void GenerateStringDictionaryReceiverCheck(MacroAssembler* masm,
|
64
|
+
Register receiver,
|
65
|
+
Register r0,
|
66
|
+
Register r1,
|
67
|
+
Label* miss) {
|
68
|
+
// Register usage:
|
69
|
+
// receiver: holds the receiver on entry and is unchanged.
|
70
|
+
// r0: used to hold receiver instance type.
|
71
|
+
// Holds the property dictionary on fall through.
|
72
|
+
// r1: used to hold receivers map.
|
73
|
+
|
74
|
+
// Check that the receiver isn't a smi.
|
75
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
76
|
+
__ j(zero, miss);
|
77
|
+
|
78
|
+
// Check that the receiver is a valid JS object.
|
79
|
+
__ mov(r1, FieldOperand(receiver, HeapObject::kMapOffset));
|
80
|
+
__ movzx_b(r0, FieldOperand(r1, Map::kInstanceTypeOffset));
|
81
|
+
__ cmp(r0, FIRST_JS_OBJECT_TYPE);
|
82
|
+
__ j(below, miss);
|
83
|
+
|
84
|
+
// If this assert fails, we have to check upper bound too.
|
85
|
+
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
|
86
|
+
|
87
|
+
GenerateGlobalInstanceTypeCheck(masm, r0, miss);
|
88
|
+
|
89
|
+
// Check for non-global object that requires access check.
|
90
|
+
__ test_b(FieldOperand(r1, Map::kBitFieldOffset),
|
91
|
+
(1 << Map::kIsAccessCheckNeeded) |
|
92
|
+
(1 << Map::kHasNamedInterceptor));
|
93
|
+
__ j(not_zero, miss);
|
94
|
+
|
95
|
+
__ mov(r0, FieldOperand(receiver, JSObject::kPropertiesOffset));
|
96
|
+
__ CheckMap(r0, FACTORY->hash_table_map(), miss, DONT_DO_SMI_CHECK);
|
97
|
+
}
|
98
|
+
|
99
|
+
|
100
|
+
// Helper function used to load a property from a dictionary backing
|
101
|
+
// storage. This function may fail to load a property even though it is
|
102
|
+
// in the dictionary, so code at miss_label must always call a backup
|
103
|
+
// property load that is complete. This function is safe to call if
|
104
|
+
// name is not a symbol, and will jump to the miss_label in that
|
105
|
+
// case. The generated code assumes that the receiver has slow
|
106
|
+
// properties, is not a global object and does not have interceptors.
|
107
|
+
static void GenerateDictionaryLoad(MacroAssembler* masm,
|
108
|
+
Label* miss_label,
|
109
|
+
Register elements,
|
110
|
+
Register name,
|
111
|
+
Register r0,
|
112
|
+
Register r1,
|
113
|
+
Register result) {
|
114
|
+
// Register use:
|
115
|
+
//
|
116
|
+
// elements - holds the property dictionary on entry and is unchanged.
|
117
|
+
//
|
118
|
+
// name - holds the name of the property on entry and is unchanged.
|
119
|
+
//
|
120
|
+
// Scratch registers:
|
121
|
+
//
|
122
|
+
// r0 - used for the index into the property dictionary
|
123
|
+
//
|
124
|
+
// r1 - used to hold the capacity of the property dictionary.
|
125
|
+
//
|
126
|
+
// result - holds the result on exit.
|
127
|
+
|
128
|
+
Label done;
|
129
|
+
|
130
|
+
// Probe the dictionary.
|
131
|
+
StringDictionaryLookupStub::GeneratePositiveLookup(masm,
|
132
|
+
miss_label,
|
133
|
+
&done,
|
134
|
+
elements,
|
135
|
+
name,
|
136
|
+
r0,
|
137
|
+
r1);
|
138
|
+
|
139
|
+
// If probing finds an entry in the dictionary, r0 contains the
|
140
|
+
// index into the dictionary. Check that the value is a normal
|
141
|
+
// property.
|
142
|
+
__ bind(&done);
|
143
|
+
const int kElementsStartOffset =
|
144
|
+
StringDictionary::kHeaderSize +
|
145
|
+
StringDictionary::kElementsStartIndex * kPointerSize;
|
146
|
+
const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
|
147
|
+
__ test(Operand(elements, r0, times_4, kDetailsOffset - kHeapObjectTag),
|
148
|
+
Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize));
|
149
|
+
__ j(not_zero, miss_label);
|
150
|
+
|
151
|
+
// Get the value at the masked, scaled index.
|
152
|
+
const int kValueOffset = kElementsStartOffset + kPointerSize;
|
153
|
+
__ mov(result, Operand(elements, r0, times_4, kValueOffset - kHeapObjectTag));
|
154
|
+
}
|
155
|
+
|
156
|
+
|
157
|
+
// Helper function used to store a property to a dictionary backing
|
158
|
+
// storage. This function may fail to store a property eventhough it
|
159
|
+
// is in the dictionary, so code at miss_label must always call a
|
160
|
+
// backup property store that is complete. This function is safe to
|
161
|
+
// call if name is not a symbol, and will jump to the miss_label in
|
162
|
+
// that case. The generated code assumes that the receiver has slow
|
163
|
+
// properties, is not a global object and does not have interceptors.
|
164
|
+
static void GenerateDictionaryStore(MacroAssembler* masm,
|
165
|
+
Label* miss_label,
|
166
|
+
Register elements,
|
167
|
+
Register name,
|
168
|
+
Register value,
|
169
|
+
Register r0,
|
170
|
+
Register r1) {
|
171
|
+
// Register use:
|
172
|
+
//
|
173
|
+
// elements - holds the property dictionary on entry and is clobbered.
|
174
|
+
//
|
175
|
+
// name - holds the name of the property on entry and is unchanged.
|
176
|
+
//
|
177
|
+
// value - holds the value to store and is unchanged.
|
178
|
+
//
|
179
|
+
// r0 - used for index into the property dictionary and is clobbered.
|
180
|
+
//
|
181
|
+
// r1 - used to hold the capacity of the property dictionary and is clobbered.
|
182
|
+
Label done;
|
183
|
+
|
184
|
+
|
185
|
+
// Probe the dictionary.
|
186
|
+
StringDictionaryLookupStub::GeneratePositiveLookup(masm,
|
187
|
+
miss_label,
|
188
|
+
&done,
|
189
|
+
elements,
|
190
|
+
name,
|
191
|
+
r0,
|
192
|
+
r1);
|
193
|
+
|
194
|
+
// If probing finds an entry in the dictionary, r0 contains the
|
195
|
+
// index into the dictionary. Check that the value is a normal
|
196
|
+
// property that is not read only.
|
197
|
+
__ bind(&done);
|
198
|
+
const int kElementsStartOffset =
|
199
|
+
StringDictionary::kHeaderSize +
|
200
|
+
StringDictionary::kElementsStartIndex * kPointerSize;
|
201
|
+
const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize;
|
202
|
+
const int kTypeAndReadOnlyMask
|
203
|
+
= (PropertyDetails::TypeField::mask() |
|
204
|
+
PropertyDetails::AttributesField::encode(READ_ONLY)) << kSmiTagSize;
|
205
|
+
__ test(Operand(elements, r0, times_4, kDetailsOffset - kHeapObjectTag),
|
206
|
+
Immediate(kTypeAndReadOnlyMask));
|
207
|
+
__ j(not_zero, miss_label);
|
208
|
+
|
209
|
+
// Store the value at the masked, scaled index.
|
210
|
+
const int kValueOffset = kElementsStartOffset + kPointerSize;
|
211
|
+
__ lea(r0, Operand(elements, r0, times_4, kValueOffset - kHeapObjectTag));
|
212
|
+
__ mov(Operand(r0, 0), value);
|
213
|
+
|
214
|
+
// Update write barrier. Make sure not to clobber the value.
|
215
|
+
__ mov(r1, value);
|
216
|
+
__ RecordWrite(elements, r0, r1);
|
217
|
+
}
|
218
|
+
|
219
|
+
|
220
|
+
static void GenerateNumberDictionaryLoad(MacroAssembler* masm,
|
221
|
+
Label* miss,
|
222
|
+
Register elements,
|
223
|
+
Register key,
|
224
|
+
Register r0,
|
225
|
+
Register r1,
|
226
|
+
Register r2,
|
227
|
+
Register result) {
|
228
|
+
// Register use:
|
229
|
+
//
|
230
|
+
// elements - holds the slow-case elements of the receiver and is unchanged.
|
231
|
+
//
|
232
|
+
// key - holds the smi key on entry and is unchanged.
|
233
|
+
//
|
234
|
+
// Scratch registers:
|
235
|
+
//
|
236
|
+
// r0 - holds the untagged key on entry and holds the hash once computed.
|
237
|
+
//
|
238
|
+
// r1 - used to hold the capacity mask of the dictionary
|
239
|
+
//
|
240
|
+
// r2 - used for the index into the dictionary.
|
241
|
+
//
|
242
|
+
// result - holds the result on exit if the load succeeds and we fall through.
|
243
|
+
|
244
|
+
Label done;
|
245
|
+
|
246
|
+
// Compute the hash code from the untagged key. This must be kept in sync
|
247
|
+
// with ComputeIntegerHash in utils.h.
|
248
|
+
//
|
249
|
+
// hash = ~hash + (hash << 15);
|
250
|
+
__ mov(r1, r0);
|
251
|
+
__ not_(r0);
|
252
|
+
__ shl(r1, 15);
|
253
|
+
__ add(r0, Operand(r1));
|
254
|
+
// hash = hash ^ (hash >> 12);
|
255
|
+
__ mov(r1, r0);
|
256
|
+
__ shr(r1, 12);
|
257
|
+
__ xor_(r0, Operand(r1));
|
258
|
+
// hash = hash + (hash << 2);
|
259
|
+
__ lea(r0, Operand(r0, r0, times_4, 0));
|
260
|
+
// hash = hash ^ (hash >> 4);
|
261
|
+
__ mov(r1, r0);
|
262
|
+
__ shr(r1, 4);
|
263
|
+
__ xor_(r0, Operand(r1));
|
264
|
+
// hash = hash * 2057;
|
265
|
+
__ imul(r0, r0, 2057);
|
266
|
+
// hash = hash ^ (hash >> 16);
|
267
|
+
__ mov(r1, r0);
|
268
|
+
__ shr(r1, 16);
|
269
|
+
__ xor_(r0, Operand(r1));
|
270
|
+
|
271
|
+
// Compute capacity mask.
|
272
|
+
__ mov(r1, FieldOperand(elements, NumberDictionary::kCapacityOffset));
|
273
|
+
__ shr(r1, kSmiTagSize); // convert smi to int
|
274
|
+
__ dec(r1);
|
275
|
+
|
276
|
+
// Generate an unrolled loop that performs a few probes before giving up.
|
277
|
+
const int kProbes = 4;
|
278
|
+
for (int i = 0; i < kProbes; i++) {
|
279
|
+
// Use r2 for index calculations and keep the hash intact in r0.
|
280
|
+
__ mov(r2, r0);
|
281
|
+
// Compute the masked index: (hash + i + i * i) & mask.
|
282
|
+
if (i > 0) {
|
283
|
+
__ add(Operand(r2), Immediate(NumberDictionary::GetProbeOffset(i)));
|
284
|
+
}
|
285
|
+
__ and_(r2, Operand(r1));
|
286
|
+
|
287
|
+
// Scale the index by multiplying by the entry size.
|
288
|
+
ASSERT(NumberDictionary::kEntrySize == 3);
|
289
|
+
__ lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3
|
290
|
+
|
291
|
+
// Check if the key matches.
|
292
|
+
__ cmp(key, FieldOperand(elements,
|
293
|
+
r2,
|
294
|
+
times_pointer_size,
|
295
|
+
NumberDictionary::kElementsStartOffset));
|
296
|
+
if (i != (kProbes - 1)) {
|
297
|
+
__ j(equal, &done);
|
298
|
+
} else {
|
299
|
+
__ j(not_equal, miss);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
__ bind(&done);
|
304
|
+
// Check that the value is a normal propety.
|
305
|
+
const int kDetailsOffset =
|
306
|
+
NumberDictionary::kElementsStartOffset + 2 * kPointerSize;
|
307
|
+
ASSERT_EQ(NORMAL, 0);
|
308
|
+
__ test(FieldOperand(elements, r2, times_pointer_size, kDetailsOffset),
|
309
|
+
Immediate(PropertyDetails::TypeField::mask() << kSmiTagSize));
|
310
|
+
__ j(not_zero, miss);
|
311
|
+
|
312
|
+
// Get the value at the masked, scaled index.
|
313
|
+
const int kValueOffset =
|
314
|
+
NumberDictionary::kElementsStartOffset + kPointerSize;
|
315
|
+
__ mov(result, FieldOperand(elements, r2, times_pointer_size, kValueOffset));
|
316
|
+
}
|
317
|
+
|
318
|
+
|
319
|
+
void LoadIC::GenerateArrayLength(MacroAssembler* masm) {
|
320
|
+
// ----------- S t a t e -------------
|
321
|
+
// -- eax : receiver
|
322
|
+
// -- ecx : name
|
323
|
+
// -- esp[0] : return address
|
324
|
+
// -----------------------------------
|
325
|
+
Label miss;
|
326
|
+
|
327
|
+
StubCompiler::GenerateLoadArrayLength(masm, eax, edx, &miss);
|
328
|
+
__ bind(&miss);
|
329
|
+
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
|
330
|
+
}
|
331
|
+
|
332
|
+
|
333
|
+
void LoadIC::GenerateStringLength(MacroAssembler* masm,
|
334
|
+
bool support_wrappers) {
|
335
|
+
// ----------- S t a t e -------------
|
336
|
+
// -- eax : receiver
|
337
|
+
// -- ecx : name
|
338
|
+
// -- esp[0] : return address
|
339
|
+
// -----------------------------------
|
340
|
+
Label miss;
|
341
|
+
|
342
|
+
StubCompiler::GenerateLoadStringLength(masm, eax, edx, ebx, &miss,
|
343
|
+
support_wrappers);
|
344
|
+
__ bind(&miss);
|
345
|
+
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) {
|
350
|
+
// ----------- S t a t e -------------
|
351
|
+
// -- eax : receiver
|
352
|
+
// -- ecx : name
|
353
|
+
// -- esp[0] : return address
|
354
|
+
// -----------------------------------
|
355
|
+
Label miss;
|
356
|
+
|
357
|
+
StubCompiler::GenerateLoadFunctionPrototype(masm, eax, edx, ebx, &miss);
|
358
|
+
__ bind(&miss);
|
359
|
+
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC);
|
360
|
+
}
|
361
|
+
|
362
|
+
|
363
|
+
// Checks the receiver for special cases (value type, slow case bits).
|
364
|
+
// Falls through for regular JS object.
|
365
|
+
static void GenerateKeyedLoadReceiverCheck(MacroAssembler* masm,
|
366
|
+
Register receiver,
|
367
|
+
Register map,
|
368
|
+
int interceptor_bit,
|
369
|
+
Label* slow) {
|
370
|
+
// Register use:
|
371
|
+
// receiver - holds the receiver and is unchanged.
|
372
|
+
// Scratch registers:
|
373
|
+
// map - used to hold the map of the receiver.
|
374
|
+
|
375
|
+
// Check that the object isn't a smi.
|
376
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
377
|
+
__ j(zero, slow);
|
378
|
+
|
379
|
+
// Get the map of the receiver.
|
380
|
+
__ mov(map, FieldOperand(receiver, HeapObject::kMapOffset));
|
381
|
+
|
382
|
+
// Check bit field.
|
383
|
+
__ test_b(FieldOperand(map, Map::kBitFieldOffset),
|
384
|
+
(1 << Map::kIsAccessCheckNeeded) | (1 << interceptor_bit));
|
385
|
+
__ j(not_zero, slow);
|
386
|
+
// Check that the object is some kind of JS object EXCEPT JS Value type.
|
387
|
+
// In the case that the object is a value-wrapper object,
|
388
|
+
// we enter the runtime system to make sure that indexing
|
389
|
+
// into string objects works as intended.
|
390
|
+
ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE);
|
391
|
+
|
392
|
+
__ CmpInstanceType(map, JS_OBJECT_TYPE);
|
393
|
+
__ j(below, slow);
|
394
|
+
}
|
395
|
+
|
396
|
+
|
397
|
+
// Loads an indexed element from a fast case array.
|
398
|
+
// If not_fast_array is NULL, doesn't perform the elements map check.
|
399
|
+
static void GenerateFastArrayLoad(MacroAssembler* masm,
|
400
|
+
Register receiver,
|
401
|
+
Register key,
|
402
|
+
Register scratch,
|
403
|
+
Register result,
|
404
|
+
Label* not_fast_array,
|
405
|
+
Label* out_of_range) {
|
406
|
+
// Register use:
|
407
|
+
// receiver - holds the receiver and is unchanged.
|
408
|
+
// key - holds the key and is unchanged (must be a smi).
|
409
|
+
// Scratch registers:
|
410
|
+
// scratch - used to hold elements of the receiver and the loaded value.
|
411
|
+
// result - holds the result on exit if the load succeeds and
|
412
|
+
// we fall through.
|
413
|
+
|
414
|
+
__ mov(scratch, FieldOperand(receiver, JSObject::kElementsOffset));
|
415
|
+
if (not_fast_array != NULL) {
|
416
|
+
// Check that the object is in fast mode and writable.
|
417
|
+
__ CheckMap(scratch,
|
418
|
+
FACTORY->fixed_array_map(),
|
419
|
+
not_fast_array,
|
420
|
+
DONT_DO_SMI_CHECK);
|
421
|
+
} else {
|
422
|
+
__ AssertFastElements(scratch);
|
423
|
+
}
|
424
|
+
// Check that the key (index) is within bounds.
|
425
|
+
__ cmp(key, FieldOperand(scratch, FixedArray::kLengthOffset));
|
426
|
+
__ j(above_equal, out_of_range);
|
427
|
+
// Fast case: Do the load.
|
428
|
+
ASSERT((kPointerSize == 4) && (kSmiTagSize == 1) && (kSmiTag == 0));
|
429
|
+
__ mov(scratch, FieldOperand(scratch, key, times_2, FixedArray::kHeaderSize));
|
430
|
+
__ cmp(Operand(scratch), Immediate(FACTORY->the_hole_value()));
|
431
|
+
// In case the loaded value is the_hole we have to consult GetProperty
|
432
|
+
// to ensure the prototype chain is searched.
|
433
|
+
__ j(equal, out_of_range);
|
434
|
+
if (!result.is(scratch)) {
|
435
|
+
__ mov(result, scratch);
|
436
|
+
}
|
437
|
+
}
|
438
|
+
|
439
|
+
|
440
|
+
// Checks whether a key is an array index string or a symbol string.
|
441
|
+
// Falls through if the key is a symbol.
|
442
|
+
static void GenerateKeyStringCheck(MacroAssembler* masm,
|
443
|
+
Register key,
|
444
|
+
Register map,
|
445
|
+
Register hash,
|
446
|
+
Label* index_string,
|
447
|
+
Label* not_symbol) {
|
448
|
+
// Register use:
|
449
|
+
// key - holds the key and is unchanged. Assumed to be non-smi.
|
450
|
+
// Scratch registers:
|
451
|
+
// map - used to hold the map of the key.
|
452
|
+
// hash - used to hold the hash of the key.
|
453
|
+
__ CmpObjectType(key, FIRST_NONSTRING_TYPE, map);
|
454
|
+
__ j(above_equal, not_symbol);
|
455
|
+
|
456
|
+
// Is the string an array index, with cached numeric value?
|
457
|
+
__ mov(hash, FieldOperand(key, String::kHashFieldOffset));
|
458
|
+
__ test(hash, Immediate(String::kContainsCachedArrayIndexMask));
|
459
|
+
__ j(zero, index_string);
|
460
|
+
|
461
|
+
// Is the string a symbol?
|
462
|
+
ASSERT(kSymbolTag != 0);
|
463
|
+
__ test_b(FieldOperand(map, Map::kInstanceTypeOffset), kIsSymbolMask);
|
464
|
+
__ j(zero, not_symbol);
|
465
|
+
}
|
466
|
+
|
467
|
+
|
468
|
+
void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
|
469
|
+
// ----------- S t a t e -------------
|
470
|
+
// -- eax : key
|
471
|
+
// -- edx : receiver
|
472
|
+
// -- esp[0] : return address
|
473
|
+
// -----------------------------------
|
474
|
+
Label slow, check_string, index_smi, index_string, property_array_property;
|
475
|
+
Label probe_dictionary, check_number_dictionary;
|
476
|
+
|
477
|
+
// Check that the key is a smi.
|
478
|
+
__ test(eax, Immediate(kSmiTagMask));
|
479
|
+
__ j(not_zero, &check_string);
|
480
|
+
__ bind(&index_smi);
|
481
|
+
// Now the key is known to be a smi. This place is also jumped to from
|
482
|
+
// where a numeric string is converted to a smi.
|
483
|
+
|
484
|
+
GenerateKeyedLoadReceiverCheck(
|
485
|
+
masm, edx, ecx, Map::kHasIndexedInterceptor, &slow);
|
486
|
+
|
487
|
+
// Check the "has fast elements" bit in the receiver's map which is
|
488
|
+
// now in ecx.
|
489
|
+
__ test_b(FieldOperand(ecx, Map::kBitField2Offset),
|
490
|
+
1 << Map::kHasFastElements);
|
491
|
+
__ j(zero, &check_number_dictionary);
|
492
|
+
|
493
|
+
GenerateFastArrayLoad(masm,
|
494
|
+
edx,
|
495
|
+
eax,
|
496
|
+
ecx,
|
497
|
+
eax,
|
498
|
+
NULL,
|
499
|
+
&slow);
|
500
|
+
Isolate* isolate = masm->isolate();
|
501
|
+
Counters* counters = isolate->counters();
|
502
|
+
__ IncrementCounter(counters->keyed_load_generic_smi(), 1);
|
503
|
+
__ ret(0);
|
504
|
+
|
505
|
+
__ bind(&check_number_dictionary);
|
506
|
+
__ mov(ebx, eax);
|
507
|
+
__ SmiUntag(ebx);
|
508
|
+
__ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
|
509
|
+
|
510
|
+
// Check whether the elements is a number dictionary.
|
511
|
+
// edx: receiver
|
512
|
+
// ebx: untagged index
|
513
|
+
// eax: key
|
514
|
+
// ecx: elements
|
515
|
+
__ CheckMap(ecx,
|
516
|
+
isolate->factory()->hash_table_map(),
|
517
|
+
&slow,
|
518
|
+
DONT_DO_SMI_CHECK);
|
519
|
+
Label slow_pop_receiver;
|
520
|
+
// Push receiver on the stack to free up a register for the dictionary
|
521
|
+
// probing.
|
522
|
+
__ push(edx);
|
523
|
+
GenerateNumberDictionaryLoad(masm,
|
524
|
+
&slow_pop_receiver,
|
525
|
+
ecx,
|
526
|
+
eax,
|
527
|
+
ebx,
|
528
|
+
edx,
|
529
|
+
edi,
|
530
|
+
eax);
|
531
|
+
// Pop receiver before returning.
|
532
|
+
__ pop(edx);
|
533
|
+
__ ret(0);
|
534
|
+
|
535
|
+
__ bind(&slow_pop_receiver);
|
536
|
+
// Pop the receiver from the stack and jump to runtime.
|
537
|
+
__ pop(edx);
|
538
|
+
|
539
|
+
__ bind(&slow);
|
540
|
+
// Slow case: jump to runtime.
|
541
|
+
// edx: receiver
|
542
|
+
// eax: key
|
543
|
+
__ IncrementCounter(counters->keyed_load_generic_slow(), 1);
|
544
|
+
GenerateRuntimeGetProperty(masm);
|
545
|
+
|
546
|
+
__ bind(&check_string);
|
547
|
+
GenerateKeyStringCheck(masm, eax, ecx, ebx, &index_string, &slow);
|
548
|
+
|
549
|
+
GenerateKeyedLoadReceiverCheck(
|
550
|
+
masm, edx, ecx, Map::kHasNamedInterceptor, &slow);
|
551
|
+
|
552
|
+
// If the receiver is a fast-case object, check the keyed lookup
|
553
|
+
// cache. Otherwise probe the dictionary.
|
554
|
+
__ mov(ebx, FieldOperand(edx, JSObject::kPropertiesOffset));
|
555
|
+
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
|
556
|
+
Immediate(isolate->factory()->hash_table_map()));
|
557
|
+
__ j(equal, &probe_dictionary);
|
558
|
+
|
559
|
+
// Load the map of the receiver, compute the keyed lookup cache hash
|
560
|
+
// based on 32 bits of the map pointer and the string hash.
|
561
|
+
__ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
|
562
|
+
__ mov(ecx, ebx);
|
563
|
+
__ shr(ecx, KeyedLookupCache::kMapHashShift);
|
564
|
+
__ mov(edi, FieldOperand(eax, String::kHashFieldOffset));
|
565
|
+
__ shr(edi, String::kHashShift);
|
566
|
+
__ xor_(ecx, Operand(edi));
|
567
|
+
__ and_(ecx, KeyedLookupCache::kCapacityMask);
|
568
|
+
|
569
|
+
// Load the key (consisting of map and symbol) from the cache and
|
570
|
+
// check for match.
|
571
|
+
ExternalReference cache_keys =
|
572
|
+
ExternalReference::keyed_lookup_cache_keys(masm->isolate());
|
573
|
+
__ mov(edi, ecx);
|
574
|
+
__ shl(edi, kPointerSizeLog2 + 1);
|
575
|
+
__ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
|
576
|
+
__ j(not_equal, &slow);
|
577
|
+
__ add(Operand(edi), Immediate(kPointerSize));
|
578
|
+
__ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys));
|
579
|
+
__ j(not_equal, &slow);
|
580
|
+
|
581
|
+
// Get field offset.
|
582
|
+
// edx : receiver
|
583
|
+
// ebx : receiver's map
|
584
|
+
// eax : key
|
585
|
+
// ecx : lookup cache index
|
586
|
+
ExternalReference cache_field_offsets =
|
587
|
+
ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
|
588
|
+
__ mov(edi,
|
589
|
+
Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets));
|
590
|
+
__ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
|
591
|
+
__ sub(edi, Operand(ecx));
|
592
|
+
__ j(above_equal, &property_array_property);
|
593
|
+
|
594
|
+
// Load in-object property.
|
595
|
+
__ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
|
596
|
+
__ add(ecx, Operand(edi));
|
597
|
+
__ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0));
|
598
|
+
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
|
599
|
+
__ ret(0);
|
600
|
+
|
601
|
+
// Load property array property.
|
602
|
+
__ bind(&property_array_property);
|
603
|
+
__ mov(eax, FieldOperand(edx, JSObject::kPropertiesOffset));
|
604
|
+
__ mov(eax, FieldOperand(eax, edi, times_pointer_size,
|
605
|
+
FixedArray::kHeaderSize));
|
606
|
+
__ IncrementCounter(counters->keyed_load_generic_lookup_cache(), 1);
|
607
|
+
__ ret(0);
|
608
|
+
|
609
|
+
// Do a quick inline probe of the receiver's dictionary, if it
|
610
|
+
// exists.
|
611
|
+
__ bind(&probe_dictionary);
|
612
|
+
|
613
|
+
__ mov(ecx, FieldOperand(edx, JSObject::kMapOffset));
|
614
|
+
__ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
|
615
|
+
GenerateGlobalInstanceTypeCheck(masm, ecx, &slow);
|
616
|
+
|
617
|
+
GenerateDictionaryLoad(masm, &slow, ebx, eax, ecx, edi, eax);
|
618
|
+
__ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
|
619
|
+
__ ret(0);
|
620
|
+
|
621
|
+
__ bind(&index_string);
|
622
|
+
__ IndexFromHash(ebx, eax);
|
623
|
+
// Now jump to the place where smi keys are handled.
|
624
|
+
__ jmp(&index_smi);
|
625
|
+
}
|
626
|
+
|
627
|
+
|
628
|
+
void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
|
629
|
+
// ----------- S t a t e -------------
|
630
|
+
// -- eax : key (index)
|
631
|
+
// -- edx : receiver
|
632
|
+
// -- esp[0] : return address
|
633
|
+
// -----------------------------------
|
634
|
+
Label miss;
|
635
|
+
|
636
|
+
Register receiver = edx;
|
637
|
+
Register index = eax;
|
638
|
+
Register scratch1 = ebx;
|
639
|
+
Register scratch2 = ecx;
|
640
|
+
Register result = eax;
|
641
|
+
|
642
|
+
StringCharAtGenerator char_at_generator(receiver,
|
643
|
+
index,
|
644
|
+
scratch1,
|
645
|
+
scratch2,
|
646
|
+
result,
|
647
|
+
&miss, // When not a string.
|
648
|
+
&miss, // When not a number.
|
649
|
+
&miss, // When index out of range.
|
650
|
+
STRING_INDEX_IS_ARRAY_INDEX);
|
651
|
+
char_at_generator.GenerateFast(masm);
|
652
|
+
__ ret(0);
|
653
|
+
|
654
|
+
StubRuntimeCallHelper call_helper;
|
655
|
+
char_at_generator.GenerateSlow(masm, call_helper);
|
656
|
+
|
657
|
+
__ bind(&miss);
|
658
|
+
GenerateMiss(masm, false);
|
659
|
+
}
|
660
|
+
|
661
|
+
|
662
|
+
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
|
663
|
+
// ----------- S t a t e -------------
|
664
|
+
// -- eax : key
|
665
|
+
// -- edx : receiver
|
666
|
+
// -- esp[0] : return address
|
667
|
+
// -----------------------------------
|
668
|
+
Label slow;
|
669
|
+
|
670
|
+
// Check that the receiver isn't a smi.
|
671
|
+
__ test(edx, Immediate(kSmiTagMask));
|
672
|
+
__ j(zero, &slow);
|
673
|
+
|
674
|
+
// Check that the key is an array index, that is Uint32.
|
675
|
+
__ test(eax, Immediate(kSmiTagMask | kSmiSignMask));
|
676
|
+
__ j(not_zero, &slow);
|
677
|
+
|
678
|
+
// Get the map of the receiver.
|
679
|
+
__ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
|
680
|
+
|
681
|
+
// Check that it has indexed interceptor and access checks
|
682
|
+
// are not enabled for this object.
|
683
|
+
__ movzx_b(ecx, FieldOperand(ecx, Map::kBitFieldOffset));
|
684
|
+
__ and_(Operand(ecx), Immediate(kSlowCaseBitFieldMask));
|
685
|
+
__ cmp(Operand(ecx), Immediate(1 << Map::kHasIndexedInterceptor));
|
686
|
+
__ j(not_zero, &slow);
|
687
|
+
|
688
|
+
// Everything is fine, call runtime.
|
689
|
+
__ pop(ecx);
|
690
|
+
__ push(edx); // receiver
|
691
|
+
__ push(eax); // key
|
692
|
+
__ push(ecx); // return address
|
693
|
+
|
694
|
+
// Perform tail call to the entry.
|
695
|
+
ExternalReference ref =
|
696
|
+
ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor),
|
697
|
+
masm->isolate());
|
698
|
+
__ TailCallExternalReference(ref, 2, 1);
|
699
|
+
|
700
|
+
__ bind(&slow);
|
701
|
+
GenerateMiss(masm, false);
|
702
|
+
}
|
703
|
+
|
704
|
+
|
705
|
+
void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm,
|
706
|
+
StrictModeFlag strict_mode) {
|
707
|
+
// ----------- S t a t e -------------
|
708
|
+
// -- eax : value
|
709
|
+
// -- ecx : key
|
710
|
+
// -- edx : receiver
|
711
|
+
// -- esp[0] : return address
|
712
|
+
// -----------------------------------
|
713
|
+
Label slow, fast, array, extra;
|
714
|
+
|
715
|
+
// Check that the object isn't a smi.
|
716
|
+
__ test(edx, Immediate(kSmiTagMask));
|
717
|
+
__ j(zero, &slow);
|
718
|
+
// Get the map from the receiver.
|
719
|
+
__ mov(edi, FieldOperand(edx, HeapObject::kMapOffset));
|
720
|
+
// Check that the receiver does not require access checks. We need
|
721
|
+
// to do this because this generic stub does not perform map checks.
|
722
|
+
__ test_b(FieldOperand(edi, Map::kBitFieldOffset),
|
723
|
+
1 << Map::kIsAccessCheckNeeded);
|
724
|
+
__ j(not_zero, &slow);
|
725
|
+
// Check that the key is a smi.
|
726
|
+
__ test(ecx, Immediate(kSmiTagMask));
|
727
|
+
__ j(not_zero, &slow);
|
728
|
+
__ CmpInstanceType(edi, JS_ARRAY_TYPE);
|
729
|
+
__ j(equal, &array);
|
730
|
+
// Check that the object is some kind of JS object.
|
731
|
+
__ CmpInstanceType(edi, FIRST_JS_OBJECT_TYPE);
|
732
|
+
__ j(below, &slow);
|
733
|
+
|
734
|
+
// Object case: Check key against length in the elements array.
|
735
|
+
// eax: value
|
736
|
+
// edx: JSObject
|
737
|
+
// ecx: key (a smi)
|
738
|
+
__ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
|
739
|
+
// Check that the object is in fast mode and writable.
|
740
|
+
__ CheckMap(edi, FACTORY->fixed_array_map(), &slow, DONT_DO_SMI_CHECK);
|
741
|
+
__ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset));
|
742
|
+
__ j(below, &fast);
|
743
|
+
|
744
|
+
// Slow case: call runtime.
|
745
|
+
__ bind(&slow);
|
746
|
+
GenerateRuntimeSetProperty(masm, strict_mode);
|
747
|
+
|
748
|
+
// Extra capacity case: Check if there is extra capacity to
|
749
|
+
// perform the store and update the length. Used for adding one
|
750
|
+
// element to the array by writing to array[array.length].
|
751
|
+
__ bind(&extra);
|
752
|
+
// eax: value
|
753
|
+
// edx: receiver, a JSArray
|
754
|
+
// ecx: key, a smi.
|
755
|
+
// edi: receiver->elements, a FixedArray
|
756
|
+
// flags: compare (ecx, edx.length())
|
757
|
+
// do not leave holes in the array:
|
758
|
+
__ j(not_equal, &slow);
|
759
|
+
__ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset));
|
760
|
+
__ j(above_equal, &slow);
|
761
|
+
// Add 1 to receiver->length, and go to fast array write.
|
762
|
+
__ add(FieldOperand(edx, JSArray::kLengthOffset),
|
763
|
+
Immediate(Smi::FromInt(1)));
|
764
|
+
__ jmp(&fast);
|
765
|
+
|
766
|
+
// Array case: Get the length and the elements array from the JS
|
767
|
+
// array. Check that the array is in fast mode (and writable); if it
|
768
|
+
// is the length is always a smi.
|
769
|
+
__ bind(&array);
|
770
|
+
// eax: value
|
771
|
+
// edx: receiver, a JSArray
|
772
|
+
// ecx: key, a smi.
|
773
|
+
__ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
|
774
|
+
__ CheckMap(edi, FACTORY->fixed_array_map(), &slow, DONT_DO_SMI_CHECK);
|
775
|
+
|
776
|
+
// Check the key against the length in the array, compute the
|
777
|
+
// address to store into and fall through to fast case.
|
778
|
+
__ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis.
|
779
|
+
__ j(above_equal, &extra);
|
780
|
+
|
781
|
+
// Fast case: Do the store.
|
782
|
+
__ bind(&fast);
|
783
|
+
// eax: value
|
784
|
+
// ecx: key (a smi)
|
785
|
+
// edx: receiver
|
786
|
+
// edi: FixedArray receiver->elements
|
787
|
+
__ mov(CodeGenerator::FixedArrayElementOperand(edi, ecx), eax);
|
788
|
+
// Update write barrier for the elements array address.
|
789
|
+
__ mov(edx, Operand(eax));
|
790
|
+
__ RecordWrite(edi, 0, edx, ecx);
|
791
|
+
__ ret(0);
|
792
|
+
}
|
793
|
+
|
794
|
+
|
795
|
+
// The generated code does not accept smi keys.
|
796
|
+
// The generated code falls through if both probes miss.
|
797
|
+
static void GenerateMonomorphicCacheProbe(MacroAssembler* masm,
|
798
|
+
int argc,
|
799
|
+
Code::Kind kind,
|
800
|
+
Code::ExtraICState extra_ic_state) {
|
801
|
+
// ----------- S t a t e -------------
|
802
|
+
// -- ecx : name
|
803
|
+
// -- edx : receiver
|
804
|
+
// -----------------------------------
|
805
|
+
Label number, non_number, non_string, boolean, probe, miss;
|
806
|
+
|
807
|
+
// Probe the stub cache.
|
808
|
+
Code::Flags flags = Code::ComputeFlags(kind,
|
809
|
+
NOT_IN_LOOP,
|
810
|
+
MONOMORPHIC,
|
811
|
+
extra_ic_state,
|
812
|
+
NORMAL,
|
813
|
+
argc);
|
814
|
+
Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx,
|
815
|
+
eax);
|
816
|
+
|
817
|
+
// If the stub cache probing failed, the receiver might be a value.
|
818
|
+
// For value objects, we use the map of the prototype objects for
|
819
|
+
// the corresponding JSValue for the cache and that is what we need
|
820
|
+
// to probe.
|
821
|
+
//
|
822
|
+
// Check for number.
|
823
|
+
__ test(edx, Immediate(kSmiTagMask));
|
824
|
+
__ j(zero, &number);
|
825
|
+
__ CmpObjectType(edx, HEAP_NUMBER_TYPE, ebx);
|
826
|
+
__ j(not_equal, &non_number);
|
827
|
+
__ bind(&number);
|
828
|
+
StubCompiler::GenerateLoadGlobalFunctionPrototype(
|
829
|
+
masm, Context::NUMBER_FUNCTION_INDEX, edx);
|
830
|
+
__ jmp(&probe);
|
831
|
+
|
832
|
+
// Check for string.
|
833
|
+
__ bind(&non_number);
|
834
|
+
__ CmpInstanceType(ebx, FIRST_NONSTRING_TYPE);
|
835
|
+
__ j(above_equal, &non_string);
|
836
|
+
StubCompiler::GenerateLoadGlobalFunctionPrototype(
|
837
|
+
masm, Context::STRING_FUNCTION_INDEX, edx);
|
838
|
+
__ jmp(&probe);
|
839
|
+
|
840
|
+
// Check for boolean.
|
841
|
+
__ bind(&non_string);
|
842
|
+
__ cmp(edx, FACTORY->true_value());
|
843
|
+
__ j(equal, &boolean);
|
844
|
+
__ cmp(edx, FACTORY->false_value());
|
845
|
+
__ j(not_equal, &miss);
|
846
|
+
__ bind(&boolean);
|
847
|
+
StubCompiler::GenerateLoadGlobalFunctionPrototype(
|
848
|
+
masm, Context::BOOLEAN_FUNCTION_INDEX, edx);
|
849
|
+
|
850
|
+
// Probe the stub cache for the value object.
|
851
|
+
__ bind(&probe);
|
852
|
+
Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx,
|
853
|
+
no_reg);
|
854
|
+
__ bind(&miss);
|
855
|
+
}
|
856
|
+
|
857
|
+
|
858
|
+
static void GenerateFunctionTailCall(MacroAssembler* masm,
|
859
|
+
int argc,
|
860
|
+
Label* miss) {
|
861
|
+
// ----------- S t a t e -------------
|
862
|
+
// -- ecx : name
|
863
|
+
// -- edi : function
|
864
|
+
// -- esp[0] : return address
|
865
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
866
|
+
// -- ...
|
867
|
+
// -- esp[(argc + 1) * 4] : receiver
|
868
|
+
// -----------------------------------
|
869
|
+
|
870
|
+
// Check that the result is not a smi.
|
871
|
+
__ test(edi, Immediate(kSmiTagMask));
|
872
|
+
__ j(zero, miss);
|
873
|
+
|
874
|
+
// Check that the value is a JavaScript function, fetching its map into eax.
|
875
|
+
__ CmpObjectType(edi, JS_FUNCTION_TYPE, eax);
|
876
|
+
__ j(not_equal, miss);
|
877
|
+
|
878
|
+
// Invoke the function.
|
879
|
+
ParameterCount actual(argc);
|
880
|
+
__ InvokeFunction(edi, actual, JUMP_FUNCTION);
|
881
|
+
}
|
882
|
+
|
883
|
+
// The generated code falls through if the call should be handled by runtime.
|
884
|
+
static void GenerateCallNormal(MacroAssembler* masm, int argc) {
|
885
|
+
// ----------- S t a t e -------------
|
886
|
+
// -- ecx : name
|
887
|
+
// -- esp[0] : return address
|
888
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
889
|
+
// -- ...
|
890
|
+
// -- esp[(argc + 1) * 4] : receiver
|
891
|
+
// -----------------------------------
|
892
|
+
Label miss;
|
893
|
+
|
894
|
+
// Get the receiver of the function from the stack; 1 ~ return address.
|
895
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
896
|
+
|
897
|
+
GenerateStringDictionaryReceiverCheck(masm, edx, eax, ebx, &miss);
|
898
|
+
|
899
|
+
// eax: elements
|
900
|
+
// Search the dictionary placing the result in edi.
|
901
|
+
GenerateDictionaryLoad(masm, &miss, eax, ecx, edi, ebx, edi);
|
902
|
+
GenerateFunctionTailCall(masm, argc, &miss);
|
903
|
+
|
904
|
+
__ bind(&miss);
|
905
|
+
}
|
906
|
+
|
907
|
+
|
908
|
+
static void GenerateCallMiss(MacroAssembler* masm,
|
909
|
+
int argc,
|
910
|
+
IC::UtilityId id,
|
911
|
+
Code::ExtraICState extra_ic_state) {
|
912
|
+
// ----------- S t a t e -------------
|
913
|
+
// -- ecx : name
|
914
|
+
// -- esp[0] : return address
|
915
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
916
|
+
// -- ...
|
917
|
+
// -- esp[(argc + 1) * 4] : receiver
|
918
|
+
// -----------------------------------
|
919
|
+
|
920
|
+
Counters* counters = masm->isolate()->counters();
|
921
|
+
if (id == IC::kCallIC_Miss) {
|
922
|
+
__ IncrementCounter(counters->call_miss(), 1);
|
923
|
+
} else {
|
924
|
+
__ IncrementCounter(counters->keyed_call_miss(), 1);
|
925
|
+
}
|
926
|
+
|
927
|
+
// Get the receiver of the function from the stack; 1 ~ return address.
|
928
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
929
|
+
|
930
|
+
// Enter an internal frame.
|
931
|
+
__ EnterInternalFrame();
|
932
|
+
|
933
|
+
// Push the receiver and the name of the function.
|
934
|
+
__ push(edx);
|
935
|
+
__ push(ecx);
|
936
|
+
|
937
|
+
// Call the entry.
|
938
|
+
CEntryStub stub(1);
|
939
|
+
__ mov(eax, Immediate(2));
|
940
|
+
__ mov(ebx, Immediate(ExternalReference(IC_Utility(id), masm->isolate())));
|
941
|
+
__ CallStub(&stub);
|
942
|
+
|
943
|
+
// Move result to edi and exit the internal frame.
|
944
|
+
__ mov(edi, eax);
|
945
|
+
__ LeaveInternalFrame();
|
946
|
+
|
947
|
+
// Check if the receiver is a global object of some sort.
|
948
|
+
// This can happen only for regular CallIC but not KeyedCallIC.
|
949
|
+
if (id == IC::kCallIC_Miss) {
|
950
|
+
Label invoke, global;
|
951
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); // receiver
|
952
|
+
__ test(edx, Immediate(kSmiTagMask));
|
953
|
+
__ j(zero, &invoke, Label::kNear);
|
954
|
+
__ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset));
|
955
|
+
__ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset));
|
956
|
+
__ cmp(ebx, JS_GLOBAL_OBJECT_TYPE);
|
957
|
+
__ j(equal, &global, Label::kNear);
|
958
|
+
__ cmp(ebx, JS_BUILTINS_OBJECT_TYPE);
|
959
|
+
__ j(not_equal, &invoke, Label::kNear);
|
960
|
+
|
961
|
+
// Patch the receiver on the stack.
|
962
|
+
__ bind(&global);
|
963
|
+
__ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
|
964
|
+
__ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
|
965
|
+
__ bind(&invoke);
|
966
|
+
}
|
967
|
+
|
968
|
+
// Invoke the function.
|
969
|
+
CallKind call_kind = CallICBase::Contextual::decode(extra_ic_state)
|
970
|
+
? CALL_AS_FUNCTION
|
971
|
+
: CALL_AS_METHOD;
|
972
|
+
ParameterCount actual(argc);
|
973
|
+
__ InvokeFunction(edi,
|
974
|
+
actual,
|
975
|
+
JUMP_FUNCTION,
|
976
|
+
NullCallWrapper(),
|
977
|
+
call_kind);
|
978
|
+
}
|
979
|
+
|
980
|
+
|
981
|
+
void CallIC::GenerateMegamorphic(MacroAssembler* masm,
|
982
|
+
int argc,
|
983
|
+
Code::ExtraICState extra_ic_state) {
|
984
|
+
// ----------- S t a t e -------------
|
985
|
+
// -- ecx : name
|
986
|
+
// -- esp[0] : return address
|
987
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
988
|
+
// -- ...
|
989
|
+
// -- esp[(argc + 1) * 4] : receiver
|
990
|
+
// -----------------------------------
|
991
|
+
|
992
|
+
// Get the receiver of the function from the stack; 1 ~ return address.
|
993
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
994
|
+
GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state);
|
995
|
+
|
996
|
+
GenerateMiss(masm, argc, extra_ic_state);
|
997
|
+
}
|
998
|
+
|
999
|
+
|
1000
|
+
void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
|
1001
|
+
// ----------- S t a t e -------------
|
1002
|
+
// -- ecx : name
|
1003
|
+
// -- esp[0] : return address
|
1004
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1005
|
+
// -- ...
|
1006
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1007
|
+
// -----------------------------------
|
1008
|
+
|
1009
|
+
GenerateCallNormal(masm, argc);
|
1010
|
+
GenerateMiss(masm, argc, Code::kNoExtraICState);
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
|
1014
|
+
void CallIC::GenerateMiss(MacroAssembler* masm,
|
1015
|
+
int argc,
|
1016
|
+
Code::ExtraICState extra_ic_state) {
|
1017
|
+
// ----------- S t a t e -------------
|
1018
|
+
// -- ecx : name
|
1019
|
+
// -- esp[0] : return address
|
1020
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1021
|
+
// -- ...
|
1022
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1023
|
+
// -----------------------------------
|
1024
|
+
|
1025
|
+
GenerateCallMiss(masm, argc, IC::kCallIC_Miss, extra_ic_state);
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
|
1029
|
+
void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
|
1030
|
+
// ----------- S t a t e -------------
|
1031
|
+
// -- ecx : name
|
1032
|
+
// -- esp[0] : return address
|
1033
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1034
|
+
// -- ...
|
1035
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1036
|
+
// -----------------------------------
|
1037
|
+
|
1038
|
+
// Get the receiver of the function from the stack; 1 ~ return address.
|
1039
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1040
|
+
|
1041
|
+
Label do_call, slow_call, slow_load, slow_reload_receiver;
|
1042
|
+
Label check_number_dictionary, check_string, lookup_monomorphic_cache;
|
1043
|
+
Label index_smi, index_string;
|
1044
|
+
|
1045
|
+
// Check that the key is a smi.
|
1046
|
+
__ test(ecx, Immediate(kSmiTagMask));
|
1047
|
+
__ j(not_zero, &check_string);
|
1048
|
+
|
1049
|
+
__ bind(&index_smi);
|
1050
|
+
// Now the key is known to be a smi. This place is also jumped to from
|
1051
|
+
// where a numeric string is converted to a smi.
|
1052
|
+
|
1053
|
+
GenerateKeyedLoadReceiverCheck(
|
1054
|
+
masm, edx, eax, Map::kHasIndexedInterceptor, &slow_call);
|
1055
|
+
|
1056
|
+
GenerateFastArrayLoad(
|
1057
|
+
masm, edx, ecx, eax, edi, &check_number_dictionary, &slow_load);
|
1058
|
+
Isolate* isolate = masm->isolate();
|
1059
|
+
Counters* counters = isolate->counters();
|
1060
|
+
__ IncrementCounter(counters->keyed_call_generic_smi_fast(), 1);
|
1061
|
+
|
1062
|
+
__ bind(&do_call);
|
1063
|
+
// receiver in edx is not used after this point.
|
1064
|
+
// ecx: key
|
1065
|
+
// edi: function
|
1066
|
+
GenerateFunctionTailCall(masm, argc, &slow_call);
|
1067
|
+
|
1068
|
+
__ bind(&check_number_dictionary);
|
1069
|
+
// eax: elements
|
1070
|
+
// ecx: smi key
|
1071
|
+
// Check whether the elements is a number dictionary.
|
1072
|
+
__ CheckMap(eax,
|
1073
|
+
isolate->factory()->hash_table_map(),
|
1074
|
+
&slow_load,
|
1075
|
+
DONT_DO_SMI_CHECK);
|
1076
|
+
__ mov(ebx, ecx);
|
1077
|
+
__ SmiUntag(ebx);
|
1078
|
+
// ebx: untagged index
|
1079
|
+
// Receiver in edx will be clobbered, need to reload it on miss.
|
1080
|
+
GenerateNumberDictionaryLoad(
|
1081
|
+
masm, &slow_reload_receiver, eax, ecx, ebx, edx, edi, edi);
|
1082
|
+
__ IncrementCounter(counters->keyed_call_generic_smi_dict(), 1);
|
1083
|
+
__ jmp(&do_call);
|
1084
|
+
|
1085
|
+
__ bind(&slow_reload_receiver);
|
1086
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1087
|
+
|
1088
|
+
__ bind(&slow_load);
|
1089
|
+
// This branch is taken when calling KeyedCallIC_Miss is neither required
|
1090
|
+
// nor beneficial.
|
1091
|
+
__ IncrementCounter(counters->keyed_call_generic_slow_load(), 1);
|
1092
|
+
__ EnterInternalFrame();
|
1093
|
+
__ push(ecx); // save the key
|
1094
|
+
__ push(edx); // pass the receiver
|
1095
|
+
__ push(ecx); // pass the key
|
1096
|
+
__ CallRuntime(Runtime::kKeyedGetProperty, 2);
|
1097
|
+
__ pop(ecx); // restore the key
|
1098
|
+
__ LeaveInternalFrame();
|
1099
|
+
__ mov(edi, eax);
|
1100
|
+
__ jmp(&do_call);
|
1101
|
+
|
1102
|
+
__ bind(&check_string);
|
1103
|
+
GenerateKeyStringCheck(masm, ecx, eax, ebx, &index_string, &slow_call);
|
1104
|
+
|
1105
|
+
// The key is known to be a symbol.
|
1106
|
+
// If the receiver is a regular JS object with slow properties then do
|
1107
|
+
// a quick inline probe of the receiver's dictionary.
|
1108
|
+
// Otherwise do the monomorphic cache probe.
|
1109
|
+
GenerateKeyedLoadReceiverCheck(
|
1110
|
+
masm, edx, eax, Map::kHasNamedInterceptor, &lookup_monomorphic_cache);
|
1111
|
+
|
1112
|
+
__ mov(ebx, FieldOperand(edx, JSObject::kPropertiesOffset));
|
1113
|
+
__ CheckMap(ebx,
|
1114
|
+
isolate->factory()->hash_table_map(),
|
1115
|
+
&lookup_monomorphic_cache,
|
1116
|
+
DONT_DO_SMI_CHECK);
|
1117
|
+
|
1118
|
+
GenerateDictionaryLoad(masm, &slow_load, ebx, ecx, eax, edi, edi);
|
1119
|
+
__ IncrementCounter(counters->keyed_call_generic_lookup_dict(), 1);
|
1120
|
+
__ jmp(&do_call);
|
1121
|
+
|
1122
|
+
__ bind(&lookup_monomorphic_cache);
|
1123
|
+
__ IncrementCounter(counters->keyed_call_generic_lookup_cache(), 1);
|
1124
|
+
GenerateMonomorphicCacheProbe(masm,
|
1125
|
+
argc,
|
1126
|
+
Code::KEYED_CALL_IC,
|
1127
|
+
Code::kNoExtraICState);
|
1128
|
+
// Fall through on miss.
|
1129
|
+
|
1130
|
+
__ bind(&slow_call);
|
1131
|
+
// This branch is taken if:
|
1132
|
+
// - the receiver requires boxing or access check,
|
1133
|
+
// - the key is neither smi nor symbol,
|
1134
|
+
// - the value loaded is not a function,
|
1135
|
+
// - there is hope that the runtime will create a monomorphic call stub
|
1136
|
+
// that will get fetched next time.
|
1137
|
+
__ IncrementCounter(counters->keyed_call_generic_slow(), 1);
|
1138
|
+
GenerateMiss(masm, argc);
|
1139
|
+
|
1140
|
+
__ bind(&index_string);
|
1141
|
+
__ IndexFromHash(ebx, ecx);
|
1142
|
+
// Now jump to the place where smi keys are handled.
|
1143
|
+
__ jmp(&index_smi);
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
|
1147
|
+
void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) {
|
1148
|
+
// ----------- S t a t e -------------
|
1149
|
+
// -- ecx : name
|
1150
|
+
// -- esp[0] : return address
|
1151
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1152
|
+
// -- ...
|
1153
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1154
|
+
// -----------------------------------
|
1155
|
+
|
1156
|
+
// Check if the name is a string.
|
1157
|
+
Label miss;
|
1158
|
+
__ test(ecx, Immediate(kSmiTagMask));
|
1159
|
+
__ j(zero, &miss);
|
1160
|
+
Condition cond = masm->IsObjectStringType(ecx, eax, eax);
|
1161
|
+
__ j(NegateCondition(cond), &miss);
|
1162
|
+
GenerateCallNormal(masm, argc);
|
1163
|
+
__ bind(&miss);
|
1164
|
+
GenerateMiss(masm, argc);
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
|
1168
|
+
void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) {
|
1169
|
+
// ----------- S t a t e -------------
|
1170
|
+
// -- ecx : name
|
1171
|
+
// -- esp[0] : return address
|
1172
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1173
|
+
// -- ...
|
1174
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1175
|
+
// -----------------------------------
|
1176
|
+
|
1177
|
+
GenerateCallMiss(masm, argc, IC::kKeyedCallIC_Miss, Code::kNoExtraICState);
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
|
1181
|
+
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
|
1182
|
+
// ----------- S t a t e -------------
|
1183
|
+
// -- eax : receiver
|
1184
|
+
// -- ecx : name
|
1185
|
+
// -- esp[0] : return address
|
1186
|
+
// -----------------------------------
|
1187
|
+
|
1188
|
+
// Probe the stub cache.
|
1189
|
+
Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC,
|
1190
|
+
NOT_IN_LOOP,
|
1191
|
+
MONOMORPHIC);
|
1192
|
+
Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, eax, ecx, ebx,
|
1193
|
+
edx);
|
1194
|
+
|
1195
|
+
// Cache miss: Jump to runtime.
|
1196
|
+
GenerateMiss(masm);
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
|
1200
|
+
void LoadIC::GenerateNormal(MacroAssembler* masm) {
|
1201
|
+
// ----------- S t a t e -------------
|
1202
|
+
// -- eax : receiver
|
1203
|
+
// -- ecx : name
|
1204
|
+
// -- esp[0] : return address
|
1205
|
+
// -----------------------------------
|
1206
|
+
Label miss;
|
1207
|
+
|
1208
|
+
GenerateStringDictionaryReceiverCheck(masm, eax, edx, ebx, &miss);
|
1209
|
+
|
1210
|
+
// edx: elements
|
1211
|
+
// Search the dictionary placing the result in eax.
|
1212
|
+
GenerateDictionaryLoad(masm, &miss, edx, ecx, edi, ebx, eax);
|
1213
|
+
__ ret(0);
|
1214
|
+
|
1215
|
+
// Cache miss: Jump to runtime.
|
1216
|
+
__ bind(&miss);
|
1217
|
+
GenerateMiss(masm);
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
|
1221
|
+
void LoadIC::GenerateMiss(MacroAssembler* masm) {
|
1222
|
+
// ----------- S t a t e -------------
|
1223
|
+
// -- eax : receiver
|
1224
|
+
// -- ecx : name
|
1225
|
+
// -- esp[0] : return address
|
1226
|
+
// -----------------------------------
|
1227
|
+
|
1228
|
+
__ IncrementCounter(masm->isolate()->counters()->load_miss(), 1);
|
1229
|
+
|
1230
|
+
__ pop(ebx);
|
1231
|
+
__ push(eax); // receiver
|
1232
|
+
__ push(ecx); // name
|
1233
|
+
__ push(ebx); // return address
|
1234
|
+
|
1235
|
+
// Perform tail call to the entry.
|
1236
|
+
ExternalReference ref =
|
1237
|
+
ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
|
1238
|
+
__ TailCallExternalReference(ref, 2, 1);
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
|
1242
|
+
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
|
1243
|
+
// ----------- S t a t e -------------
|
1244
|
+
// -- eax : key
|
1245
|
+
// -- edx : receiver
|
1246
|
+
// -- esp[0] : return address
|
1247
|
+
// -----------------------------------
|
1248
|
+
|
1249
|
+
__ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1);
|
1250
|
+
|
1251
|
+
__ pop(ebx);
|
1252
|
+
__ push(edx); // receiver
|
1253
|
+
__ push(eax); // name
|
1254
|
+
__ push(ebx); // return address
|
1255
|
+
|
1256
|
+
// Perform tail call to the entry.
|
1257
|
+
ExternalReference ref = force_generic
|
1258
|
+
? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric),
|
1259
|
+
masm->isolate())
|
1260
|
+
: ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
|
1261
|
+
__ TailCallExternalReference(ref, 2, 1);
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
|
1265
|
+
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
|
1266
|
+
// ----------- S t a t e -------------
|
1267
|
+
// -- eax : key
|
1268
|
+
// -- edx : receiver
|
1269
|
+
// -- esp[0] : return address
|
1270
|
+
// -----------------------------------
|
1271
|
+
|
1272
|
+
__ pop(ebx);
|
1273
|
+
__ push(edx); // receiver
|
1274
|
+
__ push(eax); // name
|
1275
|
+
__ push(ebx); // return address
|
1276
|
+
|
1277
|
+
// Perform tail call to the entry.
|
1278
|
+
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
|
1279
|
+
}
|
1280
|
+
|
1281
|
+
|
1282
|
+
void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
|
1283
|
+
StrictModeFlag strict_mode) {
|
1284
|
+
// ----------- S t a t e -------------
|
1285
|
+
// -- eax : value
|
1286
|
+
// -- ecx : name
|
1287
|
+
// -- edx : receiver
|
1288
|
+
// -- esp[0] : return address
|
1289
|
+
// -----------------------------------
|
1290
|
+
|
1291
|
+
Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
|
1292
|
+
NOT_IN_LOOP,
|
1293
|
+
MONOMORPHIC,
|
1294
|
+
strict_mode);
|
1295
|
+
Isolate::Current()->stub_cache()->GenerateProbe(masm, flags, edx, ecx, ebx,
|
1296
|
+
no_reg);
|
1297
|
+
|
1298
|
+
// Cache miss: Jump to runtime.
|
1299
|
+
GenerateMiss(masm);
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
|
1303
|
+
void StoreIC::GenerateMiss(MacroAssembler* masm) {
|
1304
|
+
// ----------- S t a t e -------------
|
1305
|
+
// -- eax : value
|
1306
|
+
// -- ecx : name
|
1307
|
+
// -- edx : receiver
|
1308
|
+
// -- esp[0] : return address
|
1309
|
+
// -----------------------------------
|
1310
|
+
|
1311
|
+
__ pop(ebx);
|
1312
|
+
__ push(edx);
|
1313
|
+
__ push(ecx);
|
1314
|
+
__ push(eax);
|
1315
|
+
__ push(ebx);
|
1316
|
+
|
1317
|
+
// Perform tail call to the entry.
|
1318
|
+
ExternalReference ref =
|
1319
|
+
ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
|
1320
|
+
__ TailCallExternalReference(ref, 3, 1);
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
|
1324
|
+
void StoreIC::GenerateArrayLength(MacroAssembler* masm) {
|
1325
|
+
// ----------- S t a t e -------------
|
1326
|
+
// -- eax : value
|
1327
|
+
// -- ecx : name
|
1328
|
+
// -- edx : receiver
|
1329
|
+
// -- esp[0] : return address
|
1330
|
+
// -----------------------------------
|
1331
|
+
//
|
1332
|
+
// This accepts as a receiver anything JSObject::SetElementsLength accepts
|
1333
|
+
// (currently anything except for external arrays which means anything with
|
1334
|
+
// elements of FixedArray type.), but currently is restricted to JSArray.
|
1335
|
+
// Value must be a number, but only smis are accepted as the most common case.
|
1336
|
+
|
1337
|
+
Label miss;
|
1338
|
+
|
1339
|
+
Register receiver = edx;
|
1340
|
+
Register value = eax;
|
1341
|
+
Register scratch = ebx;
|
1342
|
+
|
1343
|
+
// Check that the receiver isn't a smi.
|
1344
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
1345
|
+
__ j(zero, &miss);
|
1346
|
+
|
1347
|
+
// Check that the object is a JS array.
|
1348
|
+
__ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
|
1349
|
+
__ j(not_equal, &miss);
|
1350
|
+
|
1351
|
+
// Check that elements are FixedArray.
|
1352
|
+
// We rely on StoreIC_ArrayLength below to deal with all types of
|
1353
|
+
// fast elements (including COW).
|
1354
|
+
__ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset));
|
1355
|
+
__ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
|
1356
|
+
__ j(not_equal, &miss);
|
1357
|
+
|
1358
|
+
// Check that value is a smi.
|
1359
|
+
__ test(value, Immediate(kSmiTagMask));
|
1360
|
+
__ j(not_zero, &miss);
|
1361
|
+
|
1362
|
+
// Prepare tail call to StoreIC_ArrayLength.
|
1363
|
+
__ pop(scratch);
|
1364
|
+
__ push(receiver);
|
1365
|
+
__ push(value);
|
1366
|
+
__ push(scratch); // return address
|
1367
|
+
|
1368
|
+
ExternalReference ref =
|
1369
|
+
ExternalReference(IC_Utility(kStoreIC_ArrayLength), masm->isolate());
|
1370
|
+
__ TailCallExternalReference(ref, 2, 1);
|
1371
|
+
|
1372
|
+
__ bind(&miss);
|
1373
|
+
|
1374
|
+
GenerateMiss(masm);
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
|
1378
|
+
void StoreIC::GenerateNormal(MacroAssembler* masm) {
|
1379
|
+
// ----------- S t a t e -------------
|
1380
|
+
// -- eax : value
|
1381
|
+
// -- ecx : name
|
1382
|
+
// -- edx : receiver
|
1383
|
+
// -- esp[0] : return address
|
1384
|
+
// -----------------------------------
|
1385
|
+
|
1386
|
+
Label miss, restore_miss;
|
1387
|
+
|
1388
|
+
GenerateStringDictionaryReceiverCheck(masm, edx, ebx, edi, &miss);
|
1389
|
+
|
1390
|
+
// A lot of registers are needed for storing to slow case
|
1391
|
+
// objects. Push and restore receiver but rely on
|
1392
|
+
// GenerateDictionaryStore preserving the value and name.
|
1393
|
+
__ push(edx);
|
1394
|
+
GenerateDictionaryStore(masm, &restore_miss, ebx, ecx, eax, edx, edi);
|
1395
|
+
__ Drop(1);
|
1396
|
+
Counters* counters = masm->isolate()->counters();
|
1397
|
+
__ IncrementCounter(counters->store_normal_hit(), 1);
|
1398
|
+
__ ret(0);
|
1399
|
+
|
1400
|
+
__ bind(&restore_miss);
|
1401
|
+
__ pop(edx);
|
1402
|
+
|
1403
|
+
__ bind(&miss);
|
1404
|
+
__ IncrementCounter(counters->store_normal_miss(), 1);
|
1405
|
+
GenerateMiss(masm);
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
|
1409
|
+
void StoreIC::GenerateGlobalProxy(MacroAssembler* masm,
|
1410
|
+
StrictModeFlag strict_mode) {
|
1411
|
+
// ----------- S t a t e -------------
|
1412
|
+
// -- eax : value
|
1413
|
+
// -- ecx : name
|
1414
|
+
// -- edx : receiver
|
1415
|
+
// -- esp[0] : return address
|
1416
|
+
// -----------------------------------
|
1417
|
+
__ pop(ebx);
|
1418
|
+
__ push(edx);
|
1419
|
+
__ push(ecx);
|
1420
|
+
__ push(eax);
|
1421
|
+
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
|
1422
|
+
__ push(Immediate(Smi::FromInt(strict_mode)));
|
1423
|
+
__ push(ebx); // return address
|
1424
|
+
|
1425
|
+
// Do tail-call to runtime routine.
|
1426
|
+
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
|
1430
|
+
void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
|
1431
|
+
StrictModeFlag strict_mode) {
|
1432
|
+
// ----------- S t a t e -------------
|
1433
|
+
// -- eax : value
|
1434
|
+
// -- ecx : key
|
1435
|
+
// -- edx : receiver
|
1436
|
+
// -- esp[0] : return address
|
1437
|
+
// -----------------------------------
|
1438
|
+
|
1439
|
+
__ pop(ebx);
|
1440
|
+
__ push(edx);
|
1441
|
+
__ push(ecx);
|
1442
|
+
__ push(eax);
|
1443
|
+
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
|
1444
|
+
__ push(Immediate(Smi::FromInt(strict_mode))); // Strict mode.
|
1445
|
+
__ push(ebx); // return address
|
1446
|
+
|
1447
|
+
// Do tail-call to runtime routine.
|
1448
|
+
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
|
1452
|
+
void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, bool force_generic) {
|
1453
|
+
// ----------- S t a t e -------------
|
1454
|
+
// -- eax : value
|
1455
|
+
// -- ecx : key
|
1456
|
+
// -- edx : receiver
|
1457
|
+
// -- esp[0] : return address
|
1458
|
+
// -----------------------------------
|
1459
|
+
|
1460
|
+
__ pop(ebx);
|
1461
|
+
__ push(edx);
|
1462
|
+
__ push(ecx);
|
1463
|
+
__ push(eax);
|
1464
|
+
__ push(ebx);
|
1465
|
+
|
1466
|
+
// Do tail-call to runtime routine.
|
1467
|
+
ExternalReference ref = force_generic
|
1468
|
+
? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric),
|
1469
|
+
masm->isolate())
|
1470
|
+
: ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
|
1471
|
+
__ TailCallExternalReference(ref, 3, 1);
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
|
1475
|
+
void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
|
1476
|
+
// ----------- S t a t e -------------
|
1477
|
+
// -- eax : value
|
1478
|
+
// -- ecx : key
|
1479
|
+
// -- edx : receiver
|
1480
|
+
// -- esp[0] : return address
|
1481
|
+
// -----------------------------------
|
1482
|
+
|
1483
|
+
__ pop(ebx);
|
1484
|
+
__ push(edx);
|
1485
|
+
__ push(ecx);
|
1486
|
+
__ push(eax);
|
1487
|
+
__ push(ebx); // return address
|
1488
|
+
|
1489
|
+
// Do tail-call to runtime routine.
|
1490
|
+
ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
|
1491
|
+
__ TailCallExternalReference(ref, 3, 1);
|
1492
|
+
}
|
1493
|
+
|
1494
|
+
|
1495
|
+
#undef __
|
1496
|
+
|
1497
|
+
|
1498
|
+
Condition CompareIC::ComputeCondition(Token::Value op) {
|
1499
|
+
switch (op) {
|
1500
|
+
case Token::EQ_STRICT:
|
1501
|
+
case Token::EQ:
|
1502
|
+
return equal;
|
1503
|
+
case Token::LT:
|
1504
|
+
return less;
|
1505
|
+
case Token::GT:
|
1506
|
+
// Reverse left and right operands to obtain ECMA-262 conversion order.
|
1507
|
+
return less;
|
1508
|
+
case Token::LTE:
|
1509
|
+
// Reverse left and right operands to obtain ECMA-262 conversion order.
|
1510
|
+
return greater_equal;
|
1511
|
+
case Token::GTE:
|
1512
|
+
return greater_equal;
|
1513
|
+
default:
|
1514
|
+
UNREACHABLE();
|
1515
|
+
return no_condition;
|
1516
|
+
}
|
1517
|
+
}
|
1518
|
+
|
1519
|
+
|
1520
|
+
static bool HasInlinedSmiCode(Address address) {
|
1521
|
+
// The address of the instruction following the call.
|
1522
|
+
Address test_instruction_address =
|
1523
|
+
address + Assembler::kCallTargetAddressOffset;
|
1524
|
+
|
1525
|
+
// If the instruction following the call is not a test al, nothing
|
1526
|
+
// was inlined.
|
1527
|
+
return *test_instruction_address == Assembler::kTestAlByte;
|
1528
|
+
}
|
1529
|
+
|
1530
|
+
|
1531
|
+
void CompareIC::UpdateCaches(Handle<Object> x, Handle<Object> y) {
|
1532
|
+
HandleScope scope;
|
1533
|
+
Handle<Code> rewritten;
|
1534
|
+
State previous_state = GetState();
|
1535
|
+
|
1536
|
+
State state = TargetState(previous_state, HasInlinedSmiCode(address()), x, y);
|
1537
|
+
if (state == GENERIC) {
|
1538
|
+
CompareStub stub(GetCondition(), strict(), NO_COMPARE_FLAGS);
|
1539
|
+
rewritten = stub.GetCode();
|
1540
|
+
} else {
|
1541
|
+
ICCompareStub stub(op_, state);
|
1542
|
+
rewritten = stub.GetCode();
|
1543
|
+
}
|
1544
|
+
set_target(*rewritten);
|
1545
|
+
|
1546
|
+
#ifdef DEBUG
|
1547
|
+
if (FLAG_trace_ic) {
|
1548
|
+
PrintF("[CompareIC (%s->%s)#%s]\n",
|
1549
|
+
GetStateName(previous_state),
|
1550
|
+
GetStateName(state),
|
1551
|
+
Token::Name(op_));
|
1552
|
+
}
|
1553
|
+
#endif
|
1554
|
+
|
1555
|
+
// Activate inlined smi code.
|
1556
|
+
if (previous_state == UNINITIALIZED) {
|
1557
|
+
PatchInlinedSmiCode(address());
|
1558
|
+
}
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
|
1562
|
+
void PatchInlinedSmiCode(Address address) {
|
1563
|
+
// The address of the instruction following the call.
|
1564
|
+
Address test_instruction_address =
|
1565
|
+
address + Assembler::kCallTargetAddressOffset;
|
1566
|
+
|
1567
|
+
// If the instruction following the call is not a test al, nothing
|
1568
|
+
// was inlined.
|
1569
|
+
if (*test_instruction_address != Assembler::kTestAlByte) {
|
1570
|
+
ASSERT(*test_instruction_address == Assembler::kNopByte);
|
1571
|
+
return;
|
1572
|
+
}
|
1573
|
+
|
1574
|
+
Address delta_address = test_instruction_address + 1;
|
1575
|
+
// The delta to the start of the map check instruction and the
|
1576
|
+
// condition code uses at the patched jump.
|
1577
|
+
int8_t delta = *reinterpret_cast<int8_t*>(delta_address);
|
1578
|
+
if (FLAG_trace_ic) {
|
1579
|
+
PrintF("[ patching ic at %p, test=%p, delta=%d\n",
|
1580
|
+
address, test_instruction_address, delta);
|
1581
|
+
}
|
1582
|
+
|
1583
|
+
// Patch with a short conditional jump. There must be a
|
1584
|
+
// short jump-if-carry/not-carry at this position.
|
1585
|
+
Address jmp_address = test_instruction_address - delta;
|
1586
|
+
ASSERT(*jmp_address == Assembler::kJncShortOpcode ||
|
1587
|
+
*jmp_address == Assembler::kJcShortOpcode);
|
1588
|
+
Condition cc = *jmp_address == Assembler::kJncShortOpcode
|
1589
|
+
? not_zero
|
1590
|
+
: zero;
|
1591
|
+
*jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
|
1595
|
+
} } // namespace v8::internal
|
1596
|
+
|
1597
|
+
#endif // V8_TARGET_ARCH_IA32
|