therubyracer 0.8.1.pre2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/Changelog.md +2 -1
- data/README.md +6 -3
- data/ext/v8/upstream/3.1.8/.gitignore +31 -0
- data/ext/v8/upstream/3.1.8/AUTHORS +40 -0
- data/ext/v8/upstream/3.1.8/ChangeLog +2566 -0
- data/ext/v8/upstream/3.1.8/LICENSE +52 -0
- data/ext/v8/upstream/3.1.8/LICENSE.strongtalk +29 -0
- data/ext/v8/upstream/3.1.8/LICENSE.v8 +26 -0
- data/ext/v8/upstream/3.1.8/LICENSE.valgrind +45 -0
- data/ext/v8/upstream/3.1.8/SConstruct +1192 -0
- data/ext/v8/upstream/3.1.8/build/README.txt +25 -0
- data/ext/v8/upstream/3.1.8/build/all.gyp +18 -0
- data/ext/v8/upstream/3.1.8/build/armu.gypi +32 -0
- data/ext/v8/upstream/3.1.8/build/common.gypi +82 -0
- data/ext/v8/upstream/3.1.8/build/gyp_v8 +145 -0
- data/ext/v8/upstream/3.1.8/include/v8-debug.h +384 -0
- data/ext/v8/upstream/3.1.8/include/v8-preparser.h +116 -0
- data/ext/v8/upstream/3.1.8/include/v8-profiler.h +426 -0
- data/ext/v8/upstream/3.1.8/include/v8-testing.h +99 -0
- data/ext/v8/upstream/3.1.8/include/v8.h +3846 -0
- data/ext/v8/upstream/3.1.8/include/v8stdint.h +53 -0
- data/ext/v8/upstream/3.1.8/preparser/preparser-process.cc +206 -0
- data/ext/v8/upstream/3.1.8/src/SConscript +356 -0
- data/ext/v8/upstream/3.1.8/src/accessors.cc +907 -0
- data/ext/v8/upstream/3.1.8/src/accessors.h +121 -0
- data/ext/v8/upstream/3.1.8/src/allocation.cc +204 -0
- data/ext/v8/upstream/3.1.8/src/allocation.h +176 -0
- data/ext/v8/upstream/3.1.8/src/api.cc +5191 -0
- data/ext/v8/upstream/3.1.8/src/api.h +508 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/apinatives.js +0 -0
- data/ext/v8/upstream/3.1.8/src/apiutils.h +80 -0
- data/ext/v8/upstream/3.1.8/src/arguments.h +105 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm-inl.h +352 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.cc +2756 -0
- data/ext/v8/upstream/3.1.8/src/arm/assembler-arm.h +1294 -0
- data/ext/v8/upstream/3.1.8/src/arm/builtins-arm.cc +1628 -0
- data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.cc +6783 -0
- data/ext/v8/upstream/3.1.8/src/arm/code-stubs-arm.h +657 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm-inl.h +48 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.cc +7403 -0
- data/ext/v8/upstream/3.1.8/src/arm/codegen-arm.h +595 -0
- data/ext/v8/upstream/3.1.8/src/arm/constants-arm.cc +152 -0
- data/ext/v8/upstream/3.1.8/src/arm/constants-arm.h +769 -0
- data/ext/v8/upstream/3.1.8/src/arm/cpu-arm.cc +147 -0
- data/ext/v8/upstream/3.1.8/src/arm/debug-arm.cc +315 -0
- data/ext/v8/upstream/3.1.8/src/arm/deoptimizer-arm.cc +700 -0
- data/ext/v8/upstream/3.1.8/src/arm/disasm-arm.cc +1439 -0
- data/ext/v8/upstream/3.1.8/src/arm/frames-arm.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/arm/frames-arm.h +168 -0
- data/ext/v8/upstream/3.1.8/src/arm/full-codegen-arm.cc +4230 -0
- data/ext/v8/upstream/3.1.8/src/arm/ic-arm.cc +1799 -0
- data/ext/v8/upstream/3.1.8/src/arm/jump-target-arm.cc +174 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.cc +2041 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-arm.h +2046 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.cc +3822 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-codegen-arm.h +312 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.cc +303 -0
- data/ext/v8/upstream/3.1.8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.cc +2701 -0
- data/ext/v8/upstream/3.1.8/src/arm/macro-assembler-arm.h +1015 -0
- data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.cc +1280 -0
- data/ext/v8/upstream/3.1.8/src/arm/regexp-macro-assembler-arm.h +252 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/register-allocator-arm.h +0 -0
- data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.cc +3165 -0
- data/ext/v8/upstream/3.1.8/src/arm/simulator-arm.h +402 -0
- data/ext/v8/upstream/3.1.8/src/arm/stub-cache-arm.cc +4077 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/arm/virtual-frame-arm-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.cc +843 -0
- data/ext/v8/upstream/3.1.8/src/arm/virtual-frame-arm.h +520 -0
- data/ext/v8/upstream/3.1.8/src/array.js +1231 -0
- data/ext/v8/upstream/3.1.8/src/assembler.cc +973 -0
- data/ext/v8/upstream/3.1.8/src/assembler.h +787 -0
- data/ext/v8/upstream/3.1.8/src/ast-inl.h +107 -0
- data/ext/v8/upstream/3.1.8/src/ast.cc +1067 -0
- data/ext/v8/upstream/3.1.8/src/ast.h +2177 -0
- data/ext/v8/upstream/3.1.8/src/atomicops.h +165 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_arm_gcc.h +145 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.cc +126 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_gcc.h +287 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_macosx.h +301 -0
- data/ext/v8/upstream/3.1.8/src/atomicops_internals_x86_msvc.h +203 -0
- data/ext/v8/upstream/3.1.8/src/bignum-dtoa.cc +655 -0
- data/ext/v8/upstream/3.1.8/src/bignum-dtoa.h +81 -0
- data/ext/v8/upstream/3.1.8/src/bignum.cc +768 -0
- data/ext/v8/upstream/3.1.8/src/bignum.h +140 -0
- data/ext/v8/upstream/3.1.8/src/bootstrapper.cc +1888 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/bootstrapper.h +0 -0
- data/ext/v8/upstream/3.1.8/src/builtins.cc +1586 -0
- data/ext/v8/upstream/3.1.8/src/builtins.h +339 -0
- data/ext/v8/upstream/3.1.8/src/bytecodes-irregexp.h +105 -0
- data/ext/v8/upstream/3.1.8/src/cached-powers.cc +177 -0
- data/ext/v8/upstream/3.1.8/src/cached-powers.h +65 -0
- data/ext/v8/upstream/3.1.8/src/char-predicates-inl.h +94 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/char-predicates.h +0 -0
- data/ext/v8/upstream/3.1.8/src/checks.cc +110 -0
- data/ext/v8/upstream/3.1.8/src/checks.h +292 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/circular-queue.cc +122 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/circular-queue.h +0 -0
- data/ext/v8/upstream/3.1.8/src/code-stubs.cc +230 -0
- data/ext/v8/upstream/3.1.8/src/code-stubs.h +950 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/code.h +0 -0
- data/ext/v8/upstream/3.1.8/src/codegen-inl.h +64 -0
- data/ext/v8/upstream/3.1.8/src/codegen.cc +495 -0
- data/ext/v8/upstream/3.1.8/src/codegen.h +245 -0
- data/ext/v8/upstream/3.1.8/src/compilation-cache.cc +654 -0
- data/ext/v8/upstream/3.1.8/src/compilation-cache.h +112 -0
- data/ext/v8/upstream/3.1.8/src/compiler.cc +806 -0
- data/ext/v8/upstream/3.1.8/src/compiler.h +290 -0
- data/ext/v8/upstream/3.1.8/src/contexts.cc +320 -0
- data/ext/v8/upstream/3.1.8/src/contexts.h +376 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/conversions-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/conversions.cc +1069 -0
- data/ext/v8/upstream/3.1.8/src/conversions.h +122 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/counters.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/counters.h +242 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler-inl.h +100 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler.cc +554 -0
- data/ext/v8/upstream/3.1.8/src/cpu-profiler.h +291 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/cpu.h +0 -0
- data/ext/v8/upstream/3.1.8/src/d8-debug.cc +367 -0
- data/ext/v8/upstream/3.1.8/src/d8-debug.h +157 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-posix.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-readline.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/d8-windows.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/d8.cc +792 -0
- data/ext/v8/upstream/3.1.8/src/d8.gyp +85 -0
- data/ext/v8/upstream/3.1.8/src/d8.h +231 -0
- data/ext/v8/upstream/3.1.8/src/d8.js +2798 -0
- data/ext/v8/upstream/3.1.8/src/data-flow.cc +545 -0
- data/ext/v8/upstream/3.1.8/src/data-flow.h +379 -0
- data/ext/v8/upstream/3.1.8/src/date.js +1103 -0
- data/ext/v8/upstream/3.1.8/src/dateparser-inl.h +125 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/dateparser.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/dateparser.h +263 -0
- data/ext/v8/upstream/3.1.8/src/debug-agent.cc +446 -0
- data/ext/v8/upstream/3.1.8/src/debug-agent.h +131 -0
- data/ext/v8/upstream/3.1.8/src/debug-debugger.js +2569 -0
- data/ext/v8/upstream/3.1.8/src/debug.cc +3085 -0
- data/ext/v8/upstream/3.1.8/src/debug.h +1025 -0
- data/ext/v8/upstream/3.1.8/src/deoptimizer.cc +1185 -0
- data/ext/v8/upstream/3.1.8/src/deoptimizer.h +529 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disasm.h +0 -0
- data/ext/v8/upstream/3.1.8/src/disassembler.cc +338 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/disassembler.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/diy-fp.h +0 -0
- data/ext/v8/upstream/3.1.8/src/double.h +238 -0
- data/ext/v8/upstream/3.1.8/src/dtoa.cc +103 -0
- data/ext/v8/upstream/3.1.8/src/dtoa.h +85 -0
- data/ext/v8/upstream/3.1.8/src/execution.cc +735 -0
- data/ext/v8/upstream/3.1.8/src/execution.h +322 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/experimental.gyp +53 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.cc +264 -0
- data/ext/v8/upstream/3.1.8/src/extensions/experimental/i18n-extension.h +64 -0
- data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.cc +141 -0
- data/ext/v8/upstream/3.1.8/src/extensions/externalize-string-extension.h +50 -0
- data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.cc +58 -0
- data/ext/v8/upstream/3.1.8/src/extensions/gc-extension.h +49 -0
- data/ext/v8/upstream/3.1.8/src/factory.cc +1087 -0
- data/ext/v8/upstream/3.1.8/src/factory.h +432 -0
- data/ext/v8/upstream/3.1.8/src/fast-dtoa.cc +736 -0
- data/ext/v8/upstream/3.1.8/src/fast-dtoa.h +83 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/fixed-dtoa.h +0 -0
- data/ext/v8/upstream/3.1.8/src/flag-definitions.h +552 -0
- data/ext/v8/upstream/3.1.8/src/flags.cc +551 -0
- data/ext/v8/upstream/3.1.8/src/flags.h +79 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/frame-element.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/frame-element.h +277 -0
- data/ext/v8/upstream/3.1.8/src/frames-inl.h +210 -0
- data/ext/v8/upstream/3.1.8/src/frames.cc +1232 -0
- data/ext/v8/upstream/3.1.8/src/frames.h +826 -0
- data/ext/v8/upstream/3.1.8/src/full-codegen.cc +1382 -0
- data/ext/v8/upstream/3.1.8/src/full-codegen.h +751 -0
- data/ext/v8/upstream/3.1.8/src/func-name-inferrer.cc +90 -0
- data/ext/v8/upstream/3.1.8/src/func-name-inferrer.h +111 -0
- data/ext/v8/upstream/3.1.8/src/gdb-jit.cc +1547 -0
- data/ext/v8/upstream/3.1.8/src/gdb-jit.h +138 -0
- data/ext/v8/upstream/3.1.8/src/global-handles.cc +534 -0
- data/ext/v8/upstream/3.1.8/src/global-handles.h +181 -0
- data/ext/v8/upstream/3.1.8/src/globals.h +325 -0
- data/ext/v8/upstream/3.1.8/src/handles-inl.h +80 -0
- data/ext/v8/upstream/3.1.8/src/handles.cc +910 -0
- data/ext/v8/upstream/3.1.8/src/handles.h +424 -0
- data/ext/v8/upstream/3.1.8/src/hashmap.cc +230 -0
- data/ext/v8/upstream/3.1.8/src/hashmap.h +121 -0
- data/ext/v8/upstream/3.1.8/src/heap-inl.h +587 -0
- data/ext/v8/upstream/3.1.8/src/heap-profiler.cc +1128 -0
- data/ext/v8/upstream/3.1.8/src/heap-profiler.h +381 -0
- data/ext/v8/upstream/3.1.8/src/heap.cc +5610 -0
- data/ext/v8/upstream/3.1.8/src/heap.h +2218 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.cc +1490 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen-instructions.h +3493 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen.cc +6056 -0
- data/ext/v8/upstream/3.1.8/src/hydrogen.h +1091 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32-inl.h +429 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.cc +2800 -0
- data/ext/v8/upstream/3.1.8/src/ia32/assembler-ia32.h +1093 -0
- data/ext/v8/upstream/3.1.8/src/ia32/builtins-ia32.cc +1590 -0
- data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.cc +6624 -0
- data/ext/v8/upstream/3.1.8/src/ia32/code-stubs-ia32.h +536 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/codegen-ia32-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.cc +10354 -0
- data/ext/v8/upstream/3.1.8/src/ia32/codegen-ia32.h +798 -0
- data/ext/v8/upstream/3.1.8/src/ia32/cpu-ia32.cc +87 -0
- data/ext/v8/upstream/3.1.8/src/ia32/debug-ia32.cc +309 -0
- data/ext/v8/upstream/3.1.8/src/ia32/deoptimizer-ia32.cc +664 -0
- data/ext/v8/upstream/3.1.8/src/ia32/disasm-ia32.cc +1597 -0
- data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/ia32/frames-ia32.h +140 -0
- data/ext/v8/upstream/3.1.8/src/ia32/full-codegen-ia32.cc +4278 -0
- data/ext/v8/upstream/3.1.8/src/ia32/ic-ia32.cc +1786 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/jump-target-ia32.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.cc +3880 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-codegen-ia32.h +309 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.cc +460 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.cc +2095 -0
- data/ext/v8/upstream/3.1.8/src/ia32/lithium-ia32.h +2127 -0
- data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.cc +2031 -0
- data/ext/v8/upstream/3.1.8/src/ia32/macro-assembler-ia32.h +798 -0
- data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.cc +1253 -0
- data/ext/v8/upstream/3.1.8/src/ia32/regexp-macro-assembler-ia32.h +215 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/register-allocator-ia32.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/ia32/simulator-ia32.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/ia32/simulator-ia32.h +72 -0
- data/ext/v8/upstream/3.1.8/src/ia32/stub-cache-ia32.cc +3732 -0
- data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.cc +1360 -0
- data/ext/v8/upstream/3.1.8/src/ia32/virtual-frame-ia32.h +646 -0
- data/ext/v8/upstream/3.1.8/src/ic-inl.h +129 -0
- data/ext/v8/upstream/3.1.8/src/ic.cc +2333 -0
- data/ext/v8/upstream/3.1.8/src/ic.h +639 -0
- data/ext/v8/upstream/3.1.8/src/inspector.cc +63 -0
- data/ext/v8/upstream/3.1.8/src/inspector.h +62 -0
- data/ext/v8/upstream/3.1.8/src/interpreter-irregexp.cc +655 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/interpreter-irregexp.h +0 -0
- data/ext/v8/upstream/3.1.8/src/json.js +342 -0
- data/ext/v8/upstream/3.1.8/src/jsregexp.cc +5340 -0
- data/ext/v8/upstream/3.1.8/src/jsregexp.h +1484 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-heavy-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-heavy.cc +430 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-heavy.h +244 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target-light-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-light.cc +111 -0
- data/ext/v8/upstream/3.1.8/src/jump-target-light.h +193 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/jump-target.h +0 -0
- data/ext/v8/upstream/3.1.8/src/list-inl.h +206 -0
- data/ext/v8/upstream/3.1.8/src/list.h +164 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator-inl.h +140 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator.cc +2093 -0
- data/ext/v8/upstream/3.1.8/src/lithium-allocator.h +644 -0
- data/ext/v8/upstream/3.1.8/src/lithium.cc +168 -0
- data/ext/v8/upstream/3.1.8/src/lithium.h +592 -0
- data/ext/v8/upstream/3.1.8/src/liveedit-debugger.js +1082 -0
- data/ext/v8/upstream/3.1.8/src/liveedit.cc +1650 -0
- data/ext/v8/upstream/3.1.8/src/liveedit.h +174 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist-inl.h +126 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist.cc +2527 -0
- data/ext/v8/upstream/3.1.8/src/liveobjectlist.h +322 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/log-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/log-utils.cc +336 -0
- data/ext/v8/upstream/3.1.8/src/log-utils.h +232 -0
- data/ext/v8/upstream/3.1.8/src/log.cc +1608 -0
- data/ext/v8/upstream/3.1.8/src/log.h +379 -0
- data/ext/v8/upstream/3.1.8/src/macro-assembler.h +120 -0
- data/ext/v8/upstream/3.1.8/src/macros.py +178 -0
- data/ext/v8/upstream/3.1.8/src/mark-compact.cc +2957 -0
- data/ext/v8/upstream/3.1.8/src/mark-compact.h +433 -0
- data/ext/v8/upstream/3.1.8/src/math.js +264 -0
- data/ext/v8/upstream/3.1.8/src/memory.h +82 -0
- data/ext/v8/upstream/3.1.8/src/messages.cc +164 -0
- data/ext/v8/upstream/3.1.8/src/messages.h +114 -0
- data/ext/v8/upstream/3.1.8/src/messages.js +1071 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/assembler-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/assembler-mips.h +667 -0
- data/ext/v8/upstream/3.1.8/src/mips/builtins-mips.cc +205 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/codegen-mips.h +431 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/constants-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/cpu-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/debug-mips.cc +127 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/disasm-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/fast-codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/frames-mips.cc +96 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/frames-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/full-codegen-mips.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/ic-mips.cc +208 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/jump-target-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/macro-assembler-mips.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/register-allocator-mips.h +0 -0
- data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.cc +1650 -0
- data/ext/v8/upstream/3.1.8/src/mips/simulator-mips.h +311 -0
- data/ext/v8/upstream/3.1.8/src/mips/stub-cache-mips.cc +418 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mips/virtual-frame-mips.h +0 -0
- data/ext/v8/upstream/3.1.8/src/mirror-debugger.js +2380 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/mksnapshot.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/natives.h +0 -0
- data/ext/v8/upstream/3.1.8/src/objects-debug.cc +722 -0
- data/ext/v8/upstream/3.1.8/src/objects-inl.h +3946 -0
- data/ext/v8/upstream/3.1.8/src/objects-printer.cc +801 -0
- data/ext/v8/upstream/3.1.8/src/objects-visiting.cc +142 -0
- data/ext/v8/upstream/3.1.8/src/objects-visiting.h +401 -0
- data/ext/v8/upstream/3.1.8/src/objects.cc +10044 -0
- data/ext/v8/upstream/3.1.8/src/objects.h +6571 -0
- data/ext/v8/upstream/3.1.8/src/parser.cc +5165 -0
- data/ext/v8/upstream/3.1.8/src/parser.h +802 -0
- data/ext/v8/upstream/3.1.8/src/platform-cygwin.cc +745 -0
- data/ext/v8/upstream/3.1.8/src/platform-freebsd.cc +702 -0
- data/ext/v8/upstream/3.1.8/src/platform-linux.cc +981 -0
- data/ext/v8/upstream/3.1.8/src/platform-macos.cc +732 -0
- data/ext/v8/upstream/3.1.8/src/platform-nullos.cc +498 -0
- data/ext/v8/upstream/3.1.8/src/platform-openbsd.cc +657 -0
- data/ext/v8/upstream/3.1.8/src/platform-posix.cc +399 -0
- data/ext/v8/upstream/3.1.8/src/platform-solaris.cc +714 -0
- data/ext/v8/upstream/3.1.8/src/platform-win32.cc +1974 -0
- data/ext/v8/upstream/3.1.8/src/platform.h +636 -0
- data/ext/v8/upstream/3.1.8/src/preparse-data.cc +183 -0
- data/ext/v8/upstream/3.1.8/src/preparse-data.h +249 -0
- data/ext/v8/upstream/3.1.8/src/preparser-api.cc +213 -0
- data/ext/v8/upstream/3.1.8/src/preparser.cc +1205 -0
- data/ext/v8/upstream/3.1.8/src/preparser.h +278 -0
- data/ext/v8/upstream/3.1.8/src/prettyprinter.cc +1539 -0
- data/ext/v8/upstream/3.1.8/src/prettyprinter.h +223 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator-inl.h +128 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator.cc +2899 -0
- data/ext/v8/upstream/3.1.8/src/profile-generator.h +1151 -0
- data/ext/v8/upstream/3.1.8/src/property.cc +96 -0
- data/ext/v8/upstream/3.1.8/src/property.h +337 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-macro-assembler-irregexp-inl.h +0 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.cc +470 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler-tracer.h +104 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.cc +257 -0
- data/ext/v8/upstream/3.1.8/src/regexp-macro-assembler.h +231 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/regexp-stack.h +0 -0
- data/ext/v8/upstream/3.1.8/src/regexp.js +483 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/register-allocator.h +0 -0
- data/ext/v8/upstream/3.1.8/src/rewriter.cc +1023 -0
- data/ext/v8/upstream/3.1.8/src/rewriter.h +59 -0
- data/ext/v8/upstream/3.1.8/src/runtime-profiler.cc +443 -0
- data/ext/v8/upstream/3.1.8/src/runtime-profiler.h +77 -0
- data/ext/v8/upstream/3.1.8/src/runtime.cc +11592 -0
- data/ext/v8/upstream/3.1.8/src/runtime.h +582 -0
- data/ext/v8/upstream/3.1.8/src/runtime.js +643 -0
- data/ext/v8/upstream/3.1.8/src/safepoint-table.cc +253 -0
- data/ext/v8/upstream/3.1.8/src/safepoint-table.h +263 -0
- data/ext/v8/upstream/3.1.8/src/scanner-base.cc +971 -0
- data/ext/v8/upstream/3.1.8/src/scanner-base.h +653 -0
- data/ext/v8/upstream/3.1.8/src/scanner.cc +586 -0
- data/ext/v8/upstream/3.1.8/src/scanner.h +194 -0
- data/ext/v8/upstream/3.1.8/src/scopeinfo.cc +636 -0
- data/ext/v8/upstream/3.1.8/src/scopeinfo.h +238 -0
- data/ext/v8/upstream/3.1.8/src/scopes.cc +1063 -0
- data/ext/v8/upstream/3.1.8/src/scopes.h +494 -0
- data/ext/v8/upstream/3.1.8/src/serialize.cc +1535 -0
- data/ext/v8/upstream/3.1.8/src/serialize.h +584 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/shell.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/simulator.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/smart-pointer.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-common.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot-empty.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/snapshot.h +0 -0
- data/ext/v8/upstream/3.1.8/src/spaces-inl.h +524 -0
- data/ext/v8/upstream/3.1.8/src/spaces.cc +3254 -0
- data/ext/v8/upstream/3.1.8/src/spaces.h +2362 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/splay-tree.h +0 -0
- data/ext/v8/upstream/3.1.8/src/string-search.cc +40 -0
- data/ext/v8/upstream/3.1.8/src/string-search.h +567 -0
- data/ext/v8/upstream/3.1.8/src/string-stream.cc +584 -0
- data/ext/v8/upstream/3.1.8/src/string-stream.h +191 -0
- data/ext/v8/upstream/3.1.8/src/string.js +915 -0
- data/ext/v8/upstream/3.1.8/src/strtod.cc +440 -0
- data/ext/v8/upstream/3.1.8/src/strtod.h +40 -0
- data/ext/v8/upstream/3.1.8/src/stub-cache.cc +1878 -0
- data/ext/v8/upstream/3.1.8/src/stub-cache.h +849 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/third_party/valgrind/valgrind.h +0 -0
- data/ext/v8/upstream/3.1.8/src/token.cc +63 -0
- data/ext/v8/upstream/3.1.8/src/token.h +288 -0
- data/ext/v8/upstream/3.1.8/src/top.cc +1152 -0
- data/ext/v8/upstream/3.1.8/src/top.h +608 -0
- data/ext/v8/upstream/3.1.8/src/type-info.cc +406 -0
- data/ext/v8/upstream/3.1.8/src/type-info.h +283 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/unbound-queue.h +0 -0
- data/ext/v8/upstream/3.1.8/src/unicode-inl.h +238 -0
- data/ext/v8/upstream/3.1.8/src/unicode.cc +1624 -0
- data/ext/v8/upstream/3.1.8/src/unicode.h +280 -0
- data/ext/v8/upstream/3.1.8/src/uri.js +402 -0
- data/ext/v8/upstream/3.1.8/src/utils.cc +371 -0
- data/ext/v8/upstream/3.1.8/src/utils.h +793 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8-counters.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/v8-counters.h +290 -0
- data/ext/v8/upstream/3.1.8/src/v8.cc +270 -0
- data/ext/v8/upstream/3.1.8/src/v8.h +127 -0
- data/ext/v8/upstream/3.1.8/src/v8checks.h +64 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/v8dll-main.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/v8globals.h +480 -0
- data/ext/v8/upstream/3.1.8/src/v8natives.js +1252 -0
- data/ext/v8/upstream/3.1.8/src/v8preparserdll-main.cc +39 -0
- data/ext/v8/upstream/3.1.8/src/v8threads.cc +440 -0
- data/ext/v8/upstream/3.1.8/src/v8threads.h +157 -0
- data/ext/v8/upstream/3.1.8/src/v8utils.h +354 -0
- data/ext/v8/upstream/3.1.8/src/variables.cc +132 -0
- data/ext/v8/upstream/3.1.8/src/variables.h +212 -0
- data/ext/v8/upstream/3.1.8/src/version.cc +95 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/version.h +0 -0
- data/ext/v8/upstream/3.1.8/src/virtual-frame-heavy-inl.h +190 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-heavy.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame-light.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/virtual-frame.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/virtual-frame.h +59 -0
- data/ext/v8/upstream/3.1.8/src/vm-state-inl.h +134 -0
- data/ext/v8/upstream/3.1.8/src/vm-state.h +68 -0
- data/ext/v8/upstream/3.1.8/src/win32-headers.h +95 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64-inl.h +455 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.cc +3162 -0
- data/ext/v8/upstream/3.1.8/src/x64/assembler-x64.h +1584 -0
- data/ext/v8/upstream/3.1.8/src/x64/builtins-x64.cc +1492 -0
- data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.cc +5150 -0
- data/ext/v8/upstream/3.1.8/src/x64/code-stubs-x64.h +519 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64-inl.h +46 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.cc +8835 -0
- data/ext/v8/upstream/3.1.8/src/x64/codegen-x64.h +750 -0
- data/ext/v8/upstream/3.1.8/src/x64/cpu-x64.cc +86 -0
- data/ext/v8/upstream/3.1.8/src/x64/debug-x64.cc +316 -0
- data/ext/v8/upstream/3.1.8/src/x64/deoptimizer-x64.cc +781 -0
- data/ext/v8/upstream/3.1.8/src/x64/disasm-x64.cc +1737 -0
- data/ext/v8/upstream/3.1.8/src/x64/frames-x64.cc +45 -0
- data/ext/v8/upstream/3.1.8/src/x64/frames-x64.h +130 -0
- data/ext/v8/upstream/3.1.8/src/x64/full-codegen-x64.cc +3984 -0
- data/ext/v8/upstream/3.1.8/src/x64/ic-x64.cc +1761 -0
- data/ext/v8/upstream/3.1.8/src/x64/jump-target-x64.cc +437 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.cc +3639 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-codegen-x64.h +305 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.cc +2044 -0
- data/ext/v8/upstream/3.1.8/src/x64/lithium-x64.h +2052 -0
- data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.cc +2660 -0
- data/ext/v8/upstream/3.1.8/src/x64/macro-assembler-x64.h +1852 -0
- data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.cc +1382 -0
- data/ext/v8/upstream/3.1.8/src/x64/regexp-macro-assembler-x64.h +278 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64-inl.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.cc +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/register-allocator-x64.h +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/src/x64/simulator-x64.cc +0 -0
- data/ext/v8/upstream/3.1.8/src/x64/simulator-x64.h +71 -0
- data/ext/v8/upstream/3.1.8/src/x64/stub-cache-x64.cc +3509 -0
- data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.cc +1292 -0
- data/ext/v8/upstream/3.1.8/src/x64/virtual-frame-x64.h +593 -0
- data/ext/v8/upstream/3.1.8/src/zone-inl.h +83 -0
- data/ext/v8/upstream/3.1.8/src/zone.cc +195 -0
- data/ext/v8/upstream/3.1.8/src/zone.h +233 -0
- data/ext/v8/upstream/3.1.8/tools/codemap.js +265 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/consarray.js +0 -0
- data/ext/v8/upstream/3.1.8/tools/csvparser.js +78 -0
- data/ext/v8/upstream/3.1.8/tools/disasm.py +92 -0
- data/ext/v8/upstream/3.1.8/tools/gc-nvp-trace-processor.py +328 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/generate-ten-powers.scm +0 -0
- data/ext/v8/upstream/3.1.8/tools/grokdump.py +840 -0
- data/ext/v8/upstream/3.1.8/tools/gyp/v8.gyp +869 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/js2c.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/jsmin.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/linux-tick-processor +0 -0
- data/ext/v8/upstream/3.1.8/tools/ll_prof.py +919 -0
- data/ext/v8/upstream/3.1.8/tools/logreader.js +185 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-nm +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/mac-tick-processor +0 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/README +31 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/SConstruct +42 -0
- data/ext/v8/upstream/3.1.8/tools/oom_dump/oom_dump.cc +288 -0
- data/ext/v8/upstream/3.1.8/tools/presubmit.py +305 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/process-heap-prof.py +0 -0
- data/ext/v8/upstream/3.1.8/tools/profile.js +751 -0
- data/ext/v8/upstream/3.1.8/tools/profile_view.js +219 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/run-valgrind.py +0 -0
- data/ext/v8/upstream/3.1.8/tools/splaytree.js +316 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/stats-viewer.py +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/tickprocessor-driver.js +0 -0
- data/ext/v8/upstream/3.1.8/tools/tickprocessor.js +863 -0
- data/ext/v8/upstream/3.1.8/tools/utils.py +96 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/README.txt +70 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/arm.vsprops +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/common.vsprops +34 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/d8js2c.cmd +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/debug.vsprops +17 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/ia32.vsprops +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/js2c.cmd +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/release.vsprops +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_arm.vcproj +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base.vcproj +1296 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_arm.vcproj +1234 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_base_x64.vcproj +1296 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_cctest_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_arm.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_process_sample_x64.vcproj +0 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample.vcproj +147 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_arm.vcproj +147 -0
- data/ext/v8/upstream/3.1.8/tools/visual_studio/v8_shell_sample_x64.vcproj +163 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.sln +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/v8_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.3.3 → 3.1.8}/tools/visual_studio/x64.vsprops +0 -0
- data/ext/v8/upstream/3.1.8/tools/windows-tick-processor.bat +30 -0
- data/ext/v8/upstream/Makefile +2 -1
- data/ext/v8/v8_template.cpp +2 -2
- data/lib/v8/version.rb +1 -1
- data/spec/redjs/jsapi_spec.rb +2 -2
- metadata +552 -490
- data/ext/v8/upstream/2.3.3/.gitignore +0 -26
- data/ext/v8/upstream/2.3.3/AUTHORS +0 -31
- data/ext/v8/upstream/2.3.3/ChangeLog +0 -1916
- data/ext/v8/upstream/2.3.3/LICENSE +0 -55
- data/ext/v8/upstream/2.3.3/SConstruct +0 -1154
- data/ext/v8/upstream/2.3.3/include/v8-debug.h +0 -381
- data/ext/v8/upstream/2.3.3/include/v8-profiler.h +0 -353
- data/ext/v8/upstream/2.3.3/include/v8.h +0 -3616
- data/ext/v8/upstream/2.3.3/src/SConscript +0 -330
- data/ext/v8/upstream/2.3.3/src/accessors.cc +0 -661
- data/ext/v8/upstream/2.3.3/src/accessors.h +0 -114
- data/ext/v8/upstream/2.3.3/src/allocation.cc +0 -198
- data/ext/v8/upstream/2.3.3/src/allocation.h +0 -169
- data/ext/v8/upstream/2.3.3/src/api.cc +0 -4795
- data/ext/v8/upstream/2.3.3/src/api.h +0 -485
- data/ext/v8/upstream/2.3.3/src/apiutils.h +0 -69
- data/ext/v8/upstream/2.3.3/src/arguments.h +0 -96
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm-inl.h +0 -305
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.cc +0 -2580
- data/ext/v8/upstream/2.3.3/src/arm/assembler-arm.h +0 -1275
- data/ext/v8/upstream/2.3.3/src/arm/builtins-arm.cc +0 -1320
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm-inl.h +0 -48
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.cc +0 -11398
- data/ext/v8/upstream/2.3.3/src/arm/codegen-arm.h +0 -1102
- data/ext/v8/upstream/2.3.3/src/arm/constants-arm.cc +0 -154
- data/ext/v8/upstream/2.3.3/src/arm/constants-arm.h +0 -388
- data/ext/v8/upstream/2.3.3/src/arm/cpu-arm.cc +0 -142
- data/ext/v8/upstream/2.3.3/src/arm/debug-arm.cc +0 -309
- data/ext/v8/upstream/2.3.3/src/arm/disasm-arm.cc +0 -1459
- data/ext/v8/upstream/2.3.3/src/arm/fast-codegen-arm.cc +0 -241
- data/ext/v8/upstream/2.3.3/src/arm/frames-arm.cc +0 -123
- data/ext/v8/upstream/2.3.3/src/arm/frames-arm.h +0 -162
- data/ext/v8/upstream/2.3.3/src/arm/full-codegen-arm.cc +0 -3178
- data/ext/v8/upstream/2.3.3/src/arm/ic-arm.cc +0 -2258
- data/ext/v8/upstream/2.3.3/src/arm/jump-target-arm.cc +0 -164
- data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.cc +0 -1892
- data/ext/v8/upstream/2.3.3/src/arm/macro-assembler-arm.h +0 -727
- data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.cc +0 -1261
- data/ext/v8/upstream/2.3.3/src/arm/regexp-macro-assembler-arm.h +0 -266
- data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.cc +0 -2822
- data/ext/v8/upstream/2.3.3/src/arm/simulator-arm.h +0 -361
- data/ext/v8/upstream/2.3.3/src/arm/stub-cache-arm.cc +0 -2387
- data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.cc +0 -834
- data/ext/v8/upstream/2.3.3/src/arm/virtual-frame-arm.h +0 -519
- data/ext/v8/upstream/2.3.3/src/array.js +0 -1127
- data/ext/v8/upstream/2.3.3/src/assembler.cc +0 -801
- data/ext/v8/upstream/2.3.3/src/assembler.h +0 -573
- data/ext/v8/upstream/2.3.3/src/ast-inl.h +0 -81
- data/ext/v8/upstream/2.3.3/src/ast.cc +0 -1152
- data/ext/v8/upstream/2.3.3/src/ast.h +0 -2106
- data/ext/v8/upstream/2.3.3/src/bootstrapper.cc +0 -1819
- data/ext/v8/upstream/2.3.3/src/builtins.cc +0 -1529
- data/ext/v8/upstream/2.3.3/src/builtins.h +0 -263
- data/ext/v8/upstream/2.3.3/src/bytecodes-irregexp.h +0 -104
- data/ext/v8/upstream/2.3.3/src/cached-powers.h +0 -119
- data/ext/v8/upstream/2.3.3/src/char-predicates-inl.h +0 -86
- data/ext/v8/upstream/2.3.3/src/checks.cc +0 -100
- data/ext/v8/upstream/2.3.3/src/checks.h +0 -310
- data/ext/v8/upstream/2.3.3/src/circular-queue.cc +0 -121
- data/ext/v8/upstream/2.3.3/src/code-stubs.cc +0 -177
- data/ext/v8/upstream/2.3.3/src/code-stubs.h +0 -177
- data/ext/v8/upstream/2.3.3/src/codegen-inl.h +0 -60
- data/ext/v8/upstream/2.3.3/src/codegen.cc +0 -516
- data/ext/v8/upstream/2.3.3/src/codegen.h +0 -897
- data/ext/v8/upstream/2.3.3/src/compilation-cache.cc +0 -562
- data/ext/v8/upstream/2.3.3/src/compilation-cache.h +0 -102
- data/ext/v8/upstream/2.3.3/src/compiler.cc +0 -654
- data/ext/v8/upstream/2.3.3/src/compiler.h +0 -299
- data/ext/v8/upstream/2.3.3/src/contexts.cc +0 -256
- data/ext/v8/upstream/2.3.3/src/contexts.h +0 -342
- data/ext/v8/upstream/2.3.3/src/conversions.cc +0 -1119
- data/ext/v8/upstream/2.3.3/src/conversions.h +0 -123
- data/ext/v8/upstream/2.3.3/src/counters.h +0 -239
- data/ext/v8/upstream/2.3.3/src/cpu-profiler-inl.h +0 -100
- data/ext/v8/upstream/2.3.3/src/cpu-profiler.cc +0 -538
- data/ext/v8/upstream/2.3.3/src/cpu-profiler.h +0 -285
- data/ext/v8/upstream/2.3.3/src/d8-debug.cc +0 -356
- data/ext/v8/upstream/2.3.3/src/d8-debug.h +0 -155
- data/ext/v8/upstream/2.3.3/src/d8.cc +0 -783
- data/ext/v8/upstream/2.3.3/src/d8.h +0 -227
- data/ext/v8/upstream/2.3.3/src/d8.js +0 -1683
- data/ext/v8/upstream/2.3.3/src/data-flow.cc +0 -758
- data/ext/v8/upstream/2.3.3/src/data-flow.h +0 -278
- data/ext/v8/upstream/2.3.3/src/date.js +0 -1059
- data/ext/v8/upstream/2.3.3/src/dateparser-inl.h +0 -123
- data/ext/v8/upstream/2.3.3/src/dateparser.h +0 -244
- data/ext/v8/upstream/2.3.3/src/debug-agent.cc +0 -427
- data/ext/v8/upstream/2.3.3/src/debug-agent.h +0 -129
- data/ext/v8/upstream/2.3.3/src/debug-debugger.js +0 -2227
- data/ext/v8/upstream/2.3.3/src/debug.cc +0 -3005
- data/ext/v8/upstream/2.3.3/src/debug.h +0 -993
- data/ext/v8/upstream/2.3.3/src/disassembler.cc +0 -312
- data/ext/v8/upstream/2.3.3/src/double.h +0 -169
- data/ext/v8/upstream/2.3.3/src/dtoa-config.c +0 -92
- data/ext/v8/upstream/2.3.3/src/dtoa.cc +0 -77
- data/ext/v8/upstream/2.3.3/src/dtoa.h +0 -81
- data/ext/v8/upstream/2.3.3/src/execution.cc +0 -809
- data/ext/v8/upstream/2.3.3/src/execution.h +0 -336
- data/ext/v8/upstream/2.3.3/src/factory.cc +0 -1003
- data/ext/v8/upstream/2.3.3/src/factory.h +0 -410
- data/ext/v8/upstream/2.3.3/src/fast-codegen.cc +0 -746
- data/ext/v8/upstream/2.3.3/src/fast-codegen.h +0 -161
- data/ext/v8/upstream/2.3.3/src/fast-dtoa.cc +0 -505
- data/ext/v8/upstream/2.3.3/src/fast-dtoa.h +0 -58
- data/ext/v8/upstream/2.3.3/src/flag-definitions.h +0 -455
- data/ext/v8/upstream/2.3.3/src/flags.cc +0 -551
- data/ext/v8/upstream/2.3.3/src/flags.h +0 -81
- data/ext/v8/upstream/2.3.3/src/flow-graph.cc +0 -763
- data/ext/v8/upstream/2.3.3/src/flow-graph.h +0 -180
- data/ext/v8/upstream/2.3.3/src/frame-element.h +0 -273
- data/ext/v8/upstream/2.3.3/src/frames-inl.h +0 -217
- data/ext/v8/upstream/2.3.3/src/frames.cc +0 -826
- data/ext/v8/upstream/2.3.3/src/frames.h +0 -682
- data/ext/v8/upstream/2.3.3/src/full-codegen.cc +0 -1443
- data/ext/v8/upstream/2.3.3/src/full-codegen.h +0 -548
- data/ext/v8/upstream/2.3.3/src/func-name-inferrer.cc +0 -76
- data/ext/v8/upstream/2.3.3/src/func-name-inferrer.h +0 -135
- data/ext/v8/upstream/2.3.3/src/global-handles.cc +0 -520
- data/ext/v8/upstream/2.3.3/src/global-handles.h +0 -180
- data/ext/v8/upstream/2.3.3/src/globals.h +0 -669
- data/ext/v8/upstream/2.3.3/src/handles-inl.h +0 -76
- data/ext/v8/upstream/2.3.3/src/handles.cc +0 -825
- data/ext/v8/upstream/2.3.3/src/handles.h +0 -393
- data/ext/v8/upstream/2.3.3/src/hashmap.cc +0 -226
- data/ext/v8/upstream/2.3.3/src/hashmap.h +0 -120
- data/ext/v8/upstream/2.3.3/src/heap-inl.h +0 -493
- data/ext/v8/upstream/2.3.3/src/heap-profiler.cc +0 -779
- data/ext/v8/upstream/2.3.3/src/heap-profiler.h +0 -323
- data/ext/v8/upstream/2.3.3/src/heap.cc +0 -4994
- data/ext/v8/upstream/2.3.3/src/heap.h +0 -1984
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32-inl.h +0 -360
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.cc +0 -2600
- data/ext/v8/upstream/2.3.3/src/ia32/assembler-ia32.h +0 -969
- data/ext/v8/upstream/2.3.3/src/ia32/builtins-ia32.cc +0 -1261
- data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.cc +0 -13968
- data/ext/v8/upstream/2.3.3/src/ia32/codegen-ia32.h +0 -1097
- data/ext/v8/upstream/2.3.3/src/ia32/cpu-ia32.cc +0 -83
- data/ext/v8/upstream/2.3.3/src/ia32/debug-ia32.cc +0 -309
- data/ext/v8/upstream/2.3.3/src/ia32/disasm-ia32.cc +0 -1471
- data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.cc +0 -954
- data/ext/v8/upstream/2.3.3/src/ia32/fast-codegen-ia32.h +0 -155
- data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.cc +0 -115
- data/ext/v8/upstream/2.3.3/src/ia32/frames-ia32.h +0 -135
- data/ext/v8/upstream/2.3.3/src/ia32/full-codegen-ia32.cc +0 -3281
- data/ext/v8/upstream/2.3.3/src/ia32/ic-ia32.cc +0 -1966
- data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.cc +0 -1610
- data/ext/v8/upstream/2.3.3/src/ia32/macro-assembler-ia32.h +0 -610
- data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.cc +0 -1247
- data/ext/v8/upstream/2.3.3/src/ia32/regexp-macro-assembler-ia32.h +0 -214
- data/ext/v8/upstream/2.3.3/src/ia32/simulator-ia32.h +0 -62
- data/ext/v8/upstream/2.3.3/src/ia32/stub-cache-ia32.cc +0 -2750
- data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.cc +0 -1334
- data/ext/v8/upstream/2.3.3/src/ia32/virtual-frame-ia32.h +0 -627
- data/ext/v8/upstream/2.3.3/src/ic-inl.h +0 -120
- data/ext/v8/upstream/2.3.3/src/ic.cc +0 -1827
- data/ext/v8/upstream/2.3.3/src/ic.h +0 -515
- data/ext/v8/upstream/2.3.3/src/interpreter-irregexp.cc +0 -646
- data/ext/v8/upstream/2.3.3/src/json.js +0 -268
- data/ext/v8/upstream/2.3.3/src/jsregexp.cc +0 -5283
- data/ext/v8/upstream/2.3.3/src/jsregexp.h +0 -1463
- data/ext/v8/upstream/2.3.3/src/jump-target-heavy.cc +0 -429
- data/ext/v8/upstream/2.3.3/src/jump-target-heavy.h +0 -244
- data/ext/v8/upstream/2.3.3/src/jump-target-light.cc +0 -110
- data/ext/v8/upstream/2.3.3/src/jump-target-light.h +0 -192
- data/ext/v8/upstream/2.3.3/src/list-inl.h +0 -166
- data/ext/v8/upstream/2.3.3/src/list.h +0 -159
- data/ext/v8/upstream/2.3.3/src/liveedit-debugger.js +0 -1057
- data/ext/v8/upstream/2.3.3/src/liveedit.cc +0 -1480
- data/ext/v8/upstream/2.3.3/src/liveedit.h +0 -170
- data/ext/v8/upstream/2.3.3/src/log-utils.cc +0 -497
- data/ext/v8/upstream/2.3.3/src/log-utils.h +0 -289
- data/ext/v8/upstream/2.3.3/src/log.cc +0 -1561
- data/ext/v8/upstream/2.3.3/src/log.h +0 -384
- data/ext/v8/upstream/2.3.3/src/macro-assembler.h +0 -86
- data/ext/v8/upstream/2.3.3/src/macros.py +0 -177
- data/ext/v8/upstream/2.3.3/src/mark-compact.cc +0 -2330
- data/ext/v8/upstream/2.3.3/src/mark-compact.h +0 -451
- data/ext/v8/upstream/2.3.3/src/math.js +0 -264
- data/ext/v8/upstream/2.3.3/src/memory.h +0 -74
- data/ext/v8/upstream/2.3.3/src/messages.cc +0 -183
- data/ext/v8/upstream/2.3.3/src/messages.h +0 -113
- data/ext/v8/upstream/2.3.3/src/messages.js +0 -982
- data/ext/v8/upstream/2.3.3/src/mips/assembler-mips.h +0 -668
- data/ext/v8/upstream/2.3.3/src/mips/builtins-mips.cc +0 -205
- data/ext/v8/upstream/2.3.3/src/mips/codegen-mips.h +0 -434
- data/ext/v8/upstream/2.3.3/src/mips/debug-mips.cc +0 -131
- data/ext/v8/upstream/2.3.3/src/mips/frames-mips.cc +0 -102
- data/ext/v8/upstream/2.3.3/src/mips/ic-mips.cc +0 -220
- data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.cc +0 -1651
- data/ext/v8/upstream/2.3.3/src/mips/simulator-mips.h +0 -311
- data/ext/v8/upstream/2.3.3/src/mips/stub-cache-mips.cc +0 -403
- data/ext/v8/upstream/2.3.3/src/mirror-debugger.js +0 -2380
- data/ext/v8/upstream/2.3.3/src/objects-debug.cc +0 -1366
- data/ext/v8/upstream/2.3.3/src/objects-inl.h +0 -3333
- data/ext/v8/upstream/2.3.3/src/objects.cc +0 -8820
- data/ext/v8/upstream/2.3.3/src/objects.h +0 -5373
- data/ext/v8/upstream/2.3.3/src/oprofile-agent.cc +0 -108
- data/ext/v8/upstream/2.3.3/src/oprofile-agent.h +0 -77
- data/ext/v8/upstream/2.3.3/src/parser.cc +0 -5207
- data/ext/v8/upstream/2.3.3/src/parser.h +0 -197
- data/ext/v8/upstream/2.3.3/src/platform-freebsd.cc +0 -667
- data/ext/v8/upstream/2.3.3/src/platform-linux.cc +0 -862
- data/ext/v8/upstream/2.3.3/src/platform-macos.cc +0 -665
- data/ext/v8/upstream/2.3.3/src/platform-nullos.cc +0 -454
- data/ext/v8/upstream/2.3.3/src/platform-openbsd.cc +0 -622
- data/ext/v8/upstream/2.3.3/src/platform-posix.cc +0 -362
- data/ext/v8/upstream/2.3.3/src/platform-solaris.cc +0 -653
- data/ext/v8/upstream/2.3.3/src/platform-win32.cc +0 -1911
- data/ext/v8/upstream/2.3.3/src/platform.h +0 -577
- data/ext/v8/upstream/2.3.3/src/powers-ten.h +0 -2461
- data/ext/v8/upstream/2.3.3/src/prettyprinter.cc +0 -1531
- data/ext/v8/upstream/2.3.3/src/prettyprinter.h +0 -221
- data/ext/v8/upstream/2.3.3/src/profile-generator-inl.h +0 -148
- data/ext/v8/upstream/2.3.3/src/profile-generator.cc +0 -1830
- data/ext/v8/upstream/2.3.3/src/profile-generator.h +0 -853
- data/ext/v8/upstream/2.3.3/src/property.cc +0 -96
- data/ext/v8/upstream/2.3.3/src/property.h +0 -315
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.cc +0 -464
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-irregexp.h +0 -141
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.cc +0 -356
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler-tracer.h +0 -103
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.cc +0 -261
- data/ext/v8/upstream/2.3.3/src/regexp-macro-assembler.h +0 -228
- data/ext/v8/upstream/2.3.3/src/regexp.js +0 -549
- data/ext/v8/upstream/2.3.3/src/rewriter.cc +0 -1038
- data/ext/v8/upstream/2.3.3/src/rewriter.h +0 -54
- data/ext/v8/upstream/2.3.3/src/runtime.cc +0 -10599
- data/ext/v8/upstream/2.3.3/src/runtime.h +0 -459
- data/ext/v8/upstream/2.3.3/src/runtime.js +0 -629
- data/ext/v8/upstream/2.3.3/src/scanner.cc +0 -1346
- data/ext/v8/upstream/2.3.3/src/scanner.h +0 -503
- data/ext/v8/upstream/2.3.3/src/scopeinfo.cc +0 -637
- data/ext/v8/upstream/2.3.3/src/scopeinfo.h +0 -233
- data/ext/v8/upstream/2.3.3/src/scopes.cc +0 -962
- data/ext/v8/upstream/2.3.3/src/scopes.h +0 -400
- data/ext/v8/upstream/2.3.3/src/serialize.cc +0 -1461
- data/ext/v8/upstream/2.3.3/src/serialize.h +0 -581
- data/ext/v8/upstream/2.3.3/src/spaces-inl.h +0 -483
- data/ext/v8/upstream/2.3.3/src/spaces.cc +0 -2901
- data/ext/v8/upstream/2.3.3/src/spaces.h +0 -2197
- data/ext/v8/upstream/2.3.3/src/string-stream.cc +0 -584
- data/ext/v8/upstream/2.3.3/src/string-stream.h +0 -189
- data/ext/v8/upstream/2.3.3/src/string.js +0 -1006
- data/ext/v8/upstream/2.3.3/src/stub-cache.cc +0 -1379
- data/ext/v8/upstream/2.3.3/src/stub-cache.h +0 -756
- data/ext/v8/upstream/2.3.3/src/third_party/dtoa/COPYING +0 -15
- data/ext/v8/upstream/2.3.3/src/third_party/dtoa/dtoa.c +0 -3334
- data/ext/v8/upstream/2.3.3/src/token.cc +0 -56
- data/ext/v8/upstream/2.3.3/src/token.h +0 -270
- data/ext/v8/upstream/2.3.3/src/top.cc +0 -1067
- data/ext/v8/upstream/2.3.3/src/top.h +0 -463
- data/ext/v8/upstream/2.3.3/src/type-info.cc +0 -53
- data/ext/v8/upstream/2.3.3/src/type-info.h +0 -244
- data/ext/v8/upstream/2.3.3/src/unicode-inl.h +0 -238
- data/ext/v8/upstream/2.3.3/src/unicode.cc +0 -749
- data/ext/v8/upstream/2.3.3/src/unicode.h +0 -279
- data/ext/v8/upstream/2.3.3/src/uri.js +0 -415
- data/ext/v8/upstream/2.3.3/src/utils.cc +0 -285
- data/ext/v8/upstream/2.3.3/src/utils.h +0 -745
- data/ext/v8/upstream/2.3.3/src/v8-counters.h +0 -250
- data/ext/v8/upstream/2.3.3/src/v8.cc +0 -228
- data/ext/v8/upstream/2.3.3/src/v8.h +0 -121
- data/ext/v8/upstream/2.3.3/src/v8natives.js +0 -1188
- data/ext/v8/upstream/2.3.3/src/v8threads.cc +0 -461
- data/ext/v8/upstream/2.3.3/src/v8threads.h +0 -159
- data/ext/v8/upstream/2.3.3/src/variables.cc +0 -119
- data/ext/v8/upstream/2.3.3/src/variables.h +0 -205
- data/ext/v8/upstream/2.3.3/src/version.cc +0 -88
- data/ext/v8/upstream/2.3.3/src/virtual-frame-heavy-inl.h +0 -192
- data/ext/v8/upstream/2.3.3/src/virtual-frame.h +0 -46
- data/ext/v8/upstream/2.3.3/src/vm-state-inl.h +0 -137
- data/ext/v8/upstream/2.3.3/src/vm-state.cc +0 -39
- data/ext/v8/upstream/2.3.3/src/vm-state.h +0 -77
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64-inl.h +0 -400
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.cc +0 -2963
- data/ext/v8/upstream/2.3.3/src/x64/assembler-x64.h +0 -1438
- data/ext/v8/upstream/2.3.3/src/x64/builtins-x64.cc +0 -1296
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64-inl.h +0 -46
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.cc +0 -12491
- data/ext/v8/upstream/2.3.3/src/x64/codegen-x64.h +0 -1090
- data/ext/v8/upstream/2.3.3/src/x64/cpu-x64.cc +0 -83
- data/ext/v8/upstream/2.3.3/src/x64/debug-x64.cc +0 -267
- data/ext/v8/upstream/2.3.3/src/x64/disasm-x64.cc +0 -1696
- data/ext/v8/upstream/2.3.3/src/x64/fast-codegen-x64.cc +0 -250
- data/ext/v8/upstream/2.3.3/src/x64/frames-x64.cc +0 -113
- data/ext/v8/upstream/2.3.3/src/x64/frames-x64.h +0 -125
- data/ext/v8/upstream/2.3.3/src/x64/full-codegen-x64.cc +0 -3270
- data/ext/v8/upstream/2.3.3/src/x64/ic-x64.cc +0 -1907
- data/ext/v8/upstream/2.3.3/src/x64/jump-target-x64.cc +0 -437
- data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.cc +0 -2793
- data/ext/v8/upstream/2.3.3/src/x64/macro-assembler-x64.h +0 -916
- data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.cc +0 -1374
- data/ext/v8/upstream/2.3.3/src/x64/regexp-macro-assembler-x64.h +0 -277
- data/ext/v8/upstream/2.3.3/src/x64/simulator-x64.h +0 -63
- data/ext/v8/upstream/2.3.3/src/x64/stub-cache-x64.cc +0 -2560
- data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.cc +0 -1264
- data/ext/v8/upstream/2.3.3/src/x64/virtual-frame-x64.h +0 -590
- data/ext/v8/upstream/2.3.3/src/zone-inl.h +0 -82
- data/ext/v8/upstream/2.3.3/src/zone.cc +0 -194
- data/ext/v8/upstream/2.3.3/src/zone.h +0 -221
- data/ext/v8/upstream/2.3.3/tools/codemap.js +0 -270
- data/ext/v8/upstream/2.3.3/tools/csvparser.js +0 -83
- data/ext/v8/upstream/2.3.3/tools/gc-nvp-trace-processor.py +0 -317
- data/ext/v8/upstream/2.3.3/tools/gyp/v8.gyp +0 -749
- data/ext/v8/upstream/2.3.3/tools/linux-tick-processor.py +0 -78
- data/ext/v8/upstream/2.3.3/tools/logreader.js +0 -338
- data/ext/v8/upstream/2.3.3/tools/oprofile/annotate +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/common +0 -19
- data/ext/v8/upstream/2.3.3/tools/oprofile/dump +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/report +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/reset +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/run +0 -14
- data/ext/v8/upstream/2.3.3/tools/oprofile/shutdown +0 -7
- data/ext/v8/upstream/2.3.3/tools/oprofile/start +0 -7
- data/ext/v8/upstream/2.3.3/tools/presubmit.py +0 -299
- data/ext/v8/upstream/2.3.3/tools/profile.js +0 -691
- data/ext/v8/upstream/2.3.3/tools/profile_view.js +0 -224
- data/ext/v8/upstream/2.3.3/tools/splaytree.js +0 -322
- data/ext/v8/upstream/2.3.3/tools/splaytree.py +0 -226
- data/ext/v8/upstream/2.3.3/tools/tickprocessor.js +0 -862
- data/ext/v8/upstream/2.3.3/tools/tickprocessor.py +0 -571
- data/ext/v8/upstream/2.3.3/tools/utils.py +0 -88
- data/ext/v8/upstream/2.3.3/tools/visual_studio/README.txt +0 -71
- data/ext/v8/upstream/2.3.3/tools/visual_studio/common.vsprops +0 -34
- data/ext/v8/upstream/2.3.3/tools/visual_studio/debug.vsprops +0 -17
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base.vcproj +0 -1143
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_arm.vcproj +0 -1115
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_base_x64.vcproj +0 -1096
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample.vcproj +0 -145
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_arm.vcproj +0 -145
- data/ext/v8/upstream/2.3.3/tools/visual_studio/v8_shell_sample_x64.vcproj +0 -161
- data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.bat +0 -29
- data/ext/v8/upstream/2.3.3/tools/windows-tick-processor.py +0 -137
@@ -0,0 +1,215 @@
|
|
1
|
+
// Copyright 2008-2009 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_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_
|
29
|
+
#define V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_
|
30
|
+
|
31
|
+
namespace v8 {
|
32
|
+
namespace internal {
|
33
|
+
|
34
|
+
#ifdef V8_INTERPRETED_REGEXP
|
35
|
+
class RegExpMacroAssemblerIA32: public RegExpMacroAssembler {
|
36
|
+
public:
|
37
|
+
RegExpMacroAssemblerIA32() { }
|
38
|
+
virtual ~RegExpMacroAssemblerIA32() { }
|
39
|
+
};
|
40
|
+
|
41
|
+
#else // V8_INTERPRETED_REGEXP
|
42
|
+
class RegExpMacroAssemblerIA32: public NativeRegExpMacroAssembler {
|
43
|
+
public:
|
44
|
+
RegExpMacroAssemblerIA32(Mode mode, int registers_to_save);
|
45
|
+
virtual ~RegExpMacroAssemblerIA32();
|
46
|
+
virtual int stack_limit_slack();
|
47
|
+
virtual void AdvanceCurrentPosition(int by);
|
48
|
+
virtual void AdvanceRegister(int reg, int by);
|
49
|
+
virtual void Backtrack();
|
50
|
+
virtual void Bind(Label* label);
|
51
|
+
virtual void CheckAtStart(Label* on_at_start);
|
52
|
+
virtual void CheckCharacter(uint32_t c, Label* on_equal);
|
53
|
+
virtual void CheckCharacterAfterAnd(uint32_t c,
|
54
|
+
uint32_t mask,
|
55
|
+
Label* on_equal);
|
56
|
+
virtual void CheckCharacterGT(uc16 limit, Label* on_greater);
|
57
|
+
virtual void CheckCharacterLT(uc16 limit, Label* on_less);
|
58
|
+
virtual void CheckCharacters(Vector<const uc16> str,
|
59
|
+
int cp_offset,
|
60
|
+
Label* on_failure,
|
61
|
+
bool check_end_of_string);
|
62
|
+
// A "greedy loop" is a loop that is both greedy and with a simple
|
63
|
+
// body. It has a particularly simple implementation.
|
64
|
+
virtual void CheckGreedyLoop(Label* on_tos_equals_current_position);
|
65
|
+
virtual void CheckNotAtStart(Label* on_not_at_start);
|
66
|
+
virtual void CheckNotBackReference(int start_reg, Label* on_no_match);
|
67
|
+
virtual void CheckNotBackReferenceIgnoreCase(int start_reg,
|
68
|
+
Label* on_no_match);
|
69
|
+
virtual void CheckNotRegistersEqual(int reg1, int reg2, Label* on_not_equal);
|
70
|
+
virtual void CheckNotCharacter(uint32_t c, Label* on_not_equal);
|
71
|
+
virtual void CheckNotCharacterAfterAnd(uint32_t c,
|
72
|
+
uint32_t mask,
|
73
|
+
Label* on_not_equal);
|
74
|
+
virtual void CheckNotCharacterAfterMinusAnd(uc16 c,
|
75
|
+
uc16 minus,
|
76
|
+
uc16 mask,
|
77
|
+
Label* on_not_equal);
|
78
|
+
// Checks whether the given offset from the current position is before
|
79
|
+
// the end of the string.
|
80
|
+
virtual void CheckPosition(int cp_offset, Label* on_outside_input);
|
81
|
+
virtual bool CheckSpecialCharacterClass(uc16 type, Label* on_no_match);
|
82
|
+
virtual void Fail();
|
83
|
+
virtual Handle<Object> GetCode(Handle<String> source);
|
84
|
+
virtual void GoTo(Label* label);
|
85
|
+
virtual void IfRegisterGE(int reg, int comparand, Label* if_ge);
|
86
|
+
virtual void IfRegisterLT(int reg, int comparand, Label* if_lt);
|
87
|
+
virtual void IfRegisterEqPos(int reg, Label* if_eq);
|
88
|
+
virtual IrregexpImplementation Implementation();
|
89
|
+
virtual void LoadCurrentCharacter(int cp_offset,
|
90
|
+
Label* on_end_of_input,
|
91
|
+
bool check_bounds = true,
|
92
|
+
int characters = 1);
|
93
|
+
virtual void PopCurrentPosition();
|
94
|
+
virtual void PopRegister(int register_index);
|
95
|
+
virtual void PushBacktrack(Label* label);
|
96
|
+
virtual void PushCurrentPosition();
|
97
|
+
virtual void PushRegister(int register_index,
|
98
|
+
StackCheckFlag check_stack_limit);
|
99
|
+
virtual void ReadCurrentPositionFromRegister(int reg);
|
100
|
+
virtual void ReadStackPointerFromRegister(int reg);
|
101
|
+
virtual void SetCurrentPositionFromEnd(int by);
|
102
|
+
virtual void SetRegister(int register_index, int to);
|
103
|
+
virtual void Succeed();
|
104
|
+
virtual void WriteCurrentPositionToRegister(int reg, int cp_offset);
|
105
|
+
virtual void ClearRegisters(int reg_from, int reg_to);
|
106
|
+
virtual void WriteStackPointerToRegister(int reg);
|
107
|
+
|
108
|
+
// Called from RegExp if the stack-guard is triggered.
|
109
|
+
// If the code object is relocated, the return address is fixed before
|
110
|
+
// returning.
|
111
|
+
static int CheckStackGuardState(Address* return_address,
|
112
|
+
Code* re_code,
|
113
|
+
Address re_frame);
|
114
|
+
|
115
|
+
private:
|
116
|
+
// Offsets from ebp of function parameters and stored registers.
|
117
|
+
static const int kFramePointer = 0;
|
118
|
+
// Above the frame pointer - function parameters and return address.
|
119
|
+
static const int kReturn_eip = kFramePointer + kPointerSize;
|
120
|
+
static const int kFrameAlign = kReturn_eip + kPointerSize;
|
121
|
+
// Parameters.
|
122
|
+
static const int kInputString = kFrameAlign;
|
123
|
+
static const int kStartIndex = kInputString + kPointerSize;
|
124
|
+
static const int kInputStart = kStartIndex + kPointerSize;
|
125
|
+
static const int kInputEnd = kInputStart + kPointerSize;
|
126
|
+
static const int kRegisterOutput = kInputEnd + kPointerSize;
|
127
|
+
static const int kStackHighEnd = kRegisterOutput + kPointerSize;
|
128
|
+
static const int kDirectCall = kStackHighEnd + kPointerSize;
|
129
|
+
// Below the frame pointer - local stack variables.
|
130
|
+
// When adding local variables remember to push space for them in
|
131
|
+
// the frame in GetCode.
|
132
|
+
static const int kBackup_esi = kFramePointer - kPointerSize;
|
133
|
+
static const int kBackup_edi = kBackup_esi - kPointerSize;
|
134
|
+
static const int kBackup_ebx = kBackup_edi - kPointerSize;
|
135
|
+
static const int kInputStartMinusOne = kBackup_ebx - kPointerSize;
|
136
|
+
// First register address. Following registers are below it on the stack.
|
137
|
+
static const int kRegisterZero = kInputStartMinusOne - kPointerSize;
|
138
|
+
|
139
|
+
// Initial size of code buffer.
|
140
|
+
static const size_t kRegExpCodeSize = 1024;
|
141
|
+
|
142
|
+
// Load a number of characters at the given offset from the
|
143
|
+
// current position, into the current-character register.
|
144
|
+
void LoadCurrentCharacterUnchecked(int cp_offset, int character_count);
|
145
|
+
|
146
|
+
// Check whether preemption has been requested.
|
147
|
+
void CheckPreemption();
|
148
|
+
|
149
|
+
// Check whether we are exceeding the stack limit on the backtrack stack.
|
150
|
+
void CheckStackLimit();
|
151
|
+
|
152
|
+
// Generate a call to CheckStackGuardState.
|
153
|
+
void CallCheckStackGuardState(Register scratch);
|
154
|
+
|
155
|
+
// The ebp-relative location of a regexp register.
|
156
|
+
Operand register_location(int register_index);
|
157
|
+
|
158
|
+
// The register containing the current character after LoadCurrentCharacter.
|
159
|
+
inline Register current_character() { return edx; }
|
160
|
+
|
161
|
+
// The register containing the backtrack stack top. Provides a meaningful
|
162
|
+
// name to the register.
|
163
|
+
inline Register backtrack_stackpointer() { return ecx; }
|
164
|
+
|
165
|
+
// Byte size of chars in the string to match (decided by the Mode argument)
|
166
|
+
inline int char_size() { return static_cast<int>(mode_); }
|
167
|
+
|
168
|
+
// Equivalent to a conditional branch to the label, unless the label
|
169
|
+
// is NULL, in which case it is a conditional Backtrack.
|
170
|
+
void BranchOrBacktrack(Condition condition, Label* to, Hint hint = no_hint);
|
171
|
+
|
172
|
+
// Call and return internally in the generated code in a way that
|
173
|
+
// is GC-safe (i.e., doesn't leave absolute code addresses on the stack)
|
174
|
+
inline void SafeCall(Label* to);
|
175
|
+
inline void SafeReturn();
|
176
|
+
inline void SafeCallTarget(Label* name);
|
177
|
+
|
178
|
+
// Pushes the value of a register on the backtrack stack. Decrements the
|
179
|
+
// stack pointer (ecx) by a word size and stores the register's value there.
|
180
|
+
inline void Push(Register source);
|
181
|
+
|
182
|
+
// Pushes a value on the backtrack stack. Decrements the stack pointer (ecx)
|
183
|
+
// by a word size and stores the value there.
|
184
|
+
inline void Push(Immediate value);
|
185
|
+
|
186
|
+
// Pops a value from the backtrack stack. Reads the word at the stack pointer
|
187
|
+
// (ecx) and increments it by a word size.
|
188
|
+
inline void Pop(Register target);
|
189
|
+
|
190
|
+
MacroAssembler* masm_;
|
191
|
+
|
192
|
+
// Which mode to generate code for (ASCII or UC16).
|
193
|
+
Mode mode_;
|
194
|
+
|
195
|
+
// One greater than maximal register index actually used.
|
196
|
+
int num_registers_;
|
197
|
+
|
198
|
+
// Number of registers to output at the end (the saved registers
|
199
|
+
// are always 0..num_saved_registers_-1)
|
200
|
+
int num_saved_registers_;
|
201
|
+
|
202
|
+
// Labels used internally.
|
203
|
+
Label entry_label_;
|
204
|
+
Label start_label_;
|
205
|
+
Label success_label_;
|
206
|
+
Label backtrack_label_;
|
207
|
+
Label exit_label_;
|
208
|
+
Label check_preempt_label_;
|
209
|
+
Label stack_overflow_label_;
|
210
|
+
};
|
211
|
+
#endif // V8_INTERPRETED_REGEXP
|
212
|
+
|
213
|
+
}} // namespace v8::internal
|
214
|
+
|
215
|
+
#endif // V8_IA32_REGEXP_MACRO_ASSEMBLER_IA32_H_
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,72 @@
|
|
1
|
+
// Copyright 2008 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_IA32_SIMULATOR_IA32_H_
|
29
|
+
#define V8_IA32_SIMULATOR_IA32_H_
|
30
|
+
|
31
|
+
#include "allocation.h"
|
32
|
+
|
33
|
+
namespace v8 {
|
34
|
+
namespace internal {
|
35
|
+
|
36
|
+
// Since there is no simulator for the ia32 architecture the only thing we can
|
37
|
+
// do is to call the entry directly.
|
38
|
+
#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
|
39
|
+
(entry(p0, p1, p2, p3, p4))
|
40
|
+
|
41
|
+
|
42
|
+
typedef int (*regexp_matcher)(String*, int, const byte*,
|
43
|
+
const byte*, int*, Address, int);
|
44
|
+
|
45
|
+
// Call the generated regexp code directly. The code at the entry address should
|
46
|
+
// expect seven int/pointer sized arguments and return an int.
|
47
|
+
#define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6) \
|
48
|
+
(FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6))
|
49
|
+
|
50
|
+
|
51
|
+
#define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
|
52
|
+
(reinterpret_cast<TryCatch*>(try_catch_address))
|
53
|
+
|
54
|
+
// The stack limit beyond which we will throw stack overflow errors in
|
55
|
+
// generated code. Because generated code on ia32 uses the C stack, we
|
56
|
+
// just use the C stack limit.
|
57
|
+
class SimulatorStack : public v8::internal::AllStatic {
|
58
|
+
public:
|
59
|
+
static inline uintptr_t JsLimitFromCLimit(uintptr_t c_limit) {
|
60
|
+
return c_limit;
|
61
|
+
}
|
62
|
+
|
63
|
+
static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
|
64
|
+
return try_catch_address;
|
65
|
+
}
|
66
|
+
|
67
|
+
static inline void UnregisterCTryCatch() { }
|
68
|
+
};
|
69
|
+
|
70
|
+
} } // namespace v8::internal
|
71
|
+
|
72
|
+
#endif // V8_IA32_SIMULATOR_IA32_H_
|
@@ -0,0 +1,3732 @@
|
|
1
|
+
// Copyright 2006-2009 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 "ic-inl.h"
|
33
|
+
#include "codegen-inl.h"
|
34
|
+
#include "stub-cache.h"
|
35
|
+
|
36
|
+
namespace v8 {
|
37
|
+
namespace internal {
|
38
|
+
|
39
|
+
#define __ ACCESS_MASM(masm)
|
40
|
+
|
41
|
+
|
42
|
+
static void ProbeTable(MacroAssembler* masm,
|
43
|
+
Code::Flags flags,
|
44
|
+
StubCache::Table table,
|
45
|
+
Register name,
|
46
|
+
Register offset,
|
47
|
+
Register extra) {
|
48
|
+
ExternalReference key_offset(SCTableReference::keyReference(table));
|
49
|
+
ExternalReference value_offset(SCTableReference::valueReference(table));
|
50
|
+
|
51
|
+
Label miss;
|
52
|
+
|
53
|
+
if (extra.is_valid()) {
|
54
|
+
// Get the code entry from the cache.
|
55
|
+
__ mov(extra, Operand::StaticArray(offset, times_2, value_offset));
|
56
|
+
|
57
|
+
// Check that the key in the entry matches the name.
|
58
|
+
__ cmp(name, Operand::StaticArray(offset, times_2, key_offset));
|
59
|
+
__ j(not_equal, &miss, not_taken);
|
60
|
+
|
61
|
+
// Check that the flags match what we're looking for.
|
62
|
+
__ mov(offset, FieldOperand(extra, Code::kFlagsOffset));
|
63
|
+
__ and_(offset, ~Code::kFlagsNotUsedInLookup);
|
64
|
+
__ cmp(offset, flags);
|
65
|
+
__ j(not_equal, &miss);
|
66
|
+
|
67
|
+
// Jump to the first instruction in the code stub.
|
68
|
+
__ add(Operand(extra), Immediate(Code::kHeaderSize - kHeapObjectTag));
|
69
|
+
__ jmp(Operand(extra));
|
70
|
+
|
71
|
+
__ bind(&miss);
|
72
|
+
} else {
|
73
|
+
// Save the offset on the stack.
|
74
|
+
__ push(offset);
|
75
|
+
|
76
|
+
// Check that the key in the entry matches the name.
|
77
|
+
__ cmp(name, Operand::StaticArray(offset, times_2, key_offset));
|
78
|
+
__ j(not_equal, &miss, not_taken);
|
79
|
+
|
80
|
+
// Get the code entry from the cache.
|
81
|
+
__ mov(offset, Operand::StaticArray(offset, times_2, value_offset));
|
82
|
+
|
83
|
+
// Check that the flags match what we're looking for.
|
84
|
+
__ mov(offset, FieldOperand(offset, Code::kFlagsOffset));
|
85
|
+
__ and_(offset, ~Code::kFlagsNotUsedInLookup);
|
86
|
+
__ cmp(offset, flags);
|
87
|
+
__ j(not_equal, &miss);
|
88
|
+
|
89
|
+
// Restore offset and re-load code entry from cache.
|
90
|
+
__ pop(offset);
|
91
|
+
__ mov(offset, Operand::StaticArray(offset, times_2, value_offset));
|
92
|
+
|
93
|
+
// Jump to the first instruction in the code stub.
|
94
|
+
__ add(Operand(offset), Immediate(Code::kHeaderSize - kHeapObjectTag));
|
95
|
+
__ jmp(Operand(offset));
|
96
|
+
|
97
|
+
// Pop at miss.
|
98
|
+
__ bind(&miss);
|
99
|
+
__ pop(offset);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
|
104
|
+
// Helper function used to check that the dictionary doesn't contain
|
105
|
+
// the property. This function may return false negatives, so miss_label
|
106
|
+
// must always call a backup property check that is complete.
|
107
|
+
// This function is safe to call if the receiver has fast properties.
|
108
|
+
// Name must be a symbol and receiver must be a heap object.
|
109
|
+
static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
|
110
|
+
Label* miss_label,
|
111
|
+
Register receiver,
|
112
|
+
String* name,
|
113
|
+
Register r0,
|
114
|
+
Register r1) {
|
115
|
+
ASSERT(name->IsSymbol());
|
116
|
+
__ IncrementCounter(&Counters::negative_lookups, 1);
|
117
|
+
__ IncrementCounter(&Counters::negative_lookups_miss, 1);
|
118
|
+
|
119
|
+
Label done;
|
120
|
+
__ mov(r0, FieldOperand(receiver, HeapObject::kMapOffset));
|
121
|
+
|
122
|
+
const int kInterceptorOrAccessCheckNeededMask =
|
123
|
+
(1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
|
124
|
+
|
125
|
+
// Bail out if the receiver has a named interceptor or requires access checks.
|
126
|
+
__ test_b(FieldOperand(r0, Map::kBitFieldOffset),
|
127
|
+
kInterceptorOrAccessCheckNeededMask);
|
128
|
+
__ j(not_zero, miss_label, not_taken);
|
129
|
+
|
130
|
+
// Check that receiver is a JSObject.
|
131
|
+
__ CmpInstanceType(r0, FIRST_JS_OBJECT_TYPE);
|
132
|
+
__ j(below, miss_label, not_taken);
|
133
|
+
|
134
|
+
// Load properties array.
|
135
|
+
Register properties = r0;
|
136
|
+
__ mov(properties, FieldOperand(receiver, JSObject::kPropertiesOffset));
|
137
|
+
|
138
|
+
// Check that the properties array is a dictionary.
|
139
|
+
__ cmp(FieldOperand(properties, HeapObject::kMapOffset),
|
140
|
+
Immediate(Factory::hash_table_map()));
|
141
|
+
__ j(not_equal, miss_label);
|
142
|
+
|
143
|
+
// Compute the capacity mask.
|
144
|
+
const int kCapacityOffset =
|
145
|
+
StringDictionary::kHeaderSize +
|
146
|
+
StringDictionary::kCapacityIndex * kPointerSize;
|
147
|
+
|
148
|
+
// Generate an unrolled loop that performs a few probes before
|
149
|
+
// giving up.
|
150
|
+
static const int kProbes = 4;
|
151
|
+
const int kElementsStartOffset =
|
152
|
+
StringDictionary::kHeaderSize +
|
153
|
+
StringDictionary::kElementsStartIndex * kPointerSize;
|
154
|
+
|
155
|
+
// If names of slots in range from 1 to kProbes - 1 for the hash value are
|
156
|
+
// not equal to the name and kProbes-th slot is not used (its name is the
|
157
|
+
// undefined value), it guarantees the hash table doesn't contain the
|
158
|
+
// property. It's true even if some slots represent deleted properties
|
159
|
+
// (their names are the null value).
|
160
|
+
for (int i = 0; i < kProbes; i++) {
|
161
|
+
// r0 points to properties hash.
|
162
|
+
// Compute the masked index: (hash + i + i * i) & mask.
|
163
|
+
Register index = r1;
|
164
|
+
// Capacity is smi 2^n.
|
165
|
+
__ mov(index, FieldOperand(properties, kCapacityOffset));
|
166
|
+
__ dec(index);
|
167
|
+
__ and_(Operand(index),
|
168
|
+
Immediate(Smi::FromInt(name->Hash() +
|
169
|
+
StringDictionary::GetProbeOffset(i))));
|
170
|
+
|
171
|
+
// Scale the index by multiplying by the entry size.
|
172
|
+
ASSERT(StringDictionary::kEntrySize == 3);
|
173
|
+
__ lea(index, Operand(index, index, times_2, 0)); // index *= 3.
|
174
|
+
|
175
|
+
Register entity_name = r1;
|
176
|
+
// Having undefined at this place means the name is not contained.
|
177
|
+
ASSERT_EQ(kSmiTagSize, 1);
|
178
|
+
__ mov(entity_name, Operand(properties, index, times_half_pointer_size,
|
179
|
+
kElementsStartOffset - kHeapObjectTag));
|
180
|
+
__ cmp(entity_name, Factory::undefined_value());
|
181
|
+
if (i != kProbes - 1) {
|
182
|
+
__ j(equal, &done, taken);
|
183
|
+
|
184
|
+
// Stop if found the property.
|
185
|
+
__ cmp(entity_name, Handle<String>(name));
|
186
|
+
__ j(equal, miss_label, not_taken);
|
187
|
+
|
188
|
+
// Check if the entry name is not a symbol.
|
189
|
+
__ mov(entity_name, FieldOperand(entity_name, HeapObject::kMapOffset));
|
190
|
+
__ test_b(FieldOperand(entity_name, Map::kInstanceTypeOffset),
|
191
|
+
kIsSymbolMask);
|
192
|
+
__ j(zero, miss_label, not_taken);
|
193
|
+
} else {
|
194
|
+
// Give up probing if still not found the undefined value.
|
195
|
+
__ j(not_equal, miss_label, not_taken);
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
__ bind(&done);
|
200
|
+
__ DecrementCounter(&Counters::negative_lookups_miss, 1);
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
void StubCache::GenerateProbe(MacroAssembler* masm,
|
205
|
+
Code::Flags flags,
|
206
|
+
Register receiver,
|
207
|
+
Register name,
|
208
|
+
Register scratch,
|
209
|
+
Register extra,
|
210
|
+
Register extra2) {
|
211
|
+
Label miss;
|
212
|
+
USE(extra2); // The register extra2 is not used on the ia32 platform.
|
213
|
+
|
214
|
+
// Make sure that code is valid. The shifting code relies on the
|
215
|
+
// entry size being 8.
|
216
|
+
ASSERT(sizeof(Entry) == 8);
|
217
|
+
|
218
|
+
// Make sure the flags does not name a specific type.
|
219
|
+
ASSERT(Code::ExtractTypeFromFlags(flags) == 0);
|
220
|
+
|
221
|
+
// Make sure that there are no register conflicts.
|
222
|
+
ASSERT(!scratch.is(receiver));
|
223
|
+
ASSERT(!scratch.is(name));
|
224
|
+
ASSERT(!extra.is(receiver));
|
225
|
+
ASSERT(!extra.is(name));
|
226
|
+
ASSERT(!extra.is(scratch));
|
227
|
+
|
228
|
+
// Check scratch and extra registers are valid, and extra2 is unused.
|
229
|
+
ASSERT(!scratch.is(no_reg));
|
230
|
+
ASSERT(extra2.is(no_reg));
|
231
|
+
|
232
|
+
// Check that the receiver isn't a smi.
|
233
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
234
|
+
__ j(zero, &miss, not_taken);
|
235
|
+
|
236
|
+
// Get the map of the receiver and compute the hash.
|
237
|
+
__ mov(scratch, FieldOperand(name, String::kHashFieldOffset));
|
238
|
+
__ add(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
|
239
|
+
__ xor_(scratch, flags);
|
240
|
+
__ and_(scratch, (kPrimaryTableSize - 1) << kHeapObjectTagSize);
|
241
|
+
|
242
|
+
// Probe the primary table.
|
243
|
+
ProbeTable(masm, flags, kPrimary, name, scratch, extra);
|
244
|
+
|
245
|
+
// Primary miss: Compute hash for secondary probe.
|
246
|
+
__ mov(scratch, FieldOperand(name, String::kHashFieldOffset));
|
247
|
+
__ add(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
|
248
|
+
__ xor_(scratch, flags);
|
249
|
+
__ and_(scratch, (kPrimaryTableSize - 1) << kHeapObjectTagSize);
|
250
|
+
__ sub(scratch, Operand(name));
|
251
|
+
__ add(Operand(scratch), Immediate(flags));
|
252
|
+
__ and_(scratch, (kSecondaryTableSize - 1) << kHeapObjectTagSize);
|
253
|
+
|
254
|
+
// Probe the secondary table.
|
255
|
+
ProbeTable(masm, flags, kSecondary, name, scratch, extra);
|
256
|
+
|
257
|
+
// Cache miss: Fall-through and let caller handle the miss by
|
258
|
+
// entering the runtime system.
|
259
|
+
__ bind(&miss);
|
260
|
+
}
|
261
|
+
|
262
|
+
|
263
|
+
void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm,
|
264
|
+
int index,
|
265
|
+
Register prototype) {
|
266
|
+
__ LoadGlobalFunction(index, prototype);
|
267
|
+
__ LoadGlobalFunctionInitialMap(prototype, prototype);
|
268
|
+
// Load the prototype from the initial map.
|
269
|
+
__ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
|
270
|
+
}
|
271
|
+
|
272
|
+
|
273
|
+
void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype(
|
274
|
+
MacroAssembler* masm, int index, Register prototype, Label* miss) {
|
275
|
+
// Check we're still in the same context.
|
276
|
+
__ cmp(Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX)),
|
277
|
+
Top::global());
|
278
|
+
__ j(not_equal, miss);
|
279
|
+
// Get the global function with the given index.
|
280
|
+
JSFunction* function = JSFunction::cast(Top::global_context()->get(index));
|
281
|
+
// Load its initial map. The global functions all have initial maps.
|
282
|
+
__ Set(prototype, Immediate(Handle<Map>(function->initial_map())));
|
283
|
+
// Load the prototype from the initial map.
|
284
|
+
__ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
|
285
|
+
}
|
286
|
+
|
287
|
+
|
288
|
+
void StubCompiler::GenerateLoadArrayLength(MacroAssembler* masm,
|
289
|
+
Register receiver,
|
290
|
+
Register scratch,
|
291
|
+
Label* miss_label) {
|
292
|
+
// Check that the receiver isn't a smi.
|
293
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
294
|
+
__ j(zero, miss_label, not_taken);
|
295
|
+
|
296
|
+
// Check that the object is a JS array.
|
297
|
+
__ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch);
|
298
|
+
__ j(not_equal, miss_label, not_taken);
|
299
|
+
|
300
|
+
// Load length directly from the JS array.
|
301
|
+
__ mov(eax, FieldOperand(receiver, JSArray::kLengthOffset));
|
302
|
+
__ ret(0);
|
303
|
+
}
|
304
|
+
|
305
|
+
|
306
|
+
// Generate code to check if an object is a string. If the object is
|
307
|
+
// a string, the map's instance type is left in the scratch register.
|
308
|
+
static void GenerateStringCheck(MacroAssembler* masm,
|
309
|
+
Register receiver,
|
310
|
+
Register scratch,
|
311
|
+
Label* smi,
|
312
|
+
Label* non_string_object) {
|
313
|
+
// Check that the object isn't a smi.
|
314
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
315
|
+
__ j(zero, smi, not_taken);
|
316
|
+
|
317
|
+
// Check that the object is a string.
|
318
|
+
__ mov(scratch, FieldOperand(receiver, HeapObject::kMapOffset));
|
319
|
+
__ movzx_b(scratch, FieldOperand(scratch, Map::kInstanceTypeOffset));
|
320
|
+
ASSERT(kNotStringTag != 0);
|
321
|
+
__ test(scratch, Immediate(kNotStringTag));
|
322
|
+
__ j(not_zero, non_string_object, not_taken);
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm,
|
327
|
+
Register receiver,
|
328
|
+
Register scratch1,
|
329
|
+
Register scratch2,
|
330
|
+
Label* miss,
|
331
|
+
bool support_wrappers) {
|
332
|
+
Label check_wrapper;
|
333
|
+
|
334
|
+
// Check if the object is a string leaving the instance type in the
|
335
|
+
// scratch register.
|
336
|
+
GenerateStringCheck(masm, receiver, scratch1, miss,
|
337
|
+
support_wrappers ? &check_wrapper : miss);
|
338
|
+
|
339
|
+
// Load length from the string and convert to a smi.
|
340
|
+
__ mov(eax, FieldOperand(receiver, String::kLengthOffset));
|
341
|
+
__ ret(0);
|
342
|
+
|
343
|
+
if (support_wrappers) {
|
344
|
+
// Check if the object is a JSValue wrapper.
|
345
|
+
__ bind(&check_wrapper);
|
346
|
+
__ cmp(scratch1, JS_VALUE_TYPE);
|
347
|
+
__ j(not_equal, miss, not_taken);
|
348
|
+
|
349
|
+
// Check if the wrapped value is a string and load the length
|
350
|
+
// directly if it is.
|
351
|
+
__ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset));
|
352
|
+
GenerateStringCheck(masm, scratch2, scratch1, miss, miss);
|
353
|
+
__ mov(eax, FieldOperand(scratch2, String::kLengthOffset));
|
354
|
+
__ ret(0);
|
355
|
+
}
|
356
|
+
}
|
357
|
+
|
358
|
+
|
359
|
+
void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
|
360
|
+
Register receiver,
|
361
|
+
Register scratch1,
|
362
|
+
Register scratch2,
|
363
|
+
Label* miss_label) {
|
364
|
+
__ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
|
365
|
+
__ mov(eax, Operand(scratch1));
|
366
|
+
__ ret(0);
|
367
|
+
}
|
368
|
+
|
369
|
+
|
370
|
+
// Load a fast property out of a holder object (src). In-object properties
|
371
|
+
// are loaded directly otherwise the property is loaded from the properties
|
372
|
+
// fixed array.
|
373
|
+
void StubCompiler::GenerateFastPropertyLoad(MacroAssembler* masm,
|
374
|
+
Register dst, Register src,
|
375
|
+
JSObject* holder, int index) {
|
376
|
+
// Adjust for the number of properties stored in the holder.
|
377
|
+
index -= holder->map()->inobject_properties();
|
378
|
+
if (index < 0) {
|
379
|
+
// Get the property straight out of the holder.
|
380
|
+
int offset = holder->map()->instance_size() + (index * kPointerSize);
|
381
|
+
__ mov(dst, FieldOperand(src, offset));
|
382
|
+
} else {
|
383
|
+
// Calculate the offset into the properties array.
|
384
|
+
int offset = index * kPointerSize + FixedArray::kHeaderSize;
|
385
|
+
__ mov(dst, FieldOperand(src, JSObject::kPropertiesOffset));
|
386
|
+
__ mov(dst, FieldOperand(dst, offset));
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
390
|
+
|
391
|
+
static void PushInterceptorArguments(MacroAssembler* masm,
|
392
|
+
Register receiver,
|
393
|
+
Register holder,
|
394
|
+
Register name,
|
395
|
+
JSObject* holder_obj) {
|
396
|
+
__ push(name);
|
397
|
+
InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor();
|
398
|
+
ASSERT(!Heap::InNewSpace(interceptor));
|
399
|
+
Register scratch = name;
|
400
|
+
__ mov(scratch, Immediate(Handle<Object>(interceptor)));
|
401
|
+
__ push(scratch);
|
402
|
+
__ push(receiver);
|
403
|
+
__ push(holder);
|
404
|
+
__ push(FieldOperand(scratch, InterceptorInfo::kDataOffset));
|
405
|
+
}
|
406
|
+
|
407
|
+
|
408
|
+
static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm,
|
409
|
+
Register receiver,
|
410
|
+
Register holder,
|
411
|
+
Register name,
|
412
|
+
JSObject* holder_obj) {
|
413
|
+
PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
|
414
|
+
__ CallExternalReference(
|
415
|
+
ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly)),
|
416
|
+
5);
|
417
|
+
}
|
418
|
+
|
419
|
+
|
420
|
+
// Number of pointers to be reserved on stack for fast API call.
|
421
|
+
static const int kFastApiCallArguments = 3;
|
422
|
+
|
423
|
+
|
424
|
+
// Reserves space for the extra arguments to API function in the
|
425
|
+
// caller's frame.
|
426
|
+
//
|
427
|
+
// These arguments are set by CheckPrototypes and GenerateFastApiCall.
|
428
|
+
static void ReserveSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
|
429
|
+
// ----------- S t a t e -------------
|
430
|
+
// -- esp[0] : return address
|
431
|
+
// -- esp[4] : last argument in the internal frame of the caller
|
432
|
+
// -----------------------------------
|
433
|
+
__ pop(scratch);
|
434
|
+
for (int i = 0; i < kFastApiCallArguments; i++) {
|
435
|
+
__ push(Immediate(Smi::FromInt(0)));
|
436
|
+
}
|
437
|
+
__ push(scratch);
|
438
|
+
}
|
439
|
+
|
440
|
+
|
441
|
+
// Undoes the effects of ReserveSpaceForFastApiCall.
|
442
|
+
static void FreeSpaceForFastApiCall(MacroAssembler* masm, Register scratch) {
|
443
|
+
// ----------- S t a t e -------------
|
444
|
+
// -- esp[0] : return address.
|
445
|
+
// -- esp[4] : last fast api call extra argument.
|
446
|
+
// -- ...
|
447
|
+
// -- esp[kFastApiCallArguments * 4] : first fast api call extra argument.
|
448
|
+
// -- esp[kFastApiCallArguments * 4 + 4] : last argument in the internal
|
449
|
+
// frame.
|
450
|
+
// -----------------------------------
|
451
|
+
__ pop(scratch);
|
452
|
+
__ add(Operand(esp), Immediate(kPointerSize * kFastApiCallArguments));
|
453
|
+
__ push(scratch);
|
454
|
+
}
|
455
|
+
|
456
|
+
|
457
|
+
// Generates call to API function.
|
458
|
+
static MaybeObject* GenerateFastApiCall(MacroAssembler* masm,
|
459
|
+
const CallOptimization& optimization,
|
460
|
+
int argc) {
|
461
|
+
// ----------- S t a t e -------------
|
462
|
+
// -- esp[0] : return address
|
463
|
+
// -- esp[4] : object passing the type check
|
464
|
+
// (last fast api call extra argument,
|
465
|
+
// set by CheckPrototypes)
|
466
|
+
// -- esp[8] : api function
|
467
|
+
// (first fast api call extra argument)
|
468
|
+
// -- esp[12] : api call data
|
469
|
+
// -- esp[16] : last argument
|
470
|
+
// -- ...
|
471
|
+
// -- esp[(argc + 3) * 4] : first argument
|
472
|
+
// -- esp[(argc + 4) * 4] : receiver
|
473
|
+
// -----------------------------------
|
474
|
+
// Get the function and setup the context.
|
475
|
+
JSFunction* function = optimization.constant_function();
|
476
|
+
__ mov(edi, Immediate(Handle<JSFunction>(function)));
|
477
|
+
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
|
478
|
+
|
479
|
+
// Pass the additional arguments.
|
480
|
+
__ mov(Operand(esp, 2 * kPointerSize), edi);
|
481
|
+
Object* call_data = optimization.api_call_info()->data();
|
482
|
+
Handle<CallHandlerInfo> api_call_info_handle(optimization.api_call_info());
|
483
|
+
if (Heap::InNewSpace(call_data)) {
|
484
|
+
__ mov(ecx, api_call_info_handle);
|
485
|
+
__ mov(ebx, FieldOperand(ecx, CallHandlerInfo::kDataOffset));
|
486
|
+
__ mov(Operand(esp, 3 * kPointerSize), ebx);
|
487
|
+
} else {
|
488
|
+
__ mov(Operand(esp, 3 * kPointerSize),
|
489
|
+
Immediate(Handle<Object>(call_data)));
|
490
|
+
}
|
491
|
+
|
492
|
+
// Prepare arguments.
|
493
|
+
__ lea(eax, Operand(esp, 3 * kPointerSize));
|
494
|
+
|
495
|
+
Object* callback = optimization.api_call_info()->callback();
|
496
|
+
Address api_function_address = v8::ToCData<Address>(callback);
|
497
|
+
ApiFunction fun(api_function_address);
|
498
|
+
|
499
|
+
const int kApiArgc = 1; // API function gets reference to the v8::Arguments.
|
500
|
+
|
501
|
+
// Allocate the v8::Arguments structure in the arguments' space since
|
502
|
+
// it's not controlled by GC.
|
503
|
+
const int kApiStackSpace = 4;
|
504
|
+
|
505
|
+
__ PrepareCallApiFunction(kApiArgc + kApiStackSpace, ebx);
|
506
|
+
|
507
|
+
__ mov(ApiParameterOperand(1), eax); // v8::Arguments::implicit_args_.
|
508
|
+
__ add(Operand(eax), Immediate(argc * kPointerSize));
|
509
|
+
__ mov(ApiParameterOperand(2), eax); // v8::Arguments::values_.
|
510
|
+
__ Set(ApiParameterOperand(3), Immediate(argc)); // v8::Arguments::length_.
|
511
|
+
// v8::Arguments::is_construct_call_.
|
512
|
+
__ Set(ApiParameterOperand(4), Immediate(0));
|
513
|
+
|
514
|
+
// v8::InvocationCallback's argument.
|
515
|
+
__ lea(eax, ApiParameterOperand(1));
|
516
|
+
__ mov(ApiParameterOperand(0), eax);
|
517
|
+
|
518
|
+
// Emitting a stub call may try to allocate (if the code is not
|
519
|
+
// already generated). Do not allow the assembler to perform a
|
520
|
+
// garbage collection but instead return the allocation failure
|
521
|
+
// object.
|
522
|
+
return masm->TryCallApiFunctionAndReturn(&fun,
|
523
|
+
argc + kFastApiCallArguments + 1);
|
524
|
+
}
|
525
|
+
|
526
|
+
|
527
|
+
class CallInterceptorCompiler BASE_EMBEDDED {
|
528
|
+
public:
|
529
|
+
CallInterceptorCompiler(StubCompiler* stub_compiler,
|
530
|
+
const ParameterCount& arguments,
|
531
|
+
Register name)
|
532
|
+
: stub_compiler_(stub_compiler),
|
533
|
+
arguments_(arguments),
|
534
|
+
name_(name) {}
|
535
|
+
|
536
|
+
MaybeObject* Compile(MacroAssembler* masm,
|
537
|
+
JSObject* object,
|
538
|
+
JSObject* holder,
|
539
|
+
String* name,
|
540
|
+
LookupResult* lookup,
|
541
|
+
Register receiver,
|
542
|
+
Register scratch1,
|
543
|
+
Register scratch2,
|
544
|
+
Register scratch3,
|
545
|
+
Label* miss) {
|
546
|
+
ASSERT(holder->HasNamedInterceptor());
|
547
|
+
ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined());
|
548
|
+
|
549
|
+
// Check that the receiver isn't a smi.
|
550
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
551
|
+
__ j(zero, miss, not_taken);
|
552
|
+
|
553
|
+
CallOptimization optimization(lookup);
|
554
|
+
|
555
|
+
if (optimization.is_constant_call()) {
|
556
|
+
return CompileCacheable(masm,
|
557
|
+
object,
|
558
|
+
receiver,
|
559
|
+
scratch1,
|
560
|
+
scratch2,
|
561
|
+
scratch3,
|
562
|
+
holder,
|
563
|
+
lookup,
|
564
|
+
name,
|
565
|
+
optimization,
|
566
|
+
miss);
|
567
|
+
} else {
|
568
|
+
CompileRegular(masm,
|
569
|
+
object,
|
570
|
+
receiver,
|
571
|
+
scratch1,
|
572
|
+
scratch2,
|
573
|
+
scratch3,
|
574
|
+
name,
|
575
|
+
holder,
|
576
|
+
miss);
|
577
|
+
return Heap::undefined_value(); // Success.
|
578
|
+
}
|
579
|
+
}
|
580
|
+
|
581
|
+
private:
|
582
|
+
MaybeObject* CompileCacheable(MacroAssembler* masm,
|
583
|
+
JSObject* object,
|
584
|
+
Register receiver,
|
585
|
+
Register scratch1,
|
586
|
+
Register scratch2,
|
587
|
+
Register scratch3,
|
588
|
+
JSObject* interceptor_holder,
|
589
|
+
LookupResult* lookup,
|
590
|
+
String* name,
|
591
|
+
const CallOptimization& optimization,
|
592
|
+
Label* miss_label) {
|
593
|
+
ASSERT(optimization.is_constant_call());
|
594
|
+
ASSERT(!lookup->holder()->IsGlobalObject());
|
595
|
+
|
596
|
+
int depth1 = kInvalidProtoDepth;
|
597
|
+
int depth2 = kInvalidProtoDepth;
|
598
|
+
bool can_do_fast_api_call = false;
|
599
|
+
if (optimization.is_simple_api_call() &&
|
600
|
+
!lookup->holder()->IsGlobalObject()) {
|
601
|
+
depth1 =
|
602
|
+
optimization.GetPrototypeDepthOfExpectedType(object,
|
603
|
+
interceptor_holder);
|
604
|
+
if (depth1 == kInvalidProtoDepth) {
|
605
|
+
depth2 =
|
606
|
+
optimization.GetPrototypeDepthOfExpectedType(interceptor_holder,
|
607
|
+
lookup->holder());
|
608
|
+
}
|
609
|
+
can_do_fast_api_call = (depth1 != kInvalidProtoDepth) ||
|
610
|
+
(depth2 != kInvalidProtoDepth);
|
611
|
+
}
|
612
|
+
|
613
|
+
__ IncrementCounter(&Counters::call_const_interceptor, 1);
|
614
|
+
|
615
|
+
if (can_do_fast_api_call) {
|
616
|
+
__ IncrementCounter(&Counters::call_const_interceptor_fast_api, 1);
|
617
|
+
ReserveSpaceForFastApiCall(masm, scratch1);
|
618
|
+
}
|
619
|
+
|
620
|
+
// Check that the maps from receiver to interceptor's holder
|
621
|
+
// haven't changed and thus we can invoke interceptor.
|
622
|
+
Label miss_cleanup;
|
623
|
+
Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
|
624
|
+
Register holder =
|
625
|
+
stub_compiler_->CheckPrototypes(object, receiver,
|
626
|
+
interceptor_holder, scratch1,
|
627
|
+
scratch2, scratch3, name, depth1, miss);
|
628
|
+
|
629
|
+
// Invoke an interceptor and if it provides a value,
|
630
|
+
// branch to |regular_invoke|.
|
631
|
+
Label regular_invoke;
|
632
|
+
LoadWithInterceptor(masm, receiver, holder, interceptor_holder,
|
633
|
+
®ular_invoke);
|
634
|
+
|
635
|
+
// Interceptor returned nothing for this property. Try to use cached
|
636
|
+
// constant function.
|
637
|
+
|
638
|
+
// Check that the maps from interceptor's holder to constant function's
|
639
|
+
// holder haven't changed and thus we can use cached constant function.
|
640
|
+
if (interceptor_holder != lookup->holder()) {
|
641
|
+
stub_compiler_->CheckPrototypes(interceptor_holder, receiver,
|
642
|
+
lookup->holder(), scratch1,
|
643
|
+
scratch2, scratch3, name, depth2, miss);
|
644
|
+
} else {
|
645
|
+
// CheckPrototypes has a side effect of fetching a 'holder'
|
646
|
+
// for API (object which is instanceof for the signature). It's
|
647
|
+
// safe to omit it here, as if present, it should be fetched
|
648
|
+
// by the previous CheckPrototypes.
|
649
|
+
ASSERT(depth2 == kInvalidProtoDepth);
|
650
|
+
}
|
651
|
+
|
652
|
+
// Invoke function.
|
653
|
+
if (can_do_fast_api_call) {
|
654
|
+
MaybeObject* result =
|
655
|
+
GenerateFastApiCall(masm, optimization, arguments_.immediate());
|
656
|
+
if (result->IsFailure()) return result;
|
657
|
+
} else {
|
658
|
+
__ InvokeFunction(optimization.constant_function(), arguments_,
|
659
|
+
JUMP_FUNCTION);
|
660
|
+
}
|
661
|
+
|
662
|
+
// Deferred code for fast API call case---clean preallocated space.
|
663
|
+
if (can_do_fast_api_call) {
|
664
|
+
__ bind(&miss_cleanup);
|
665
|
+
FreeSpaceForFastApiCall(masm, scratch1);
|
666
|
+
__ jmp(miss_label);
|
667
|
+
}
|
668
|
+
|
669
|
+
// Invoke a regular function.
|
670
|
+
__ bind(®ular_invoke);
|
671
|
+
if (can_do_fast_api_call) {
|
672
|
+
FreeSpaceForFastApiCall(masm, scratch1);
|
673
|
+
}
|
674
|
+
|
675
|
+
return Heap::undefined_value(); // Success.
|
676
|
+
}
|
677
|
+
|
678
|
+
void CompileRegular(MacroAssembler* masm,
|
679
|
+
JSObject* object,
|
680
|
+
Register receiver,
|
681
|
+
Register scratch1,
|
682
|
+
Register scratch2,
|
683
|
+
Register scratch3,
|
684
|
+
String* name,
|
685
|
+
JSObject* interceptor_holder,
|
686
|
+
Label* miss_label) {
|
687
|
+
Register holder =
|
688
|
+
stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
|
689
|
+
scratch1, scratch2, scratch3, name,
|
690
|
+
miss_label);
|
691
|
+
|
692
|
+
__ EnterInternalFrame();
|
693
|
+
// Save the name_ register across the call.
|
694
|
+
__ push(name_);
|
695
|
+
|
696
|
+
PushInterceptorArguments(masm,
|
697
|
+
receiver,
|
698
|
+
holder,
|
699
|
+
name_,
|
700
|
+
interceptor_holder);
|
701
|
+
|
702
|
+
__ CallExternalReference(
|
703
|
+
ExternalReference(
|
704
|
+
IC_Utility(IC::kLoadPropertyWithInterceptorForCall)),
|
705
|
+
5);
|
706
|
+
|
707
|
+
// Restore the name_ register.
|
708
|
+
__ pop(name_);
|
709
|
+
__ LeaveInternalFrame();
|
710
|
+
}
|
711
|
+
|
712
|
+
void LoadWithInterceptor(MacroAssembler* masm,
|
713
|
+
Register receiver,
|
714
|
+
Register holder,
|
715
|
+
JSObject* holder_obj,
|
716
|
+
Label* interceptor_succeeded) {
|
717
|
+
__ EnterInternalFrame();
|
718
|
+
__ push(holder); // Save the holder.
|
719
|
+
__ push(name_); // Save the name.
|
720
|
+
|
721
|
+
CompileCallLoadPropertyWithInterceptor(masm,
|
722
|
+
receiver,
|
723
|
+
holder,
|
724
|
+
name_,
|
725
|
+
holder_obj);
|
726
|
+
|
727
|
+
__ pop(name_); // Restore the name.
|
728
|
+
__ pop(receiver); // Restore the holder.
|
729
|
+
__ LeaveInternalFrame();
|
730
|
+
|
731
|
+
__ cmp(eax, Factory::no_interceptor_result_sentinel());
|
732
|
+
__ j(not_equal, interceptor_succeeded);
|
733
|
+
}
|
734
|
+
|
735
|
+
StubCompiler* stub_compiler_;
|
736
|
+
const ParameterCount& arguments_;
|
737
|
+
Register name_;
|
738
|
+
};
|
739
|
+
|
740
|
+
|
741
|
+
void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) {
|
742
|
+
ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC);
|
743
|
+
Code* code = NULL;
|
744
|
+
if (kind == Code::LOAD_IC) {
|
745
|
+
code = Builtins::builtin(Builtins::LoadIC_Miss);
|
746
|
+
} else {
|
747
|
+
code = Builtins::builtin(Builtins::KeyedLoadIC_Miss);
|
748
|
+
}
|
749
|
+
|
750
|
+
Handle<Code> ic(code);
|
751
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
752
|
+
}
|
753
|
+
|
754
|
+
|
755
|
+
// Both name_reg and receiver_reg are preserved on jumps to miss_label,
|
756
|
+
// but may be destroyed if store is successful.
|
757
|
+
void StubCompiler::GenerateStoreField(MacroAssembler* masm,
|
758
|
+
JSObject* object,
|
759
|
+
int index,
|
760
|
+
Map* transition,
|
761
|
+
Register receiver_reg,
|
762
|
+
Register name_reg,
|
763
|
+
Register scratch,
|
764
|
+
Label* miss_label) {
|
765
|
+
// Check that the object isn't a smi.
|
766
|
+
__ test(receiver_reg, Immediate(kSmiTagMask));
|
767
|
+
__ j(zero, miss_label, not_taken);
|
768
|
+
|
769
|
+
// Check that the map of the object hasn't changed.
|
770
|
+
__ cmp(FieldOperand(receiver_reg, HeapObject::kMapOffset),
|
771
|
+
Immediate(Handle<Map>(object->map())));
|
772
|
+
__ j(not_equal, miss_label, not_taken);
|
773
|
+
|
774
|
+
// Perform global security token check if needed.
|
775
|
+
if (object->IsJSGlobalProxy()) {
|
776
|
+
__ CheckAccessGlobalProxy(receiver_reg, scratch, miss_label);
|
777
|
+
}
|
778
|
+
|
779
|
+
// Stub never generated for non-global objects that require access
|
780
|
+
// checks.
|
781
|
+
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
|
782
|
+
|
783
|
+
// Perform map transition for the receiver if necessary.
|
784
|
+
if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) {
|
785
|
+
// The properties must be extended before we can store the value.
|
786
|
+
// We jump to a runtime call that extends the properties array.
|
787
|
+
__ pop(scratch); // Return address.
|
788
|
+
__ push(receiver_reg);
|
789
|
+
__ push(Immediate(Handle<Map>(transition)));
|
790
|
+
__ push(eax);
|
791
|
+
__ push(scratch);
|
792
|
+
__ TailCallExternalReference(
|
793
|
+
ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), 3, 1);
|
794
|
+
return;
|
795
|
+
}
|
796
|
+
|
797
|
+
if (transition != NULL) {
|
798
|
+
// Update the map of the object; no write barrier updating is
|
799
|
+
// needed because the map is never in new space.
|
800
|
+
__ mov(FieldOperand(receiver_reg, HeapObject::kMapOffset),
|
801
|
+
Immediate(Handle<Map>(transition)));
|
802
|
+
}
|
803
|
+
|
804
|
+
// Adjust for the number of properties stored in the object. Even in the
|
805
|
+
// face of a transition we can use the old map here because the size of the
|
806
|
+
// object and the number of in-object properties is not going to change.
|
807
|
+
index -= object->map()->inobject_properties();
|
808
|
+
|
809
|
+
if (index < 0) {
|
810
|
+
// Set the property straight into the object.
|
811
|
+
int offset = object->map()->instance_size() + (index * kPointerSize);
|
812
|
+
__ mov(FieldOperand(receiver_reg, offset), eax);
|
813
|
+
|
814
|
+
// Update the write barrier for the array address.
|
815
|
+
// Pass the value being stored in the now unused name_reg.
|
816
|
+
__ mov(name_reg, Operand(eax));
|
817
|
+
__ RecordWrite(receiver_reg, offset, name_reg, scratch);
|
818
|
+
} else {
|
819
|
+
// Write to the properties array.
|
820
|
+
int offset = index * kPointerSize + FixedArray::kHeaderSize;
|
821
|
+
// Get the properties array (optimistically).
|
822
|
+
__ mov(scratch, FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
|
823
|
+
__ mov(FieldOperand(scratch, offset), eax);
|
824
|
+
|
825
|
+
// Update the write barrier for the array address.
|
826
|
+
// Pass the value being stored in the now unused name_reg.
|
827
|
+
__ mov(name_reg, Operand(eax));
|
828
|
+
__ RecordWrite(scratch, offset, name_reg, receiver_reg);
|
829
|
+
}
|
830
|
+
|
831
|
+
// Return the value (register eax).
|
832
|
+
__ ret(0);
|
833
|
+
}
|
834
|
+
|
835
|
+
|
836
|
+
// Generate code to check that a global property cell is empty. Create
|
837
|
+
// the property cell at compilation time if no cell exists for the
|
838
|
+
// property.
|
839
|
+
MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell(
|
840
|
+
MacroAssembler* masm,
|
841
|
+
GlobalObject* global,
|
842
|
+
String* name,
|
843
|
+
Register scratch,
|
844
|
+
Label* miss) {
|
845
|
+
Object* probe;
|
846
|
+
{ MaybeObject* maybe_probe = global->EnsurePropertyCell(name);
|
847
|
+
if (!maybe_probe->ToObject(&probe)) return maybe_probe;
|
848
|
+
}
|
849
|
+
JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
|
850
|
+
ASSERT(cell->value()->IsTheHole());
|
851
|
+
if (Serializer::enabled()) {
|
852
|
+
__ mov(scratch, Immediate(Handle<Object>(cell)));
|
853
|
+
__ cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
|
854
|
+
Immediate(Factory::the_hole_value()));
|
855
|
+
} else {
|
856
|
+
__ cmp(Operand::Cell(Handle<JSGlobalPropertyCell>(cell)),
|
857
|
+
Immediate(Factory::the_hole_value()));
|
858
|
+
}
|
859
|
+
__ j(not_equal, miss, not_taken);
|
860
|
+
return cell;
|
861
|
+
}
|
862
|
+
|
863
|
+
|
864
|
+
// Calls GenerateCheckPropertyCell for each global object in the prototype chain
|
865
|
+
// from object to (but not including) holder.
|
866
|
+
MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCells(
|
867
|
+
MacroAssembler* masm,
|
868
|
+
JSObject* object,
|
869
|
+
JSObject* holder,
|
870
|
+
String* name,
|
871
|
+
Register scratch,
|
872
|
+
Label* miss) {
|
873
|
+
JSObject* current = object;
|
874
|
+
while (current != holder) {
|
875
|
+
if (current->IsGlobalObject()) {
|
876
|
+
// Returns a cell or a failure.
|
877
|
+
MaybeObject* result = GenerateCheckPropertyCell(
|
878
|
+
masm,
|
879
|
+
GlobalObject::cast(current),
|
880
|
+
name,
|
881
|
+
scratch,
|
882
|
+
miss);
|
883
|
+
if (result->IsFailure()) return result;
|
884
|
+
}
|
885
|
+
ASSERT(current->IsJSObject());
|
886
|
+
current = JSObject::cast(current->GetPrototype());
|
887
|
+
}
|
888
|
+
return NULL;
|
889
|
+
}
|
890
|
+
|
891
|
+
|
892
|
+
#undef __
|
893
|
+
#define __ ACCESS_MASM(masm())
|
894
|
+
|
895
|
+
|
896
|
+
Register StubCompiler::CheckPrototypes(JSObject* object,
|
897
|
+
Register object_reg,
|
898
|
+
JSObject* holder,
|
899
|
+
Register holder_reg,
|
900
|
+
Register scratch1,
|
901
|
+
Register scratch2,
|
902
|
+
String* name,
|
903
|
+
int save_at_depth,
|
904
|
+
Label* miss) {
|
905
|
+
// Make sure there's no overlap between holder and object registers.
|
906
|
+
ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
|
907
|
+
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
|
908
|
+
&& !scratch2.is(scratch1));
|
909
|
+
// Keep track of the current object in register reg.
|
910
|
+
Register reg = object_reg;
|
911
|
+
JSObject* current = object;
|
912
|
+
int depth = 0;
|
913
|
+
|
914
|
+
if (save_at_depth == depth) {
|
915
|
+
__ mov(Operand(esp, kPointerSize), reg);
|
916
|
+
}
|
917
|
+
|
918
|
+
// Traverse the prototype chain and check the maps in the prototype chain for
|
919
|
+
// fast and global objects or do negative lookup for normal objects.
|
920
|
+
while (current != holder) {
|
921
|
+
depth++;
|
922
|
+
|
923
|
+
// Only global objects and objects that do not require access
|
924
|
+
// checks are allowed in stubs.
|
925
|
+
ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
|
926
|
+
|
927
|
+
ASSERT(current->GetPrototype()->IsJSObject());
|
928
|
+
JSObject* prototype = JSObject::cast(current->GetPrototype());
|
929
|
+
if (!current->HasFastProperties() &&
|
930
|
+
!current->IsJSGlobalObject() &&
|
931
|
+
!current->IsJSGlobalProxy()) {
|
932
|
+
if (!name->IsSymbol()) {
|
933
|
+
MaybeObject* maybe_lookup_result = Heap::LookupSymbol(name);
|
934
|
+
Object* lookup_result = NULL; // Initialization to please compiler.
|
935
|
+
if (!maybe_lookup_result->ToObject(&lookup_result)) {
|
936
|
+
set_failure(Failure::cast(maybe_lookup_result));
|
937
|
+
return reg;
|
938
|
+
}
|
939
|
+
name = String::cast(lookup_result);
|
940
|
+
}
|
941
|
+
ASSERT(current->property_dictionary()->FindEntry(name) ==
|
942
|
+
StringDictionary::kNotFound);
|
943
|
+
|
944
|
+
GenerateDictionaryNegativeLookup(masm(),
|
945
|
+
miss,
|
946
|
+
reg,
|
947
|
+
name,
|
948
|
+
scratch1,
|
949
|
+
scratch2);
|
950
|
+
__ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
|
951
|
+
reg = holder_reg; // from now the object is in holder_reg
|
952
|
+
__ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
|
953
|
+
} else if (Heap::InNewSpace(prototype)) {
|
954
|
+
// Get the map of the current object.
|
955
|
+
__ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
|
956
|
+
__ cmp(Operand(scratch1), Immediate(Handle<Map>(current->map())));
|
957
|
+
// Branch on the result of the map check.
|
958
|
+
__ j(not_equal, miss, not_taken);
|
959
|
+
// Check access rights to the global object. This has to happen
|
960
|
+
// after the map check so that we know that the object is
|
961
|
+
// actually a global object.
|
962
|
+
if (current->IsJSGlobalProxy()) {
|
963
|
+
__ CheckAccessGlobalProxy(reg, scratch1, miss);
|
964
|
+
|
965
|
+
// Restore scratch register to be the map of the object.
|
966
|
+
// We load the prototype from the map in the scratch register.
|
967
|
+
__ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
|
968
|
+
}
|
969
|
+
// The prototype is in new space; we cannot store a reference
|
970
|
+
// to it in the code. Load it from the map.
|
971
|
+
reg = holder_reg; // from now the object is in holder_reg
|
972
|
+
__ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
|
973
|
+
} else {
|
974
|
+
// Check the map of the current object.
|
975
|
+
__ cmp(FieldOperand(reg, HeapObject::kMapOffset),
|
976
|
+
Immediate(Handle<Map>(current->map())));
|
977
|
+
// Branch on the result of the map check.
|
978
|
+
__ j(not_equal, miss, not_taken);
|
979
|
+
// Check access rights to the global object. This has to happen
|
980
|
+
// after the map check so that we know that the object is
|
981
|
+
// actually a global object.
|
982
|
+
if (current->IsJSGlobalProxy()) {
|
983
|
+
__ CheckAccessGlobalProxy(reg, scratch1, miss);
|
984
|
+
}
|
985
|
+
// The prototype is in old space; load it directly.
|
986
|
+
reg = holder_reg; // from now the object is in holder_reg
|
987
|
+
__ mov(reg, Handle<JSObject>(prototype));
|
988
|
+
}
|
989
|
+
|
990
|
+
if (save_at_depth == depth) {
|
991
|
+
__ mov(Operand(esp, kPointerSize), reg);
|
992
|
+
}
|
993
|
+
|
994
|
+
// Go to the next object in the prototype chain.
|
995
|
+
current = prototype;
|
996
|
+
}
|
997
|
+
ASSERT(current == holder);
|
998
|
+
|
999
|
+
// Log the check depth.
|
1000
|
+
LOG(IntEvent("check-maps-depth", depth + 1));
|
1001
|
+
|
1002
|
+
// Check the holder map.
|
1003
|
+
__ cmp(FieldOperand(reg, HeapObject::kMapOffset),
|
1004
|
+
Immediate(Handle<Map>(holder->map())));
|
1005
|
+
__ j(not_equal, miss, not_taken);
|
1006
|
+
|
1007
|
+
// Perform security check for access to the global object.
|
1008
|
+
ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
|
1009
|
+
if (holder->IsJSGlobalProxy()) {
|
1010
|
+
__ CheckAccessGlobalProxy(reg, scratch1, miss);
|
1011
|
+
};
|
1012
|
+
|
1013
|
+
// If we've skipped any global objects, it's not enough to verify
|
1014
|
+
// that their maps haven't changed. We also need to check that the
|
1015
|
+
// property cell for the property is still empty.
|
1016
|
+
MaybeObject* result = GenerateCheckPropertyCells(masm(),
|
1017
|
+
object,
|
1018
|
+
holder,
|
1019
|
+
name,
|
1020
|
+
scratch1,
|
1021
|
+
miss);
|
1022
|
+
if (result->IsFailure()) set_failure(Failure::cast(result));
|
1023
|
+
|
1024
|
+
// Return the register containing the holder.
|
1025
|
+
return reg;
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
|
1029
|
+
void StubCompiler::GenerateLoadField(JSObject* object,
|
1030
|
+
JSObject* holder,
|
1031
|
+
Register receiver,
|
1032
|
+
Register scratch1,
|
1033
|
+
Register scratch2,
|
1034
|
+
Register scratch3,
|
1035
|
+
int index,
|
1036
|
+
String* name,
|
1037
|
+
Label* miss) {
|
1038
|
+
// Check that the receiver isn't a smi.
|
1039
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
1040
|
+
__ j(zero, miss, not_taken);
|
1041
|
+
|
1042
|
+
// Check the prototype chain.
|
1043
|
+
Register reg =
|
1044
|
+
CheckPrototypes(object, receiver, holder,
|
1045
|
+
scratch1, scratch2, scratch3, name, miss);
|
1046
|
+
|
1047
|
+
// Get the value from the properties.
|
1048
|
+
GenerateFastPropertyLoad(masm(), eax, reg, holder, index);
|
1049
|
+
__ ret(0);
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
|
1053
|
+
MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object,
|
1054
|
+
JSObject* holder,
|
1055
|
+
Register receiver,
|
1056
|
+
Register name_reg,
|
1057
|
+
Register scratch1,
|
1058
|
+
Register scratch2,
|
1059
|
+
Register scratch3,
|
1060
|
+
AccessorInfo* callback,
|
1061
|
+
String* name,
|
1062
|
+
Label* miss) {
|
1063
|
+
// Check that the receiver isn't a smi.
|
1064
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
1065
|
+
__ j(zero, miss, not_taken);
|
1066
|
+
|
1067
|
+
// Check that the maps haven't changed.
|
1068
|
+
Register reg =
|
1069
|
+
CheckPrototypes(object, receiver, holder, scratch1,
|
1070
|
+
scratch2, scratch3, name, miss);
|
1071
|
+
|
1072
|
+
Handle<AccessorInfo> callback_handle(callback);
|
1073
|
+
|
1074
|
+
// Insert additional parameters into the stack frame above return address.
|
1075
|
+
ASSERT(!scratch3.is(reg));
|
1076
|
+
__ pop(scratch3); // Get return address to place it below.
|
1077
|
+
|
1078
|
+
__ push(receiver); // receiver
|
1079
|
+
__ mov(scratch2, Operand(esp));
|
1080
|
+
ASSERT(!scratch2.is(reg));
|
1081
|
+
__ push(reg); // holder
|
1082
|
+
// Push data from AccessorInfo.
|
1083
|
+
if (Heap::InNewSpace(callback_handle->data())) {
|
1084
|
+
__ mov(scratch1, Immediate(callback_handle));
|
1085
|
+
__ push(FieldOperand(scratch1, AccessorInfo::kDataOffset));
|
1086
|
+
} else {
|
1087
|
+
__ push(Immediate(Handle<Object>(callback_handle->data())));
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
// Save a pointer to where we pushed the arguments pointer.
|
1091
|
+
// This will be passed as the const AccessorInfo& to the C++ callback.
|
1092
|
+
__ push(scratch2);
|
1093
|
+
|
1094
|
+
__ push(name_reg); // name
|
1095
|
+
__ mov(ebx, esp); // esp points to reference to name (handler).
|
1096
|
+
|
1097
|
+
__ push(scratch3); // Restore return address.
|
1098
|
+
|
1099
|
+
// Do call through the api.
|
1100
|
+
Address getter_address = v8::ToCData<Address>(callback->getter());
|
1101
|
+
ApiFunction fun(getter_address);
|
1102
|
+
|
1103
|
+
// 3 elements array for v8::Agruments::values_, handler for name and pointer
|
1104
|
+
// to the values (it considered as smi in GC).
|
1105
|
+
const int kStackSpace = 5;
|
1106
|
+
const int kApiArgc = 2;
|
1107
|
+
|
1108
|
+
__ PrepareCallApiFunction(kApiArgc, eax);
|
1109
|
+
__ mov(ApiParameterOperand(0), ebx); // name.
|
1110
|
+
__ add(Operand(ebx), Immediate(kPointerSize));
|
1111
|
+
__ mov(ApiParameterOperand(1), ebx); // arguments pointer.
|
1112
|
+
|
1113
|
+
// Emitting a stub call may try to allocate (if the code is not
|
1114
|
+
// already generated). Do not allow the assembler to perform a
|
1115
|
+
// garbage collection but instead return the allocation failure
|
1116
|
+
// object.
|
1117
|
+
return masm()->TryCallApiFunctionAndReturn(&fun, kStackSpace);
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
|
1121
|
+
void StubCompiler::GenerateLoadConstant(JSObject* object,
|
1122
|
+
JSObject* holder,
|
1123
|
+
Register receiver,
|
1124
|
+
Register scratch1,
|
1125
|
+
Register scratch2,
|
1126
|
+
Register scratch3,
|
1127
|
+
Object* value,
|
1128
|
+
String* name,
|
1129
|
+
Label* miss) {
|
1130
|
+
// Check that the receiver isn't a smi.
|
1131
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
1132
|
+
__ j(zero, miss, not_taken);
|
1133
|
+
|
1134
|
+
// Check that the maps haven't changed.
|
1135
|
+
CheckPrototypes(object, receiver, holder,
|
1136
|
+
scratch1, scratch2, scratch3, name, miss);
|
1137
|
+
|
1138
|
+
// Return the constant value.
|
1139
|
+
__ mov(eax, Handle<Object>(value));
|
1140
|
+
__ ret(0);
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
|
1144
|
+
void StubCompiler::GenerateLoadInterceptor(JSObject* object,
|
1145
|
+
JSObject* interceptor_holder,
|
1146
|
+
LookupResult* lookup,
|
1147
|
+
Register receiver,
|
1148
|
+
Register name_reg,
|
1149
|
+
Register scratch1,
|
1150
|
+
Register scratch2,
|
1151
|
+
Register scratch3,
|
1152
|
+
String* name,
|
1153
|
+
Label* miss) {
|
1154
|
+
ASSERT(interceptor_holder->HasNamedInterceptor());
|
1155
|
+
ASSERT(!interceptor_holder->GetNamedInterceptor()->getter()->IsUndefined());
|
1156
|
+
|
1157
|
+
// Check that the receiver isn't a smi.
|
1158
|
+
__ test(receiver, Immediate(kSmiTagMask));
|
1159
|
+
__ j(zero, miss, not_taken);
|
1160
|
+
|
1161
|
+
// So far the most popular follow ups for interceptor loads are FIELD
|
1162
|
+
// and CALLBACKS, so inline only them, other cases may be added
|
1163
|
+
// later.
|
1164
|
+
bool compile_followup_inline = false;
|
1165
|
+
if (lookup->IsProperty() && lookup->IsCacheable()) {
|
1166
|
+
if (lookup->type() == FIELD) {
|
1167
|
+
compile_followup_inline = true;
|
1168
|
+
} else if (lookup->type() == CALLBACKS &&
|
1169
|
+
lookup->GetCallbackObject()->IsAccessorInfo() &&
|
1170
|
+
AccessorInfo::cast(lookup->GetCallbackObject())->getter() != NULL) {
|
1171
|
+
compile_followup_inline = true;
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
if (compile_followup_inline) {
|
1176
|
+
// Compile the interceptor call, followed by inline code to load the
|
1177
|
+
// property from further up the prototype chain if the call fails.
|
1178
|
+
// Check that the maps haven't changed.
|
1179
|
+
Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder,
|
1180
|
+
scratch1, scratch2, scratch3,
|
1181
|
+
name, miss);
|
1182
|
+
ASSERT(holder_reg.is(receiver) || holder_reg.is(scratch1));
|
1183
|
+
|
1184
|
+
// Save necessary data before invoking an interceptor.
|
1185
|
+
// Requires a frame to make GC aware of pushed pointers.
|
1186
|
+
__ EnterInternalFrame();
|
1187
|
+
|
1188
|
+
if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) {
|
1189
|
+
// CALLBACKS case needs a receiver to be passed into C++ callback.
|
1190
|
+
__ push(receiver);
|
1191
|
+
}
|
1192
|
+
__ push(holder_reg);
|
1193
|
+
__ push(name_reg);
|
1194
|
+
|
1195
|
+
// Invoke an interceptor. Note: map checks from receiver to
|
1196
|
+
// interceptor's holder has been compiled before (see a caller
|
1197
|
+
// of this method.)
|
1198
|
+
CompileCallLoadPropertyWithInterceptor(masm(),
|
1199
|
+
receiver,
|
1200
|
+
holder_reg,
|
1201
|
+
name_reg,
|
1202
|
+
interceptor_holder);
|
1203
|
+
|
1204
|
+
// Check if interceptor provided a value for property. If it's
|
1205
|
+
// the case, return immediately.
|
1206
|
+
Label interceptor_failed;
|
1207
|
+
__ cmp(eax, Factory::no_interceptor_result_sentinel());
|
1208
|
+
__ j(equal, &interceptor_failed);
|
1209
|
+
__ LeaveInternalFrame();
|
1210
|
+
__ ret(0);
|
1211
|
+
|
1212
|
+
__ bind(&interceptor_failed);
|
1213
|
+
__ pop(name_reg);
|
1214
|
+
__ pop(holder_reg);
|
1215
|
+
if (lookup->type() == CALLBACKS && !receiver.is(holder_reg)) {
|
1216
|
+
__ pop(receiver);
|
1217
|
+
}
|
1218
|
+
|
1219
|
+
__ LeaveInternalFrame();
|
1220
|
+
|
1221
|
+
// Check that the maps from interceptor's holder to lookup's holder
|
1222
|
+
// haven't changed. And load lookup's holder into holder_reg.
|
1223
|
+
if (interceptor_holder != lookup->holder()) {
|
1224
|
+
holder_reg = CheckPrototypes(interceptor_holder,
|
1225
|
+
holder_reg,
|
1226
|
+
lookup->holder(),
|
1227
|
+
scratch1,
|
1228
|
+
scratch2,
|
1229
|
+
scratch3,
|
1230
|
+
name,
|
1231
|
+
miss);
|
1232
|
+
}
|
1233
|
+
|
1234
|
+
if (lookup->type() == FIELD) {
|
1235
|
+
// We found FIELD property in prototype chain of interceptor's holder.
|
1236
|
+
// Retrieve a field from field's holder.
|
1237
|
+
GenerateFastPropertyLoad(masm(), eax, holder_reg,
|
1238
|
+
lookup->holder(), lookup->GetFieldIndex());
|
1239
|
+
__ ret(0);
|
1240
|
+
} else {
|
1241
|
+
// We found CALLBACKS property in prototype chain of interceptor's
|
1242
|
+
// holder.
|
1243
|
+
ASSERT(lookup->type() == CALLBACKS);
|
1244
|
+
ASSERT(lookup->GetCallbackObject()->IsAccessorInfo());
|
1245
|
+
AccessorInfo* callback = AccessorInfo::cast(lookup->GetCallbackObject());
|
1246
|
+
ASSERT(callback != NULL);
|
1247
|
+
ASSERT(callback->getter() != NULL);
|
1248
|
+
|
1249
|
+
// Tail call to runtime.
|
1250
|
+
// Important invariant in CALLBACKS case: the code above must be
|
1251
|
+
// structured to never clobber |receiver| register.
|
1252
|
+
__ pop(scratch2); // return address
|
1253
|
+
__ push(receiver);
|
1254
|
+
__ push(holder_reg);
|
1255
|
+
__ mov(holder_reg, Immediate(Handle<AccessorInfo>(callback)));
|
1256
|
+
__ push(FieldOperand(holder_reg, AccessorInfo::kDataOffset));
|
1257
|
+
__ push(holder_reg);
|
1258
|
+
__ push(name_reg);
|
1259
|
+
__ push(scratch2); // restore return address
|
1260
|
+
|
1261
|
+
ExternalReference ref =
|
1262
|
+
ExternalReference(IC_Utility(IC::kLoadCallbackProperty));
|
1263
|
+
__ TailCallExternalReference(ref, 5, 1);
|
1264
|
+
}
|
1265
|
+
} else { // !compile_followup_inline
|
1266
|
+
// Call the runtime system to load the interceptor.
|
1267
|
+
// Check that the maps haven't changed.
|
1268
|
+
Register holder_reg =
|
1269
|
+
CheckPrototypes(object, receiver, interceptor_holder,
|
1270
|
+
scratch1, scratch2, scratch3, name, miss);
|
1271
|
+
__ pop(scratch2); // save old return address
|
1272
|
+
PushInterceptorArguments(masm(), receiver, holder_reg,
|
1273
|
+
name_reg, interceptor_holder);
|
1274
|
+
__ push(scratch2); // restore old return address
|
1275
|
+
|
1276
|
+
ExternalReference ref = ExternalReference(
|
1277
|
+
IC_Utility(IC::kLoadPropertyWithInterceptorForLoad));
|
1278
|
+
__ TailCallExternalReference(ref, 5, 1);
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
|
1283
|
+
void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) {
|
1284
|
+
if (kind_ == Code::KEYED_CALL_IC) {
|
1285
|
+
__ cmp(Operand(ecx), Immediate(Handle<String>(name)));
|
1286
|
+
__ j(not_equal, miss, not_taken);
|
1287
|
+
}
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
|
1291
|
+
void CallStubCompiler::GenerateGlobalReceiverCheck(JSObject* object,
|
1292
|
+
JSObject* holder,
|
1293
|
+
String* name,
|
1294
|
+
Label* miss) {
|
1295
|
+
ASSERT(holder->IsGlobalObject());
|
1296
|
+
|
1297
|
+
// Get the number of arguments.
|
1298
|
+
const int argc = arguments().immediate();
|
1299
|
+
|
1300
|
+
// Get the receiver from the stack.
|
1301
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1302
|
+
|
1303
|
+
// If the object is the holder then we know that it's a global
|
1304
|
+
// object which can only happen for contextual calls. In this case,
|
1305
|
+
// the receiver cannot be a smi.
|
1306
|
+
if (object != holder) {
|
1307
|
+
__ test(edx, Immediate(kSmiTagMask));
|
1308
|
+
__ j(zero, miss, not_taken);
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
// Check that the maps haven't changed.
|
1312
|
+
CheckPrototypes(object, edx, holder, ebx, eax, edi, name, miss);
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
|
1316
|
+
void CallStubCompiler::GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell,
|
1317
|
+
JSFunction* function,
|
1318
|
+
Label* miss) {
|
1319
|
+
// Get the value from the cell.
|
1320
|
+
if (Serializer::enabled()) {
|
1321
|
+
__ mov(edi, Immediate(Handle<JSGlobalPropertyCell>(cell)));
|
1322
|
+
__ mov(edi, FieldOperand(edi, JSGlobalPropertyCell::kValueOffset));
|
1323
|
+
} else {
|
1324
|
+
__ mov(edi, Operand::Cell(Handle<JSGlobalPropertyCell>(cell)));
|
1325
|
+
}
|
1326
|
+
|
1327
|
+
// Check that the cell contains the same function.
|
1328
|
+
if (Heap::InNewSpace(function)) {
|
1329
|
+
// We can't embed a pointer to a function in new space so we have
|
1330
|
+
// to verify that the shared function info is unchanged. This has
|
1331
|
+
// the nice side effect that multiple closures based on the same
|
1332
|
+
// function can all use this call IC. Before we load through the
|
1333
|
+
// function, we have to verify that it still is a function.
|
1334
|
+
__ test(edi, Immediate(kSmiTagMask));
|
1335
|
+
__ j(zero, miss, not_taken);
|
1336
|
+
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ebx);
|
1337
|
+
__ j(not_equal, miss, not_taken);
|
1338
|
+
|
1339
|
+
// Check the shared function info. Make sure it hasn't changed.
|
1340
|
+
__ cmp(FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset),
|
1341
|
+
Immediate(Handle<SharedFunctionInfo>(function->shared())));
|
1342
|
+
__ j(not_equal, miss, not_taken);
|
1343
|
+
} else {
|
1344
|
+
__ cmp(Operand(edi), Immediate(Handle<JSFunction>(function)));
|
1345
|
+
__ j(not_equal, miss, not_taken);
|
1346
|
+
}
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
|
1350
|
+
MaybeObject* CallStubCompiler::GenerateMissBranch() {
|
1351
|
+
MaybeObject* maybe_obj = StubCache::ComputeCallMiss(arguments().immediate(),
|
1352
|
+
kind_);
|
1353
|
+
Object* obj;
|
1354
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1355
|
+
__ jmp(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
|
1356
|
+
return obj;
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
|
1360
|
+
MUST_USE_RESULT MaybeObject* CallStubCompiler::CompileCallField(
|
1361
|
+
JSObject* object,
|
1362
|
+
JSObject* holder,
|
1363
|
+
int index,
|
1364
|
+
String* name) {
|
1365
|
+
// ----------- S t a t e -------------
|
1366
|
+
// -- ecx : name
|
1367
|
+
// -- esp[0] : return address
|
1368
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1369
|
+
// -- ...
|
1370
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1371
|
+
// -----------------------------------
|
1372
|
+
Label miss;
|
1373
|
+
|
1374
|
+
GenerateNameCheck(name, &miss);
|
1375
|
+
|
1376
|
+
// Get the receiver from the stack.
|
1377
|
+
const int argc = arguments().immediate();
|
1378
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1379
|
+
|
1380
|
+
// Check that the receiver isn't a smi.
|
1381
|
+
__ test(edx, Immediate(kSmiTagMask));
|
1382
|
+
__ j(zero, &miss, not_taken);
|
1383
|
+
|
1384
|
+
// Do the right check and compute the holder register.
|
1385
|
+
Register reg = CheckPrototypes(object, edx, holder, ebx, eax, edi,
|
1386
|
+
name, &miss);
|
1387
|
+
|
1388
|
+
GenerateFastPropertyLoad(masm(), edi, reg, holder, index);
|
1389
|
+
|
1390
|
+
// Check that the function really is a function.
|
1391
|
+
__ test(edi, Immediate(kSmiTagMask));
|
1392
|
+
__ j(zero, &miss, not_taken);
|
1393
|
+
__ CmpObjectType(edi, JS_FUNCTION_TYPE, ebx);
|
1394
|
+
__ j(not_equal, &miss, not_taken);
|
1395
|
+
|
1396
|
+
// Patch the receiver on the stack with the global proxy if
|
1397
|
+
// necessary.
|
1398
|
+
if (object->IsGlobalObject()) {
|
1399
|
+
__ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
|
1400
|
+
__ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
// Invoke the function.
|
1404
|
+
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
|
1405
|
+
|
1406
|
+
// Handle call cache miss.
|
1407
|
+
__ bind(&miss);
|
1408
|
+
Object* obj;
|
1409
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
1410
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
// Return the generated code.
|
1414
|
+
return GetCode(FIELD, name);
|
1415
|
+
}
|
1416
|
+
|
1417
|
+
|
1418
|
+
MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object,
|
1419
|
+
JSObject* holder,
|
1420
|
+
JSGlobalPropertyCell* cell,
|
1421
|
+
JSFunction* function,
|
1422
|
+
String* name) {
|
1423
|
+
// ----------- S t a t e -------------
|
1424
|
+
// -- ecx : name
|
1425
|
+
// -- esp[0] : return address
|
1426
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1427
|
+
// -- ...
|
1428
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1429
|
+
// -----------------------------------
|
1430
|
+
|
1431
|
+
// If object is not an array, bail out to regular call.
|
1432
|
+
if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value();
|
1433
|
+
|
1434
|
+
Label miss;
|
1435
|
+
|
1436
|
+
GenerateNameCheck(name, &miss);
|
1437
|
+
|
1438
|
+
// Get the receiver from the stack.
|
1439
|
+
const int argc = arguments().immediate();
|
1440
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1441
|
+
|
1442
|
+
// Check that the receiver isn't a smi.
|
1443
|
+
__ test(edx, Immediate(kSmiTagMask));
|
1444
|
+
__ j(zero, &miss);
|
1445
|
+
|
1446
|
+
CheckPrototypes(JSObject::cast(object), edx,
|
1447
|
+
holder, ebx,
|
1448
|
+
eax, edi, name, &miss);
|
1449
|
+
|
1450
|
+
if (argc == 0) {
|
1451
|
+
// Noop, return the length.
|
1452
|
+
__ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
|
1453
|
+
__ ret((argc + 1) * kPointerSize);
|
1454
|
+
} else {
|
1455
|
+
Label call_builtin;
|
1456
|
+
|
1457
|
+
// Get the elements array of the object.
|
1458
|
+
__ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
|
1459
|
+
|
1460
|
+
// Check that the elements are in fast mode and writable.
|
1461
|
+
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
|
1462
|
+
Immediate(Factory::fixed_array_map()));
|
1463
|
+
__ j(not_equal, &call_builtin);
|
1464
|
+
|
1465
|
+
if (argc == 1) { // Otherwise fall through to call builtin.
|
1466
|
+
Label exit, with_write_barrier, attempt_to_grow_elements;
|
1467
|
+
|
1468
|
+
// Get the array's length into eax and calculate new length.
|
1469
|
+
__ mov(eax, FieldOperand(edx, JSArray::kLengthOffset));
|
1470
|
+
STATIC_ASSERT(kSmiTagSize == 1);
|
1471
|
+
STATIC_ASSERT(kSmiTag == 0);
|
1472
|
+
__ add(Operand(eax), Immediate(Smi::FromInt(argc)));
|
1473
|
+
|
1474
|
+
// Get the element's length into ecx.
|
1475
|
+
__ mov(ecx, FieldOperand(ebx, FixedArray::kLengthOffset));
|
1476
|
+
|
1477
|
+
// Check if we could survive without allocation.
|
1478
|
+
__ cmp(eax, Operand(ecx));
|
1479
|
+
__ j(greater, &attempt_to_grow_elements);
|
1480
|
+
|
1481
|
+
// Save new length.
|
1482
|
+
__ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
|
1483
|
+
|
1484
|
+
// Push the element.
|
1485
|
+
__ lea(edx, FieldOperand(ebx,
|
1486
|
+
eax, times_half_pointer_size,
|
1487
|
+
FixedArray::kHeaderSize - argc * kPointerSize));
|
1488
|
+
__ mov(ecx, Operand(esp, argc * kPointerSize));
|
1489
|
+
__ mov(Operand(edx, 0), ecx);
|
1490
|
+
|
1491
|
+
// Check if value is a smi.
|
1492
|
+
__ test(ecx, Immediate(kSmiTagMask));
|
1493
|
+
__ j(not_zero, &with_write_barrier);
|
1494
|
+
|
1495
|
+
__ bind(&exit);
|
1496
|
+
__ ret((argc + 1) * kPointerSize);
|
1497
|
+
|
1498
|
+
__ bind(&with_write_barrier);
|
1499
|
+
|
1500
|
+
__ InNewSpace(ebx, ecx, equal, &exit);
|
1501
|
+
|
1502
|
+
__ RecordWriteHelper(ebx, edx, ecx);
|
1503
|
+
__ ret((argc + 1) * kPointerSize);
|
1504
|
+
|
1505
|
+
__ bind(&attempt_to_grow_elements);
|
1506
|
+
if (!FLAG_inline_new) {
|
1507
|
+
__ jmp(&call_builtin);
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
ExternalReference new_space_allocation_top =
|
1511
|
+
ExternalReference::new_space_allocation_top_address();
|
1512
|
+
ExternalReference new_space_allocation_limit =
|
1513
|
+
ExternalReference::new_space_allocation_limit_address();
|
1514
|
+
|
1515
|
+
const int kAllocationDelta = 4;
|
1516
|
+
// Load top.
|
1517
|
+
__ mov(ecx, Operand::StaticVariable(new_space_allocation_top));
|
1518
|
+
|
1519
|
+
// Check if it's the end of elements.
|
1520
|
+
__ lea(edx, FieldOperand(ebx,
|
1521
|
+
eax, times_half_pointer_size,
|
1522
|
+
FixedArray::kHeaderSize - argc * kPointerSize));
|
1523
|
+
__ cmp(edx, Operand(ecx));
|
1524
|
+
__ j(not_equal, &call_builtin);
|
1525
|
+
__ add(Operand(ecx), Immediate(kAllocationDelta * kPointerSize));
|
1526
|
+
__ cmp(ecx, Operand::StaticVariable(new_space_allocation_limit));
|
1527
|
+
__ j(above, &call_builtin);
|
1528
|
+
|
1529
|
+
// We fit and could grow elements.
|
1530
|
+
__ mov(Operand::StaticVariable(new_space_allocation_top), ecx);
|
1531
|
+
__ mov(ecx, Operand(esp, argc * kPointerSize));
|
1532
|
+
|
1533
|
+
// Push the argument...
|
1534
|
+
__ mov(Operand(edx, 0), ecx);
|
1535
|
+
// ... and fill the rest with holes.
|
1536
|
+
for (int i = 1; i < kAllocationDelta; i++) {
|
1537
|
+
__ mov(Operand(edx, i * kPointerSize),
|
1538
|
+
Immediate(Factory::the_hole_value()));
|
1539
|
+
}
|
1540
|
+
|
1541
|
+
// Restore receiver to edx as finish sequence assumes it's here.
|
1542
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1543
|
+
|
1544
|
+
// Increment element's and array's sizes.
|
1545
|
+
__ add(FieldOperand(ebx, FixedArray::kLengthOffset),
|
1546
|
+
Immediate(Smi::FromInt(kAllocationDelta)));
|
1547
|
+
__ mov(FieldOperand(edx, JSArray::kLengthOffset), eax);
|
1548
|
+
|
1549
|
+
// Elements are in new space, so write barrier is not required.
|
1550
|
+
__ ret((argc + 1) * kPointerSize);
|
1551
|
+
}
|
1552
|
+
|
1553
|
+
__ bind(&call_builtin);
|
1554
|
+
__ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
|
1555
|
+
argc + 1,
|
1556
|
+
1);
|
1557
|
+
}
|
1558
|
+
|
1559
|
+
__ bind(&miss);
|
1560
|
+
Object* obj;
|
1561
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
1562
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
// Return the generated code.
|
1566
|
+
return GetCode(function);
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
|
1570
|
+
MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object,
|
1571
|
+
JSObject* holder,
|
1572
|
+
JSGlobalPropertyCell* cell,
|
1573
|
+
JSFunction* function,
|
1574
|
+
String* name) {
|
1575
|
+
// ----------- S t a t e -------------
|
1576
|
+
// -- ecx : name
|
1577
|
+
// -- esp[0] : return address
|
1578
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1579
|
+
// -- ...
|
1580
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1581
|
+
// -----------------------------------
|
1582
|
+
|
1583
|
+
// If object is not an array, bail out to regular call.
|
1584
|
+
if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value();
|
1585
|
+
|
1586
|
+
Label miss, return_undefined, call_builtin;
|
1587
|
+
|
1588
|
+
GenerateNameCheck(name, &miss);
|
1589
|
+
|
1590
|
+
// Get the receiver from the stack.
|
1591
|
+
const int argc = arguments().immediate();
|
1592
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
1593
|
+
|
1594
|
+
// Check that the receiver isn't a smi.
|
1595
|
+
__ test(edx, Immediate(kSmiTagMask));
|
1596
|
+
__ j(zero, &miss);
|
1597
|
+
CheckPrototypes(JSObject::cast(object), edx,
|
1598
|
+
holder, ebx,
|
1599
|
+
eax, edi, name, &miss);
|
1600
|
+
|
1601
|
+
// Get the elements array of the object.
|
1602
|
+
__ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
|
1603
|
+
|
1604
|
+
// Check that the elements are in fast mode and writable.
|
1605
|
+
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
|
1606
|
+
Immediate(Factory::fixed_array_map()));
|
1607
|
+
__ j(not_equal, &call_builtin);
|
1608
|
+
|
1609
|
+
// Get the array's length into ecx and calculate new length.
|
1610
|
+
__ mov(ecx, FieldOperand(edx, JSArray::kLengthOffset));
|
1611
|
+
__ sub(Operand(ecx), Immediate(Smi::FromInt(1)));
|
1612
|
+
__ j(negative, &return_undefined);
|
1613
|
+
|
1614
|
+
// Get the last element.
|
1615
|
+
STATIC_ASSERT(kSmiTagSize == 1);
|
1616
|
+
STATIC_ASSERT(kSmiTag == 0);
|
1617
|
+
__ mov(eax, FieldOperand(ebx,
|
1618
|
+
ecx, times_half_pointer_size,
|
1619
|
+
FixedArray::kHeaderSize));
|
1620
|
+
__ cmp(Operand(eax), Immediate(Factory::the_hole_value()));
|
1621
|
+
__ j(equal, &call_builtin);
|
1622
|
+
|
1623
|
+
// Set the array's length.
|
1624
|
+
__ mov(FieldOperand(edx, JSArray::kLengthOffset), ecx);
|
1625
|
+
|
1626
|
+
// Fill with the hole.
|
1627
|
+
__ mov(FieldOperand(ebx,
|
1628
|
+
ecx, times_half_pointer_size,
|
1629
|
+
FixedArray::kHeaderSize),
|
1630
|
+
Immediate(Factory::the_hole_value()));
|
1631
|
+
__ ret((argc + 1) * kPointerSize);
|
1632
|
+
|
1633
|
+
__ bind(&return_undefined);
|
1634
|
+
__ mov(eax, Immediate(Factory::undefined_value()));
|
1635
|
+
__ ret((argc + 1) * kPointerSize);
|
1636
|
+
|
1637
|
+
__ bind(&call_builtin);
|
1638
|
+
__ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
|
1639
|
+
argc + 1,
|
1640
|
+
1);
|
1641
|
+
|
1642
|
+
__ bind(&miss);
|
1643
|
+
Object* obj;
|
1644
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
1645
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1646
|
+
}
|
1647
|
+
|
1648
|
+
// Return the generated code.
|
1649
|
+
return GetCode(function);
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
|
1653
|
+
MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall(
|
1654
|
+
Object* object,
|
1655
|
+
JSObject* holder,
|
1656
|
+
JSGlobalPropertyCell* cell,
|
1657
|
+
JSFunction* function,
|
1658
|
+
String* name) {
|
1659
|
+
// ----------- S t a t e -------------
|
1660
|
+
// -- ecx : function name
|
1661
|
+
// -- esp[0] : return address
|
1662
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1663
|
+
// -- ...
|
1664
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1665
|
+
// -----------------------------------
|
1666
|
+
|
1667
|
+
// If object is not a string, bail out to regular call.
|
1668
|
+
if (!object->IsString() || cell != NULL) return Heap::undefined_value();
|
1669
|
+
|
1670
|
+
const int argc = arguments().immediate();
|
1671
|
+
|
1672
|
+
Label miss;
|
1673
|
+
Label name_miss;
|
1674
|
+
Label index_out_of_range;
|
1675
|
+
Label* index_out_of_range_label = &index_out_of_range;
|
1676
|
+
|
1677
|
+
if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) {
|
1678
|
+
index_out_of_range_label = &miss;
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
GenerateNameCheck(name, &name_miss);
|
1682
|
+
|
1683
|
+
// Check that the maps starting from the prototype haven't changed.
|
1684
|
+
GenerateDirectLoadGlobalFunctionPrototype(masm(),
|
1685
|
+
Context::STRING_FUNCTION_INDEX,
|
1686
|
+
eax,
|
1687
|
+
&miss);
|
1688
|
+
ASSERT(object != holder);
|
1689
|
+
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
|
1690
|
+
ebx, edx, edi, name, &miss);
|
1691
|
+
|
1692
|
+
Register receiver = ebx;
|
1693
|
+
Register index = edi;
|
1694
|
+
Register scratch = edx;
|
1695
|
+
Register result = eax;
|
1696
|
+
__ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
|
1697
|
+
if (argc > 0) {
|
1698
|
+
__ mov(index, Operand(esp, (argc - 0) * kPointerSize));
|
1699
|
+
} else {
|
1700
|
+
__ Set(index, Immediate(Factory::undefined_value()));
|
1701
|
+
}
|
1702
|
+
|
1703
|
+
StringCharCodeAtGenerator char_code_at_generator(receiver,
|
1704
|
+
index,
|
1705
|
+
scratch,
|
1706
|
+
result,
|
1707
|
+
&miss, // When not a string.
|
1708
|
+
&miss, // When not a number.
|
1709
|
+
index_out_of_range_label,
|
1710
|
+
STRING_INDEX_IS_NUMBER);
|
1711
|
+
char_code_at_generator.GenerateFast(masm());
|
1712
|
+
__ ret((argc + 1) * kPointerSize);
|
1713
|
+
|
1714
|
+
StubRuntimeCallHelper call_helper;
|
1715
|
+
char_code_at_generator.GenerateSlow(masm(), call_helper);
|
1716
|
+
|
1717
|
+
if (index_out_of_range.is_linked()) {
|
1718
|
+
__ bind(&index_out_of_range);
|
1719
|
+
__ Set(eax, Immediate(Factory::nan_value()));
|
1720
|
+
__ ret((argc + 1) * kPointerSize);
|
1721
|
+
}
|
1722
|
+
|
1723
|
+
__ bind(&miss);
|
1724
|
+
// Restore function name in ecx.
|
1725
|
+
__ Set(ecx, Immediate(Handle<String>(name)));
|
1726
|
+
__ bind(&name_miss);
|
1727
|
+
Object* obj;
|
1728
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
1729
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1730
|
+
}
|
1731
|
+
|
1732
|
+
// Return the generated code.
|
1733
|
+
return GetCode(function);
|
1734
|
+
}
|
1735
|
+
|
1736
|
+
|
1737
|
+
MaybeObject* CallStubCompiler::CompileStringCharAtCall(
|
1738
|
+
Object* object,
|
1739
|
+
JSObject* holder,
|
1740
|
+
JSGlobalPropertyCell* cell,
|
1741
|
+
JSFunction* function,
|
1742
|
+
String* name) {
|
1743
|
+
// ----------- S t a t e -------------
|
1744
|
+
// -- ecx : function name
|
1745
|
+
// -- esp[0] : return address
|
1746
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1747
|
+
// -- ...
|
1748
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1749
|
+
// -----------------------------------
|
1750
|
+
|
1751
|
+
// If object is not a string, bail out to regular call.
|
1752
|
+
if (!object->IsString() || cell != NULL) return Heap::undefined_value();
|
1753
|
+
|
1754
|
+
const int argc = arguments().immediate();
|
1755
|
+
|
1756
|
+
Label miss;
|
1757
|
+
Label name_miss;
|
1758
|
+
Label index_out_of_range;
|
1759
|
+
Label* index_out_of_range_label = &index_out_of_range;
|
1760
|
+
|
1761
|
+
if (kind_ == Code::CALL_IC && extra_ic_state_ == DEFAULT_STRING_STUB) {
|
1762
|
+
index_out_of_range_label = &miss;
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
GenerateNameCheck(name, &name_miss);
|
1766
|
+
|
1767
|
+
// Check that the maps starting from the prototype haven't changed.
|
1768
|
+
GenerateDirectLoadGlobalFunctionPrototype(masm(),
|
1769
|
+
Context::STRING_FUNCTION_INDEX,
|
1770
|
+
eax,
|
1771
|
+
&miss);
|
1772
|
+
ASSERT(object != holder);
|
1773
|
+
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
|
1774
|
+
ebx, edx, edi, name, &miss);
|
1775
|
+
|
1776
|
+
Register receiver = eax;
|
1777
|
+
Register index = edi;
|
1778
|
+
Register scratch1 = ebx;
|
1779
|
+
Register scratch2 = edx;
|
1780
|
+
Register result = eax;
|
1781
|
+
__ mov(receiver, Operand(esp, (argc + 1) * kPointerSize));
|
1782
|
+
if (argc > 0) {
|
1783
|
+
__ mov(index, Operand(esp, (argc - 0) * kPointerSize));
|
1784
|
+
} else {
|
1785
|
+
__ Set(index, Immediate(Factory::undefined_value()));
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
StringCharAtGenerator char_at_generator(receiver,
|
1789
|
+
index,
|
1790
|
+
scratch1,
|
1791
|
+
scratch2,
|
1792
|
+
result,
|
1793
|
+
&miss, // When not a string.
|
1794
|
+
&miss, // When not a number.
|
1795
|
+
index_out_of_range_label,
|
1796
|
+
STRING_INDEX_IS_NUMBER);
|
1797
|
+
char_at_generator.GenerateFast(masm());
|
1798
|
+
__ ret((argc + 1) * kPointerSize);
|
1799
|
+
|
1800
|
+
StubRuntimeCallHelper call_helper;
|
1801
|
+
char_at_generator.GenerateSlow(masm(), call_helper);
|
1802
|
+
|
1803
|
+
if (index_out_of_range.is_linked()) {
|
1804
|
+
__ bind(&index_out_of_range);
|
1805
|
+
__ Set(eax, Immediate(Factory::empty_string()));
|
1806
|
+
__ ret((argc + 1) * kPointerSize);
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
__ bind(&miss);
|
1810
|
+
// Restore function name in ecx.
|
1811
|
+
__ Set(ecx, Immediate(Handle<String>(name)));
|
1812
|
+
__ bind(&name_miss);
|
1813
|
+
Object* obj;
|
1814
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
1815
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
// Return the generated code.
|
1819
|
+
return GetCode(function);
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
|
1823
|
+
MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall(
|
1824
|
+
Object* object,
|
1825
|
+
JSObject* holder,
|
1826
|
+
JSGlobalPropertyCell* cell,
|
1827
|
+
JSFunction* function,
|
1828
|
+
String* name) {
|
1829
|
+
// ----------- S t a t e -------------
|
1830
|
+
// -- ecx : function name
|
1831
|
+
// -- esp[0] : return address
|
1832
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1833
|
+
// -- ...
|
1834
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1835
|
+
// -----------------------------------
|
1836
|
+
|
1837
|
+
const int argc = arguments().immediate();
|
1838
|
+
|
1839
|
+
// If the object is not a JSObject or we got an unexpected number of
|
1840
|
+
// arguments, bail out to the regular call.
|
1841
|
+
if (!object->IsJSObject() || argc != 1) return Heap::undefined_value();
|
1842
|
+
|
1843
|
+
Label miss;
|
1844
|
+
GenerateNameCheck(name, &miss);
|
1845
|
+
|
1846
|
+
if (cell == NULL) {
|
1847
|
+
__ mov(edx, Operand(esp, 2 * kPointerSize));
|
1848
|
+
|
1849
|
+
STATIC_ASSERT(kSmiTag == 0);
|
1850
|
+
__ test(edx, Immediate(kSmiTagMask));
|
1851
|
+
__ j(zero, &miss);
|
1852
|
+
|
1853
|
+
CheckPrototypes(JSObject::cast(object), edx, holder, ebx, eax, edi, name,
|
1854
|
+
&miss);
|
1855
|
+
} else {
|
1856
|
+
ASSERT(cell->value() == function);
|
1857
|
+
GenerateGlobalReceiverCheck(JSObject::cast(object), holder, name, &miss);
|
1858
|
+
GenerateLoadFunctionFromCell(cell, function, &miss);
|
1859
|
+
}
|
1860
|
+
|
1861
|
+
// Load the char code argument.
|
1862
|
+
Register code = ebx;
|
1863
|
+
__ mov(code, Operand(esp, 1 * kPointerSize));
|
1864
|
+
|
1865
|
+
// Check the code is a smi.
|
1866
|
+
Label slow;
|
1867
|
+
STATIC_ASSERT(kSmiTag == 0);
|
1868
|
+
__ test(code, Immediate(kSmiTagMask));
|
1869
|
+
__ j(not_zero, &slow);
|
1870
|
+
|
1871
|
+
// Convert the smi code to uint16.
|
1872
|
+
__ and_(code, Immediate(Smi::FromInt(0xffff)));
|
1873
|
+
|
1874
|
+
StringCharFromCodeGenerator char_from_code_generator(code, eax);
|
1875
|
+
char_from_code_generator.GenerateFast(masm());
|
1876
|
+
__ ret(2 * kPointerSize);
|
1877
|
+
|
1878
|
+
StubRuntimeCallHelper call_helper;
|
1879
|
+
char_from_code_generator.GenerateSlow(masm(), call_helper);
|
1880
|
+
|
1881
|
+
// Tail call the full function. We do not have to patch the receiver
|
1882
|
+
// because the function makes no use of it.
|
1883
|
+
__ bind(&slow);
|
1884
|
+
__ InvokeFunction(function, arguments(), JUMP_FUNCTION);
|
1885
|
+
|
1886
|
+
__ bind(&miss);
|
1887
|
+
// ecx: function name.
|
1888
|
+
Object* obj;
|
1889
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
1890
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1891
|
+
}
|
1892
|
+
|
1893
|
+
// Return the generated code.
|
1894
|
+
return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
|
1895
|
+
}
|
1896
|
+
|
1897
|
+
|
1898
|
+
MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object,
|
1899
|
+
JSObject* holder,
|
1900
|
+
JSGlobalPropertyCell* cell,
|
1901
|
+
JSFunction* function,
|
1902
|
+
String* name) {
|
1903
|
+
// ----------- S t a t e -------------
|
1904
|
+
// -- ecx : name
|
1905
|
+
// -- esp[0] : return address
|
1906
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
1907
|
+
// -- ...
|
1908
|
+
// -- esp[(argc + 1) * 4] : receiver
|
1909
|
+
// -----------------------------------
|
1910
|
+
|
1911
|
+
if (!CpuFeatures::IsSupported(SSE2)) return Heap::undefined_value();
|
1912
|
+
CpuFeatures::Scope use_sse2(SSE2);
|
1913
|
+
|
1914
|
+
const int argc = arguments().immediate();
|
1915
|
+
|
1916
|
+
// If the object is not a JSObject or we got an unexpected number of
|
1917
|
+
// arguments, bail out to the regular call.
|
1918
|
+
if (!object->IsJSObject() || argc != 1) return Heap::undefined_value();
|
1919
|
+
|
1920
|
+
Label miss;
|
1921
|
+
GenerateNameCheck(name, &miss);
|
1922
|
+
|
1923
|
+
if (cell == NULL) {
|
1924
|
+
__ mov(edx, Operand(esp, 2 * kPointerSize));
|
1925
|
+
|
1926
|
+
STATIC_ASSERT(kSmiTag == 0);
|
1927
|
+
__ test(edx, Immediate(kSmiTagMask));
|
1928
|
+
__ j(zero, &miss);
|
1929
|
+
|
1930
|
+
CheckPrototypes(JSObject::cast(object), edx, holder, ebx, eax, edi, name,
|
1931
|
+
&miss);
|
1932
|
+
} else {
|
1933
|
+
ASSERT(cell->value() == function);
|
1934
|
+
GenerateGlobalReceiverCheck(JSObject::cast(object), holder, name, &miss);
|
1935
|
+
GenerateLoadFunctionFromCell(cell, function, &miss);
|
1936
|
+
}
|
1937
|
+
|
1938
|
+
// Load the (only) argument into eax.
|
1939
|
+
__ mov(eax, Operand(esp, 1 * kPointerSize));
|
1940
|
+
|
1941
|
+
// Check if the argument is a smi.
|
1942
|
+
Label smi;
|
1943
|
+
STATIC_ASSERT(kSmiTag == 0);
|
1944
|
+
__ test(eax, Immediate(kSmiTagMask));
|
1945
|
+
__ j(zero, &smi);
|
1946
|
+
|
1947
|
+
// Check if the argument is a heap number and load its value into xmm0.
|
1948
|
+
Label slow;
|
1949
|
+
__ CheckMap(eax, Factory::heap_number_map(), &slow, true);
|
1950
|
+
__ movdbl(xmm0, FieldOperand(eax, HeapNumber::kValueOffset));
|
1951
|
+
|
1952
|
+
// Check if the argument is strictly positive. Note this also
|
1953
|
+
// discards NaN.
|
1954
|
+
__ xorpd(xmm1, xmm1);
|
1955
|
+
__ ucomisd(xmm0, xmm1);
|
1956
|
+
__ j(below_equal, &slow);
|
1957
|
+
|
1958
|
+
// Do a truncating conversion.
|
1959
|
+
__ cvttsd2si(eax, Operand(xmm0));
|
1960
|
+
|
1961
|
+
// Check if the result fits into a smi. Note this also checks for
|
1962
|
+
// 0x80000000 which signals a failed conversion.
|
1963
|
+
Label wont_fit_into_smi;
|
1964
|
+
__ test(eax, Immediate(0xc0000000));
|
1965
|
+
__ j(not_zero, &wont_fit_into_smi);
|
1966
|
+
|
1967
|
+
// Smi tag and return.
|
1968
|
+
__ SmiTag(eax);
|
1969
|
+
__ bind(&smi);
|
1970
|
+
__ ret(2 * kPointerSize);
|
1971
|
+
|
1972
|
+
// Check if the argument is < 2^kMantissaBits.
|
1973
|
+
Label already_round;
|
1974
|
+
__ bind(&wont_fit_into_smi);
|
1975
|
+
__ LoadPowerOf2(xmm1, ebx, HeapNumber::kMantissaBits);
|
1976
|
+
__ ucomisd(xmm0, xmm1);
|
1977
|
+
__ j(above_equal, &already_round);
|
1978
|
+
|
1979
|
+
// Save a copy of the argument.
|
1980
|
+
__ movaps(xmm2, xmm0);
|
1981
|
+
|
1982
|
+
// Compute (argument + 2^kMantissaBits) - 2^kMantissaBits.
|
1983
|
+
__ addsd(xmm0, xmm1);
|
1984
|
+
__ subsd(xmm0, xmm1);
|
1985
|
+
|
1986
|
+
// Compare the argument and the tentative result to get the right mask:
|
1987
|
+
// if xmm2 < xmm0:
|
1988
|
+
// xmm2 = 1...1
|
1989
|
+
// else:
|
1990
|
+
// xmm2 = 0...0
|
1991
|
+
__ cmpltsd(xmm2, xmm0);
|
1992
|
+
|
1993
|
+
// Subtract 1 if the argument was less than the tentative result.
|
1994
|
+
__ LoadPowerOf2(xmm1, ebx, 0);
|
1995
|
+
__ andpd(xmm1, xmm2);
|
1996
|
+
__ subsd(xmm0, xmm1);
|
1997
|
+
|
1998
|
+
// Return a new heap number.
|
1999
|
+
__ AllocateHeapNumber(eax, ebx, edx, &slow);
|
2000
|
+
__ movdbl(FieldOperand(eax, HeapNumber::kValueOffset), xmm0);
|
2001
|
+
__ ret(2 * kPointerSize);
|
2002
|
+
|
2003
|
+
// Return the argument (when it's an already round heap number).
|
2004
|
+
__ bind(&already_round);
|
2005
|
+
__ mov(eax, Operand(esp, 1 * kPointerSize));
|
2006
|
+
__ ret(2 * kPointerSize);
|
2007
|
+
|
2008
|
+
// Tail call the full function. We do not have to patch the receiver
|
2009
|
+
// because the function makes no use of it.
|
2010
|
+
__ bind(&slow);
|
2011
|
+
__ InvokeFunction(function, arguments(), JUMP_FUNCTION);
|
2012
|
+
|
2013
|
+
__ bind(&miss);
|
2014
|
+
// ecx: function name.
|
2015
|
+
Object* obj;
|
2016
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
2017
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2018
|
+
}
|
2019
|
+
|
2020
|
+
// Return the generated code.
|
2021
|
+
return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
|
2022
|
+
}
|
2023
|
+
|
2024
|
+
|
2025
|
+
MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object,
|
2026
|
+
JSObject* holder,
|
2027
|
+
JSGlobalPropertyCell* cell,
|
2028
|
+
JSFunction* function,
|
2029
|
+
String* name) {
|
2030
|
+
// ----------- S t a t e -------------
|
2031
|
+
// -- ecx : name
|
2032
|
+
// -- esp[0] : return address
|
2033
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
2034
|
+
// -- ...
|
2035
|
+
// -- esp[(argc + 1) * 4] : receiver
|
2036
|
+
// -----------------------------------
|
2037
|
+
|
2038
|
+
const int argc = arguments().immediate();
|
2039
|
+
|
2040
|
+
// If the object is not a JSObject or we got an unexpected number of
|
2041
|
+
// arguments, bail out to the regular call.
|
2042
|
+
if (!object->IsJSObject() || argc != 1) return Heap::undefined_value();
|
2043
|
+
|
2044
|
+
Label miss;
|
2045
|
+
GenerateNameCheck(name, &miss);
|
2046
|
+
|
2047
|
+
if (cell == NULL) {
|
2048
|
+
__ mov(edx, Operand(esp, 2 * kPointerSize));
|
2049
|
+
|
2050
|
+
STATIC_ASSERT(kSmiTag == 0);
|
2051
|
+
__ test(edx, Immediate(kSmiTagMask));
|
2052
|
+
__ j(zero, &miss);
|
2053
|
+
|
2054
|
+
CheckPrototypes(JSObject::cast(object), edx, holder, ebx, eax, edi, name,
|
2055
|
+
&miss);
|
2056
|
+
} else {
|
2057
|
+
ASSERT(cell->value() == function);
|
2058
|
+
GenerateGlobalReceiverCheck(JSObject::cast(object), holder, name, &miss);
|
2059
|
+
GenerateLoadFunctionFromCell(cell, function, &miss);
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
// Load the (only) argument into eax.
|
2063
|
+
__ mov(eax, Operand(esp, 1 * kPointerSize));
|
2064
|
+
|
2065
|
+
// Check if the argument is a smi.
|
2066
|
+
Label not_smi;
|
2067
|
+
STATIC_ASSERT(kSmiTag == 0);
|
2068
|
+
__ test(eax, Immediate(kSmiTagMask));
|
2069
|
+
__ j(not_zero, ¬_smi);
|
2070
|
+
|
2071
|
+
// Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0
|
2072
|
+
// otherwise.
|
2073
|
+
__ mov(ebx, eax);
|
2074
|
+
__ sar(ebx, kBitsPerInt - 1);
|
2075
|
+
|
2076
|
+
// Do bitwise not or do nothing depending on ebx.
|
2077
|
+
__ xor_(eax, Operand(ebx));
|
2078
|
+
|
2079
|
+
// Add 1 or do nothing depending on ebx.
|
2080
|
+
__ sub(eax, Operand(ebx));
|
2081
|
+
|
2082
|
+
// If the result is still negative, go to the slow case.
|
2083
|
+
// This only happens for the most negative smi.
|
2084
|
+
Label slow;
|
2085
|
+
__ j(negative, &slow);
|
2086
|
+
|
2087
|
+
// Smi case done.
|
2088
|
+
__ ret(2 * kPointerSize);
|
2089
|
+
|
2090
|
+
// Check if the argument is a heap number and load its exponent and
|
2091
|
+
// sign into ebx.
|
2092
|
+
__ bind(¬_smi);
|
2093
|
+
__ CheckMap(eax, Factory::heap_number_map(), &slow, true);
|
2094
|
+
__ mov(ebx, FieldOperand(eax, HeapNumber::kExponentOffset));
|
2095
|
+
|
2096
|
+
// Check the sign of the argument. If the argument is positive,
|
2097
|
+
// just return it.
|
2098
|
+
Label negative_sign;
|
2099
|
+
__ test(ebx, Immediate(HeapNumber::kSignMask));
|
2100
|
+
__ j(not_zero, &negative_sign);
|
2101
|
+
__ ret(2 * kPointerSize);
|
2102
|
+
|
2103
|
+
// If the argument is negative, clear the sign, and return a new
|
2104
|
+
// number.
|
2105
|
+
__ bind(&negative_sign);
|
2106
|
+
__ and_(ebx, ~HeapNumber::kSignMask);
|
2107
|
+
__ mov(ecx, FieldOperand(eax, HeapNumber::kMantissaOffset));
|
2108
|
+
__ AllocateHeapNumber(eax, edi, edx, &slow);
|
2109
|
+
__ mov(FieldOperand(eax, HeapNumber::kExponentOffset), ebx);
|
2110
|
+
__ mov(FieldOperand(eax, HeapNumber::kMantissaOffset), ecx);
|
2111
|
+
__ ret(2 * kPointerSize);
|
2112
|
+
|
2113
|
+
// Tail call the full function. We do not have to patch the receiver
|
2114
|
+
// because the function makes no use of it.
|
2115
|
+
__ bind(&slow);
|
2116
|
+
__ InvokeFunction(function, arguments(), JUMP_FUNCTION);
|
2117
|
+
|
2118
|
+
__ bind(&miss);
|
2119
|
+
// ecx: function name.
|
2120
|
+
Object* obj;
|
2121
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
2122
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2123
|
+
}
|
2124
|
+
|
2125
|
+
// Return the generated code.
|
2126
|
+
return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
|
2127
|
+
}
|
2128
|
+
|
2129
|
+
|
2130
|
+
MaybeObject* CallStubCompiler::CompileCallConstant(Object* object,
|
2131
|
+
JSObject* holder,
|
2132
|
+
JSFunction* function,
|
2133
|
+
String* name,
|
2134
|
+
CheckType check) {
|
2135
|
+
// ----------- S t a t e -------------
|
2136
|
+
// -- ecx : name
|
2137
|
+
// -- esp[0] : return address
|
2138
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
2139
|
+
// -- ...
|
2140
|
+
// -- esp[(argc + 1) * 4] : receiver
|
2141
|
+
// -----------------------------------
|
2142
|
+
|
2143
|
+
SharedFunctionInfo* function_info = function->shared();
|
2144
|
+
if (function_info->HasBuiltinFunctionId()) {
|
2145
|
+
BuiltinFunctionId id = function_info->builtin_function_id();
|
2146
|
+
MaybeObject* maybe_result = CompileCustomCall(
|
2147
|
+
id, object, holder, NULL, function, name);
|
2148
|
+
Object* result;
|
2149
|
+
if (!maybe_result->ToObject(&result)) return maybe_result;
|
2150
|
+
// undefined means bail out to regular compiler.
|
2151
|
+
if (!result->IsUndefined()) return result;
|
2152
|
+
}
|
2153
|
+
|
2154
|
+
Label miss_in_smi_check;
|
2155
|
+
|
2156
|
+
GenerateNameCheck(name, &miss_in_smi_check);
|
2157
|
+
|
2158
|
+
// Get the receiver from the stack.
|
2159
|
+
const int argc = arguments().immediate();
|
2160
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
2161
|
+
|
2162
|
+
// Check that the receiver isn't a smi.
|
2163
|
+
if (check != NUMBER_CHECK) {
|
2164
|
+
__ test(edx, Immediate(kSmiTagMask));
|
2165
|
+
__ j(zero, &miss_in_smi_check, not_taken);
|
2166
|
+
}
|
2167
|
+
|
2168
|
+
// Make sure that it's okay not to patch the on stack receiver
|
2169
|
+
// unless we're doing a receiver map check.
|
2170
|
+
ASSERT(!object->IsGlobalObject() || check == RECEIVER_MAP_CHECK);
|
2171
|
+
|
2172
|
+
CallOptimization optimization(function);
|
2173
|
+
int depth = kInvalidProtoDepth;
|
2174
|
+
Label miss;
|
2175
|
+
|
2176
|
+
switch (check) {
|
2177
|
+
case RECEIVER_MAP_CHECK:
|
2178
|
+
__ IncrementCounter(&Counters::call_const, 1);
|
2179
|
+
|
2180
|
+
if (optimization.is_simple_api_call() && !object->IsGlobalObject()) {
|
2181
|
+
depth = optimization.GetPrototypeDepthOfExpectedType(
|
2182
|
+
JSObject::cast(object), holder);
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
if (depth != kInvalidProtoDepth) {
|
2186
|
+
__ IncrementCounter(&Counters::call_const_fast_api, 1);
|
2187
|
+
|
2188
|
+
// Allocate space for v8::Arguments implicit values. Must be initialized
|
2189
|
+
// before to call any runtime function.
|
2190
|
+
__ sub(Operand(esp), Immediate(kFastApiCallArguments * kPointerSize));
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
// Check that the maps haven't changed.
|
2194
|
+
CheckPrototypes(JSObject::cast(object), edx, holder,
|
2195
|
+
ebx, eax, edi, name, depth, &miss);
|
2196
|
+
|
2197
|
+
// Patch the receiver on the stack with the global proxy if
|
2198
|
+
// necessary.
|
2199
|
+
if (object->IsGlobalObject()) {
|
2200
|
+
ASSERT(depth == kInvalidProtoDepth);
|
2201
|
+
__ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
|
2202
|
+
__ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
|
2203
|
+
}
|
2204
|
+
break;
|
2205
|
+
|
2206
|
+
case STRING_CHECK:
|
2207
|
+
if (!function->IsBuiltin() && !function_info->strict_mode()) {
|
2208
|
+
// Calling non-strict non-builtins with a value as the receiver
|
2209
|
+
// requires boxing.
|
2210
|
+
__ jmp(&miss);
|
2211
|
+
} else {
|
2212
|
+
// Check that the object is a string or a symbol.
|
2213
|
+
__ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax);
|
2214
|
+
__ j(above_equal, &miss, not_taken);
|
2215
|
+
// Check that the maps starting from the prototype haven't changed.
|
2216
|
+
GenerateDirectLoadGlobalFunctionPrototype(
|
2217
|
+
masm(), Context::STRING_FUNCTION_INDEX, eax, &miss);
|
2218
|
+
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
|
2219
|
+
ebx, edx, edi, name, &miss);
|
2220
|
+
}
|
2221
|
+
break;
|
2222
|
+
|
2223
|
+
case NUMBER_CHECK: {
|
2224
|
+
if (!function->IsBuiltin() && !function_info->strict_mode()) {
|
2225
|
+
// Calling non-strict non-builtins with a value as the receiver
|
2226
|
+
// requires boxing.
|
2227
|
+
__ jmp(&miss);
|
2228
|
+
} else {
|
2229
|
+
Label fast;
|
2230
|
+
// Check that the object is a smi or a heap number.
|
2231
|
+
__ test(edx, Immediate(kSmiTagMask));
|
2232
|
+
__ j(zero, &fast, taken);
|
2233
|
+
__ CmpObjectType(edx, HEAP_NUMBER_TYPE, eax);
|
2234
|
+
__ j(not_equal, &miss, not_taken);
|
2235
|
+
__ bind(&fast);
|
2236
|
+
// Check that the maps starting from the prototype haven't changed.
|
2237
|
+
GenerateDirectLoadGlobalFunctionPrototype(
|
2238
|
+
masm(), Context::NUMBER_FUNCTION_INDEX, eax, &miss);
|
2239
|
+
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
|
2240
|
+
ebx, edx, edi, name, &miss);
|
2241
|
+
}
|
2242
|
+
break;
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
case BOOLEAN_CHECK: {
|
2246
|
+
if (!function->IsBuiltin() && !function_info->strict_mode()) {
|
2247
|
+
// Calling non-strict non-builtins with a value as the receiver
|
2248
|
+
// requires boxing.
|
2249
|
+
__ jmp(&miss);
|
2250
|
+
} else {
|
2251
|
+
Label fast;
|
2252
|
+
// Check that the object is a boolean.
|
2253
|
+
__ cmp(edx, Factory::true_value());
|
2254
|
+
__ j(equal, &fast, taken);
|
2255
|
+
__ cmp(edx, Factory::false_value());
|
2256
|
+
__ j(not_equal, &miss, not_taken);
|
2257
|
+
__ bind(&fast);
|
2258
|
+
// Check that the maps starting from the prototype haven't changed.
|
2259
|
+
GenerateDirectLoadGlobalFunctionPrototype(
|
2260
|
+
masm(), Context::BOOLEAN_FUNCTION_INDEX, eax, &miss);
|
2261
|
+
CheckPrototypes(JSObject::cast(object->GetPrototype()), eax, holder,
|
2262
|
+
ebx, edx, edi, name, &miss);
|
2263
|
+
}
|
2264
|
+
break;
|
2265
|
+
}
|
2266
|
+
|
2267
|
+
default:
|
2268
|
+
UNREACHABLE();
|
2269
|
+
}
|
2270
|
+
|
2271
|
+
if (depth != kInvalidProtoDepth) {
|
2272
|
+
// Move the return address on top of the stack.
|
2273
|
+
__ mov(eax, Operand(esp, 3 * kPointerSize));
|
2274
|
+
__ mov(Operand(esp, 0 * kPointerSize), eax);
|
2275
|
+
|
2276
|
+
// esp[2 * kPointerSize] is uninitialized, esp[3 * kPointerSize] contains
|
2277
|
+
// duplicate of return address and will be overwritten.
|
2278
|
+
MaybeObject* result = GenerateFastApiCall(masm(), optimization, argc);
|
2279
|
+
if (result->IsFailure()) return result;
|
2280
|
+
} else {
|
2281
|
+
__ InvokeFunction(function, arguments(), JUMP_FUNCTION);
|
2282
|
+
}
|
2283
|
+
|
2284
|
+
// Handle call cache miss.
|
2285
|
+
__ bind(&miss);
|
2286
|
+
if (depth != kInvalidProtoDepth) {
|
2287
|
+
__ add(Operand(esp), Immediate(kFastApiCallArguments * kPointerSize));
|
2288
|
+
}
|
2289
|
+
__ bind(&miss_in_smi_check);
|
2290
|
+
Object* obj;
|
2291
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
2292
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2293
|
+
}
|
2294
|
+
|
2295
|
+
// Return the generated code.
|
2296
|
+
return GetCode(function);
|
2297
|
+
}
|
2298
|
+
|
2299
|
+
|
2300
|
+
MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object,
|
2301
|
+
JSObject* holder,
|
2302
|
+
String* name) {
|
2303
|
+
// ----------- S t a t e -------------
|
2304
|
+
// -- ecx : name
|
2305
|
+
// -- esp[0] : return address
|
2306
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
2307
|
+
// -- ...
|
2308
|
+
// -- esp[(argc + 1) * 4] : receiver
|
2309
|
+
// -----------------------------------
|
2310
|
+
Label miss;
|
2311
|
+
|
2312
|
+
GenerateNameCheck(name, &miss);
|
2313
|
+
|
2314
|
+
// Get the number of arguments.
|
2315
|
+
const int argc = arguments().immediate();
|
2316
|
+
|
2317
|
+
LookupResult lookup;
|
2318
|
+
LookupPostInterceptor(holder, name, &lookup);
|
2319
|
+
|
2320
|
+
// Get the receiver from the stack.
|
2321
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
2322
|
+
|
2323
|
+
CallInterceptorCompiler compiler(this, arguments(), ecx);
|
2324
|
+
MaybeObject* result = compiler.Compile(masm(),
|
2325
|
+
object,
|
2326
|
+
holder,
|
2327
|
+
name,
|
2328
|
+
&lookup,
|
2329
|
+
edx,
|
2330
|
+
ebx,
|
2331
|
+
edi,
|
2332
|
+
eax,
|
2333
|
+
&miss);
|
2334
|
+
if (result->IsFailure()) return result;
|
2335
|
+
|
2336
|
+
// Restore receiver.
|
2337
|
+
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
|
2338
|
+
|
2339
|
+
// Check that the function really is a function.
|
2340
|
+
__ test(eax, Immediate(kSmiTagMask));
|
2341
|
+
__ j(zero, &miss, not_taken);
|
2342
|
+
__ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx);
|
2343
|
+
__ j(not_equal, &miss, not_taken);
|
2344
|
+
|
2345
|
+
// Patch the receiver on the stack with the global proxy if
|
2346
|
+
// necessary.
|
2347
|
+
if (object->IsGlobalObject()) {
|
2348
|
+
__ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
|
2349
|
+
__ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
|
2350
|
+
}
|
2351
|
+
|
2352
|
+
// Invoke the function.
|
2353
|
+
__ mov(edi, eax);
|
2354
|
+
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
|
2355
|
+
|
2356
|
+
// Handle load cache miss.
|
2357
|
+
__ bind(&miss);
|
2358
|
+
Object* obj;
|
2359
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
2360
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2361
|
+
}
|
2362
|
+
|
2363
|
+
// Return the generated code.
|
2364
|
+
return GetCode(INTERCEPTOR, name);
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
|
2368
|
+
MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object,
|
2369
|
+
GlobalObject* holder,
|
2370
|
+
JSGlobalPropertyCell* cell,
|
2371
|
+
JSFunction* function,
|
2372
|
+
String* name) {
|
2373
|
+
// ----------- S t a t e -------------
|
2374
|
+
// -- ecx : name
|
2375
|
+
// -- esp[0] : return address
|
2376
|
+
// -- esp[(argc - n) * 4] : arg[n] (zero-based)
|
2377
|
+
// -- ...
|
2378
|
+
// -- esp[(argc + 1) * 4] : receiver
|
2379
|
+
// -----------------------------------
|
2380
|
+
|
2381
|
+
SharedFunctionInfo* function_info = function->shared();
|
2382
|
+
if (function_info->HasBuiltinFunctionId()) {
|
2383
|
+
BuiltinFunctionId id = function_info->builtin_function_id();
|
2384
|
+
MaybeObject* maybe_result = CompileCustomCall(
|
2385
|
+
id, object, holder, cell, function, name);
|
2386
|
+
Object* result;
|
2387
|
+
if (!maybe_result->ToObject(&result)) return maybe_result;
|
2388
|
+
// undefined means bail out to regular compiler.
|
2389
|
+
if (!result->IsUndefined()) return result;
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
Label miss;
|
2393
|
+
|
2394
|
+
GenerateNameCheck(name, &miss);
|
2395
|
+
|
2396
|
+
// Get the number of arguments.
|
2397
|
+
const int argc = arguments().immediate();
|
2398
|
+
|
2399
|
+
GenerateGlobalReceiverCheck(object, holder, name, &miss);
|
2400
|
+
|
2401
|
+
GenerateLoadFunctionFromCell(cell, function, &miss);
|
2402
|
+
|
2403
|
+
// Patch the receiver on the stack with the global proxy.
|
2404
|
+
if (object->IsGlobalObject()) {
|
2405
|
+
__ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
|
2406
|
+
__ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
|
2407
|
+
}
|
2408
|
+
|
2409
|
+
// Setup the context (function already in edi).
|
2410
|
+
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
|
2411
|
+
|
2412
|
+
// Jump to the cached code (tail call).
|
2413
|
+
__ IncrementCounter(&Counters::call_global_inline, 1);
|
2414
|
+
ASSERT(function->is_compiled());
|
2415
|
+
ParameterCount expected(function->shared()->formal_parameter_count());
|
2416
|
+
if (V8::UseCrankshaft()) {
|
2417
|
+
// TODO(kasperl): For now, we always call indirectly through the
|
2418
|
+
// code field in the function to allow recompilation to take effect
|
2419
|
+
// without changing any of the call sites.
|
2420
|
+
__ InvokeCode(FieldOperand(edi, JSFunction::kCodeEntryOffset),
|
2421
|
+
expected, arguments(), JUMP_FUNCTION);
|
2422
|
+
} else {
|
2423
|
+
Handle<Code> code(function->code());
|
2424
|
+
__ InvokeCode(code, expected, arguments(),
|
2425
|
+
RelocInfo::CODE_TARGET, JUMP_FUNCTION);
|
2426
|
+
}
|
2427
|
+
|
2428
|
+
// Handle call cache miss.
|
2429
|
+
__ bind(&miss);
|
2430
|
+
__ IncrementCounter(&Counters::call_global_inline_miss, 1);
|
2431
|
+
Object* obj;
|
2432
|
+
{ MaybeObject* maybe_obj = GenerateMissBranch();
|
2433
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2434
|
+
}
|
2435
|
+
|
2436
|
+
// Return the generated code.
|
2437
|
+
return GetCode(NORMAL, name);
|
2438
|
+
}
|
2439
|
+
|
2440
|
+
|
2441
|
+
MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object,
|
2442
|
+
int index,
|
2443
|
+
Map* transition,
|
2444
|
+
String* name) {
|
2445
|
+
// ----------- S t a t e -------------
|
2446
|
+
// -- eax : value
|
2447
|
+
// -- ecx : name
|
2448
|
+
// -- edx : receiver
|
2449
|
+
// -- esp[0] : return address
|
2450
|
+
// -----------------------------------
|
2451
|
+
Label miss;
|
2452
|
+
|
2453
|
+
// Generate store field code. Trashes the name register.
|
2454
|
+
GenerateStoreField(masm(),
|
2455
|
+
object,
|
2456
|
+
index,
|
2457
|
+
transition,
|
2458
|
+
edx, ecx, ebx,
|
2459
|
+
&miss);
|
2460
|
+
|
2461
|
+
// Handle store cache miss.
|
2462
|
+
__ bind(&miss);
|
2463
|
+
__ mov(ecx, Immediate(Handle<String>(name))); // restore name
|
2464
|
+
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
|
2465
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2466
|
+
|
2467
|
+
// Return the generated code.
|
2468
|
+
return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
|
2469
|
+
}
|
2470
|
+
|
2471
|
+
|
2472
|
+
MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object,
|
2473
|
+
AccessorInfo* callback,
|
2474
|
+
String* name) {
|
2475
|
+
// ----------- S t a t e -------------
|
2476
|
+
// -- eax : value
|
2477
|
+
// -- ecx : name
|
2478
|
+
// -- edx : receiver
|
2479
|
+
// -- esp[0] : return address
|
2480
|
+
// -----------------------------------
|
2481
|
+
Label miss;
|
2482
|
+
|
2483
|
+
// Check that the object isn't a smi.
|
2484
|
+
__ test(edx, Immediate(kSmiTagMask));
|
2485
|
+
__ j(zero, &miss, not_taken);
|
2486
|
+
|
2487
|
+
// Check that the map of the object hasn't changed.
|
2488
|
+
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
|
2489
|
+
Immediate(Handle<Map>(object->map())));
|
2490
|
+
__ j(not_equal, &miss, not_taken);
|
2491
|
+
|
2492
|
+
// Perform global security token check if needed.
|
2493
|
+
if (object->IsJSGlobalProxy()) {
|
2494
|
+
__ CheckAccessGlobalProxy(edx, ebx, &miss);
|
2495
|
+
}
|
2496
|
+
|
2497
|
+
// Stub never generated for non-global objects that require access
|
2498
|
+
// checks.
|
2499
|
+
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
|
2500
|
+
|
2501
|
+
__ pop(ebx); // remove the return address
|
2502
|
+
__ push(edx); // receiver
|
2503
|
+
__ push(Immediate(Handle<AccessorInfo>(callback))); // callback info
|
2504
|
+
__ push(ecx); // name
|
2505
|
+
__ push(eax); // value
|
2506
|
+
__ push(ebx); // restore return address
|
2507
|
+
|
2508
|
+
// Do tail-call to the runtime system.
|
2509
|
+
ExternalReference store_callback_property =
|
2510
|
+
ExternalReference(IC_Utility(IC::kStoreCallbackProperty));
|
2511
|
+
__ TailCallExternalReference(store_callback_property, 4, 1);
|
2512
|
+
|
2513
|
+
// Handle store cache miss.
|
2514
|
+
__ bind(&miss);
|
2515
|
+
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
|
2516
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2517
|
+
|
2518
|
+
// Return the generated code.
|
2519
|
+
return GetCode(CALLBACKS, name);
|
2520
|
+
}
|
2521
|
+
|
2522
|
+
|
2523
|
+
MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
|
2524
|
+
String* name) {
|
2525
|
+
// ----------- S t a t e -------------
|
2526
|
+
// -- eax : value
|
2527
|
+
// -- ecx : name
|
2528
|
+
// -- edx : receiver
|
2529
|
+
// -- esp[0] : return address
|
2530
|
+
// -----------------------------------
|
2531
|
+
Label miss;
|
2532
|
+
|
2533
|
+
// Check that the object isn't a smi.
|
2534
|
+
__ test(edx, Immediate(kSmiTagMask));
|
2535
|
+
__ j(zero, &miss, not_taken);
|
2536
|
+
|
2537
|
+
// Check that the map of the object hasn't changed.
|
2538
|
+
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
|
2539
|
+
Immediate(Handle<Map>(receiver->map())));
|
2540
|
+
__ j(not_equal, &miss, not_taken);
|
2541
|
+
|
2542
|
+
// Perform global security token check if needed.
|
2543
|
+
if (receiver->IsJSGlobalProxy()) {
|
2544
|
+
__ CheckAccessGlobalProxy(edx, ebx, &miss);
|
2545
|
+
}
|
2546
|
+
|
2547
|
+
// Stub never generated for non-global objects that require access
|
2548
|
+
// checks.
|
2549
|
+
ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
|
2550
|
+
|
2551
|
+
__ pop(ebx); // remove the return address
|
2552
|
+
__ push(edx); // receiver
|
2553
|
+
__ push(ecx); // name
|
2554
|
+
__ push(eax); // value
|
2555
|
+
__ push(Immediate(Smi::FromInt(strict_mode_)));
|
2556
|
+
__ push(ebx); // restore return address
|
2557
|
+
|
2558
|
+
// Do tail-call to the runtime system.
|
2559
|
+
ExternalReference store_ic_property =
|
2560
|
+
ExternalReference(IC_Utility(IC::kStoreInterceptorProperty));
|
2561
|
+
__ TailCallExternalReference(store_ic_property, 4, 1);
|
2562
|
+
|
2563
|
+
// Handle store cache miss.
|
2564
|
+
__ bind(&miss);
|
2565
|
+
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
|
2566
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2567
|
+
|
2568
|
+
// Return the generated code.
|
2569
|
+
return GetCode(INTERCEPTOR, name);
|
2570
|
+
}
|
2571
|
+
|
2572
|
+
|
2573
|
+
MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
|
2574
|
+
JSGlobalPropertyCell* cell,
|
2575
|
+
String* name) {
|
2576
|
+
// ----------- S t a t e -------------
|
2577
|
+
// -- eax : value
|
2578
|
+
// -- ecx : name
|
2579
|
+
// -- edx : receiver
|
2580
|
+
// -- esp[0] : return address
|
2581
|
+
// -----------------------------------
|
2582
|
+
Label miss;
|
2583
|
+
|
2584
|
+
// Check that the map of the global has not changed.
|
2585
|
+
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
|
2586
|
+
Immediate(Handle<Map>(object->map())));
|
2587
|
+
__ j(not_equal, &miss, not_taken);
|
2588
|
+
|
2589
|
+
|
2590
|
+
// Compute the cell operand to use.
|
2591
|
+
Operand cell_operand = Operand::Cell(Handle<JSGlobalPropertyCell>(cell));
|
2592
|
+
if (Serializer::enabled()) {
|
2593
|
+
__ mov(ebx, Immediate(Handle<JSGlobalPropertyCell>(cell)));
|
2594
|
+
cell_operand = FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset);
|
2595
|
+
}
|
2596
|
+
|
2597
|
+
// Check that the value in the cell is not the hole. If it is, this
|
2598
|
+
// cell could have been deleted and reintroducing the global needs
|
2599
|
+
// to update the property details in the property dictionary of the
|
2600
|
+
// global object. We bail out to the runtime system to do that.
|
2601
|
+
__ cmp(cell_operand, Factory::the_hole_value());
|
2602
|
+
__ j(equal, &miss);
|
2603
|
+
|
2604
|
+
// Store the value in the cell.
|
2605
|
+
__ mov(cell_operand, eax);
|
2606
|
+
|
2607
|
+
// Return the value (register eax).
|
2608
|
+
__ IncrementCounter(&Counters::named_store_global_inline, 1);
|
2609
|
+
__ ret(0);
|
2610
|
+
|
2611
|
+
// Handle store cache miss.
|
2612
|
+
__ bind(&miss);
|
2613
|
+
__ IncrementCounter(&Counters::named_store_global_inline_miss, 1);
|
2614
|
+
Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
|
2615
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2616
|
+
|
2617
|
+
// Return the generated code.
|
2618
|
+
return GetCode(NORMAL, name);
|
2619
|
+
}
|
2620
|
+
|
2621
|
+
|
2622
|
+
MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
|
2623
|
+
int index,
|
2624
|
+
Map* transition,
|
2625
|
+
String* name) {
|
2626
|
+
// ----------- S t a t e -------------
|
2627
|
+
// -- eax : value
|
2628
|
+
// -- ecx : key
|
2629
|
+
// -- edx : receiver
|
2630
|
+
// -- esp[0] : return address
|
2631
|
+
// -----------------------------------
|
2632
|
+
Label miss;
|
2633
|
+
|
2634
|
+
__ IncrementCounter(&Counters::keyed_store_field, 1);
|
2635
|
+
|
2636
|
+
// Check that the name has not changed.
|
2637
|
+
__ cmp(Operand(ecx), Immediate(Handle<String>(name)));
|
2638
|
+
__ j(not_equal, &miss, not_taken);
|
2639
|
+
|
2640
|
+
// Generate store field code. Trashes the name register.
|
2641
|
+
GenerateStoreField(masm(),
|
2642
|
+
object,
|
2643
|
+
index,
|
2644
|
+
transition,
|
2645
|
+
edx, ecx, ebx,
|
2646
|
+
&miss);
|
2647
|
+
|
2648
|
+
// Handle store cache miss.
|
2649
|
+
__ bind(&miss);
|
2650
|
+
__ DecrementCounter(&Counters::keyed_store_field, 1);
|
2651
|
+
Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss));
|
2652
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2653
|
+
|
2654
|
+
// Return the generated code.
|
2655
|
+
return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
|
2656
|
+
}
|
2657
|
+
|
2658
|
+
|
2659
|
+
MaybeObject* KeyedStoreStubCompiler::CompileStoreSpecialized(
|
2660
|
+
JSObject* receiver) {
|
2661
|
+
// ----------- S t a t e -------------
|
2662
|
+
// -- eax : value
|
2663
|
+
// -- ecx : key
|
2664
|
+
// -- edx : receiver
|
2665
|
+
// -- esp[0] : return address
|
2666
|
+
// -----------------------------------
|
2667
|
+
Label miss;
|
2668
|
+
|
2669
|
+
// Check that the receiver isn't a smi.
|
2670
|
+
__ test(edx, Immediate(kSmiTagMask));
|
2671
|
+
__ j(zero, &miss, not_taken);
|
2672
|
+
|
2673
|
+
// Check that the map matches.
|
2674
|
+
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
|
2675
|
+
Immediate(Handle<Map>(receiver->map())));
|
2676
|
+
__ j(not_equal, &miss, not_taken);
|
2677
|
+
|
2678
|
+
// Check that the key is a smi.
|
2679
|
+
__ test(ecx, Immediate(kSmiTagMask));
|
2680
|
+
__ j(not_zero, &miss, not_taken);
|
2681
|
+
|
2682
|
+
// Get the elements array and make sure it is a fast element array, not 'cow'.
|
2683
|
+
__ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
|
2684
|
+
__ cmp(FieldOperand(edi, HeapObject::kMapOffset),
|
2685
|
+
Immediate(Factory::fixed_array_map()));
|
2686
|
+
__ j(not_equal, &miss, not_taken);
|
2687
|
+
|
2688
|
+
// Check that the key is within bounds.
|
2689
|
+
if (receiver->IsJSArray()) {
|
2690
|
+
__ cmp(ecx, FieldOperand(edx, JSArray::kLengthOffset)); // Compare smis.
|
2691
|
+
__ j(above_equal, &miss, not_taken);
|
2692
|
+
} else {
|
2693
|
+
__ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); // Compare smis.
|
2694
|
+
__ j(above_equal, &miss, not_taken);
|
2695
|
+
}
|
2696
|
+
|
2697
|
+
// Do the store and update the write barrier. Make sure to preserve
|
2698
|
+
// the value in register eax.
|
2699
|
+
__ mov(edx, Operand(eax));
|
2700
|
+
__ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax);
|
2701
|
+
__ RecordWrite(edi, 0, edx, ecx);
|
2702
|
+
|
2703
|
+
// Done.
|
2704
|
+
__ ret(0);
|
2705
|
+
|
2706
|
+
// Handle store cache miss.
|
2707
|
+
__ bind(&miss);
|
2708
|
+
Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss));
|
2709
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2710
|
+
|
2711
|
+
// Return the generated code.
|
2712
|
+
return GetCode(NORMAL, NULL);
|
2713
|
+
}
|
2714
|
+
|
2715
|
+
|
2716
|
+
MaybeObject* KeyedStoreStubCompiler::CompileStorePixelArray(
|
2717
|
+
JSObject* receiver) {
|
2718
|
+
// ----------- S t a t e -------------
|
2719
|
+
// -- eax : value
|
2720
|
+
// -- ecx : key
|
2721
|
+
// -- edx : receiver
|
2722
|
+
// -- esp[0] : return address
|
2723
|
+
// -----------------------------------
|
2724
|
+
Label miss;
|
2725
|
+
|
2726
|
+
// Check that the map matches.
|
2727
|
+
__ CheckMap(edx, Handle<Map>(receiver->map()), &miss, false);
|
2728
|
+
|
2729
|
+
// Do the load.
|
2730
|
+
GenerateFastPixelArrayStore(masm(),
|
2731
|
+
edx,
|
2732
|
+
ecx,
|
2733
|
+
eax,
|
2734
|
+
edi,
|
2735
|
+
ebx,
|
2736
|
+
true,
|
2737
|
+
&miss,
|
2738
|
+
&miss,
|
2739
|
+
NULL,
|
2740
|
+
&miss);
|
2741
|
+
|
2742
|
+
// Handle store cache miss.
|
2743
|
+
__ bind(&miss);
|
2744
|
+
Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss));
|
2745
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
2746
|
+
|
2747
|
+
// Return the generated code.
|
2748
|
+
return GetCode(NORMAL, NULL);
|
2749
|
+
}
|
2750
|
+
|
2751
|
+
|
2752
|
+
MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name,
|
2753
|
+
JSObject* object,
|
2754
|
+
JSObject* last) {
|
2755
|
+
// ----------- S t a t e -------------
|
2756
|
+
// -- eax : receiver
|
2757
|
+
// -- ecx : name
|
2758
|
+
// -- esp[0] : return address
|
2759
|
+
// -----------------------------------
|
2760
|
+
Label miss;
|
2761
|
+
|
2762
|
+
// Check that the receiver isn't a smi.
|
2763
|
+
__ test(eax, Immediate(kSmiTagMask));
|
2764
|
+
__ j(zero, &miss, not_taken);
|
2765
|
+
|
2766
|
+
ASSERT(last->IsGlobalObject() || last->HasFastProperties());
|
2767
|
+
|
2768
|
+
// Check the maps of the full prototype chain. Also check that
|
2769
|
+
// global property cells up to (but not including) the last object
|
2770
|
+
// in the prototype chain are empty.
|
2771
|
+
CheckPrototypes(object, eax, last, ebx, edx, edi, name, &miss);
|
2772
|
+
|
2773
|
+
// If the last object in the prototype chain is a global object,
|
2774
|
+
// check that the global property cell is empty.
|
2775
|
+
if (last->IsGlobalObject()) {
|
2776
|
+
MaybeObject* cell = GenerateCheckPropertyCell(masm(),
|
2777
|
+
GlobalObject::cast(last),
|
2778
|
+
name,
|
2779
|
+
edx,
|
2780
|
+
&miss);
|
2781
|
+
if (cell->IsFailure()) {
|
2782
|
+
miss.Unuse();
|
2783
|
+
return cell;
|
2784
|
+
}
|
2785
|
+
}
|
2786
|
+
|
2787
|
+
// Return undefined if maps of the full prototype chain are still the
|
2788
|
+
// same and no global property with this name contains a value.
|
2789
|
+
__ mov(eax, Factory::undefined_value());
|
2790
|
+
__ ret(0);
|
2791
|
+
|
2792
|
+
__ bind(&miss);
|
2793
|
+
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
2794
|
+
|
2795
|
+
// Return the generated code.
|
2796
|
+
return GetCode(NONEXISTENT, Heap::empty_string());
|
2797
|
+
}
|
2798
|
+
|
2799
|
+
|
2800
|
+
MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object,
|
2801
|
+
JSObject* holder,
|
2802
|
+
int index,
|
2803
|
+
String* name) {
|
2804
|
+
// ----------- S t a t e -------------
|
2805
|
+
// -- eax : receiver
|
2806
|
+
// -- ecx : name
|
2807
|
+
// -- esp[0] : return address
|
2808
|
+
// -----------------------------------
|
2809
|
+
Label miss;
|
2810
|
+
|
2811
|
+
GenerateLoadField(object, holder, eax, ebx, edx, edi, index, name, &miss);
|
2812
|
+
__ bind(&miss);
|
2813
|
+
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
2814
|
+
|
2815
|
+
// Return the generated code.
|
2816
|
+
return GetCode(FIELD, name);
|
2817
|
+
}
|
2818
|
+
|
2819
|
+
|
2820
|
+
MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name,
|
2821
|
+
JSObject* object,
|
2822
|
+
JSObject* holder,
|
2823
|
+
AccessorInfo* callback) {
|
2824
|
+
// ----------- S t a t e -------------
|
2825
|
+
// -- eax : receiver
|
2826
|
+
// -- ecx : name
|
2827
|
+
// -- esp[0] : return address
|
2828
|
+
// -----------------------------------
|
2829
|
+
Label miss;
|
2830
|
+
|
2831
|
+
MaybeObject* result = GenerateLoadCallback(object, holder, eax, ecx, ebx, edx,
|
2832
|
+
edi, callback, name, &miss);
|
2833
|
+
if (result->IsFailure()) {
|
2834
|
+
miss.Unuse();
|
2835
|
+
return result;
|
2836
|
+
}
|
2837
|
+
|
2838
|
+
__ bind(&miss);
|
2839
|
+
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
2840
|
+
|
2841
|
+
// Return the generated code.
|
2842
|
+
return GetCode(CALLBACKS, name);
|
2843
|
+
}
|
2844
|
+
|
2845
|
+
|
2846
|
+
MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object,
|
2847
|
+
JSObject* holder,
|
2848
|
+
Object* value,
|
2849
|
+
String* name) {
|
2850
|
+
// ----------- S t a t e -------------
|
2851
|
+
// -- eax : receiver
|
2852
|
+
// -- ecx : name
|
2853
|
+
// -- esp[0] : return address
|
2854
|
+
// -----------------------------------
|
2855
|
+
Label miss;
|
2856
|
+
|
2857
|
+
GenerateLoadConstant(object, holder, eax, ebx, edx, edi, value, name, &miss);
|
2858
|
+
__ bind(&miss);
|
2859
|
+
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
2860
|
+
|
2861
|
+
// Return the generated code.
|
2862
|
+
return GetCode(CONSTANT_FUNCTION, name);
|
2863
|
+
}
|
2864
|
+
|
2865
|
+
|
2866
|
+
MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
|
2867
|
+
JSObject* holder,
|
2868
|
+
String* name) {
|
2869
|
+
// ----------- S t a t e -------------
|
2870
|
+
// -- eax : receiver
|
2871
|
+
// -- ecx : name
|
2872
|
+
// -- esp[0] : return address
|
2873
|
+
// -----------------------------------
|
2874
|
+
Label miss;
|
2875
|
+
|
2876
|
+
LookupResult lookup;
|
2877
|
+
LookupPostInterceptor(holder, name, &lookup);
|
2878
|
+
|
2879
|
+
// TODO(368): Compile in the whole chain: all the interceptors in
|
2880
|
+
// prototypes and ultimate answer.
|
2881
|
+
GenerateLoadInterceptor(receiver,
|
2882
|
+
holder,
|
2883
|
+
&lookup,
|
2884
|
+
eax,
|
2885
|
+
ecx,
|
2886
|
+
edx,
|
2887
|
+
ebx,
|
2888
|
+
edi,
|
2889
|
+
name,
|
2890
|
+
&miss);
|
2891
|
+
|
2892
|
+
__ bind(&miss);
|
2893
|
+
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
2894
|
+
|
2895
|
+
// Return the generated code.
|
2896
|
+
return GetCode(INTERCEPTOR, name);
|
2897
|
+
}
|
2898
|
+
|
2899
|
+
|
2900
|
+
MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object,
|
2901
|
+
GlobalObject* holder,
|
2902
|
+
JSGlobalPropertyCell* cell,
|
2903
|
+
String* name,
|
2904
|
+
bool is_dont_delete) {
|
2905
|
+
// ----------- S t a t e -------------
|
2906
|
+
// -- eax : receiver
|
2907
|
+
// -- ecx : name
|
2908
|
+
// -- esp[0] : return address
|
2909
|
+
// -----------------------------------
|
2910
|
+
Label miss;
|
2911
|
+
|
2912
|
+
// If the object is the holder then we know that it's a global
|
2913
|
+
// object which can only happen for contextual loads. In this case,
|
2914
|
+
// the receiver cannot be a smi.
|
2915
|
+
if (object != holder) {
|
2916
|
+
__ test(eax, Immediate(kSmiTagMask));
|
2917
|
+
__ j(zero, &miss, not_taken);
|
2918
|
+
}
|
2919
|
+
|
2920
|
+
// Check that the maps haven't changed.
|
2921
|
+
CheckPrototypes(object, eax, holder, ebx, edx, edi, name, &miss);
|
2922
|
+
|
2923
|
+
// Get the value from the cell.
|
2924
|
+
if (Serializer::enabled()) {
|
2925
|
+
__ mov(ebx, Immediate(Handle<JSGlobalPropertyCell>(cell)));
|
2926
|
+
__ mov(ebx, FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset));
|
2927
|
+
} else {
|
2928
|
+
__ mov(ebx, Operand::Cell(Handle<JSGlobalPropertyCell>(cell)));
|
2929
|
+
}
|
2930
|
+
|
2931
|
+
// Check for deleted property if property can actually be deleted.
|
2932
|
+
if (!is_dont_delete) {
|
2933
|
+
__ cmp(ebx, Factory::the_hole_value());
|
2934
|
+
__ j(equal, &miss, not_taken);
|
2935
|
+
} else if (FLAG_debug_code) {
|
2936
|
+
__ cmp(ebx, Factory::the_hole_value());
|
2937
|
+
__ Check(not_equal, "DontDelete cells can't contain the hole");
|
2938
|
+
}
|
2939
|
+
|
2940
|
+
__ IncrementCounter(&Counters::named_load_global_stub, 1);
|
2941
|
+
__ mov(eax, ebx);
|
2942
|
+
__ ret(0);
|
2943
|
+
|
2944
|
+
__ bind(&miss);
|
2945
|
+
__ IncrementCounter(&Counters::named_load_global_stub_miss, 1);
|
2946
|
+
GenerateLoadMiss(masm(), Code::LOAD_IC);
|
2947
|
+
|
2948
|
+
// Return the generated code.
|
2949
|
+
return GetCode(NORMAL, name);
|
2950
|
+
}
|
2951
|
+
|
2952
|
+
|
2953
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name,
|
2954
|
+
JSObject* receiver,
|
2955
|
+
JSObject* holder,
|
2956
|
+
int index) {
|
2957
|
+
// ----------- S t a t e -------------
|
2958
|
+
// -- eax : key
|
2959
|
+
// -- edx : receiver
|
2960
|
+
// -- esp[0] : return address
|
2961
|
+
// -----------------------------------
|
2962
|
+
Label miss;
|
2963
|
+
|
2964
|
+
__ IncrementCounter(&Counters::keyed_load_field, 1);
|
2965
|
+
|
2966
|
+
// Check that the name has not changed.
|
2967
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
2968
|
+
__ j(not_equal, &miss, not_taken);
|
2969
|
+
|
2970
|
+
GenerateLoadField(receiver, holder, edx, ebx, ecx, edi, index, name, &miss);
|
2971
|
+
|
2972
|
+
__ bind(&miss);
|
2973
|
+
__ DecrementCounter(&Counters::keyed_load_field, 1);
|
2974
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
2975
|
+
|
2976
|
+
// Return the generated code.
|
2977
|
+
return GetCode(FIELD, name);
|
2978
|
+
}
|
2979
|
+
|
2980
|
+
|
2981
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback(
|
2982
|
+
String* name,
|
2983
|
+
JSObject* receiver,
|
2984
|
+
JSObject* holder,
|
2985
|
+
AccessorInfo* callback) {
|
2986
|
+
// ----------- S t a t e -------------
|
2987
|
+
// -- eax : key
|
2988
|
+
// -- edx : receiver
|
2989
|
+
// -- esp[0] : return address
|
2990
|
+
// -----------------------------------
|
2991
|
+
Label miss;
|
2992
|
+
|
2993
|
+
__ IncrementCounter(&Counters::keyed_load_callback, 1);
|
2994
|
+
|
2995
|
+
// Check that the name has not changed.
|
2996
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
2997
|
+
__ j(not_equal, &miss, not_taken);
|
2998
|
+
|
2999
|
+
MaybeObject* result = GenerateLoadCallback(receiver, holder, edx, eax, ebx,
|
3000
|
+
ecx, edi, callback, name, &miss);
|
3001
|
+
if (result->IsFailure()) {
|
3002
|
+
miss.Unuse();
|
3003
|
+
return result;
|
3004
|
+
}
|
3005
|
+
|
3006
|
+
__ bind(&miss);
|
3007
|
+
|
3008
|
+
__ DecrementCounter(&Counters::keyed_load_callback, 1);
|
3009
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3010
|
+
|
3011
|
+
// Return the generated code.
|
3012
|
+
return GetCode(CALLBACKS, name);
|
3013
|
+
}
|
3014
|
+
|
3015
|
+
|
3016
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
|
3017
|
+
JSObject* receiver,
|
3018
|
+
JSObject* holder,
|
3019
|
+
Object* value) {
|
3020
|
+
// ----------- S t a t e -------------
|
3021
|
+
// -- eax : key
|
3022
|
+
// -- edx : receiver
|
3023
|
+
// -- esp[0] : return address
|
3024
|
+
// -----------------------------------
|
3025
|
+
Label miss;
|
3026
|
+
|
3027
|
+
__ IncrementCounter(&Counters::keyed_load_constant_function, 1);
|
3028
|
+
|
3029
|
+
// Check that the name has not changed.
|
3030
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
3031
|
+
__ j(not_equal, &miss, not_taken);
|
3032
|
+
|
3033
|
+
GenerateLoadConstant(receiver, holder, edx, ebx, ecx, edi,
|
3034
|
+
value, name, &miss);
|
3035
|
+
__ bind(&miss);
|
3036
|
+
__ DecrementCounter(&Counters::keyed_load_constant_function, 1);
|
3037
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3038
|
+
|
3039
|
+
// Return the generated code.
|
3040
|
+
return GetCode(CONSTANT_FUNCTION, name);
|
3041
|
+
}
|
3042
|
+
|
3043
|
+
|
3044
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver,
|
3045
|
+
JSObject* holder,
|
3046
|
+
String* name) {
|
3047
|
+
// ----------- S t a t e -------------
|
3048
|
+
// -- eax : key
|
3049
|
+
// -- edx : receiver
|
3050
|
+
// -- esp[0] : return address
|
3051
|
+
// -----------------------------------
|
3052
|
+
Label miss;
|
3053
|
+
|
3054
|
+
__ IncrementCounter(&Counters::keyed_load_interceptor, 1);
|
3055
|
+
|
3056
|
+
// Check that the name has not changed.
|
3057
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
3058
|
+
__ j(not_equal, &miss, not_taken);
|
3059
|
+
|
3060
|
+
LookupResult lookup;
|
3061
|
+
LookupPostInterceptor(holder, name, &lookup);
|
3062
|
+
GenerateLoadInterceptor(receiver,
|
3063
|
+
holder,
|
3064
|
+
&lookup,
|
3065
|
+
edx,
|
3066
|
+
eax,
|
3067
|
+
ecx,
|
3068
|
+
ebx,
|
3069
|
+
edi,
|
3070
|
+
name,
|
3071
|
+
&miss);
|
3072
|
+
__ bind(&miss);
|
3073
|
+
__ DecrementCounter(&Counters::keyed_load_interceptor, 1);
|
3074
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3075
|
+
|
3076
|
+
// Return the generated code.
|
3077
|
+
return GetCode(INTERCEPTOR, name);
|
3078
|
+
}
|
3079
|
+
|
3080
|
+
|
3081
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) {
|
3082
|
+
// ----------- S t a t e -------------
|
3083
|
+
// -- eax : key
|
3084
|
+
// -- edx : receiver
|
3085
|
+
// -- esp[0] : return address
|
3086
|
+
// -----------------------------------
|
3087
|
+
Label miss;
|
3088
|
+
|
3089
|
+
__ IncrementCounter(&Counters::keyed_load_array_length, 1);
|
3090
|
+
|
3091
|
+
// Check that the name has not changed.
|
3092
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
3093
|
+
__ j(not_equal, &miss, not_taken);
|
3094
|
+
|
3095
|
+
GenerateLoadArrayLength(masm(), edx, ecx, &miss);
|
3096
|
+
__ bind(&miss);
|
3097
|
+
__ DecrementCounter(&Counters::keyed_load_array_length, 1);
|
3098
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3099
|
+
|
3100
|
+
// Return the generated code.
|
3101
|
+
return GetCode(CALLBACKS, name);
|
3102
|
+
}
|
3103
|
+
|
3104
|
+
|
3105
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) {
|
3106
|
+
// ----------- S t a t e -------------
|
3107
|
+
// -- eax : key
|
3108
|
+
// -- edx : receiver
|
3109
|
+
// -- esp[0] : return address
|
3110
|
+
// -----------------------------------
|
3111
|
+
Label miss;
|
3112
|
+
|
3113
|
+
__ IncrementCounter(&Counters::keyed_load_string_length, 1);
|
3114
|
+
|
3115
|
+
// Check that the name has not changed.
|
3116
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
3117
|
+
__ j(not_equal, &miss, not_taken);
|
3118
|
+
|
3119
|
+
GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss, true);
|
3120
|
+
__ bind(&miss);
|
3121
|
+
__ DecrementCounter(&Counters::keyed_load_string_length, 1);
|
3122
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3123
|
+
|
3124
|
+
// Return the generated code.
|
3125
|
+
return GetCode(CALLBACKS, name);
|
3126
|
+
}
|
3127
|
+
|
3128
|
+
|
3129
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) {
|
3130
|
+
// ----------- S t a t e -------------
|
3131
|
+
// -- eax : key
|
3132
|
+
// -- edx : receiver
|
3133
|
+
// -- esp[0] : return address
|
3134
|
+
// -----------------------------------
|
3135
|
+
Label miss;
|
3136
|
+
|
3137
|
+
__ IncrementCounter(&Counters::keyed_load_function_prototype, 1);
|
3138
|
+
|
3139
|
+
// Check that the name has not changed.
|
3140
|
+
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
|
3141
|
+
__ j(not_equal, &miss, not_taken);
|
3142
|
+
|
3143
|
+
GenerateLoadFunctionPrototype(masm(), edx, ecx, ebx, &miss);
|
3144
|
+
__ bind(&miss);
|
3145
|
+
__ DecrementCounter(&Counters::keyed_load_function_prototype, 1);
|
3146
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3147
|
+
|
3148
|
+
// Return the generated code.
|
3149
|
+
return GetCode(CALLBACKS, name);
|
3150
|
+
}
|
3151
|
+
|
3152
|
+
|
3153
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadSpecialized(JSObject* receiver) {
|
3154
|
+
// ----------- S t a t e -------------
|
3155
|
+
// -- eax : key
|
3156
|
+
// -- edx : receiver
|
3157
|
+
// -- esp[0] : return address
|
3158
|
+
// -----------------------------------
|
3159
|
+
Label miss;
|
3160
|
+
|
3161
|
+
// Check that the receiver isn't a smi.
|
3162
|
+
__ test(edx, Immediate(kSmiTagMask));
|
3163
|
+
__ j(zero, &miss, not_taken);
|
3164
|
+
|
3165
|
+
// Check that the map matches.
|
3166
|
+
__ cmp(FieldOperand(edx, HeapObject::kMapOffset),
|
3167
|
+
Immediate(Handle<Map>(receiver->map())));
|
3168
|
+
__ j(not_equal, &miss, not_taken);
|
3169
|
+
|
3170
|
+
// Check that the key is a smi.
|
3171
|
+
__ test(eax, Immediate(kSmiTagMask));
|
3172
|
+
__ j(not_zero, &miss, not_taken);
|
3173
|
+
|
3174
|
+
// Get the elements array.
|
3175
|
+
__ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset));
|
3176
|
+
__ AssertFastElements(ecx);
|
3177
|
+
|
3178
|
+
// Check that the key is within bounds.
|
3179
|
+
__ cmp(eax, FieldOperand(ecx, FixedArray::kLengthOffset));
|
3180
|
+
__ j(above_equal, &miss, not_taken);
|
3181
|
+
|
3182
|
+
// Load the result and make sure it's not the hole.
|
3183
|
+
__ mov(ebx, Operand(ecx, eax, times_2,
|
3184
|
+
FixedArray::kHeaderSize - kHeapObjectTag));
|
3185
|
+
__ cmp(ebx, Factory::the_hole_value());
|
3186
|
+
__ j(equal, &miss, not_taken);
|
3187
|
+
__ mov(eax, ebx);
|
3188
|
+
__ ret(0);
|
3189
|
+
|
3190
|
+
__ bind(&miss);
|
3191
|
+
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
|
3192
|
+
|
3193
|
+
// Return the generated code.
|
3194
|
+
return GetCode(NORMAL, NULL);
|
3195
|
+
}
|
3196
|
+
|
3197
|
+
|
3198
|
+
MaybeObject* KeyedLoadStubCompiler::CompileLoadPixelArray(JSObject* receiver) {
|
3199
|
+
// ----------- S t a t e -------------
|
3200
|
+
// -- eax : key
|
3201
|
+
// -- edx : receiver
|
3202
|
+
// -- esp[0] : return address
|
3203
|
+
// -----------------------------------
|
3204
|
+
Label miss;
|
3205
|
+
|
3206
|
+
// Check that the map matches.
|
3207
|
+
__ CheckMap(edx, Handle<Map>(receiver->map()), &miss, false);
|
3208
|
+
|
3209
|
+
GenerateFastPixelArrayLoad(masm(),
|
3210
|
+
edx,
|
3211
|
+
eax,
|
3212
|
+
ecx,
|
3213
|
+
ebx,
|
3214
|
+
eax,
|
3215
|
+
&miss,
|
3216
|
+
&miss,
|
3217
|
+
&miss);
|
3218
|
+
|
3219
|
+
// Handle load cache miss.
|
3220
|
+
__ bind(&miss);
|
3221
|
+
Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Miss));
|
3222
|
+
__ jmp(ic, RelocInfo::CODE_TARGET);
|
3223
|
+
|
3224
|
+
// Return the generated code.
|
3225
|
+
return GetCode(NORMAL, NULL);
|
3226
|
+
}
|
3227
|
+
|
3228
|
+
|
3229
|
+
// Specialized stub for constructing objects from functions which only have only
|
3230
|
+
// simple assignments of the form this.x = ...; in their body.
|
3231
|
+
MaybeObject* ConstructStubCompiler::CompileConstructStub(JSFunction* function) {
|
3232
|
+
// ----------- S t a t e -------------
|
3233
|
+
// -- eax : argc
|
3234
|
+
// -- edi : constructor
|
3235
|
+
// -- esp[0] : return address
|
3236
|
+
// -- esp[4] : last argument
|
3237
|
+
// -----------------------------------
|
3238
|
+
Label generic_stub_call;
|
3239
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
3240
|
+
// Check to see whether there are any break points in the function code. If
|
3241
|
+
// there are jump to the generic constructor stub which calls the actual
|
3242
|
+
// code for the function thereby hitting the break points.
|
3243
|
+
__ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
|
3244
|
+
__ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kDebugInfoOffset));
|
3245
|
+
__ cmp(ebx, Factory::undefined_value());
|
3246
|
+
__ j(not_equal, &generic_stub_call, not_taken);
|
3247
|
+
#endif
|
3248
|
+
|
3249
|
+
// Load the initial map and verify that it is in fact a map.
|
3250
|
+
__ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
|
3251
|
+
// Will both indicate a NULL and a Smi.
|
3252
|
+
__ test(ebx, Immediate(kSmiTagMask));
|
3253
|
+
__ j(zero, &generic_stub_call);
|
3254
|
+
__ CmpObjectType(ebx, MAP_TYPE, ecx);
|
3255
|
+
__ j(not_equal, &generic_stub_call);
|
3256
|
+
|
3257
|
+
#ifdef DEBUG
|
3258
|
+
// Cannot construct functions this way.
|
3259
|
+
// edi: constructor
|
3260
|
+
// ebx: initial map
|
3261
|
+
__ CmpInstanceType(ebx, JS_FUNCTION_TYPE);
|
3262
|
+
__ Assert(not_equal, "Function constructed by construct stub.");
|
3263
|
+
#endif
|
3264
|
+
|
3265
|
+
// Now allocate the JSObject on the heap by moving the new space allocation
|
3266
|
+
// top forward.
|
3267
|
+
// edi: constructor
|
3268
|
+
// ebx: initial map
|
3269
|
+
__ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
|
3270
|
+
__ shl(ecx, kPointerSizeLog2);
|
3271
|
+
__ AllocateInNewSpace(ecx,
|
3272
|
+
edx,
|
3273
|
+
ecx,
|
3274
|
+
no_reg,
|
3275
|
+
&generic_stub_call,
|
3276
|
+
NO_ALLOCATION_FLAGS);
|
3277
|
+
|
3278
|
+
// Allocated the JSObject, now initialize the fields and add the heap tag.
|
3279
|
+
// ebx: initial map
|
3280
|
+
// edx: JSObject (untagged)
|
3281
|
+
__ mov(Operand(edx, JSObject::kMapOffset), ebx);
|
3282
|
+
__ mov(ebx, Factory::empty_fixed_array());
|
3283
|
+
__ mov(Operand(edx, JSObject::kPropertiesOffset), ebx);
|
3284
|
+
__ mov(Operand(edx, JSObject::kElementsOffset), ebx);
|
3285
|
+
|
3286
|
+
// Push the allocated object to the stack. This is the object that will be
|
3287
|
+
// returned (after it is tagged).
|
3288
|
+
__ push(edx);
|
3289
|
+
|
3290
|
+
// eax: argc
|
3291
|
+
// edx: JSObject (untagged)
|
3292
|
+
// Load the address of the first in-object property into edx.
|
3293
|
+
__ lea(edx, Operand(edx, JSObject::kHeaderSize));
|
3294
|
+
// Calculate the location of the first argument. The stack contains the
|
3295
|
+
// allocated object and the return address on top of the argc arguments.
|
3296
|
+
__ lea(ecx, Operand(esp, eax, times_4, 1 * kPointerSize));
|
3297
|
+
|
3298
|
+
// Use edi for holding undefined which is used in several places below.
|
3299
|
+
__ mov(edi, Factory::undefined_value());
|
3300
|
+
|
3301
|
+
// eax: argc
|
3302
|
+
// ecx: first argument
|
3303
|
+
// edx: first in-object property of the JSObject
|
3304
|
+
// edi: undefined
|
3305
|
+
// Fill the initialized properties with a constant value or a passed argument
|
3306
|
+
// depending on the this.x = ...; assignment in the function.
|
3307
|
+
SharedFunctionInfo* shared = function->shared();
|
3308
|
+
for (int i = 0; i < shared->this_property_assignments_count(); i++) {
|
3309
|
+
if (shared->IsThisPropertyAssignmentArgument(i)) {
|
3310
|
+
// Check if the argument assigned to the property is actually passed.
|
3311
|
+
// If argument is not passed the property is set to undefined,
|
3312
|
+
// otherwise find it on the stack.
|
3313
|
+
int arg_number = shared->GetThisPropertyAssignmentArgument(i);
|
3314
|
+
__ mov(ebx, edi);
|
3315
|
+
__ cmp(eax, arg_number);
|
3316
|
+
if (CpuFeatures::IsSupported(CMOV)) {
|
3317
|
+
CpuFeatures::Scope use_cmov(CMOV);
|
3318
|
+
__ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize));
|
3319
|
+
} else {
|
3320
|
+
Label not_passed;
|
3321
|
+
__ j(below_equal, ¬_passed);
|
3322
|
+
__ mov(ebx, Operand(ecx, arg_number * -kPointerSize));
|
3323
|
+
__ bind(¬_passed);
|
3324
|
+
}
|
3325
|
+
// Store value in the property.
|
3326
|
+
__ mov(Operand(edx, i * kPointerSize), ebx);
|
3327
|
+
} else {
|
3328
|
+
// Set the property to the constant value.
|
3329
|
+
Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i));
|
3330
|
+
__ mov(Operand(edx, i * kPointerSize), Immediate(constant));
|
3331
|
+
}
|
3332
|
+
}
|
3333
|
+
|
3334
|
+
// Fill the unused in-object property fields with undefined.
|
3335
|
+
ASSERT(function->has_initial_map());
|
3336
|
+
for (int i = shared->this_property_assignments_count();
|
3337
|
+
i < function->initial_map()->inobject_properties();
|
3338
|
+
i++) {
|
3339
|
+
__ mov(Operand(edx, i * kPointerSize), edi);
|
3340
|
+
}
|
3341
|
+
|
3342
|
+
// Move argc to ebx and retrieve and tag the JSObject to return.
|
3343
|
+
__ mov(ebx, eax);
|
3344
|
+
__ pop(eax);
|
3345
|
+
__ or_(Operand(eax), Immediate(kHeapObjectTag));
|
3346
|
+
|
3347
|
+
// Remove caller arguments and receiver from the stack and return.
|
3348
|
+
__ pop(ecx);
|
3349
|
+
__ lea(esp, Operand(esp, ebx, times_pointer_size, 1 * kPointerSize));
|
3350
|
+
__ push(ecx);
|
3351
|
+
__ IncrementCounter(&Counters::constructed_objects, 1);
|
3352
|
+
__ IncrementCounter(&Counters::constructed_objects_stub, 1);
|
3353
|
+
__ ret(0);
|
3354
|
+
|
3355
|
+
// Jump to the generic stub in case the specialized code cannot handle the
|
3356
|
+
// construction.
|
3357
|
+
__ bind(&generic_stub_call);
|
3358
|
+
Code* code = Builtins::builtin(Builtins::JSConstructStubGeneric);
|
3359
|
+
Handle<Code> generic_construct_stub(code);
|
3360
|
+
__ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
|
3361
|
+
|
3362
|
+
// Return the generated code.
|
3363
|
+
return GetCode();
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
|
3367
|
+
MaybeObject* ExternalArrayStubCompiler::CompileKeyedLoadStub(
|
3368
|
+
ExternalArrayType array_type, Code::Flags flags) {
|
3369
|
+
// ----------- S t a t e -------------
|
3370
|
+
// -- eax : key
|
3371
|
+
// -- edx : receiver
|
3372
|
+
// -- esp[0] : return address
|
3373
|
+
// -----------------------------------
|
3374
|
+
Label slow, failed_allocation;
|
3375
|
+
|
3376
|
+
// Check that the object isn't a smi.
|
3377
|
+
__ test(edx, Immediate(kSmiTagMask));
|
3378
|
+
__ j(zero, &slow, not_taken);
|
3379
|
+
|
3380
|
+
// Check that the key is a smi.
|
3381
|
+
__ test(eax, Immediate(kSmiTagMask));
|
3382
|
+
__ j(not_zero, &slow, not_taken);
|
3383
|
+
|
3384
|
+
// Get the map of the receiver.
|
3385
|
+
__ mov(ecx, FieldOperand(edx, HeapObject::kMapOffset));
|
3386
|
+
// Check that the receiver does not require access checks. We need
|
3387
|
+
// to check this explicitly since this generic stub does not perform
|
3388
|
+
// map checks.
|
3389
|
+
__ test_b(FieldOperand(ecx, Map::kBitFieldOffset),
|
3390
|
+
1 << Map::kIsAccessCheckNeeded);
|
3391
|
+
__ j(not_zero, &slow, not_taken);
|
3392
|
+
|
3393
|
+
__ CmpInstanceType(ecx, JS_OBJECT_TYPE);
|
3394
|
+
__ j(not_equal, &slow, not_taken);
|
3395
|
+
|
3396
|
+
// Check that the elements array is the appropriate type of
|
3397
|
+
// ExternalArray.
|
3398
|
+
__ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset));
|
3399
|
+
Handle<Map> map(Heap::MapForExternalArrayType(array_type));
|
3400
|
+
__ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
|
3401
|
+
Immediate(map));
|
3402
|
+
__ j(not_equal, &slow, not_taken);
|
3403
|
+
|
3404
|
+
// eax: key, known to be a smi.
|
3405
|
+
// edx: receiver, known to be a JSObject.
|
3406
|
+
// ebx: elements object, known to be an external array.
|
3407
|
+
// Check that the index is in range.
|
3408
|
+
__ mov(ecx, eax);
|
3409
|
+
__ SmiUntag(ecx); // Untag the index.
|
3410
|
+
__ cmp(ecx, FieldOperand(ebx, ExternalArray::kLengthOffset));
|
3411
|
+
// Unsigned comparison catches both negative and too-large values.
|
3412
|
+
__ j(above_equal, &slow);
|
3413
|
+
|
3414
|
+
__ mov(ebx, FieldOperand(ebx, ExternalArray::kExternalPointerOffset));
|
3415
|
+
// ebx: base pointer of external storage
|
3416
|
+
switch (array_type) {
|
3417
|
+
case kExternalByteArray:
|
3418
|
+
__ movsx_b(ecx, Operand(ebx, ecx, times_1, 0));
|
3419
|
+
break;
|
3420
|
+
case kExternalUnsignedByteArray:
|
3421
|
+
__ movzx_b(ecx, Operand(ebx, ecx, times_1, 0));
|
3422
|
+
break;
|
3423
|
+
case kExternalShortArray:
|
3424
|
+
__ movsx_w(ecx, Operand(ebx, ecx, times_2, 0));
|
3425
|
+
break;
|
3426
|
+
case kExternalUnsignedShortArray:
|
3427
|
+
__ movzx_w(ecx, Operand(ebx, ecx, times_2, 0));
|
3428
|
+
break;
|
3429
|
+
case kExternalIntArray:
|
3430
|
+
case kExternalUnsignedIntArray:
|
3431
|
+
__ mov(ecx, Operand(ebx, ecx, times_4, 0));
|
3432
|
+
break;
|
3433
|
+
case kExternalFloatArray:
|
3434
|
+
__ fld_s(Operand(ebx, ecx, times_4, 0));
|
3435
|
+
break;
|
3436
|
+
default:
|
3437
|
+
UNREACHABLE();
|
3438
|
+
break;
|
3439
|
+
}
|
3440
|
+
|
3441
|
+
// For integer array types:
|
3442
|
+
// ecx: value
|
3443
|
+
// For floating-point array type:
|
3444
|
+
// FP(0): value
|
3445
|
+
|
3446
|
+
if (array_type == kExternalIntArray ||
|
3447
|
+
array_type == kExternalUnsignedIntArray) {
|
3448
|
+
// For the Int and UnsignedInt array types, we need to see whether
|
3449
|
+
// the value can be represented in a Smi. If not, we need to convert
|
3450
|
+
// it to a HeapNumber.
|
3451
|
+
Label box_int;
|
3452
|
+
if (array_type == kExternalIntArray) {
|
3453
|
+
__ cmp(ecx, 0xC0000000);
|
3454
|
+
__ j(sign, &box_int);
|
3455
|
+
} else {
|
3456
|
+
ASSERT_EQ(array_type, kExternalUnsignedIntArray);
|
3457
|
+
// The test is different for unsigned int values. Since we need
|
3458
|
+
// the value to be in the range of a positive smi, we can't
|
3459
|
+
// handle either of the top two bits being set in the value.
|
3460
|
+
__ test(ecx, Immediate(0xC0000000));
|
3461
|
+
__ j(not_zero, &box_int);
|
3462
|
+
}
|
3463
|
+
|
3464
|
+
__ mov(eax, ecx);
|
3465
|
+
__ SmiTag(eax);
|
3466
|
+
__ ret(0);
|
3467
|
+
|
3468
|
+
__ bind(&box_int);
|
3469
|
+
|
3470
|
+
// Allocate a HeapNumber for the int and perform int-to-double
|
3471
|
+
// conversion.
|
3472
|
+
if (array_type == kExternalIntArray) {
|
3473
|
+
__ push(ecx);
|
3474
|
+
__ fild_s(Operand(esp, 0));
|
3475
|
+
__ pop(ecx);
|
3476
|
+
} else {
|
3477
|
+
ASSERT(array_type == kExternalUnsignedIntArray);
|
3478
|
+
// Need to zero-extend the value.
|
3479
|
+
// There's no fild variant for unsigned values, so zero-extend
|
3480
|
+
// to a 64-bit int manually.
|
3481
|
+
__ push(Immediate(0));
|
3482
|
+
__ push(ecx);
|
3483
|
+
__ fild_d(Operand(esp, 0));
|
3484
|
+
__ pop(ecx);
|
3485
|
+
__ pop(ecx);
|
3486
|
+
}
|
3487
|
+
// FP(0): value
|
3488
|
+
__ AllocateHeapNumber(ecx, ebx, edi, &failed_allocation);
|
3489
|
+
// Set the value.
|
3490
|
+
__ mov(eax, ecx);
|
3491
|
+
__ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
|
3492
|
+
__ ret(0);
|
3493
|
+
} else if (array_type == kExternalFloatArray) {
|
3494
|
+
// For the floating-point array type, we need to always allocate a
|
3495
|
+
// HeapNumber.
|
3496
|
+
__ AllocateHeapNumber(ecx, ebx, edi, &failed_allocation);
|
3497
|
+
// Set the value.
|
3498
|
+
__ mov(eax, ecx);
|
3499
|
+
__ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
|
3500
|
+
__ ret(0);
|
3501
|
+
} else {
|
3502
|
+
__ mov(eax, ecx);
|
3503
|
+
__ SmiTag(eax);
|
3504
|
+
__ ret(0);
|
3505
|
+
}
|
3506
|
+
|
3507
|
+
// If we fail allocation of the HeapNumber, we still have a value on
|
3508
|
+
// top of the FPU stack. Remove it.
|
3509
|
+
__ bind(&failed_allocation);
|
3510
|
+
__ ffree();
|
3511
|
+
__ fincstp();
|
3512
|
+
// Fall through to slow case.
|
3513
|
+
|
3514
|
+
// Slow case: Jump to runtime.
|
3515
|
+
__ bind(&slow);
|
3516
|
+
__ IncrementCounter(&Counters::keyed_load_external_array_slow, 1);
|
3517
|
+
// ----------- S t a t e -------------
|
3518
|
+
// -- eax : key
|
3519
|
+
// -- edx : receiver
|
3520
|
+
// -- esp[0] : return address
|
3521
|
+
// -----------------------------------
|
3522
|
+
|
3523
|
+
__ pop(ebx);
|
3524
|
+
__ push(edx); // receiver
|
3525
|
+
__ push(eax); // name
|
3526
|
+
__ push(ebx); // return address
|
3527
|
+
|
3528
|
+
// Perform tail call to the entry.
|
3529
|
+
__ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
|
3530
|
+
|
3531
|
+
// Return the generated code.
|
3532
|
+
return GetCode(flags);
|
3533
|
+
}
|
3534
|
+
|
3535
|
+
|
3536
|
+
MaybeObject* ExternalArrayStubCompiler::CompileKeyedStoreStub(
|
3537
|
+
ExternalArrayType array_type, Code::Flags flags) {
|
3538
|
+
// ----------- S t a t e -------------
|
3539
|
+
// -- eax : value
|
3540
|
+
// -- ecx : key
|
3541
|
+
// -- edx : receiver
|
3542
|
+
// -- esp[0] : return address
|
3543
|
+
// -----------------------------------
|
3544
|
+
Label slow, check_heap_number;
|
3545
|
+
|
3546
|
+
// Check that the object isn't a smi.
|
3547
|
+
__ test(edx, Immediate(kSmiTagMask));
|
3548
|
+
__ j(zero, &slow);
|
3549
|
+
// Get the map from the receiver.
|
3550
|
+
__ mov(edi, FieldOperand(edx, HeapObject::kMapOffset));
|
3551
|
+
// Check that the receiver does not require access checks. We need
|
3552
|
+
// to do this because this generic stub does not perform map checks.
|
3553
|
+
__ test_b(FieldOperand(edi, Map::kBitFieldOffset),
|
3554
|
+
1 << Map::kIsAccessCheckNeeded);
|
3555
|
+
__ j(not_zero, &slow);
|
3556
|
+
// Check that the key is a smi.
|
3557
|
+
__ test(ecx, Immediate(kSmiTagMask));
|
3558
|
+
__ j(not_zero, &slow);
|
3559
|
+
// Get the instance type from the map of the receiver.
|
3560
|
+
__ CmpInstanceType(edi, JS_OBJECT_TYPE);
|
3561
|
+
__ j(not_equal, &slow);
|
3562
|
+
|
3563
|
+
// Check that the elements array is the appropriate type of
|
3564
|
+
// ExternalArray.
|
3565
|
+
// eax: value
|
3566
|
+
// edx: receiver, a JSObject
|
3567
|
+
// ecx: key, a smi
|
3568
|
+
__ mov(edi, FieldOperand(edx, JSObject::kElementsOffset));
|
3569
|
+
__ CheckMap(edi, Handle<Map>(Heap::MapForExternalArrayType(array_type)),
|
3570
|
+
&slow, true);
|
3571
|
+
|
3572
|
+
// Check that the index is in range.
|
3573
|
+
__ mov(ebx, ecx);
|
3574
|
+
__ SmiUntag(ebx);
|
3575
|
+
__ cmp(ebx, FieldOperand(edi, ExternalArray::kLengthOffset));
|
3576
|
+
// Unsigned comparison catches both negative and too-large values.
|
3577
|
+
__ j(above_equal, &slow);
|
3578
|
+
|
3579
|
+
// Handle both smis and HeapNumbers in the fast path. Go to the
|
3580
|
+
// runtime for all other kinds of values.
|
3581
|
+
// eax: value
|
3582
|
+
// edx: receiver
|
3583
|
+
// ecx: key
|
3584
|
+
// edi: elements array
|
3585
|
+
// ebx: untagged index
|
3586
|
+
__ test(eax, Immediate(kSmiTagMask));
|
3587
|
+
__ j(not_equal, &check_heap_number);
|
3588
|
+
// smi case
|
3589
|
+
__ mov(ecx, eax); // Preserve the value in eax. Key is no longer needed.
|
3590
|
+
__ SmiUntag(ecx);
|
3591
|
+
__ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset));
|
3592
|
+
// ecx: base pointer of external storage
|
3593
|
+
switch (array_type) {
|
3594
|
+
case kExternalByteArray:
|
3595
|
+
case kExternalUnsignedByteArray:
|
3596
|
+
__ mov_b(Operand(edi, ebx, times_1, 0), ecx);
|
3597
|
+
break;
|
3598
|
+
case kExternalShortArray:
|
3599
|
+
case kExternalUnsignedShortArray:
|
3600
|
+
__ mov_w(Operand(edi, ebx, times_2, 0), ecx);
|
3601
|
+
break;
|
3602
|
+
case kExternalIntArray:
|
3603
|
+
case kExternalUnsignedIntArray:
|
3604
|
+
__ mov(Operand(edi, ebx, times_4, 0), ecx);
|
3605
|
+
break;
|
3606
|
+
case kExternalFloatArray:
|
3607
|
+
// Need to perform int-to-float conversion.
|
3608
|
+
__ push(ecx);
|
3609
|
+
__ fild_s(Operand(esp, 0));
|
3610
|
+
__ pop(ecx);
|
3611
|
+
__ fstp_s(Operand(edi, ebx, times_4, 0));
|
3612
|
+
break;
|
3613
|
+
default:
|
3614
|
+
UNREACHABLE();
|
3615
|
+
break;
|
3616
|
+
}
|
3617
|
+
__ ret(0); // Return the original value.
|
3618
|
+
|
3619
|
+
__ bind(&check_heap_number);
|
3620
|
+
// eax: value
|
3621
|
+
// edx: receiver
|
3622
|
+
// ecx: key
|
3623
|
+
// edi: elements array
|
3624
|
+
// ebx: untagged index
|
3625
|
+
__ cmp(FieldOperand(eax, HeapObject::kMapOffset),
|
3626
|
+
Immediate(Factory::heap_number_map()));
|
3627
|
+
__ j(not_equal, &slow);
|
3628
|
+
|
3629
|
+
// The WebGL specification leaves the behavior of storing NaN and
|
3630
|
+
// +/-Infinity into integer arrays basically undefined. For more
|
3631
|
+
// reproducible behavior, convert these to zero.
|
3632
|
+
__ mov(edi, FieldOperand(edi, ExternalArray::kExternalPointerOffset));
|
3633
|
+
// ebx: untagged index
|
3634
|
+
// edi: base pointer of external storage
|
3635
|
+
if (array_type == kExternalFloatArray) {
|
3636
|
+
__ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
|
3637
|
+
__ fstp_s(Operand(edi, ebx, times_4, 0));
|
3638
|
+
__ ret(0);
|
3639
|
+
} else {
|
3640
|
+
// Perform float-to-int conversion with truncation (round-to-zero)
|
3641
|
+
// behavior.
|
3642
|
+
|
3643
|
+
// For the moment we make the slow call to the runtime on
|
3644
|
+
// processors that don't support SSE2. The code in IntegerConvert
|
3645
|
+
// (code-stubs-ia32.cc) is roughly what is needed here though the
|
3646
|
+
// conversion failure case does not need to be handled.
|
3647
|
+
if (CpuFeatures::IsSupported(SSE2)) {
|
3648
|
+
if (array_type != kExternalIntArray &&
|
3649
|
+
array_type != kExternalUnsignedIntArray) {
|
3650
|
+
ASSERT(CpuFeatures::IsSupported(SSE2));
|
3651
|
+
CpuFeatures::Scope scope(SSE2);
|
3652
|
+
__ cvttsd2si(ecx, FieldOperand(eax, HeapNumber::kValueOffset));
|
3653
|
+
// ecx: untagged integer value
|
3654
|
+
switch (array_type) {
|
3655
|
+
case kExternalByteArray:
|
3656
|
+
case kExternalUnsignedByteArray:
|
3657
|
+
__ mov_b(Operand(edi, ebx, times_1, 0), ecx);
|
3658
|
+
break;
|
3659
|
+
case kExternalShortArray:
|
3660
|
+
case kExternalUnsignedShortArray:
|
3661
|
+
__ mov_w(Operand(edi, ebx, times_2, 0), ecx);
|
3662
|
+
break;
|
3663
|
+
default:
|
3664
|
+
UNREACHABLE();
|
3665
|
+
break;
|
3666
|
+
}
|
3667
|
+
} else {
|
3668
|
+
if (CpuFeatures::IsSupported(SSE3)) {
|
3669
|
+
CpuFeatures::Scope scope(SSE3);
|
3670
|
+
// fisttp stores values as signed integers. To represent the
|
3671
|
+
// entire range of int and unsigned int arrays, store as a
|
3672
|
+
// 64-bit int and discard the high 32 bits.
|
3673
|
+
// If the value is NaN or +/-infinity, the result is 0x80000000,
|
3674
|
+
// which is automatically zero when taken mod 2^n, n < 32.
|
3675
|
+
__ fld_d(FieldOperand(eax, HeapNumber::kValueOffset));
|
3676
|
+
__ sub(Operand(esp), Immediate(2 * kPointerSize));
|
3677
|
+
__ fisttp_d(Operand(esp, 0));
|
3678
|
+
__ pop(ecx);
|
3679
|
+
__ add(Operand(esp), Immediate(kPointerSize));
|
3680
|
+
} else {
|
3681
|
+
ASSERT(CpuFeatures::IsSupported(SSE2));
|
3682
|
+
CpuFeatures::Scope scope(SSE2);
|
3683
|
+
// We can easily implement the correct rounding behavior for the
|
3684
|
+
// range [0, 2^31-1]. For the time being, to keep this code simple,
|
3685
|
+
// make the slow runtime call for values outside this range.
|
3686
|
+
// Note: we could do better for signed int arrays.
|
3687
|
+
__ movd(xmm0, FieldOperand(eax, HeapNumber::kValueOffset));
|
3688
|
+
// We will need the key if we have to make the slow runtime call.
|
3689
|
+
__ push(ecx);
|
3690
|
+
__ LoadPowerOf2(xmm1, ecx, 31);
|
3691
|
+
__ pop(ecx);
|
3692
|
+
__ ucomisd(xmm1, xmm0);
|
3693
|
+
__ j(above_equal, &slow);
|
3694
|
+
__ cvttsd2si(ecx, Operand(xmm0));
|
3695
|
+
}
|
3696
|
+
// ecx: untagged integer value
|
3697
|
+
__ mov(Operand(edi, ebx, times_4, 0), ecx);
|
3698
|
+
}
|
3699
|
+
__ ret(0); // Return original value.
|
3700
|
+
}
|
3701
|
+
}
|
3702
|
+
|
3703
|
+
// Slow case: call runtime.
|
3704
|
+
__ bind(&slow);
|
3705
|
+
// ----------- S t a t e -------------
|
3706
|
+
// -- eax : value
|
3707
|
+
// -- ecx : key
|
3708
|
+
// -- edx : receiver
|
3709
|
+
// -- esp[0] : return address
|
3710
|
+
// -----------------------------------
|
3711
|
+
|
3712
|
+
__ pop(ebx);
|
3713
|
+
__ push(edx);
|
3714
|
+
__ push(ecx);
|
3715
|
+
__ push(eax);
|
3716
|
+
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes
|
3717
|
+
__ push(Immediate(Smi::FromInt(
|
3718
|
+
Code::ExtractExtraICStateFromFlags(flags) & kStrictMode)));
|
3719
|
+
__ push(ebx); // return address
|
3720
|
+
|
3721
|
+
// Do tail-call to runtime routine.
|
3722
|
+
__ TailCallRuntime(Runtime::kSetProperty, 5, 1);
|
3723
|
+
|
3724
|
+
return GetCode(flags);
|
3725
|
+
}
|
3726
|
+
|
3727
|
+
|
3728
|
+
#undef __
|
3729
|
+
|
3730
|
+
} } // namespace v8::internal
|
3731
|
+
|
3732
|
+
#endif // V8_TARGET_ARCH_IA32
|