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,3946 @@
|
|
1
|
+
// Copyright 2010 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
//
|
28
|
+
// Review notes:
|
29
|
+
//
|
30
|
+
// - The use of macros in these inline functions may seem superfluous
|
31
|
+
// but it is absolutely needed to make sure gcc generates optimal
|
32
|
+
// code. gcc is not happy when attempting to inline too deep.
|
33
|
+
//
|
34
|
+
|
35
|
+
#ifndef V8_OBJECTS_INL_H_
|
36
|
+
#define V8_OBJECTS_INL_H_
|
37
|
+
|
38
|
+
#include "objects.h"
|
39
|
+
#include "contexts.h"
|
40
|
+
#include "conversions-inl.h"
|
41
|
+
#include "heap.h"
|
42
|
+
#include "memory.h"
|
43
|
+
#include "property.h"
|
44
|
+
#include "spaces.h"
|
45
|
+
|
46
|
+
namespace v8 {
|
47
|
+
namespace internal {
|
48
|
+
|
49
|
+
PropertyDetails::PropertyDetails(Smi* smi) {
|
50
|
+
value_ = smi->value();
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
Smi* PropertyDetails::AsSmi() {
|
55
|
+
return Smi::FromInt(value_);
|
56
|
+
}
|
57
|
+
|
58
|
+
|
59
|
+
PropertyDetails PropertyDetails::AsDeleted() {
|
60
|
+
Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1));
|
61
|
+
return PropertyDetails(smi);
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
#define CAST_ACCESSOR(type) \
|
66
|
+
type* type::cast(Object* object) { \
|
67
|
+
ASSERT(object->Is##type()); \
|
68
|
+
return reinterpret_cast<type*>(object); \
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
#define INT_ACCESSORS(holder, name, offset) \
|
73
|
+
int holder::name() { return READ_INT_FIELD(this, offset); } \
|
74
|
+
void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); }
|
75
|
+
|
76
|
+
|
77
|
+
#define ACCESSORS(holder, name, type, offset) \
|
78
|
+
type* holder::name() { return type::cast(READ_FIELD(this, offset)); } \
|
79
|
+
void holder::set_##name(type* value, WriteBarrierMode mode) { \
|
80
|
+
WRITE_FIELD(this, offset, value); \
|
81
|
+
CONDITIONAL_WRITE_BARRIER(this, offset, mode); \
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
#define SMI_ACCESSORS(holder, name, offset) \
|
86
|
+
int holder::name() { \
|
87
|
+
Object* value = READ_FIELD(this, offset); \
|
88
|
+
return Smi::cast(value)->value(); \
|
89
|
+
} \
|
90
|
+
void holder::set_##name(int value) { \
|
91
|
+
WRITE_FIELD(this, offset, Smi::FromInt(value)); \
|
92
|
+
}
|
93
|
+
|
94
|
+
|
95
|
+
#define BOOL_GETTER(holder, field, name, offset) \
|
96
|
+
bool holder::name() { \
|
97
|
+
return BooleanBit::get(field(), offset); \
|
98
|
+
} \
|
99
|
+
|
100
|
+
|
101
|
+
#define BOOL_ACCESSORS(holder, field, name, offset) \
|
102
|
+
bool holder::name() { \
|
103
|
+
return BooleanBit::get(field(), offset); \
|
104
|
+
} \
|
105
|
+
void holder::set_##name(bool value) { \
|
106
|
+
set_##field(BooleanBit::set(field(), offset, value)); \
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
bool Object::IsInstanceOf(FunctionTemplateInfo* expected) {
|
111
|
+
// There is a constraint on the object; check.
|
112
|
+
if (!this->IsJSObject()) return false;
|
113
|
+
// Fetch the constructor function of the object.
|
114
|
+
Object* cons_obj = JSObject::cast(this)->map()->constructor();
|
115
|
+
if (!cons_obj->IsJSFunction()) return false;
|
116
|
+
JSFunction* fun = JSFunction::cast(cons_obj);
|
117
|
+
// Iterate through the chain of inheriting function templates to
|
118
|
+
// see if the required one occurs.
|
119
|
+
for (Object* type = fun->shared()->function_data();
|
120
|
+
type->IsFunctionTemplateInfo();
|
121
|
+
type = FunctionTemplateInfo::cast(type)->parent_template()) {
|
122
|
+
if (type == expected) return true;
|
123
|
+
}
|
124
|
+
// Didn't find the required type in the inheritance chain.
|
125
|
+
return false;
|
126
|
+
}
|
127
|
+
|
128
|
+
|
129
|
+
bool Object::IsSmi() {
|
130
|
+
return HAS_SMI_TAG(this);
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
bool Object::IsHeapObject() {
|
135
|
+
return Internals::HasHeapObjectTag(this);
|
136
|
+
}
|
137
|
+
|
138
|
+
|
139
|
+
bool Object::IsHeapNumber() {
|
140
|
+
return Object::IsHeapObject()
|
141
|
+
&& HeapObject::cast(this)->map()->instance_type() == HEAP_NUMBER_TYPE;
|
142
|
+
}
|
143
|
+
|
144
|
+
|
145
|
+
bool Object::IsString() {
|
146
|
+
return Object::IsHeapObject()
|
147
|
+
&& HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
|
148
|
+
}
|
149
|
+
|
150
|
+
|
151
|
+
bool Object::IsSymbol() {
|
152
|
+
if (!this->IsHeapObject()) return false;
|
153
|
+
uint32_t type = HeapObject::cast(this)->map()->instance_type();
|
154
|
+
// Because the symbol tag is non-zero and no non-string types have the
|
155
|
+
// symbol bit set we can test for symbols with a very simple test
|
156
|
+
// operation.
|
157
|
+
ASSERT(kSymbolTag != 0);
|
158
|
+
ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE);
|
159
|
+
return (type & kIsSymbolMask) != 0;
|
160
|
+
}
|
161
|
+
|
162
|
+
|
163
|
+
bool Object::IsConsString() {
|
164
|
+
if (!this->IsHeapObject()) return false;
|
165
|
+
uint32_t type = HeapObject::cast(this)->map()->instance_type();
|
166
|
+
return (type & (kIsNotStringMask | kStringRepresentationMask)) ==
|
167
|
+
(kStringTag | kConsStringTag);
|
168
|
+
}
|
169
|
+
|
170
|
+
|
171
|
+
bool Object::IsSeqString() {
|
172
|
+
if (!IsString()) return false;
|
173
|
+
return StringShape(String::cast(this)).IsSequential();
|
174
|
+
}
|
175
|
+
|
176
|
+
|
177
|
+
bool Object::IsSeqAsciiString() {
|
178
|
+
if (!IsString()) return false;
|
179
|
+
return StringShape(String::cast(this)).IsSequential() &&
|
180
|
+
String::cast(this)->IsAsciiRepresentation();
|
181
|
+
}
|
182
|
+
|
183
|
+
|
184
|
+
bool Object::IsSeqTwoByteString() {
|
185
|
+
if (!IsString()) return false;
|
186
|
+
return StringShape(String::cast(this)).IsSequential() &&
|
187
|
+
String::cast(this)->IsTwoByteRepresentation();
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
bool Object::IsExternalString() {
|
192
|
+
if (!IsString()) return false;
|
193
|
+
return StringShape(String::cast(this)).IsExternal();
|
194
|
+
}
|
195
|
+
|
196
|
+
|
197
|
+
bool Object::IsExternalAsciiString() {
|
198
|
+
if (!IsString()) return false;
|
199
|
+
return StringShape(String::cast(this)).IsExternal() &&
|
200
|
+
String::cast(this)->IsAsciiRepresentation();
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
bool Object::IsExternalTwoByteString() {
|
205
|
+
if (!IsString()) return false;
|
206
|
+
return StringShape(String::cast(this)).IsExternal() &&
|
207
|
+
String::cast(this)->IsTwoByteRepresentation();
|
208
|
+
}
|
209
|
+
|
210
|
+
|
211
|
+
StringShape::StringShape(String* str)
|
212
|
+
: type_(str->map()->instance_type()) {
|
213
|
+
set_valid();
|
214
|
+
ASSERT((type_ & kIsNotStringMask) == kStringTag);
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
StringShape::StringShape(Map* map)
|
219
|
+
: type_(map->instance_type()) {
|
220
|
+
set_valid();
|
221
|
+
ASSERT((type_ & kIsNotStringMask) == kStringTag);
|
222
|
+
}
|
223
|
+
|
224
|
+
|
225
|
+
StringShape::StringShape(InstanceType t)
|
226
|
+
: type_(static_cast<uint32_t>(t)) {
|
227
|
+
set_valid();
|
228
|
+
ASSERT((type_ & kIsNotStringMask) == kStringTag);
|
229
|
+
}
|
230
|
+
|
231
|
+
|
232
|
+
bool StringShape::IsSymbol() {
|
233
|
+
ASSERT(valid());
|
234
|
+
ASSERT(kSymbolTag != 0);
|
235
|
+
return (type_ & kIsSymbolMask) != 0;
|
236
|
+
}
|
237
|
+
|
238
|
+
|
239
|
+
bool String::IsAsciiRepresentation() {
|
240
|
+
uint32_t type = map()->instance_type();
|
241
|
+
return (type & kStringEncodingMask) == kAsciiStringTag;
|
242
|
+
}
|
243
|
+
|
244
|
+
|
245
|
+
bool String::IsTwoByteRepresentation() {
|
246
|
+
uint32_t type = map()->instance_type();
|
247
|
+
return (type & kStringEncodingMask) == kTwoByteStringTag;
|
248
|
+
}
|
249
|
+
|
250
|
+
|
251
|
+
bool String::HasOnlyAsciiChars() {
|
252
|
+
uint32_t type = map()->instance_type();
|
253
|
+
return (type & kStringEncodingMask) == kAsciiStringTag ||
|
254
|
+
(type & kAsciiDataHintMask) == kAsciiDataHintTag;
|
255
|
+
}
|
256
|
+
|
257
|
+
|
258
|
+
bool StringShape::IsCons() {
|
259
|
+
return (type_ & kStringRepresentationMask) == kConsStringTag;
|
260
|
+
}
|
261
|
+
|
262
|
+
|
263
|
+
bool StringShape::IsExternal() {
|
264
|
+
return (type_ & kStringRepresentationMask) == kExternalStringTag;
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
bool StringShape::IsSequential() {
|
269
|
+
return (type_ & kStringRepresentationMask) == kSeqStringTag;
|
270
|
+
}
|
271
|
+
|
272
|
+
|
273
|
+
StringRepresentationTag StringShape::representation_tag() {
|
274
|
+
uint32_t tag = (type_ & kStringRepresentationMask);
|
275
|
+
return static_cast<StringRepresentationTag>(tag);
|
276
|
+
}
|
277
|
+
|
278
|
+
|
279
|
+
uint32_t StringShape::full_representation_tag() {
|
280
|
+
return (type_ & (kStringRepresentationMask | kStringEncodingMask));
|
281
|
+
}
|
282
|
+
|
283
|
+
|
284
|
+
STATIC_CHECK((kStringRepresentationMask | kStringEncodingMask) ==
|
285
|
+
Internals::kFullStringRepresentationMask);
|
286
|
+
|
287
|
+
|
288
|
+
bool StringShape::IsSequentialAscii() {
|
289
|
+
return full_representation_tag() == (kSeqStringTag | kAsciiStringTag);
|
290
|
+
}
|
291
|
+
|
292
|
+
|
293
|
+
bool StringShape::IsSequentialTwoByte() {
|
294
|
+
return full_representation_tag() == (kSeqStringTag | kTwoByteStringTag);
|
295
|
+
}
|
296
|
+
|
297
|
+
|
298
|
+
bool StringShape::IsExternalAscii() {
|
299
|
+
return full_representation_tag() == (kExternalStringTag | kAsciiStringTag);
|
300
|
+
}
|
301
|
+
|
302
|
+
|
303
|
+
bool StringShape::IsExternalTwoByte() {
|
304
|
+
return full_representation_tag() == (kExternalStringTag | kTwoByteStringTag);
|
305
|
+
}
|
306
|
+
|
307
|
+
|
308
|
+
STATIC_CHECK((kExternalStringTag | kTwoByteStringTag) ==
|
309
|
+
Internals::kExternalTwoByteRepresentationTag);
|
310
|
+
|
311
|
+
|
312
|
+
uc32 FlatStringReader::Get(int index) {
|
313
|
+
ASSERT(0 <= index && index <= length_);
|
314
|
+
if (is_ascii_) {
|
315
|
+
return static_cast<const byte*>(start_)[index];
|
316
|
+
} else {
|
317
|
+
return static_cast<const uc16*>(start_)[index];
|
318
|
+
}
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
bool Object::IsNumber() {
|
323
|
+
return IsSmi() || IsHeapNumber();
|
324
|
+
}
|
325
|
+
|
326
|
+
|
327
|
+
bool Object::IsByteArray() {
|
328
|
+
return Object::IsHeapObject()
|
329
|
+
&& HeapObject::cast(this)->map()->instance_type() == BYTE_ARRAY_TYPE;
|
330
|
+
}
|
331
|
+
|
332
|
+
|
333
|
+
bool Object::IsPixelArray() {
|
334
|
+
return Object::IsHeapObject() &&
|
335
|
+
HeapObject::cast(this)->map()->instance_type() == PIXEL_ARRAY_TYPE;
|
336
|
+
}
|
337
|
+
|
338
|
+
|
339
|
+
bool Object::IsExternalArray() {
|
340
|
+
if (!Object::IsHeapObject())
|
341
|
+
return false;
|
342
|
+
InstanceType instance_type =
|
343
|
+
HeapObject::cast(this)->map()->instance_type();
|
344
|
+
return (instance_type >= FIRST_EXTERNAL_ARRAY_TYPE &&
|
345
|
+
instance_type <= LAST_EXTERNAL_ARRAY_TYPE);
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
bool Object::IsExternalByteArray() {
|
350
|
+
return Object::IsHeapObject() &&
|
351
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
352
|
+
EXTERNAL_BYTE_ARRAY_TYPE;
|
353
|
+
}
|
354
|
+
|
355
|
+
|
356
|
+
bool Object::IsExternalUnsignedByteArray() {
|
357
|
+
return Object::IsHeapObject() &&
|
358
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
359
|
+
EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE;
|
360
|
+
}
|
361
|
+
|
362
|
+
|
363
|
+
bool Object::IsExternalShortArray() {
|
364
|
+
return Object::IsHeapObject() &&
|
365
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
366
|
+
EXTERNAL_SHORT_ARRAY_TYPE;
|
367
|
+
}
|
368
|
+
|
369
|
+
|
370
|
+
bool Object::IsExternalUnsignedShortArray() {
|
371
|
+
return Object::IsHeapObject() &&
|
372
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
373
|
+
EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE;
|
374
|
+
}
|
375
|
+
|
376
|
+
|
377
|
+
bool Object::IsExternalIntArray() {
|
378
|
+
return Object::IsHeapObject() &&
|
379
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
380
|
+
EXTERNAL_INT_ARRAY_TYPE;
|
381
|
+
}
|
382
|
+
|
383
|
+
|
384
|
+
bool Object::IsExternalUnsignedIntArray() {
|
385
|
+
return Object::IsHeapObject() &&
|
386
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
387
|
+
EXTERNAL_UNSIGNED_INT_ARRAY_TYPE;
|
388
|
+
}
|
389
|
+
|
390
|
+
|
391
|
+
bool Object::IsExternalFloatArray() {
|
392
|
+
return Object::IsHeapObject() &&
|
393
|
+
HeapObject::cast(this)->map()->instance_type() ==
|
394
|
+
EXTERNAL_FLOAT_ARRAY_TYPE;
|
395
|
+
}
|
396
|
+
|
397
|
+
|
398
|
+
bool MaybeObject::IsFailure() {
|
399
|
+
return HAS_FAILURE_TAG(this);
|
400
|
+
}
|
401
|
+
|
402
|
+
|
403
|
+
bool MaybeObject::IsRetryAfterGC() {
|
404
|
+
return HAS_FAILURE_TAG(this)
|
405
|
+
&& Failure::cast(this)->type() == Failure::RETRY_AFTER_GC;
|
406
|
+
}
|
407
|
+
|
408
|
+
|
409
|
+
bool MaybeObject::IsOutOfMemory() {
|
410
|
+
return HAS_FAILURE_TAG(this)
|
411
|
+
&& Failure::cast(this)->IsOutOfMemoryException();
|
412
|
+
}
|
413
|
+
|
414
|
+
|
415
|
+
bool MaybeObject::IsException() {
|
416
|
+
return this == Failure::Exception();
|
417
|
+
}
|
418
|
+
|
419
|
+
|
420
|
+
bool MaybeObject::IsTheHole() {
|
421
|
+
return this == Heap::the_hole_value();
|
422
|
+
}
|
423
|
+
|
424
|
+
|
425
|
+
Failure* Failure::cast(MaybeObject* obj) {
|
426
|
+
ASSERT(HAS_FAILURE_TAG(obj));
|
427
|
+
return reinterpret_cast<Failure*>(obj);
|
428
|
+
}
|
429
|
+
|
430
|
+
|
431
|
+
bool Object::IsJSObject() {
|
432
|
+
return IsHeapObject()
|
433
|
+
&& HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE;
|
434
|
+
}
|
435
|
+
|
436
|
+
|
437
|
+
bool Object::IsJSContextExtensionObject() {
|
438
|
+
return IsHeapObject()
|
439
|
+
&& (HeapObject::cast(this)->map()->instance_type() ==
|
440
|
+
JS_CONTEXT_EXTENSION_OBJECT_TYPE);
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
bool Object::IsMap() {
|
445
|
+
return Object::IsHeapObject()
|
446
|
+
&& HeapObject::cast(this)->map()->instance_type() == MAP_TYPE;
|
447
|
+
}
|
448
|
+
|
449
|
+
|
450
|
+
bool Object::IsFixedArray() {
|
451
|
+
return Object::IsHeapObject()
|
452
|
+
&& HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE;
|
453
|
+
}
|
454
|
+
|
455
|
+
|
456
|
+
bool Object::IsDescriptorArray() {
|
457
|
+
return IsFixedArray();
|
458
|
+
}
|
459
|
+
|
460
|
+
|
461
|
+
bool Object::IsDeoptimizationInputData() {
|
462
|
+
// Must be a fixed array.
|
463
|
+
if (!IsFixedArray()) return false;
|
464
|
+
|
465
|
+
// There's no sure way to detect the difference between a fixed array and
|
466
|
+
// a deoptimization data array. Since this is used for asserts we can
|
467
|
+
// check that the length is zero or else the fixed size plus a multiple of
|
468
|
+
// the entry size.
|
469
|
+
int length = FixedArray::cast(this)->length();
|
470
|
+
if (length == 0) return true;
|
471
|
+
|
472
|
+
length -= DeoptimizationInputData::kFirstDeoptEntryIndex;
|
473
|
+
return length >= 0 &&
|
474
|
+
length % DeoptimizationInputData::kDeoptEntrySize == 0;
|
475
|
+
}
|
476
|
+
|
477
|
+
|
478
|
+
bool Object::IsDeoptimizationOutputData() {
|
479
|
+
if (!IsFixedArray()) return false;
|
480
|
+
// There's actually no way to see the difference between a fixed array and
|
481
|
+
// a deoptimization data array. Since this is used for asserts we can check
|
482
|
+
// that the length is plausible though.
|
483
|
+
if (FixedArray::cast(this)->length() % 2 != 0) return false;
|
484
|
+
return true;
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
bool Object::IsContext() {
|
489
|
+
return Object::IsHeapObject()
|
490
|
+
&& (HeapObject::cast(this)->map() == Heap::context_map() ||
|
491
|
+
HeapObject::cast(this)->map() == Heap::catch_context_map() ||
|
492
|
+
HeapObject::cast(this)->map() == Heap::global_context_map());
|
493
|
+
}
|
494
|
+
|
495
|
+
|
496
|
+
bool Object::IsCatchContext() {
|
497
|
+
return Object::IsHeapObject()
|
498
|
+
&& HeapObject::cast(this)->map() == Heap::catch_context_map();
|
499
|
+
}
|
500
|
+
|
501
|
+
|
502
|
+
bool Object::IsGlobalContext() {
|
503
|
+
return Object::IsHeapObject()
|
504
|
+
&& HeapObject::cast(this)->map() == Heap::global_context_map();
|
505
|
+
}
|
506
|
+
|
507
|
+
|
508
|
+
bool Object::IsJSFunction() {
|
509
|
+
return Object::IsHeapObject()
|
510
|
+
&& HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE;
|
511
|
+
}
|
512
|
+
|
513
|
+
|
514
|
+
template <> inline bool Is<JSFunction>(Object* obj) {
|
515
|
+
return obj->IsJSFunction();
|
516
|
+
}
|
517
|
+
|
518
|
+
|
519
|
+
bool Object::IsCode() {
|
520
|
+
return Object::IsHeapObject()
|
521
|
+
&& HeapObject::cast(this)->map()->instance_type() == CODE_TYPE;
|
522
|
+
}
|
523
|
+
|
524
|
+
|
525
|
+
bool Object::IsOddball() {
|
526
|
+
return Object::IsHeapObject()
|
527
|
+
&& HeapObject::cast(this)->map()->instance_type() == ODDBALL_TYPE;
|
528
|
+
}
|
529
|
+
|
530
|
+
|
531
|
+
bool Object::IsJSGlobalPropertyCell() {
|
532
|
+
return Object::IsHeapObject()
|
533
|
+
&& HeapObject::cast(this)->map()->instance_type()
|
534
|
+
== JS_GLOBAL_PROPERTY_CELL_TYPE;
|
535
|
+
}
|
536
|
+
|
537
|
+
|
538
|
+
bool Object::IsSharedFunctionInfo() {
|
539
|
+
return Object::IsHeapObject() &&
|
540
|
+
(HeapObject::cast(this)->map()->instance_type() ==
|
541
|
+
SHARED_FUNCTION_INFO_TYPE);
|
542
|
+
}
|
543
|
+
|
544
|
+
|
545
|
+
bool Object::IsJSValue() {
|
546
|
+
return Object::IsHeapObject()
|
547
|
+
&& HeapObject::cast(this)->map()->instance_type() == JS_VALUE_TYPE;
|
548
|
+
}
|
549
|
+
|
550
|
+
|
551
|
+
bool Object::IsJSMessageObject() {
|
552
|
+
return Object::IsHeapObject()
|
553
|
+
&& (HeapObject::cast(this)->map()->instance_type() ==
|
554
|
+
JS_MESSAGE_OBJECT_TYPE);
|
555
|
+
}
|
556
|
+
|
557
|
+
|
558
|
+
bool Object::IsStringWrapper() {
|
559
|
+
return IsJSValue() && JSValue::cast(this)->value()->IsString();
|
560
|
+
}
|
561
|
+
|
562
|
+
|
563
|
+
bool Object::IsProxy() {
|
564
|
+
return Object::IsHeapObject()
|
565
|
+
&& HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE;
|
566
|
+
}
|
567
|
+
|
568
|
+
|
569
|
+
bool Object::IsBoolean() {
|
570
|
+
return IsTrue() || IsFalse();
|
571
|
+
}
|
572
|
+
|
573
|
+
|
574
|
+
bool Object::IsJSArray() {
|
575
|
+
return Object::IsHeapObject()
|
576
|
+
&& HeapObject::cast(this)->map()->instance_type() == JS_ARRAY_TYPE;
|
577
|
+
}
|
578
|
+
|
579
|
+
|
580
|
+
bool Object::IsJSRegExp() {
|
581
|
+
return Object::IsHeapObject()
|
582
|
+
&& HeapObject::cast(this)->map()->instance_type() == JS_REGEXP_TYPE;
|
583
|
+
}
|
584
|
+
|
585
|
+
|
586
|
+
template <> inline bool Is<JSArray>(Object* obj) {
|
587
|
+
return obj->IsJSArray();
|
588
|
+
}
|
589
|
+
|
590
|
+
|
591
|
+
bool Object::IsHashTable() {
|
592
|
+
return Object::IsHeapObject()
|
593
|
+
&& HeapObject::cast(this)->map() == Heap::hash_table_map();
|
594
|
+
}
|
595
|
+
|
596
|
+
|
597
|
+
bool Object::IsDictionary() {
|
598
|
+
return IsHashTable() && this != Heap::symbol_table();
|
599
|
+
}
|
600
|
+
|
601
|
+
|
602
|
+
bool Object::IsSymbolTable() {
|
603
|
+
return IsHashTable() && this == Heap::raw_unchecked_symbol_table();
|
604
|
+
}
|
605
|
+
|
606
|
+
|
607
|
+
bool Object::IsJSFunctionResultCache() {
|
608
|
+
if (!IsFixedArray()) return false;
|
609
|
+
FixedArray* self = FixedArray::cast(this);
|
610
|
+
int length = self->length();
|
611
|
+
if (length < JSFunctionResultCache::kEntriesIndex) return false;
|
612
|
+
if ((length - JSFunctionResultCache::kEntriesIndex)
|
613
|
+
% JSFunctionResultCache::kEntrySize != 0) {
|
614
|
+
return false;
|
615
|
+
}
|
616
|
+
#ifdef DEBUG
|
617
|
+
reinterpret_cast<JSFunctionResultCache*>(this)->JSFunctionResultCacheVerify();
|
618
|
+
#endif
|
619
|
+
return true;
|
620
|
+
}
|
621
|
+
|
622
|
+
|
623
|
+
bool Object::IsNormalizedMapCache() {
|
624
|
+
if (!IsFixedArray()) return false;
|
625
|
+
if (FixedArray::cast(this)->length() != NormalizedMapCache::kEntries) {
|
626
|
+
return false;
|
627
|
+
}
|
628
|
+
#ifdef DEBUG
|
629
|
+
reinterpret_cast<NormalizedMapCache*>(this)->NormalizedMapCacheVerify();
|
630
|
+
#endif
|
631
|
+
return true;
|
632
|
+
}
|
633
|
+
|
634
|
+
|
635
|
+
bool Object::IsCompilationCacheTable() {
|
636
|
+
return IsHashTable();
|
637
|
+
}
|
638
|
+
|
639
|
+
|
640
|
+
bool Object::IsCodeCacheHashTable() {
|
641
|
+
return IsHashTable();
|
642
|
+
}
|
643
|
+
|
644
|
+
|
645
|
+
bool Object::IsMapCache() {
|
646
|
+
return IsHashTable();
|
647
|
+
}
|
648
|
+
|
649
|
+
|
650
|
+
bool Object::IsPrimitive() {
|
651
|
+
return IsOddball() || IsNumber() || IsString();
|
652
|
+
}
|
653
|
+
|
654
|
+
|
655
|
+
bool Object::IsJSGlobalProxy() {
|
656
|
+
bool result = IsHeapObject() &&
|
657
|
+
(HeapObject::cast(this)->map()->instance_type() ==
|
658
|
+
JS_GLOBAL_PROXY_TYPE);
|
659
|
+
ASSERT(!result || IsAccessCheckNeeded());
|
660
|
+
return result;
|
661
|
+
}
|
662
|
+
|
663
|
+
|
664
|
+
bool Object::IsGlobalObject() {
|
665
|
+
if (!IsHeapObject()) return false;
|
666
|
+
|
667
|
+
InstanceType type = HeapObject::cast(this)->map()->instance_type();
|
668
|
+
return type == JS_GLOBAL_OBJECT_TYPE ||
|
669
|
+
type == JS_BUILTINS_OBJECT_TYPE;
|
670
|
+
}
|
671
|
+
|
672
|
+
|
673
|
+
bool Object::IsJSGlobalObject() {
|
674
|
+
return IsHeapObject() &&
|
675
|
+
(HeapObject::cast(this)->map()->instance_type() ==
|
676
|
+
JS_GLOBAL_OBJECT_TYPE);
|
677
|
+
}
|
678
|
+
|
679
|
+
|
680
|
+
bool Object::IsJSBuiltinsObject() {
|
681
|
+
return IsHeapObject() &&
|
682
|
+
(HeapObject::cast(this)->map()->instance_type() ==
|
683
|
+
JS_BUILTINS_OBJECT_TYPE);
|
684
|
+
}
|
685
|
+
|
686
|
+
|
687
|
+
bool Object::IsUndetectableObject() {
|
688
|
+
return IsHeapObject()
|
689
|
+
&& HeapObject::cast(this)->map()->is_undetectable();
|
690
|
+
}
|
691
|
+
|
692
|
+
|
693
|
+
bool Object::IsAccessCheckNeeded() {
|
694
|
+
return IsHeapObject()
|
695
|
+
&& HeapObject::cast(this)->map()->is_access_check_needed();
|
696
|
+
}
|
697
|
+
|
698
|
+
|
699
|
+
bool Object::IsStruct() {
|
700
|
+
if (!IsHeapObject()) return false;
|
701
|
+
switch (HeapObject::cast(this)->map()->instance_type()) {
|
702
|
+
#define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true;
|
703
|
+
STRUCT_LIST(MAKE_STRUCT_CASE)
|
704
|
+
#undef MAKE_STRUCT_CASE
|
705
|
+
default: return false;
|
706
|
+
}
|
707
|
+
}
|
708
|
+
|
709
|
+
|
710
|
+
#define MAKE_STRUCT_PREDICATE(NAME, Name, name) \
|
711
|
+
bool Object::Is##Name() { \
|
712
|
+
return Object::IsHeapObject() \
|
713
|
+
&& HeapObject::cast(this)->map()->instance_type() == NAME##_TYPE; \
|
714
|
+
}
|
715
|
+
STRUCT_LIST(MAKE_STRUCT_PREDICATE)
|
716
|
+
#undef MAKE_STRUCT_PREDICATE
|
717
|
+
|
718
|
+
|
719
|
+
bool Object::IsUndefined() {
|
720
|
+
return this == Heap::undefined_value();
|
721
|
+
}
|
722
|
+
|
723
|
+
|
724
|
+
bool Object::IsNull() {
|
725
|
+
return this == Heap::null_value();
|
726
|
+
}
|
727
|
+
|
728
|
+
|
729
|
+
bool Object::IsTrue() {
|
730
|
+
return this == Heap::true_value();
|
731
|
+
}
|
732
|
+
|
733
|
+
|
734
|
+
bool Object::IsFalse() {
|
735
|
+
return this == Heap::false_value();
|
736
|
+
}
|
737
|
+
|
738
|
+
|
739
|
+
bool Object::IsArgumentsMarker() {
|
740
|
+
return this == Heap::arguments_marker();
|
741
|
+
}
|
742
|
+
|
743
|
+
|
744
|
+
double Object::Number() {
|
745
|
+
ASSERT(IsNumber());
|
746
|
+
return IsSmi()
|
747
|
+
? static_cast<double>(reinterpret_cast<Smi*>(this)->value())
|
748
|
+
: reinterpret_cast<HeapNumber*>(this)->value();
|
749
|
+
}
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
MaybeObject* Object::ToSmi() {
|
754
|
+
if (IsSmi()) return this;
|
755
|
+
if (IsHeapNumber()) {
|
756
|
+
double value = HeapNumber::cast(this)->value();
|
757
|
+
int int_value = FastD2I(value);
|
758
|
+
if (value == FastI2D(int_value) && Smi::IsValid(int_value)) {
|
759
|
+
return Smi::FromInt(int_value);
|
760
|
+
}
|
761
|
+
}
|
762
|
+
return Failure::Exception();
|
763
|
+
}
|
764
|
+
|
765
|
+
|
766
|
+
bool Object::HasSpecificClassOf(String* name) {
|
767
|
+
return this->IsJSObject() && (JSObject::cast(this)->class_name() == name);
|
768
|
+
}
|
769
|
+
|
770
|
+
|
771
|
+
MaybeObject* Object::GetElement(uint32_t index) {
|
772
|
+
// GetElement can trigger a getter which can cause allocation.
|
773
|
+
// This was not always the case. This ASSERT is here to catch
|
774
|
+
// leftover incorrect uses.
|
775
|
+
ASSERT(Heap::IsAllocationAllowed());
|
776
|
+
return GetElementWithReceiver(this, index);
|
777
|
+
}
|
778
|
+
|
779
|
+
|
780
|
+
Object* Object::GetElementNoExceptionThrown(uint32_t index) {
|
781
|
+
MaybeObject* maybe = GetElementWithReceiver(this, index);
|
782
|
+
ASSERT(!maybe->IsFailure());
|
783
|
+
Object* result = NULL; // Initialization to please compiler.
|
784
|
+
maybe->ToObject(&result);
|
785
|
+
return result;
|
786
|
+
}
|
787
|
+
|
788
|
+
|
789
|
+
MaybeObject* Object::GetProperty(String* key) {
|
790
|
+
PropertyAttributes attributes;
|
791
|
+
return GetPropertyWithReceiver(this, key, &attributes);
|
792
|
+
}
|
793
|
+
|
794
|
+
|
795
|
+
MaybeObject* Object::GetProperty(String* key, PropertyAttributes* attributes) {
|
796
|
+
return GetPropertyWithReceiver(this, key, attributes);
|
797
|
+
}
|
798
|
+
|
799
|
+
|
800
|
+
#define FIELD_ADDR(p, offset) \
|
801
|
+
(reinterpret_cast<byte*>(p) + offset - kHeapObjectTag)
|
802
|
+
|
803
|
+
#define READ_FIELD(p, offset) \
|
804
|
+
(*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)))
|
805
|
+
|
806
|
+
#define WRITE_FIELD(p, offset, value) \
|
807
|
+
(*reinterpret_cast<Object**>(FIELD_ADDR(p, offset)) = value)
|
808
|
+
|
809
|
+
|
810
|
+
#define WRITE_BARRIER(object, offset) \
|
811
|
+
Heap::RecordWrite(object->address(), offset);
|
812
|
+
|
813
|
+
// CONDITIONAL_WRITE_BARRIER must be issued after the actual
|
814
|
+
// write due to the assert validating the written value.
|
815
|
+
#define CONDITIONAL_WRITE_BARRIER(object, offset, mode) \
|
816
|
+
if (mode == UPDATE_WRITE_BARRIER) { \
|
817
|
+
Heap::RecordWrite(object->address(), offset); \
|
818
|
+
} else { \
|
819
|
+
ASSERT(mode == SKIP_WRITE_BARRIER); \
|
820
|
+
ASSERT(Heap::InNewSpace(object) || \
|
821
|
+
!Heap::InNewSpace(READ_FIELD(object, offset)) || \
|
822
|
+
Page::FromAddress(object->address())-> \
|
823
|
+
IsRegionDirty(object->address() + offset)); \
|
824
|
+
}
|
825
|
+
|
826
|
+
#define READ_DOUBLE_FIELD(p, offset) \
|
827
|
+
(*reinterpret_cast<double*>(FIELD_ADDR(p, offset)))
|
828
|
+
|
829
|
+
#define WRITE_DOUBLE_FIELD(p, offset, value) \
|
830
|
+
(*reinterpret_cast<double*>(FIELD_ADDR(p, offset)) = value)
|
831
|
+
|
832
|
+
#define READ_INT_FIELD(p, offset) \
|
833
|
+
(*reinterpret_cast<int*>(FIELD_ADDR(p, offset)))
|
834
|
+
|
835
|
+
#define WRITE_INT_FIELD(p, offset, value) \
|
836
|
+
(*reinterpret_cast<int*>(FIELD_ADDR(p, offset)) = value)
|
837
|
+
|
838
|
+
#define READ_INTPTR_FIELD(p, offset) \
|
839
|
+
(*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)))
|
840
|
+
|
841
|
+
#define WRITE_INTPTR_FIELD(p, offset, value) \
|
842
|
+
(*reinterpret_cast<intptr_t*>(FIELD_ADDR(p, offset)) = value)
|
843
|
+
|
844
|
+
#define READ_UINT32_FIELD(p, offset) \
|
845
|
+
(*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)))
|
846
|
+
|
847
|
+
#define WRITE_UINT32_FIELD(p, offset, value) \
|
848
|
+
(*reinterpret_cast<uint32_t*>(FIELD_ADDR(p, offset)) = value)
|
849
|
+
|
850
|
+
#define READ_SHORT_FIELD(p, offset) \
|
851
|
+
(*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)))
|
852
|
+
|
853
|
+
#define WRITE_SHORT_FIELD(p, offset, value) \
|
854
|
+
(*reinterpret_cast<uint16_t*>(FIELD_ADDR(p, offset)) = value)
|
855
|
+
|
856
|
+
#define READ_BYTE_FIELD(p, offset) \
|
857
|
+
(*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)))
|
858
|
+
|
859
|
+
#define WRITE_BYTE_FIELD(p, offset, value) \
|
860
|
+
(*reinterpret_cast<byte*>(FIELD_ADDR(p, offset)) = value)
|
861
|
+
|
862
|
+
|
863
|
+
Object** HeapObject::RawField(HeapObject* obj, int byte_offset) {
|
864
|
+
return &READ_FIELD(obj, byte_offset);
|
865
|
+
}
|
866
|
+
|
867
|
+
|
868
|
+
int Smi::value() {
|
869
|
+
return Internals::SmiValue(this);
|
870
|
+
}
|
871
|
+
|
872
|
+
|
873
|
+
Smi* Smi::FromInt(int value) {
|
874
|
+
ASSERT(Smi::IsValid(value));
|
875
|
+
int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
|
876
|
+
intptr_t tagged_value =
|
877
|
+
(static_cast<intptr_t>(value) << smi_shift_bits) | kSmiTag;
|
878
|
+
return reinterpret_cast<Smi*>(tagged_value);
|
879
|
+
}
|
880
|
+
|
881
|
+
|
882
|
+
Smi* Smi::FromIntptr(intptr_t value) {
|
883
|
+
ASSERT(Smi::IsValid(value));
|
884
|
+
int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
|
885
|
+
return reinterpret_cast<Smi*>((value << smi_shift_bits) | kSmiTag);
|
886
|
+
}
|
887
|
+
|
888
|
+
|
889
|
+
Failure::Type Failure::type() const {
|
890
|
+
return static_cast<Type>(value() & kFailureTypeTagMask);
|
891
|
+
}
|
892
|
+
|
893
|
+
|
894
|
+
bool Failure::IsInternalError() const {
|
895
|
+
return type() == INTERNAL_ERROR;
|
896
|
+
}
|
897
|
+
|
898
|
+
|
899
|
+
bool Failure::IsOutOfMemoryException() const {
|
900
|
+
return type() == OUT_OF_MEMORY_EXCEPTION;
|
901
|
+
}
|
902
|
+
|
903
|
+
|
904
|
+
AllocationSpace Failure::allocation_space() const {
|
905
|
+
ASSERT_EQ(RETRY_AFTER_GC, type());
|
906
|
+
return static_cast<AllocationSpace>((value() >> kFailureTypeTagSize)
|
907
|
+
& kSpaceTagMask);
|
908
|
+
}
|
909
|
+
|
910
|
+
|
911
|
+
Failure* Failure::InternalError() {
|
912
|
+
return Construct(INTERNAL_ERROR);
|
913
|
+
}
|
914
|
+
|
915
|
+
|
916
|
+
Failure* Failure::Exception() {
|
917
|
+
return Construct(EXCEPTION);
|
918
|
+
}
|
919
|
+
|
920
|
+
|
921
|
+
Failure* Failure::OutOfMemoryException() {
|
922
|
+
return Construct(OUT_OF_MEMORY_EXCEPTION);
|
923
|
+
}
|
924
|
+
|
925
|
+
|
926
|
+
intptr_t Failure::value() const {
|
927
|
+
return static_cast<intptr_t>(
|
928
|
+
reinterpret_cast<uintptr_t>(this) >> kFailureTagSize);
|
929
|
+
}
|
930
|
+
|
931
|
+
|
932
|
+
Failure* Failure::RetryAfterGC() {
|
933
|
+
return RetryAfterGC(NEW_SPACE);
|
934
|
+
}
|
935
|
+
|
936
|
+
|
937
|
+
Failure* Failure::RetryAfterGC(AllocationSpace space) {
|
938
|
+
ASSERT((space & ~kSpaceTagMask) == 0);
|
939
|
+
return Construct(RETRY_AFTER_GC, space);
|
940
|
+
}
|
941
|
+
|
942
|
+
|
943
|
+
Failure* Failure::Construct(Type type, intptr_t value) {
|
944
|
+
uintptr_t info =
|
945
|
+
(static_cast<uintptr_t>(value) << kFailureTypeTagSize) | type;
|
946
|
+
ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info);
|
947
|
+
return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag);
|
948
|
+
}
|
949
|
+
|
950
|
+
|
951
|
+
bool Smi::IsValid(intptr_t value) {
|
952
|
+
#ifdef DEBUG
|
953
|
+
bool in_range = (value >= kMinValue) && (value <= kMaxValue);
|
954
|
+
#endif
|
955
|
+
|
956
|
+
#ifdef V8_TARGET_ARCH_X64
|
957
|
+
// To be representable as a long smi, the value must be a 32-bit integer.
|
958
|
+
bool result = (value == static_cast<int32_t>(value));
|
959
|
+
#else
|
960
|
+
// To be representable as an tagged small integer, the two
|
961
|
+
// most-significant bits of 'value' must be either 00 or 11 due to
|
962
|
+
// sign-extension. To check this we add 01 to the two
|
963
|
+
// most-significant bits, and check if the most-significant bit is 0
|
964
|
+
//
|
965
|
+
// CAUTION: The original code below:
|
966
|
+
// bool result = ((value + 0x40000000) & 0x80000000) == 0;
|
967
|
+
// may lead to incorrect results according to the C language spec, and
|
968
|
+
// in fact doesn't work correctly with gcc4.1.1 in some cases: The
|
969
|
+
// compiler may produce undefined results in case of signed integer
|
970
|
+
// overflow. The computation must be done w/ unsigned ints.
|
971
|
+
bool result = (static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U);
|
972
|
+
#endif
|
973
|
+
ASSERT(result == in_range);
|
974
|
+
return result;
|
975
|
+
}
|
976
|
+
|
977
|
+
|
978
|
+
MapWord MapWord::FromMap(Map* map) {
|
979
|
+
return MapWord(reinterpret_cast<uintptr_t>(map));
|
980
|
+
}
|
981
|
+
|
982
|
+
|
983
|
+
Map* MapWord::ToMap() {
|
984
|
+
return reinterpret_cast<Map*>(value_);
|
985
|
+
}
|
986
|
+
|
987
|
+
|
988
|
+
bool MapWord::IsForwardingAddress() {
|
989
|
+
return HAS_SMI_TAG(reinterpret_cast<Object*>(value_));
|
990
|
+
}
|
991
|
+
|
992
|
+
|
993
|
+
MapWord MapWord::FromForwardingAddress(HeapObject* object) {
|
994
|
+
Address raw = reinterpret_cast<Address>(object) - kHeapObjectTag;
|
995
|
+
return MapWord(reinterpret_cast<uintptr_t>(raw));
|
996
|
+
}
|
997
|
+
|
998
|
+
|
999
|
+
HeapObject* MapWord::ToForwardingAddress() {
|
1000
|
+
ASSERT(IsForwardingAddress());
|
1001
|
+
return HeapObject::FromAddress(reinterpret_cast<Address>(value_));
|
1002
|
+
}
|
1003
|
+
|
1004
|
+
|
1005
|
+
bool MapWord::IsMarked() {
|
1006
|
+
return (value_ & kMarkingMask) == 0;
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
|
1010
|
+
void MapWord::SetMark() {
|
1011
|
+
value_ &= ~kMarkingMask;
|
1012
|
+
}
|
1013
|
+
|
1014
|
+
|
1015
|
+
void MapWord::ClearMark() {
|
1016
|
+
value_ |= kMarkingMask;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
|
1020
|
+
bool MapWord::IsOverflowed() {
|
1021
|
+
return (value_ & kOverflowMask) != 0;
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
|
1025
|
+
void MapWord::SetOverflow() {
|
1026
|
+
value_ |= kOverflowMask;
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
|
1030
|
+
void MapWord::ClearOverflow() {
|
1031
|
+
value_ &= ~kOverflowMask;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
|
1035
|
+
MapWord MapWord::EncodeAddress(Address map_address, int offset) {
|
1036
|
+
// Offset is the distance in live bytes from the first live object in the
|
1037
|
+
// same page. The offset between two objects in the same page should not
|
1038
|
+
// exceed the object area size of a page.
|
1039
|
+
ASSERT(0 <= offset && offset < Page::kObjectAreaSize);
|
1040
|
+
|
1041
|
+
uintptr_t compact_offset = offset >> kObjectAlignmentBits;
|
1042
|
+
ASSERT(compact_offset < (1 << kForwardingOffsetBits));
|
1043
|
+
|
1044
|
+
Page* map_page = Page::FromAddress(map_address);
|
1045
|
+
ASSERT_MAP_PAGE_INDEX(map_page->mc_page_index);
|
1046
|
+
|
1047
|
+
uintptr_t map_page_offset =
|
1048
|
+
map_page->Offset(map_address) >> kMapAlignmentBits;
|
1049
|
+
|
1050
|
+
uintptr_t encoding =
|
1051
|
+
(compact_offset << kForwardingOffsetShift) |
|
1052
|
+
(map_page_offset << kMapPageOffsetShift) |
|
1053
|
+
(map_page->mc_page_index << kMapPageIndexShift);
|
1054
|
+
return MapWord(encoding);
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
|
1058
|
+
Address MapWord::DecodeMapAddress(MapSpace* map_space) {
|
1059
|
+
int map_page_index =
|
1060
|
+
static_cast<int>((value_ & kMapPageIndexMask) >> kMapPageIndexShift);
|
1061
|
+
ASSERT_MAP_PAGE_INDEX(map_page_index);
|
1062
|
+
|
1063
|
+
int map_page_offset = static_cast<int>(
|
1064
|
+
((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift) <<
|
1065
|
+
kMapAlignmentBits);
|
1066
|
+
|
1067
|
+
return (map_space->PageAddress(map_page_index) + map_page_offset);
|
1068
|
+
}
|
1069
|
+
|
1070
|
+
|
1071
|
+
int MapWord::DecodeOffset() {
|
1072
|
+
// The offset field is represented in the kForwardingOffsetBits
|
1073
|
+
// most-significant bits.
|
1074
|
+
uintptr_t offset = (value_ >> kForwardingOffsetShift) << kObjectAlignmentBits;
|
1075
|
+
ASSERT(offset < static_cast<uintptr_t>(Page::kObjectAreaSize));
|
1076
|
+
return static_cast<int>(offset);
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
|
1080
|
+
MapWord MapWord::FromEncodedAddress(Address address) {
|
1081
|
+
return MapWord(reinterpret_cast<uintptr_t>(address));
|
1082
|
+
}
|
1083
|
+
|
1084
|
+
|
1085
|
+
Address MapWord::ToEncodedAddress() {
|
1086
|
+
return reinterpret_cast<Address>(value_);
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
|
1090
|
+
#ifdef DEBUG
|
1091
|
+
void HeapObject::VerifyObjectField(int offset) {
|
1092
|
+
VerifyPointer(READ_FIELD(this, offset));
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
void HeapObject::VerifySmiField(int offset) {
|
1096
|
+
ASSERT(READ_FIELD(this, offset)->IsSmi());
|
1097
|
+
}
|
1098
|
+
#endif
|
1099
|
+
|
1100
|
+
|
1101
|
+
Map* HeapObject::map() {
|
1102
|
+
return map_word().ToMap();
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
|
1106
|
+
void HeapObject::set_map(Map* value) {
|
1107
|
+
set_map_word(MapWord::FromMap(value));
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
|
1111
|
+
MapWord HeapObject::map_word() {
|
1112
|
+
return MapWord(reinterpret_cast<uintptr_t>(READ_FIELD(this, kMapOffset)));
|
1113
|
+
}
|
1114
|
+
|
1115
|
+
|
1116
|
+
void HeapObject::set_map_word(MapWord map_word) {
|
1117
|
+
// WRITE_FIELD does not invoke write barrier, but there is no need
|
1118
|
+
// here.
|
1119
|
+
WRITE_FIELD(this, kMapOffset, reinterpret_cast<Object*>(map_word.value_));
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
|
1123
|
+
HeapObject* HeapObject::FromAddress(Address address) {
|
1124
|
+
ASSERT_TAG_ALIGNED(address);
|
1125
|
+
return reinterpret_cast<HeapObject*>(address + kHeapObjectTag);
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
|
1129
|
+
Address HeapObject::address() {
|
1130
|
+
return reinterpret_cast<Address>(this) - kHeapObjectTag;
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
|
1134
|
+
int HeapObject::Size() {
|
1135
|
+
return SizeFromMap(map());
|
1136
|
+
}
|
1137
|
+
|
1138
|
+
|
1139
|
+
void HeapObject::IteratePointers(ObjectVisitor* v, int start, int end) {
|
1140
|
+
v->VisitPointers(reinterpret_cast<Object**>(FIELD_ADDR(this, start)),
|
1141
|
+
reinterpret_cast<Object**>(FIELD_ADDR(this, end)));
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
|
1145
|
+
void HeapObject::IteratePointer(ObjectVisitor* v, int offset) {
|
1146
|
+
v->VisitPointer(reinterpret_cast<Object**>(FIELD_ADDR(this, offset)));
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
|
1150
|
+
bool HeapObject::IsMarked() {
|
1151
|
+
return map_word().IsMarked();
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
|
1155
|
+
void HeapObject::SetMark() {
|
1156
|
+
ASSERT(!IsMarked());
|
1157
|
+
MapWord first_word = map_word();
|
1158
|
+
first_word.SetMark();
|
1159
|
+
set_map_word(first_word);
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
|
1163
|
+
void HeapObject::ClearMark() {
|
1164
|
+
ASSERT(IsMarked());
|
1165
|
+
MapWord first_word = map_word();
|
1166
|
+
first_word.ClearMark();
|
1167
|
+
set_map_word(first_word);
|
1168
|
+
}
|
1169
|
+
|
1170
|
+
|
1171
|
+
bool HeapObject::IsOverflowed() {
|
1172
|
+
return map_word().IsOverflowed();
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
|
1176
|
+
void HeapObject::SetOverflow() {
|
1177
|
+
MapWord first_word = map_word();
|
1178
|
+
first_word.SetOverflow();
|
1179
|
+
set_map_word(first_word);
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
|
1183
|
+
void HeapObject::ClearOverflow() {
|
1184
|
+
ASSERT(IsOverflowed());
|
1185
|
+
MapWord first_word = map_word();
|
1186
|
+
first_word.ClearOverflow();
|
1187
|
+
set_map_word(first_word);
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
|
1191
|
+
double HeapNumber::value() {
|
1192
|
+
return READ_DOUBLE_FIELD(this, kValueOffset);
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
|
1196
|
+
void HeapNumber::set_value(double value) {
|
1197
|
+
WRITE_DOUBLE_FIELD(this, kValueOffset, value);
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
|
1201
|
+
int HeapNumber::get_exponent() {
|
1202
|
+
return ((READ_INT_FIELD(this, kExponentOffset) & kExponentMask) >>
|
1203
|
+
kExponentShift) - kExponentBias;
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
|
1207
|
+
int HeapNumber::get_sign() {
|
1208
|
+
return READ_INT_FIELD(this, kExponentOffset) & kSignMask;
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
|
1212
|
+
ACCESSORS(JSObject, properties, FixedArray, kPropertiesOffset)
|
1213
|
+
|
1214
|
+
|
1215
|
+
HeapObject* JSObject::elements() {
|
1216
|
+
Object* array = READ_FIELD(this, kElementsOffset);
|
1217
|
+
// In the assert below Dictionary is covered under FixedArray.
|
1218
|
+
ASSERT(array->IsFixedArray() || array->IsPixelArray() ||
|
1219
|
+
array->IsExternalArray());
|
1220
|
+
return reinterpret_cast<HeapObject*>(array);
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
|
1224
|
+
void JSObject::set_elements(HeapObject* value, WriteBarrierMode mode) {
|
1225
|
+
ASSERT(map()->has_fast_elements() ==
|
1226
|
+
(value->map() == Heap::fixed_array_map() ||
|
1227
|
+
value->map() == Heap::fixed_cow_array_map()));
|
1228
|
+
// In the assert below Dictionary is covered under FixedArray.
|
1229
|
+
ASSERT(value->IsFixedArray() || value->IsPixelArray() ||
|
1230
|
+
value->IsExternalArray());
|
1231
|
+
WRITE_FIELD(this, kElementsOffset, value);
|
1232
|
+
CONDITIONAL_WRITE_BARRIER(this, kElementsOffset, mode);
|
1233
|
+
}
|
1234
|
+
|
1235
|
+
|
1236
|
+
void JSObject::initialize_properties() {
|
1237
|
+
ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
|
1238
|
+
WRITE_FIELD(this, kPropertiesOffset, Heap::empty_fixed_array());
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
|
1242
|
+
void JSObject::initialize_elements() {
|
1243
|
+
ASSERT(map()->has_fast_elements());
|
1244
|
+
ASSERT(!Heap::InNewSpace(Heap::empty_fixed_array()));
|
1245
|
+
WRITE_FIELD(this, kElementsOffset, Heap::empty_fixed_array());
|
1246
|
+
}
|
1247
|
+
|
1248
|
+
|
1249
|
+
MaybeObject* JSObject::ResetElements() {
|
1250
|
+
Object* obj;
|
1251
|
+
{ MaybeObject* maybe_obj = map()->GetFastElementsMap();
|
1252
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
1253
|
+
}
|
1254
|
+
set_map(Map::cast(obj));
|
1255
|
+
initialize_elements();
|
1256
|
+
return this;
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
|
1260
|
+
ACCESSORS(Oddball, to_string, String, kToStringOffset)
|
1261
|
+
ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
|
1262
|
+
|
1263
|
+
|
1264
|
+
Object* JSGlobalPropertyCell::value() {
|
1265
|
+
return READ_FIELD(this, kValueOffset);
|
1266
|
+
}
|
1267
|
+
|
1268
|
+
|
1269
|
+
void JSGlobalPropertyCell::set_value(Object* val, WriteBarrierMode ignored) {
|
1270
|
+
// The write barrier is not used for global property cells.
|
1271
|
+
ASSERT(!val->IsJSGlobalPropertyCell());
|
1272
|
+
WRITE_FIELD(this, kValueOffset, val);
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
|
1276
|
+
int JSObject::GetHeaderSize() {
|
1277
|
+
InstanceType type = map()->instance_type();
|
1278
|
+
// Check for the most common kind of JavaScript object before
|
1279
|
+
// falling into the generic switch. This speeds up the internal
|
1280
|
+
// field operations considerably on average.
|
1281
|
+
if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize;
|
1282
|
+
switch (type) {
|
1283
|
+
case JS_GLOBAL_PROXY_TYPE:
|
1284
|
+
return JSGlobalProxy::kSize;
|
1285
|
+
case JS_GLOBAL_OBJECT_TYPE:
|
1286
|
+
return JSGlobalObject::kSize;
|
1287
|
+
case JS_BUILTINS_OBJECT_TYPE:
|
1288
|
+
return JSBuiltinsObject::kSize;
|
1289
|
+
case JS_FUNCTION_TYPE:
|
1290
|
+
return JSFunction::kSize;
|
1291
|
+
case JS_VALUE_TYPE:
|
1292
|
+
return JSValue::kSize;
|
1293
|
+
case JS_ARRAY_TYPE:
|
1294
|
+
return JSValue::kSize;
|
1295
|
+
case JS_REGEXP_TYPE:
|
1296
|
+
return JSValue::kSize;
|
1297
|
+
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
|
1298
|
+
return JSObject::kHeaderSize;
|
1299
|
+
case JS_MESSAGE_OBJECT_TYPE:
|
1300
|
+
return JSMessageObject::kSize;
|
1301
|
+
default:
|
1302
|
+
UNREACHABLE();
|
1303
|
+
return 0;
|
1304
|
+
}
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
|
1308
|
+
int JSObject::GetInternalFieldCount() {
|
1309
|
+
ASSERT(1 << kPointerSizeLog2 == kPointerSize);
|
1310
|
+
// Make sure to adjust for the number of in-object properties. These
|
1311
|
+
// properties do contribute to the size, but are not internal fields.
|
1312
|
+
return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
|
1313
|
+
map()->inobject_properties();
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
|
1317
|
+
Object* JSObject::GetInternalField(int index) {
|
1318
|
+
ASSERT(index < GetInternalFieldCount() && index >= 0);
|
1319
|
+
// Internal objects do follow immediately after the header, whereas in-object
|
1320
|
+
// properties are at the end of the object. Therefore there is no need
|
1321
|
+
// to adjust the index here.
|
1322
|
+
return READ_FIELD(this, GetHeaderSize() + (kPointerSize * index));
|
1323
|
+
}
|
1324
|
+
|
1325
|
+
|
1326
|
+
void JSObject::SetInternalField(int index, Object* value) {
|
1327
|
+
ASSERT(index < GetInternalFieldCount() && index >= 0);
|
1328
|
+
// Internal objects do follow immediately after the header, whereas in-object
|
1329
|
+
// properties are at the end of the object. Therefore there is no need
|
1330
|
+
// to adjust the index here.
|
1331
|
+
int offset = GetHeaderSize() + (kPointerSize * index);
|
1332
|
+
WRITE_FIELD(this, offset, value);
|
1333
|
+
WRITE_BARRIER(this, offset);
|
1334
|
+
}
|
1335
|
+
|
1336
|
+
|
1337
|
+
// Access fast-case object properties at index. The use of these routines
|
1338
|
+
// is needed to correctly distinguish between properties stored in-object and
|
1339
|
+
// properties stored in the properties array.
|
1340
|
+
Object* JSObject::FastPropertyAt(int index) {
|
1341
|
+
// Adjust for the number of properties stored in the object.
|
1342
|
+
index -= map()->inobject_properties();
|
1343
|
+
if (index < 0) {
|
1344
|
+
int offset = map()->instance_size() + (index * kPointerSize);
|
1345
|
+
return READ_FIELD(this, offset);
|
1346
|
+
} else {
|
1347
|
+
ASSERT(index < properties()->length());
|
1348
|
+
return properties()->get(index);
|
1349
|
+
}
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
|
1353
|
+
Object* JSObject::FastPropertyAtPut(int index, Object* value) {
|
1354
|
+
// Adjust for the number of properties stored in the object.
|
1355
|
+
index -= map()->inobject_properties();
|
1356
|
+
if (index < 0) {
|
1357
|
+
int offset = map()->instance_size() + (index * kPointerSize);
|
1358
|
+
WRITE_FIELD(this, offset, value);
|
1359
|
+
WRITE_BARRIER(this, offset);
|
1360
|
+
} else {
|
1361
|
+
ASSERT(index < properties()->length());
|
1362
|
+
properties()->set(index, value);
|
1363
|
+
}
|
1364
|
+
return value;
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
|
1368
|
+
Object* JSObject::InObjectPropertyAt(int index) {
|
1369
|
+
// Adjust for the number of properties stored in the object.
|
1370
|
+
index -= map()->inobject_properties();
|
1371
|
+
ASSERT(index < 0);
|
1372
|
+
int offset = map()->instance_size() + (index * kPointerSize);
|
1373
|
+
return READ_FIELD(this, offset);
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
|
1377
|
+
Object* JSObject::InObjectPropertyAtPut(int index,
|
1378
|
+
Object* value,
|
1379
|
+
WriteBarrierMode mode) {
|
1380
|
+
// Adjust for the number of properties stored in the object.
|
1381
|
+
index -= map()->inobject_properties();
|
1382
|
+
ASSERT(index < 0);
|
1383
|
+
int offset = map()->instance_size() + (index * kPointerSize);
|
1384
|
+
WRITE_FIELD(this, offset, value);
|
1385
|
+
CONDITIONAL_WRITE_BARRIER(this, offset, mode);
|
1386
|
+
return value;
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
|
1390
|
+
|
1391
|
+
void JSObject::InitializeBody(int object_size, Object* value) {
|
1392
|
+
ASSERT(!value->IsHeapObject() || !Heap::InNewSpace(value));
|
1393
|
+
for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
|
1394
|
+
WRITE_FIELD(this, offset, value);
|
1395
|
+
}
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
|
1399
|
+
bool JSObject::HasFastProperties() {
|
1400
|
+
return !properties()->IsDictionary();
|
1401
|
+
}
|
1402
|
+
|
1403
|
+
|
1404
|
+
int JSObject::MaxFastProperties() {
|
1405
|
+
// Allow extra fast properties if the object has more than
|
1406
|
+
// kMaxFastProperties in-object properties. When this is the case,
|
1407
|
+
// it is very unlikely that the object is being used as a dictionary
|
1408
|
+
// and there is a good chance that allowing more map transitions
|
1409
|
+
// will be worth it.
|
1410
|
+
return Max(map()->inobject_properties(), kMaxFastProperties);
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
|
1414
|
+
void Struct::InitializeBody(int object_size) {
|
1415
|
+
Object* value = Heap::undefined_value();
|
1416
|
+
for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) {
|
1417
|
+
WRITE_FIELD(this, offset, value);
|
1418
|
+
}
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
|
1422
|
+
bool Object::ToArrayIndex(uint32_t* index) {
|
1423
|
+
if (IsSmi()) {
|
1424
|
+
int value = Smi::cast(this)->value();
|
1425
|
+
if (value < 0) return false;
|
1426
|
+
*index = value;
|
1427
|
+
return true;
|
1428
|
+
}
|
1429
|
+
if (IsHeapNumber()) {
|
1430
|
+
double value = HeapNumber::cast(this)->value();
|
1431
|
+
uint32_t uint_value = static_cast<uint32_t>(value);
|
1432
|
+
if (value == static_cast<double>(uint_value)) {
|
1433
|
+
*index = uint_value;
|
1434
|
+
return true;
|
1435
|
+
}
|
1436
|
+
}
|
1437
|
+
return false;
|
1438
|
+
}
|
1439
|
+
|
1440
|
+
|
1441
|
+
bool Object::IsStringObjectWithCharacterAt(uint32_t index) {
|
1442
|
+
if (!this->IsJSValue()) return false;
|
1443
|
+
|
1444
|
+
JSValue* js_value = JSValue::cast(this);
|
1445
|
+
if (!js_value->value()->IsString()) return false;
|
1446
|
+
|
1447
|
+
String* str = String::cast(js_value->value());
|
1448
|
+
if (index >= (uint32_t)str->length()) return false;
|
1449
|
+
|
1450
|
+
return true;
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
|
1454
|
+
Object* FixedArray::get(int index) {
|
1455
|
+
ASSERT(index >= 0 && index < this->length());
|
1456
|
+
return READ_FIELD(this, kHeaderSize + index * kPointerSize);
|
1457
|
+
}
|
1458
|
+
|
1459
|
+
|
1460
|
+
void FixedArray::set(int index, Smi* value) {
|
1461
|
+
ASSERT(map() != Heap::fixed_cow_array_map());
|
1462
|
+
ASSERT(reinterpret_cast<Object*>(value)->IsSmi());
|
1463
|
+
int offset = kHeaderSize + index * kPointerSize;
|
1464
|
+
WRITE_FIELD(this, offset, value);
|
1465
|
+
}
|
1466
|
+
|
1467
|
+
|
1468
|
+
void FixedArray::set(int index, Object* value) {
|
1469
|
+
ASSERT(map() != Heap::fixed_cow_array_map());
|
1470
|
+
ASSERT(index >= 0 && index < this->length());
|
1471
|
+
int offset = kHeaderSize + index * kPointerSize;
|
1472
|
+
WRITE_FIELD(this, offset, value);
|
1473
|
+
WRITE_BARRIER(this, offset);
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
|
1477
|
+
WriteBarrierMode HeapObject::GetWriteBarrierMode(const AssertNoAllocation&) {
|
1478
|
+
if (Heap::InNewSpace(this)) return SKIP_WRITE_BARRIER;
|
1479
|
+
return UPDATE_WRITE_BARRIER;
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
|
1483
|
+
void FixedArray::set(int index,
|
1484
|
+
Object* value,
|
1485
|
+
WriteBarrierMode mode) {
|
1486
|
+
ASSERT(map() != Heap::fixed_cow_array_map());
|
1487
|
+
ASSERT(index >= 0 && index < this->length());
|
1488
|
+
int offset = kHeaderSize + index * kPointerSize;
|
1489
|
+
WRITE_FIELD(this, offset, value);
|
1490
|
+
CONDITIONAL_WRITE_BARRIER(this, offset, mode);
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
|
1494
|
+
void FixedArray::fast_set(FixedArray* array, int index, Object* value) {
|
1495
|
+
ASSERT(array->map() != Heap::raw_unchecked_fixed_cow_array_map());
|
1496
|
+
ASSERT(index >= 0 && index < array->length());
|
1497
|
+
ASSERT(!Heap::InNewSpace(value));
|
1498
|
+
WRITE_FIELD(array, kHeaderSize + index * kPointerSize, value);
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
|
1502
|
+
void FixedArray::set_undefined(int index) {
|
1503
|
+
ASSERT(map() != Heap::fixed_cow_array_map());
|
1504
|
+
ASSERT(index >= 0 && index < this->length());
|
1505
|
+
ASSERT(!Heap::InNewSpace(Heap::undefined_value()));
|
1506
|
+
WRITE_FIELD(this, kHeaderSize + index * kPointerSize,
|
1507
|
+
Heap::undefined_value());
|
1508
|
+
}
|
1509
|
+
|
1510
|
+
|
1511
|
+
void FixedArray::set_null(int index) {
|
1512
|
+
ASSERT(map() != Heap::fixed_cow_array_map());
|
1513
|
+
ASSERT(index >= 0 && index < this->length());
|
1514
|
+
ASSERT(!Heap::InNewSpace(Heap::null_value()));
|
1515
|
+
WRITE_FIELD(this, kHeaderSize + index * kPointerSize, Heap::null_value());
|
1516
|
+
}
|
1517
|
+
|
1518
|
+
|
1519
|
+
void FixedArray::set_the_hole(int index) {
|
1520
|
+
ASSERT(map() != Heap::fixed_cow_array_map());
|
1521
|
+
ASSERT(index >= 0 && index < this->length());
|
1522
|
+
ASSERT(!Heap::InNewSpace(Heap::the_hole_value()));
|
1523
|
+
WRITE_FIELD(this, kHeaderSize + index * kPointerSize, Heap::the_hole_value());
|
1524
|
+
}
|
1525
|
+
|
1526
|
+
|
1527
|
+
void FixedArray::set_unchecked(int index, Smi* value) {
|
1528
|
+
ASSERT(reinterpret_cast<Object*>(value)->IsSmi());
|
1529
|
+
int offset = kHeaderSize + index * kPointerSize;
|
1530
|
+
WRITE_FIELD(this, offset, value);
|
1531
|
+
}
|
1532
|
+
|
1533
|
+
|
1534
|
+
void FixedArray::set_unchecked(int index,
|
1535
|
+
Object* value,
|
1536
|
+
WriteBarrierMode mode) {
|
1537
|
+
int offset = kHeaderSize + index * kPointerSize;
|
1538
|
+
WRITE_FIELD(this, offset, value);
|
1539
|
+
CONDITIONAL_WRITE_BARRIER(this, offset, mode);
|
1540
|
+
}
|
1541
|
+
|
1542
|
+
|
1543
|
+
void FixedArray::set_null_unchecked(int index) {
|
1544
|
+
ASSERT(index >= 0 && index < this->length());
|
1545
|
+
ASSERT(!Heap::InNewSpace(Heap::null_value()));
|
1546
|
+
WRITE_FIELD(this, kHeaderSize + index * kPointerSize, Heap::null_value());
|
1547
|
+
}
|
1548
|
+
|
1549
|
+
|
1550
|
+
Object** FixedArray::data_start() {
|
1551
|
+
return HeapObject::RawField(this, kHeaderSize);
|
1552
|
+
}
|
1553
|
+
|
1554
|
+
|
1555
|
+
bool DescriptorArray::IsEmpty() {
|
1556
|
+
ASSERT(this == Heap::empty_descriptor_array() ||
|
1557
|
+
this->length() > 2);
|
1558
|
+
return this == Heap::empty_descriptor_array();
|
1559
|
+
}
|
1560
|
+
|
1561
|
+
|
1562
|
+
void DescriptorArray::fast_swap(FixedArray* array, int first, int second) {
|
1563
|
+
Object* tmp = array->get(first);
|
1564
|
+
fast_set(array, first, array->get(second));
|
1565
|
+
fast_set(array, second, tmp);
|
1566
|
+
}
|
1567
|
+
|
1568
|
+
|
1569
|
+
int DescriptorArray::Search(String* name) {
|
1570
|
+
SLOW_ASSERT(IsSortedNoDuplicates());
|
1571
|
+
|
1572
|
+
// Check for empty descriptor array.
|
1573
|
+
int nof = number_of_descriptors();
|
1574
|
+
if (nof == 0) return kNotFound;
|
1575
|
+
|
1576
|
+
// Fast case: do linear search for small arrays.
|
1577
|
+
const int kMaxElementsForLinearSearch = 8;
|
1578
|
+
if (StringShape(name).IsSymbol() && nof < kMaxElementsForLinearSearch) {
|
1579
|
+
return LinearSearch(name, nof);
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
// Slow case: perform binary search.
|
1583
|
+
return BinarySearch(name, 0, nof - 1);
|
1584
|
+
}
|
1585
|
+
|
1586
|
+
|
1587
|
+
int DescriptorArray::SearchWithCache(String* name) {
|
1588
|
+
int number = DescriptorLookupCache::Lookup(this, name);
|
1589
|
+
if (number == DescriptorLookupCache::kAbsent) {
|
1590
|
+
number = Search(name);
|
1591
|
+
DescriptorLookupCache::Update(this, name, number);
|
1592
|
+
}
|
1593
|
+
return number;
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
|
1597
|
+
String* DescriptorArray::GetKey(int descriptor_number) {
|
1598
|
+
ASSERT(descriptor_number < number_of_descriptors());
|
1599
|
+
return String::cast(get(ToKeyIndex(descriptor_number)));
|
1600
|
+
}
|
1601
|
+
|
1602
|
+
|
1603
|
+
Object* DescriptorArray::GetValue(int descriptor_number) {
|
1604
|
+
ASSERT(descriptor_number < number_of_descriptors());
|
1605
|
+
return GetContentArray()->get(ToValueIndex(descriptor_number));
|
1606
|
+
}
|
1607
|
+
|
1608
|
+
|
1609
|
+
Smi* DescriptorArray::GetDetails(int descriptor_number) {
|
1610
|
+
ASSERT(descriptor_number < number_of_descriptors());
|
1611
|
+
return Smi::cast(GetContentArray()->get(ToDetailsIndex(descriptor_number)));
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
|
1615
|
+
PropertyType DescriptorArray::GetType(int descriptor_number) {
|
1616
|
+
ASSERT(descriptor_number < number_of_descriptors());
|
1617
|
+
return PropertyDetails(GetDetails(descriptor_number)).type();
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
|
1621
|
+
int DescriptorArray::GetFieldIndex(int descriptor_number) {
|
1622
|
+
return Descriptor::IndexFromValue(GetValue(descriptor_number));
|
1623
|
+
}
|
1624
|
+
|
1625
|
+
|
1626
|
+
JSFunction* DescriptorArray::GetConstantFunction(int descriptor_number) {
|
1627
|
+
return JSFunction::cast(GetValue(descriptor_number));
|
1628
|
+
}
|
1629
|
+
|
1630
|
+
|
1631
|
+
Object* DescriptorArray::GetCallbacksObject(int descriptor_number) {
|
1632
|
+
ASSERT(GetType(descriptor_number) == CALLBACKS);
|
1633
|
+
return GetValue(descriptor_number);
|
1634
|
+
}
|
1635
|
+
|
1636
|
+
|
1637
|
+
AccessorDescriptor* DescriptorArray::GetCallbacks(int descriptor_number) {
|
1638
|
+
ASSERT(GetType(descriptor_number) == CALLBACKS);
|
1639
|
+
Proxy* p = Proxy::cast(GetCallbacksObject(descriptor_number));
|
1640
|
+
return reinterpret_cast<AccessorDescriptor*>(p->proxy());
|
1641
|
+
}
|
1642
|
+
|
1643
|
+
|
1644
|
+
bool DescriptorArray::IsProperty(int descriptor_number) {
|
1645
|
+
return GetType(descriptor_number) < FIRST_PHANTOM_PROPERTY_TYPE;
|
1646
|
+
}
|
1647
|
+
|
1648
|
+
|
1649
|
+
bool DescriptorArray::IsTransition(int descriptor_number) {
|
1650
|
+
PropertyType t = GetType(descriptor_number);
|
1651
|
+
return t == MAP_TRANSITION || t == CONSTANT_TRANSITION;
|
1652
|
+
}
|
1653
|
+
|
1654
|
+
|
1655
|
+
bool DescriptorArray::IsNullDescriptor(int descriptor_number) {
|
1656
|
+
return GetType(descriptor_number) == NULL_DESCRIPTOR;
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
|
1660
|
+
bool DescriptorArray::IsDontEnum(int descriptor_number) {
|
1661
|
+
return PropertyDetails(GetDetails(descriptor_number)).IsDontEnum();
|
1662
|
+
}
|
1663
|
+
|
1664
|
+
|
1665
|
+
void DescriptorArray::Get(int descriptor_number, Descriptor* desc) {
|
1666
|
+
desc->Init(GetKey(descriptor_number),
|
1667
|
+
GetValue(descriptor_number),
|
1668
|
+
GetDetails(descriptor_number));
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
|
1672
|
+
void DescriptorArray::Set(int descriptor_number, Descriptor* desc) {
|
1673
|
+
// Range check.
|
1674
|
+
ASSERT(descriptor_number < number_of_descriptors());
|
1675
|
+
|
1676
|
+
// Make sure none of the elements in desc are in new space.
|
1677
|
+
ASSERT(!Heap::InNewSpace(desc->GetKey()));
|
1678
|
+
ASSERT(!Heap::InNewSpace(desc->GetValue()));
|
1679
|
+
|
1680
|
+
fast_set(this, ToKeyIndex(descriptor_number), desc->GetKey());
|
1681
|
+
FixedArray* content_array = GetContentArray();
|
1682
|
+
fast_set(content_array, ToValueIndex(descriptor_number), desc->GetValue());
|
1683
|
+
fast_set(content_array, ToDetailsIndex(descriptor_number),
|
1684
|
+
desc->GetDetails().AsSmi());
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
|
1688
|
+
void DescriptorArray::CopyFrom(int index, DescriptorArray* src, int src_index) {
|
1689
|
+
Descriptor desc;
|
1690
|
+
src->Get(src_index, &desc);
|
1691
|
+
Set(index, &desc);
|
1692
|
+
}
|
1693
|
+
|
1694
|
+
|
1695
|
+
void DescriptorArray::Swap(int first, int second) {
|
1696
|
+
fast_swap(this, ToKeyIndex(first), ToKeyIndex(second));
|
1697
|
+
FixedArray* content_array = GetContentArray();
|
1698
|
+
fast_swap(content_array, ToValueIndex(first), ToValueIndex(second));
|
1699
|
+
fast_swap(content_array, ToDetailsIndex(first), ToDetailsIndex(second));
|
1700
|
+
}
|
1701
|
+
|
1702
|
+
|
1703
|
+
bool NumberDictionary::requires_slow_elements() {
|
1704
|
+
Object* max_index_object = get(kMaxNumberKeyIndex);
|
1705
|
+
if (!max_index_object->IsSmi()) return false;
|
1706
|
+
return 0 !=
|
1707
|
+
(Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
|
1708
|
+
}
|
1709
|
+
|
1710
|
+
uint32_t NumberDictionary::max_number_key() {
|
1711
|
+
ASSERT(!requires_slow_elements());
|
1712
|
+
Object* max_index_object = get(kMaxNumberKeyIndex);
|
1713
|
+
if (!max_index_object->IsSmi()) return 0;
|
1714
|
+
uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value());
|
1715
|
+
return value >> kRequiresSlowElementsTagSize;
|
1716
|
+
}
|
1717
|
+
|
1718
|
+
void NumberDictionary::set_requires_slow_elements() {
|
1719
|
+
set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
|
1720
|
+
}
|
1721
|
+
|
1722
|
+
|
1723
|
+
// ------------------------------------
|
1724
|
+
// Cast operations
|
1725
|
+
|
1726
|
+
|
1727
|
+
CAST_ACCESSOR(FixedArray)
|
1728
|
+
CAST_ACCESSOR(DescriptorArray)
|
1729
|
+
CAST_ACCESSOR(DeoptimizationInputData)
|
1730
|
+
CAST_ACCESSOR(DeoptimizationOutputData)
|
1731
|
+
CAST_ACCESSOR(SymbolTable)
|
1732
|
+
CAST_ACCESSOR(JSFunctionResultCache)
|
1733
|
+
CAST_ACCESSOR(NormalizedMapCache)
|
1734
|
+
CAST_ACCESSOR(CompilationCacheTable)
|
1735
|
+
CAST_ACCESSOR(CodeCacheHashTable)
|
1736
|
+
CAST_ACCESSOR(MapCache)
|
1737
|
+
CAST_ACCESSOR(String)
|
1738
|
+
CAST_ACCESSOR(SeqString)
|
1739
|
+
CAST_ACCESSOR(SeqAsciiString)
|
1740
|
+
CAST_ACCESSOR(SeqTwoByteString)
|
1741
|
+
CAST_ACCESSOR(ConsString)
|
1742
|
+
CAST_ACCESSOR(ExternalString)
|
1743
|
+
CAST_ACCESSOR(ExternalAsciiString)
|
1744
|
+
CAST_ACCESSOR(ExternalTwoByteString)
|
1745
|
+
CAST_ACCESSOR(JSObject)
|
1746
|
+
CAST_ACCESSOR(Smi)
|
1747
|
+
CAST_ACCESSOR(HeapObject)
|
1748
|
+
CAST_ACCESSOR(HeapNumber)
|
1749
|
+
CAST_ACCESSOR(Oddball)
|
1750
|
+
CAST_ACCESSOR(JSGlobalPropertyCell)
|
1751
|
+
CAST_ACCESSOR(SharedFunctionInfo)
|
1752
|
+
CAST_ACCESSOR(Map)
|
1753
|
+
CAST_ACCESSOR(JSFunction)
|
1754
|
+
CAST_ACCESSOR(GlobalObject)
|
1755
|
+
CAST_ACCESSOR(JSGlobalProxy)
|
1756
|
+
CAST_ACCESSOR(JSGlobalObject)
|
1757
|
+
CAST_ACCESSOR(JSBuiltinsObject)
|
1758
|
+
CAST_ACCESSOR(Code)
|
1759
|
+
CAST_ACCESSOR(JSArray)
|
1760
|
+
CAST_ACCESSOR(JSRegExp)
|
1761
|
+
CAST_ACCESSOR(Proxy)
|
1762
|
+
CAST_ACCESSOR(ByteArray)
|
1763
|
+
CAST_ACCESSOR(PixelArray)
|
1764
|
+
CAST_ACCESSOR(ExternalArray)
|
1765
|
+
CAST_ACCESSOR(ExternalByteArray)
|
1766
|
+
CAST_ACCESSOR(ExternalUnsignedByteArray)
|
1767
|
+
CAST_ACCESSOR(ExternalShortArray)
|
1768
|
+
CAST_ACCESSOR(ExternalUnsignedShortArray)
|
1769
|
+
CAST_ACCESSOR(ExternalIntArray)
|
1770
|
+
CAST_ACCESSOR(ExternalUnsignedIntArray)
|
1771
|
+
CAST_ACCESSOR(ExternalFloatArray)
|
1772
|
+
CAST_ACCESSOR(Struct)
|
1773
|
+
|
1774
|
+
|
1775
|
+
#define MAKE_STRUCT_CAST(NAME, Name, name) CAST_ACCESSOR(Name)
|
1776
|
+
STRUCT_LIST(MAKE_STRUCT_CAST)
|
1777
|
+
#undef MAKE_STRUCT_CAST
|
1778
|
+
|
1779
|
+
|
1780
|
+
template <typename Shape, typename Key>
|
1781
|
+
HashTable<Shape, Key>* HashTable<Shape, Key>::cast(Object* obj) {
|
1782
|
+
ASSERT(obj->IsHashTable());
|
1783
|
+
return reinterpret_cast<HashTable*>(obj);
|
1784
|
+
}
|
1785
|
+
|
1786
|
+
|
1787
|
+
SMI_ACCESSORS(FixedArray, length, kLengthOffset)
|
1788
|
+
SMI_ACCESSORS(ByteArray, length, kLengthOffset)
|
1789
|
+
|
1790
|
+
INT_ACCESSORS(PixelArray, length, kLengthOffset)
|
1791
|
+
INT_ACCESSORS(ExternalArray, length, kLengthOffset)
|
1792
|
+
|
1793
|
+
|
1794
|
+
SMI_ACCESSORS(String, length, kLengthOffset)
|
1795
|
+
|
1796
|
+
|
1797
|
+
uint32_t String::hash_field() {
|
1798
|
+
return READ_UINT32_FIELD(this, kHashFieldOffset);
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
|
1802
|
+
void String::set_hash_field(uint32_t value) {
|
1803
|
+
WRITE_UINT32_FIELD(this, kHashFieldOffset, value);
|
1804
|
+
#if V8_HOST_ARCH_64_BIT
|
1805
|
+
WRITE_UINT32_FIELD(this, kHashFieldOffset + kIntSize, 0);
|
1806
|
+
#endif
|
1807
|
+
}
|
1808
|
+
|
1809
|
+
|
1810
|
+
bool String::Equals(String* other) {
|
1811
|
+
if (other == this) return true;
|
1812
|
+
if (StringShape(this).IsSymbol() && StringShape(other).IsSymbol()) {
|
1813
|
+
return false;
|
1814
|
+
}
|
1815
|
+
return SlowEquals(other);
|
1816
|
+
}
|
1817
|
+
|
1818
|
+
|
1819
|
+
MaybeObject* String::TryFlatten(PretenureFlag pretenure) {
|
1820
|
+
if (!StringShape(this).IsCons()) return this;
|
1821
|
+
ConsString* cons = ConsString::cast(this);
|
1822
|
+
if (cons->second()->length() == 0) return cons->first();
|
1823
|
+
return SlowTryFlatten(pretenure);
|
1824
|
+
}
|
1825
|
+
|
1826
|
+
|
1827
|
+
String* String::TryFlattenGetString(PretenureFlag pretenure) {
|
1828
|
+
MaybeObject* flat = TryFlatten(pretenure);
|
1829
|
+
Object* successfully_flattened;
|
1830
|
+
if (flat->ToObject(&successfully_flattened)) {
|
1831
|
+
return String::cast(successfully_flattened);
|
1832
|
+
}
|
1833
|
+
return this;
|
1834
|
+
}
|
1835
|
+
|
1836
|
+
|
1837
|
+
uint16_t String::Get(int index) {
|
1838
|
+
ASSERT(index >= 0 && index < length());
|
1839
|
+
switch (StringShape(this).full_representation_tag()) {
|
1840
|
+
case kSeqStringTag | kAsciiStringTag:
|
1841
|
+
return SeqAsciiString::cast(this)->SeqAsciiStringGet(index);
|
1842
|
+
case kSeqStringTag | kTwoByteStringTag:
|
1843
|
+
return SeqTwoByteString::cast(this)->SeqTwoByteStringGet(index);
|
1844
|
+
case kConsStringTag | kAsciiStringTag:
|
1845
|
+
case kConsStringTag | kTwoByteStringTag:
|
1846
|
+
return ConsString::cast(this)->ConsStringGet(index);
|
1847
|
+
case kExternalStringTag | kAsciiStringTag:
|
1848
|
+
return ExternalAsciiString::cast(this)->ExternalAsciiStringGet(index);
|
1849
|
+
case kExternalStringTag | kTwoByteStringTag:
|
1850
|
+
return ExternalTwoByteString::cast(this)->ExternalTwoByteStringGet(index);
|
1851
|
+
default:
|
1852
|
+
break;
|
1853
|
+
}
|
1854
|
+
|
1855
|
+
UNREACHABLE();
|
1856
|
+
return 0;
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
|
1860
|
+
void String::Set(int index, uint16_t value) {
|
1861
|
+
ASSERT(index >= 0 && index < length());
|
1862
|
+
ASSERT(StringShape(this).IsSequential());
|
1863
|
+
|
1864
|
+
return this->IsAsciiRepresentation()
|
1865
|
+
? SeqAsciiString::cast(this)->SeqAsciiStringSet(index, value)
|
1866
|
+
: SeqTwoByteString::cast(this)->SeqTwoByteStringSet(index, value);
|
1867
|
+
}
|
1868
|
+
|
1869
|
+
|
1870
|
+
bool String::IsFlat() {
|
1871
|
+
switch (StringShape(this).representation_tag()) {
|
1872
|
+
case kConsStringTag: {
|
1873
|
+
String* second = ConsString::cast(this)->second();
|
1874
|
+
// Only flattened strings have second part empty.
|
1875
|
+
return second->length() == 0;
|
1876
|
+
}
|
1877
|
+
default:
|
1878
|
+
return true;
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
|
1882
|
+
|
1883
|
+
uint16_t SeqAsciiString::SeqAsciiStringGet(int index) {
|
1884
|
+
ASSERT(index >= 0 && index < length());
|
1885
|
+
return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
|
1886
|
+
}
|
1887
|
+
|
1888
|
+
|
1889
|
+
void SeqAsciiString::SeqAsciiStringSet(int index, uint16_t value) {
|
1890
|
+
ASSERT(index >= 0 && index < length() && value <= kMaxAsciiCharCode);
|
1891
|
+
WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize,
|
1892
|
+
static_cast<byte>(value));
|
1893
|
+
}
|
1894
|
+
|
1895
|
+
|
1896
|
+
Address SeqAsciiString::GetCharsAddress() {
|
1897
|
+
return FIELD_ADDR(this, kHeaderSize);
|
1898
|
+
}
|
1899
|
+
|
1900
|
+
|
1901
|
+
char* SeqAsciiString::GetChars() {
|
1902
|
+
return reinterpret_cast<char*>(GetCharsAddress());
|
1903
|
+
}
|
1904
|
+
|
1905
|
+
|
1906
|
+
Address SeqTwoByteString::GetCharsAddress() {
|
1907
|
+
return FIELD_ADDR(this, kHeaderSize);
|
1908
|
+
}
|
1909
|
+
|
1910
|
+
|
1911
|
+
uc16* SeqTwoByteString::GetChars() {
|
1912
|
+
return reinterpret_cast<uc16*>(FIELD_ADDR(this, kHeaderSize));
|
1913
|
+
}
|
1914
|
+
|
1915
|
+
|
1916
|
+
uint16_t SeqTwoByteString::SeqTwoByteStringGet(int index) {
|
1917
|
+
ASSERT(index >= 0 && index < length());
|
1918
|
+
return READ_SHORT_FIELD(this, kHeaderSize + index * kShortSize);
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
|
1922
|
+
void SeqTwoByteString::SeqTwoByteStringSet(int index, uint16_t value) {
|
1923
|
+
ASSERT(index >= 0 && index < length());
|
1924
|
+
WRITE_SHORT_FIELD(this, kHeaderSize + index * kShortSize, value);
|
1925
|
+
}
|
1926
|
+
|
1927
|
+
|
1928
|
+
int SeqTwoByteString::SeqTwoByteStringSize(InstanceType instance_type) {
|
1929
|
+
return SizeFor(length());
|
1930
|
+
}
|
1931
|
+
|
1932
|
+
|
1933
|
+
int SeqAsciiString::SeqAsciiStringSize(InstanceType instance_type) {
|
1934
|
+
return SizeFor(length());
|
1935
|
+
}
|
1936
|
+
|
1937
|
+
|
1938
|
+
String* ConsString::first() {
|
1939
|
+
return String::cast(READ_FIELD(this, kFirstOffset));
|
1940
|
+
}
|
1941
|
+
|
1942
|
+
|
1943
|
+
Object* ConsString::unchecked_first() {
|
1944
|
+
return READ_FIELD(this, kFirstOffset);
|
1945
|
+
}
|
1946
|
+
|
1947
|
+
|
1948
|
+
void ConsString::set_first(String* value, WriteBarrierMode mode) {
|
1949
|
+
WRITE_FIELD(this, kFirstOffset, value);
|
1950
|
+
CONDITIONAL_WRITE_BARRIER(this, kFirstOffset, mode);
|
1951
|
+
}
|
1952
|
+
|
1953
|
+
|
1954
|
+
String* ConsString::second() {
|
1955
|
+
return String::cast(READ_FIELD(this, kSecondOffset));
|
1956
|
+
}
|
1957
|
+
|
1958
|
+
|
1959
|
+
Object* ConsString::unchecked_second() {
|
1960
|
+
return READ_FIELD(this, kSecondOffset);
|
1961
|
+
}
|
1962
|
+
|
1963
|
+
|
1964
|
+
void ConsString::set_second(String* value, WriteBarrierMode mode) {
|
1965
|
+
WRITE_FIELD(this, kSecondOffset, value);
|
1966
|
+
CONDITIONAL_WRITE_BARRIER(this, kSecondOffset, mode);
|
1967
|
+
}
|
1968
|
+
|
1969
|
+
|
1970
|
+
ExternalAsciiString::Resource* ExternalAsciiString::resource() {
|
1971
|
+
return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
|
1972
|
+
}
|
1973
|
+
|
1974
|
+
|
1975
|
+
void ExternalAsciiString::set_resource(
|
1976
|
+
ExternalAsciiString::Resource* resource) {
|
1977
|
+
*reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource;
|
1978
|
+
}
|
1979
|
+
|
1980
|
+
|
1981
|
+
ExternalTwoByteString::Resource* ExternalTwoByteString::resource() {
|
1982
|
+
return *reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset));
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
|
1986
|
+
void ExternalTwoByteString::set_resource(
|
1987
|
+
ExternalTwoByteString::Resource* resource) {
|
1988
|
+
*reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)) = resource;
|
1989
|
+
}
|
1990
|
+
|
1991
|
+
|
1992
|
+
void JSFunctionResultCache::MakeZeroSize() {
|
1993
|
+
set_finger_index(kEntriesIndex);
|
1994
|
+
set_size(kEntriesIndex);
|
1995
|
+
}
|
1996
|
+
|
1997
|
+
|
1998
|
+
void JSFunctionResultCache::Clear() {
|
1999
|
+
int cache_size = size();
|
2000
|
+
Object** entries_start = RawField(this, OffsetOfElementAt(kEntriesIndex));
|
2001
|
+
MemsetPointer(entries_start,
|
2002
|
+
Heap::the_hole_value(),
|
2003
|
+
cache_size - kEntriesIndex);
|
2004
|
+
MakeZeroSize();
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
|
2008
|
+
int JSFunctionResultCache::size() {
|
2009
|
+
return Smi::cast(get(kCacheSizeIndex))->value();
|
2010
|
+
}
|
2011
|
+
|
2012
|
+
|
2013
|
+
void JSFunctionResultCache::set_size(int size) {
|
2014
|
+
set(kCacheSizeIndex, Smi::FromInt(size));
|
2015
|
+
}
|
2016
|
+
|
2017
|
+
|
2018
|
+
int JSFunctionResultCache::finger_index() {
|
2019
|
+
return Smi::cast(get(kFingerIndex))->value();
|
2020
|
+
}
|
2021
|
+
|
2022
|
+
|
2023
|
+
void JSFunctionResultCache::set_finger_index(int finger_index) {
|
2024
|
+
set(kFingerIndex, Smi::FromInt(finger_index));
|
2025
|
+
}
|
2026
|
+
|
2027
|
+
|
2028
|
+
byte ByteArray::get(int index) {
|
2029
|
+
ASSERT(index >= 0 && index < this->length());
|
2030
|
+
return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
|
2031
|
+
}
|
2032
|
+
|
2033
|
+
|
2034
|
+
void ByteArray::set(int index, byte value) {
|
2035
|
+
ASSERT(index >= 0 && index < this->length());
|
2036
|
+
WRITE_BYTE_FIELD(this, kHeaderSize + index * kCharSize, value);
|
2037
|
+
}
|
2038
|
+
|
2039
|
+
|
2040
|
+
int ByteArray::get_int(int index) {
|
2041
|
+
ASSERT(index >= 0 && (index * kIntSize) < this->length());
|
2042
|
+
return READ_INT_FIELD(this, kHeaderSize + index * kIntSize);
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
|
2046
|
+
ByteArray* ByteArray::FromDataStartAddress(Address address) {
|
2047
|
+
ASSERT_TAG_ALIGNED(address);
|
2048
|
+
return reinterpret_cast<ByteArray*>(address - kHeaderSize + kHeapObjectTag);
|
2049
|
+
}
|
2050
|
+
|
2051
|
+
|
2052
|
+
Address ByteArray::GetDataStartAddress() {
|
2053
|
+
return reinterpret_cast<Address>(this) - kHeapObjectTag + kHeaderSize;
|
2054
|
+
}
|
2055
|
+
|
2056
|
+
|
2057
|
+
uint8_t* PixelArray::external_pointer() {
|
2058
|
+
intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
|
2059
|
+
return reinterpret_cast<uint8_t*>(ptr);
|
2060
|
+
}
|
2061
|
+
|
2062
|
+
|
2063
|
+
void PixelArray::set_external_pointer(uint8_t* value, WriteBarrierMode mode) {
|
2064
|
+
intptr_t ptr = reinterpret_cast<intptr_t>(value);
|
2065
|
+
WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr);
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
|
2069
|
+
uint8_t PixelArray::get(int index) {
|
2070
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2071
|
+
uint8_t* ptr = external_pointer();
|
2072
|
+
return ptr[index];
|
2073
|
+
}
|
2074
|
+
|
2075
|
+
|
2076
|
+
void PixelArray::set(int index, uint8_t value) {
|
2077
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2078
|
+
uint8_t* ptr = external_pointer();
|
2079
|
+
ptr[index] = value;
|
2080
|
+
}
|
2081
|
+
|
2082
|
+
|
2083
|
+
void* ExternalArray::external_pointer() {
|
2084
|
+
intptr_t ptr = READ_INTPTR_FIELD(this, kExternalPointerOffset);
|
2085
|
+
return reinterpret_cast<void*>(ptr);
|
2086
|
+
}
|
2087
|
+
|
2088
|
+
|
2089
|
+
void ExternalArray::set_external_pointer(void* value, WriteBarrierMode mode) {
|
2090
|
+
intptr_t ptr = reinterpret_cast<intptr_t>(value);
|
2091
|
+
WRITE_INTPTR_FIELD(this, kExternalPointerOffset, ptr);
|
2092
|
+
}
|
2093
|
+
|
2094
|
+
|
2095
|
+
int8_t ExternalByteArray::get(int index) {
|
2096
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2097
|
+
int8_t* ptr = static_cast<int8_t*>(external_pointer());
|
2098
|
+
return ptr[index];
|
2099
|
+
}
|
2100
|
+
|
2101
|
+
|
2102
|
+
void ExternalByteArray::set(int index, int8_t value) {
|
2103
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2104
|
+
int8_t* ptr = static_cast<int8_t*>(external_pointer());
|
2105
|
+
ptr[index] = value;
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
|
2109
|
+
uint8_t ExternalUnsignedByteArray::get(int index) {
|
2110
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2111
|
+
uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
|
2112
|
+
return ptr[index];
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
|
2116
|
+
void ExternalUnsignedByteArray::set(int index, uint8_t value) {
|
2117
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2118
|
+
uint8_t* ptr = static_cast<uint8_t*>(external_pointer());
|
2119
|
+
ptr[index] = value;
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
|
2123
|
+
int16_t ExternalShortArray::get(int index) {
|
2124
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2125
|
+
int16_t* ptr = static_cast<int16_t*>(external_pointer());
|
2126
|
+
return ptr[index];
|
2127
|
+
}
|
2128
|
+
|
2129
|
+
|
2130
|
+
void ExternalShortArray::set(int index, int16_t value) {
|
2131
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2132
|
+
int16_t* ptr = static_cast<int16_t*>(external_pointer());
|
2133
|
+
ptr[index] = value;
|
2134
|
+
}
|
2135
|
+
|
2136
|
+
|
2137
|
+
uint16_t ExternalUnsignedShortArray::get(int index) {
|
2138
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2139
|
+
uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
|
2140
|
+
return ptr[index];
|
2141
|
+
}
|
2142
|
+
|
2143
|
+
|
2144
|
+
void ExternalUnsignedShortArray::set(int index, uint16_t value) {
|
2145
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2146
|
+
uint16_t* ptr = static_cast<uint16_t*>(external_pointer());
|
2147
|
+
ptr[index] = value;
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
|
2151
|
+
int32_t ExternalIntArray::get(int index) {
|
2152
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2153
|
+
int32_t* ptr = static_cast<int32_t*>(external_pointer());
|
2154
|
+
return ptr[index];
|
2155
|
+
}
|
2156
|
+
|
2157
|
+
|
2158
|
+
void ExternalIntArray::set(int index, int32_t value) {
|
2159
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2160
|
+
int32_t* ptr = static_cast<int32_t*>(external_pointer());
|
2161
|
+
ptr[index] = value;
|
2162
|
+
}
|
2163
|
+
|
2164
|
+
|
2165
|
+
uint32_t ExternalUnsignedIntArray::get(int index) {
|
2166
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2167
|
+
uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
|
2168
|
+
return ptr[index];
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
|
2172
|
+
void ExternalUnsignedIntArray::set(int index, uint32_t value) {
|
2173
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2174
|
+
uint32_t* ptr = static_cast<uint32_t*>(external_pointer());
|
2175
|
+
ptr[index] = value;
|
2176
|
+
}
|
2177
|
+
|
2178
|
+
|
2179
|
+
float ExternalFloatArray::get(int index) {
|
2180
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2181
|
+
float* ptr = static_cast<float*>(external_pointer());
|
2182
|
+
return ptr[index];
|
2183
|
+
}
|
2184
|
+
|
2185
|
+
|
2186
|
+
void ExternalFloatArray::set(int index, float value) {
|
2187
|
+
ASSERT((index >= 0) && (index < this->length()));
|
2188
|
+
float* ptr = static_cast<float*>(external_pointer());
|
2189
|
+
ptr[index] = value;
|
2190
|
+
}
|
2191
|
+
|
2192
|
+
|
2193
|
+
int Map::visitor_id() {
|
2194
|
+
return READ_BYTE_FIELD(this, kVisitorIdOffset);
|
2195
|
+
}
|
2196
|
+
|
2197
|
+
|
2198
|
+
void Map::set_visitor_id(int id) {
|
2199
|
+
ASSERT(0 <= id && id < 256);
|
2200
|
+
WRITE_BYTE_FIELD(this, kVisitorIdOffset, static_cast<byte>(id));
|
2201
|
+
}
|
2202
|
+
|
2203
|
+
|
2204
|
+
int Map::instance_size() {
|
2205
|
+
return READ_BYTE_FIELD(this, kInstanceSizeOffset) << kPointerSizeLog2;
|
2206
|
+
}
|
2207
|
+
|
2208
|
+
|
2209
|
+
int Map::inobject_properties() {
|
2210
|
+
return READ_BYTE_FIELD(this, kInObjectPropertiesOffset);
|
2211
|
+
}
|
2212
|
+
|
2213
|
+
|
2214
|
+
int Map::pre_allocated_property_fields() {
|
2215
|
+
return READ_BYTE_FIELD(this, kPreAllocatedPropertyFieldsOffset);
|
2216
|
+
}
|
2217
|
+
|
2218
|
+
|
2219
|
+
int HeapObject::SizeFromMap(Map* map) {
|
2220
|
+
int instance_size = map->instance_size();
|
2221
|
+
if (instance_size != kVariableSizeSentinel) return instance_size;
|
2222
|
+
// We can ignore the "symbol" bit becase it is only set for symbols
|
2223
|
+
// and implies a string type.
|
2224
|
+
int instance_type = static_cast<int>(map->instance_type()) & ~kIsSymbolMask;
|
2225
|
+
// Only inline the most frequent cases.
|
2226
|
+
if (instance_type == FIXED_ARRAY_TYPE) {
|
2227
|
+
return FixedArray::BodyDescriptor::SizeOf(map, this);
|
2228
|
+
}
|
2229
|
+
if (instance_type == ASCII_STRING_TYPE) {
|
2230
|
+
return SeqAsciiString::SizeFor(
|
2231
|
+
reinterpret_cast<SeqAsciiString*>(this)->length());
|
2232
|
+
}
|
2233
|
+
if (instance_type == BYTE_ARRAY_TYPE) {
|
2234
|
+
return reinterpret_cast<ByteArray*>(this)->ByteArraySize();
|
2235
|
+
}
|
2236
|
+
if (instance_type == STRING_TYPE) {
|
2237
|
+
return SeqTwoByteString::SizeFor(
|
2238
|
+
reinterpret_cast<SeqTwoByteString*>(this)->length());
|
2239
|
+
}
|
2240
|
+
ASSERT(instance_type == CODE_TYPE);
|
2241
|
+
return reinterpret_cast<Code*>(this)->CodeSize();
|
2242
|
+
}
|
2243
|
+
|
2244
|
+
|
2245
|
+
void Map::set_instance_size(int value) {
|
2246
|
+
ASSERT_EQ(0, value & (kPointerSize - 1));
|
2247
|
+
value >>= kPointerSizeLog2;
|
2248
|
+
ASSERT(0 <= value && value < 256);
|
2249
|
+
WRITE_BYTE_FIELD(this, kInstanceSizeOffset, static_cast<byte>(value));
|
2250
|
+
}
|
2251
|
+
|
2252
|
+
|
2253
|
+
void Map::set_inobject_properties(int value) {
|
2254
|
+
ASSERT(0 <= value && value < 256);
|
2255
|
+
WRITE_BYTE_FIELD(this, kInObjectPropertiesOffset, static_cast<byte>(value));
|
2256
|
+
}
|
2257
|
+
|
2258
|
+
|
2259
|
+
void Map::set_pre_allocated_property_fields(int value) {
|
2260
|
+
ASSERT(0 <= value && value < 256);
|
2261
|
+
WRITE_BYTE_FIELD(this,
|
2262
|
+
kPreAllocatedPropertyFieldsOffset,
|
2263
|
+
static_cast<byte>(value));
|
2264
|
+
}
|
2265
|
+
|
2266
|
+
|
2267
|
+
InstanceType Map::instance_type() {
|
2268
|
+
return static_cast<InstanceType>(READ_BYTE_FIELD(this, kInstanceTypeOffset));
|
2269
|
+
}
|
2270
|
+
|
2271
|
+
|
2272
|
+
void Map::set_instance_type(InstanceType value) {
|
2273
|
+
WRITE_BYTE_FIELD(this, kInstanceTypeOffset, value);
|
2274
|
+
}
|
2275
|
+
|
2276
|
+
|
2277
|
+
int Map::unused_property_fields() {
|
2278
|
+
return READ_BYTE_FIELD(this, kUnusedPropertyFieldsOffset);
|
2279
|
+
}
|
2280
|
+
|
2281
|
+
|
2282
|
+
void Map::set_unused_property_fields(int value) {
|
2283
|
+
WRITE_BYTE_FIELD(this, kUnusedPropertyFieldsOffset, Min(value, 255));
|
2284
|
+
}
|
2285
|
+
|
2286
|
+
|
2287
|
+
byte Map::bit_field() {
|
2288
|
+
return READ_BYTE_FIELD(this, kBitFieldOffset);
|
2289
|
+
}
|
2290
|
+
|
2291
|
+
|
2292
|
+
void Map::set_bit_field(byte value) {
|
2293
|
+
WRITE_BYTE_FIELD(this, kBitFieldOffset, value);
|
2294
|
+
}
|
2295
|
+
|
2296
|
+
|
2297
|
+
byte Map::bit_field2() {
|
2298
|
+
return READ_BYTE_FIELD(this, kBitField2Offset);
|
2299
|
+
}
|
2300
|
+
|
2301
|
+
|
2302
|
+
void Map::set_bit_field2(byte value) {
|
2303
|
+
WRITE_BYTE_FIELD(this, kBitField2Offset, value);
|
2304
|
+
}
|
2305
|
+
|
2306
|
+
|
2307
|
+
void Map::set_non_instance_prototype(bool value) {
|
2308
|
+
if (value) {
|
2309
|
+
set_bit_field(bit_field() | (1 << kHasNonInstancePrototype));
|
2310
|
+
} else {
|
2311
|
+
set_bit_field(bit_field() & ~(1 << kHasNonInstancePrototype));
|
2312
|
+
}
|
2313
|
+
}
|
2314
|
+
|
2315
|
+
|
2316
|
+
bool Map::has_non_instance_prototype() {
|
2317
|
+
return ((1 << kHasNonInstancePrototype) & bit_field()) != 0;
|
2318
|
+
}
|
2319
|
+
|
2320
|
+
|
2321
|
+
void Map::set_function_with_prototype(bool value) {
|
2322
|
+
if (value) {
|
2323
|
+
set_bit_field2(bit_field2() | (1 << kFunctionWithPrototype));
|
2324
|
+
} else {
|
2325
|
+
set_bit_field2(bit_field2() & ~(1 << kFunctionWithPrototype));
|
2326
|
+
}
|
2327
|
+
}
|
2328
|
+
|
2329
|
+
|
2330
|
+
bool Map::function_with_prototype() {
|
2331
|
+
return ((1 << kFunctionWithPrototype) & bit_field2()) != 0;
|
2332
|
+
}
|
2333
|
+
|
2334
|
+
|
2335
|
+
void Map::set_is_access_check_needed(bool access_check_needed) {
|
2336
|
+
if (access_check_needed) {
|
2337
|
+
set_bit_field(bit_field() | (1 << kIsAccessCheckNeeded));
|
2338
|
+
} else {
|
2339
|
+
set_bit_field(bit_field() & ~(1 << kIsAccessCheckNeeded));
|
2340
|
+
}
|
2341
|
+
}
|
2342
|
+
|
2343
|
+
|
2344
|
+
bool Map::is_access_check_needed() {
|
2345
|
+
return ((1 << kIsAccessCheckNeeded) & bit_field()) != 0;
|
2346
|
+
}
|
2347
|
+
|
2348
|
+
|
2349
|
+
void Map::set_is_extensible(bool value) {
|
2350
|
+
if (value) {
|
2351
|
+
set_bit_field2(bit_field2() | (1 << kIsExtensible));
|
2352
|
+
} else {
|
2353
|
+
set_bit_field2(bit_field2() & ~(1 << kIsExtensible));
|
2354
|
+
}
|
2355
|
+
}
|
2356
|
+
|
2357
|
+
bool Map::is_extensible() {
|
2358
|
+
return ((1 << kIsExtensible) & bit_field2()) != 0;
|
2359
|
+
}
|
2360
|
+
|
2361
|
+
|
2362
|
+
void Map::set_attached_to_shared_function_info(bool value) {
|
2363
|
+
if (value) {
|
2364
|
+
set_bit_field2(bit_field2() | (1 << kAttachedToSharedFunctionInfo));
|
2365
|
+
} else {
|
2366
|
+
set_bit_field2(bit_field2() & ~(1 << kAttachedToSharedFunctionInfo));
|
2367
|
+
}
|
2368
|
+
}
|
2369
|
+
|
2370
|
+
bool Map::attached_to_shared_function_info() {
|
2371
|
+
return ((1 << kAttachedToSharedFunctionInfo) & bit_field2()) != 0;
|
2372
|
+
}
|
2373
|
+
|
2374
|
+
|
2375
|
+
void Map::set_is_shared(bool value) {
|
2376
|
+
if (value) {
|
2377
|
+
set_bit_field2(bit_field2() | (1 << kIsShared));
|
2378
|
+
} else {
|
2379
|
+
set_bit_field2(bit_field2() & ~(1 << kIsShared));
|
2380
|
+
}
|
2381
|
+
}
|
2382
|
+
|
2383
|
+
bool Map::is_shared() {
|
2384
|
+
return ((1 << kIsShared) & bit_field2()) != 0;
|
2385
|
+
}
|
2386
|
+
|
2387
|
+
|
2388
|
+
JSFunction* Map::unchecked_constructor() {
|
2389
|
+
return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset));
|
2390
|
+
}
|
2391
|
+
|
2392
|
+
|
2393
|
+
Code::Flags Code::flags() {
|
2394
|
+
return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset));
|
2395
|
+
}
|
2396
|
+
|
2397
|
+
|
2398
|
+
void Code::set_flags(Code::Flags flags) {
|
2399
|
+
STATIC_ASSERT(Code::NUMBER_OF_KINDS <= (kFlagsKindMask >> kFlagsKindShift)+1);
|
2400
|
+
// Make sure that all call stubs have an arguments count.
|
2401
|
+
ASSERT((ExtractKindFromFlags(flags) != CALL_IC &&
|
2402
|
+
ExtractKindFromFlags(flags) != KEYED_CALL_IC) ||
|
2403
|
+
ExtractArgumentsCountFromFlags(flags) >= 0);
|
2404
|
+
WRITE_INT_FIELD(this, kFlagsOffset, flags);
|
2405
|
+
}
|
2406
|
+
|
2407
|
+
|
2408
|
+
Code::Kind Code::kind() {
|
2409
|
+
return ExtractKindFromFlags(flags());
|
2410
|
+
}
|
2411
|
+
|
2412
|
+
|
2413
|
+
InLoopFlag Code::ic_in_loop() {
|
2414
|
+
return ExtractICInLoopFromFlags(flags());
|
2415
|
+
}
|
2416
|
+
|
2417
|
+
|
2418
|
+
InlineCacheState Code::ic_state() {
|
2419
|
+
InlineCacheState result = ExtractICStateFromFlags(flags());
|
2420
|
+
// Only allow uninitialized or debugger states for non-IC code
|
2421
|
+
// objects. This is used in the debugger to determine whether or not
|
2422
|
+
// a call to code object has been replaced with a debug break call.
|
2423
|
+
ASSERT(is_inline_cache_stub() ||
|
2424
|
+
result == UNINITIALIZED ||
|
2425
|
+
result == DEBUG_BREAK ||
|
2426
|
+
result == DEBUG_PREPARE_STEP_IN);
|
2427
|
+
return result;
|
2428
|
+
}
|
2429
|
+
|
2430
|
+
|
2431
|
+
Code::ExtraICState Code::extra_ic_state() {
|
2432
|
+
ASSERT(is_inline_cache_stub());
|
2433
|
+
return ExtractExtraICStateFromFlags(flags());
|
2434
|
+
}
|
2435
|
+
|
2436
|
+
|
2437
|
+
PropertyType Code::type() {
|
2438
|
+
ASSERT(ic_state() == MONOMORPHIC);
|
2439
|
+
return ExtractTypeFromFlags(flags());
|
2440
|
+
}
|
2441
|
+
|
2442
|
+
|
2443
|
+
int Code::arguments_count() {
|
2444
|
+
ASSERT(is_call_stub() || is_keyed_call_stub() || kind() == STUB);
|
2445
|
+
return ExtractArgumentsCountFromFlags(flags());
|
2446
|
+
}
|
2447
|
+
|
2448
|
+
|
2449
|
+
int Code::major_key() {
|
2450
|
+
ASSERT(kind() == STUB ||
|
2451
|
+
kind() == BINARY_OP_IC ||
|
2452
|
+
kind() == TYPE_RECORDING_BINARY_OP_IC ||
|
2453
|
+
kind() == COMPARE_IC);
|
2454
|
+
return READ_BYTE_FIELD(this, kStubMajorKeyOffset);
|
2455
|
+
}
|
2456
|
+
|
2457
|
+
|
2458
|
+
void Code::set_major_key(int major) {
|
2459
|
+
ASSERT(kind() == STUB ||
|
2460
|
+
kind() == BINARY_OP_IC ||
|
2461
|
+
kind() == TYPE_RECORDING_BINARY_OP_IC ||
|
2462
|
+
kind() == COMPARE_IC);
|
2463
|
+
ASSERT(0 <= major && major < 256);
|
2464
|
+
WRITE_BYTE_FIELD(this, kStubMajorKeyOffset, major);
|
2465
|
+
}
|
2466
|
+
|
2467
|
+
|
2468
|
+
bool Code::optimizable() {
|
2469
|
+
ASSERT(kind() == FUNCTION);
|
2470
|
+
return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
|
2471
|
+
}
|
2472
|
+
|
2473
|
+
|
2474
|
+
void Code::set_optimizable(bool value) {
|
2475
|
+
ASSERT(kind() == FUNCTION);
|
2476
|
+
WRITE_BYTE_FIELD(this, kOptimizableOffset, value ? 1 : 0);
|
2477
|
+
}
|
2478
|
+
|
2479
|
+
|
2480
|
+
bool Code::has_deoptimization_support() {
|
2481
|
+
ASSERT(kind() == FUNCTION);
|
2482
|
+
return READ_BYTE_FIELD(this, kHasDeoptimizationSupportOffset) == 1;
|
2483
|
+
}
|
2484
|
+
|
2485
|
+
|
2486
|
+
void Code::set_has_deoptimization_support(bool value) {
|
2487
|
+
ASSERT(kind() == FUNCTION);
|
2488
|
+
WRITE_BYTE_FIELD(this, kHasDeoptimizationSupportOffset, value ? 1 : 0);
|
2489
|
+
}
|
2490
|
+
|
2491
|
+
|
2492
|
+
int Code::allow_osr_at_loop_nesting_level() {
|
2493
|
+
ASSERT(kind() == FUNCTION);
|
2494
|
+
return READ_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset);
|
2495
|
+
}
|
2496
|
+
|
2497
|
+
|
2498
|
+
void Code::set_allow_osr_at_loop_nesting_level(int level) {
|
2499
|
+
ASSERT(kind() == FUNCTION);
|
2500
|
+
ASSERT(level >= 0 && level <= kMaxLoopNestingMarker);
|
2501
|
+
WRITE_BYTE_FIELD(this, kAllowOSRAtLoopNestingLevelOffset, level);
|
2502
|
+
}
|
2503
|
+
|
2504
|
+
|
2505
|
+
unsigned Code::stack_slots() {
|
2506
|
+
ASSERT(kind() == OPTIMIZED_FUNCTION);
|
2507
|
+
return READ_UINT32_FIELD(this, kStackSlotsOffset);
|
2508
|
+
}
|
2509
|
+
|
2510
|
+
|
2511
|
+
void Code::set_stack_slots(unsigned slots) {
|
2512
|
+
ASSERT(kind() == OPTIMIZED_FUNCTION);
|
2513
|
+
WRITE_UINT32_FIELD(this, kStackSlotsOffset, slots);
|
2514
|
+
}
|
2515
|
+
|
2516
|
+
|
2517
|
+
unsigned Code::safepoint_table_offset() {
|
2518
|
+
ASSERT(kind() == OPTIMIZED_FUNCTION);
|
2519
|
+
return READ_UINT32_FIELD(this, kSafepointTableOffsetOffset);
|
2520
|
+
}
|
2521
|
+
|
2522
|
+
|
2523
|
+
void Code::set_safepoint_table_offset(unsigned offset) {
|
2524
|
+
ASSERT(kind() == OPTIMIZED_FUNCTION);
|
2525
|
+
ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
|
2526
|
+
WRITE_UINT32_FIELD(this, kSafepointTableOffsetOffset, offset);
|
2527
|
+
}
|
2528
|
+
|
2529
|
+
|
2530
|
+
unsigned Code::stack_check_table_offset() {
|
2531
|
+
ASSERT(kind() == FUNCTION);
|
2532
|
+
return READ_UINT32_FIELD(this, kStackCheckTableOffsetOffset);
|
2533
|
+
}
|
2534
|
+
|
2535
|
+
|
2536
|
+
void Code::set_stack_check_table_offset(unsigned offset) {
|
2537
|
+
ASSERT(kind() == FUNCTION);
|
2538
|
+
ASSERT(IsAligned(offset, static_cast<unsigned>(kIntSize)));
|
2539
|
+
WRITE_UINT32_FIELD(this, kStackCheckTableOffsetOffset, offset);
|
2540
|
+
}
|
2541
|
+
|
2542
|
+
|
2543
|
+
CheckType Code::check_type() {
|
2544
|
+
ASSERT(is_call_stub() || is_keyed_call_stub());
|
2545
|
+
byte type = READ_BYTE_FIELD(this, kCheckTypeOffset);
|
2546
|
+
return static_cast<CheckType>(type);
|
2547
|
+
}
|
2548
|
+
|
2549
|
+
|
2550
|
+
void Code::set_check_type(CheckType value) {
|
2551
|
+
ASSERT(is_call_stub() || is_keyed_call_stub());
|
2552
|
+
WRITE_BYTE_FIELD(this, kCheckTypeOffset, value);
|
2553
|
+
}
|
2554
|
+
|
2555
|
+
|
2556
|
+
byte Code::binary_op_type() {
|
2557
|
+
ASSERT(is_binary_op_stub());
|
2558
|
+
return READ_BYTE_FIELD(this, kBinaryOpTypeOffset);
|
2559
|
+
}
|
2560
|
+
|
2561
|
+
|
2562
|
+
void Code::set_binary_op_type(byte value) {
|
2563
|
+
ASSERT(is_binary_op_stub());
|
2564
|
+
WRITE_BYTE_FIELD(this, kBinaryOpTypeOffset, value);
|
2565
|
+
}
|
2566
|
+
|
2567
|
+
|
2568
|
+
byte Code::type_recording_binary_op_type() {
|
2569
|
+
ASSERT(is_type_recording_binary_op_stub());
|
2570
|
+
return READ_BYTE_FIELD(this, kBinaryOpTypeOffset);
|
2571
|
+
}
|
2572
|
+
|
2573
|
+
|
2574
|
+
void Code::set_type_recording_binary_op_type(byte value) {
|
2575
|
+
ASSERT(is_type_recording_binary_op_stub());
|
2576
|
+
WRITE_BYTE_FIELD(this, kBinaryOpTypeOffset, value);
|
2577
|
+
}
|
2578
|
+
|
2579
|
+
|
2580
|
+
byte Code::type_recording_binary_op_result_type() {
|
2581
|
+
ASSERT(is_type_recording_binary_op_stub());
|
2582
|
+
return READ_BYTE_FIELD(this, kBinaryOpReturnTypeOffset);
|
2583
|
+
}
|
2584
|
+
|
2585
|
+
|
2586
|
+
void Code::set_type_recording_binary_op_result_type(byte value) {
|
2587
|
+
ASSERT(is_type_recording_binary_op_stub());
|
2588
|
+
WRITE_BYTE_FIELD(this, kBinaryOpReturnTypeOffset, value);
|
2589
|
+
}
|
2590
|
+
|
2591
|
+
|
2592
|
+
byte Code::compare_state() {
|
2593
|
+
ASSERT(is_compare_ic_stub());
|
2594
|
+
return READ_BYTE_FIELD(this, kCompareStateOffset);
|
2595
|
+
}
|
2596
|
+
|
2597
|
+
|
2598
|
+
void Code::set_compare_state(byte value) {
|
2599
|
+
ASSERT(is_compare_ic_stub());
|
2600
|
+
WRITE_BYTE_FIELD(this, kCompareStateOffset, value);
|
2601
|
+
}
|
2602
|
+
|
2603
|
+
|
2604
|
+
bool Code::is_inline_cache_stub() {
|
2605
|
+
Kind kind = this->kind();
|
2606
|
+
return kind >= FIRST_IC_KIND && kind <= LAST_IC_KIND;
|
2607
|
+
}
|
2608
|
+
|
2609
|
+
|
2610
|
+
Code::Flags Code::ComputeFlags(Kind kind,
|
2611
|
+
InLoopFlag in_loop,
|
2612
|
+
InlineCacheState ic_state,
|
2613
|
+
ExtraICState extra_ic_state,
|
2614
|
+
PropertyType type,
|
2615
|
+
int argc,
|
2616
|
+
InlineCacheHolderFlag holder) {
|
2617
|
+
// Extra IC state is only allowed for monomorphic call IC stubs
|
2618
|
+
// or for store IC stubs.
|
2619
|
+
ASSERT(extra_ic_state == kNoExtraICState ||
|
2620
|
+
(kind == CALL_IC && (ic_state == MONOMORPHIC ||
|
2621
|
+
ic_state == MONOMORPHIC_PROTOTYPE_FAILURE)) ||
|
2622
|
+
(kind == STORE_IC) ||
|
2623
|
+
(kind == KEYED_STORE_IC));
|
2624
|
+
// Compute the bit mask.
|
2625
|
+
int bits = kind << kFlagsKindShift;
|
2626
|
+
if (in_loop) bits |= kFlagsICInLoopMask;
|
2627
|
+
bits |= ic_state << kFlagsICStateShift;
|
2628
|
+
bits |= type << kFlagsTypeShift;
|
2629
|
+
bits |= extra_ic_state << kFlagsExtraICStateShift;
|
2630
|
+
bits |= argc << kFlagsArgumentsCountShift;
|
2631
|
+
if (holder == PROTOTYPE_MAP) bits |= kFlagsCacheInPrototypeMapMask;
|
2632
|
+
// Cast to flags and validate result before returning it.
|
2633
|
+
Flags result = static_cast<Flags>(bits);
|
2634
|
+
ASSERT(ExtractKindFromFlags(result) == kind);
|
2635
|
+
ASSERT(ExtractICStateFromFlags(result) == ic_state);
|
2636
|
+
ASSERT(ExtractICInLoopFromFlags(result) == in_loop);
|
2637
|
+
ASSERT(ExtractTypeFromFlags(result) == type);
|
2638
|
+
ASSERT(ExtractExtraICStateFromFlags(result) == extra_ic_state);
|
2639
|
+
ASSERT(ExtractArgumentsCountFromFlags(result) == argc);
|
2640
|
+
return result;
|
2641
|
+
}
|
2642
|
+
|
2643
|
+
|
2644
|
+
Code::Flags Code::ComputeMonomorphicFlags(Kind kind,
|
2645
|
+
PropertyType type,
|
2646
|
+
ExtraICState extra_ic_state,
|
2647
|
+
InlineCacheHolderFlag holder,
|
2648
|
+
InLoopFlag in_loop,
|
2649
|
+
int argc) {
|
2650
|
+
return ComputeFlags(
|
2651
|
+
kind, in_loop, MONOMORPHIC, extra_ic_state, type, argc, holder);
|
2652
|
+
}
|
2653
|
+
|
2654
|
+
|
2655
|
+
Code::Kind Code::ExtractKindFromFlags(Flags flags) {
|
2656
|
+
int bits = (flags & kFlagsKindMask) >> kFlagsKindShift;
|
2657
|
+
return static_cast<Kind>(bits);
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
|
2661
|
+
InlineCacheState Code::ExtractICStateFromFlags(Flags flags) {
|
2662
|
+
int bits = (flags & kFlagsICStateMask) >> kFlagsICStateShift;
|
2663
|
+
return static_cast<InlineCacheState>(bits);
|
2664
|
+
}
|
2665
|
+
|
2666
|
+
|
2667
|
+
Code::ExtraICState Code::ExtractExtraICStateFromFlags(Flags flags) {
|
2668
|
+
int bits = (flags & kFlagsExtraICStateMask) >> kFlagsExtraICStateShift;
|
2669
|
+
return static_cast<ExtraICState>(bits);
|
2670
|
+
}
|
2671
|
+
|
2672
|
+
|
2673
|
+
InLoopFlag Code::ExtractICInLoopFromFlags(Flags flags) {
|
2674
|
+
int bits = (flags & kFlagsICInLoopMask);
|
2675
|
+
return bits != 0 ? IN_LOOP : NOT_IN_LOOP;
|
2676
|
+
}
|
2677
|
+
|
2678
|
+
|
2679
|
+
PropertyType Code::ExtractTypeFromFlags(Flags flags) {
|
2680
|
+
int bits = (flags & kFlagsTypeMask) >> kFlagsTypeShift;
|
2681
|
+
return static_cast<PropertyType>(bits);
|
2682
|
+
}
|
2683
|
+
|
2684
|
+
|
2685
|
+
int Code::ExtractArgumentsCountFromFlags(Flags flags) {
|
2686
|
+
return (flags & kFlagsArgumentsCountMask) >> kFlagsArgumentsCountShift;
|
2687
|
+
}
|
2688
|
+
|
2689
|
+
|
2690
|
+
InlineCacheHolderFlag Code::ExtractCacheHolderFromFlags(Flags flags) {
|
2691
|
+
int bits = (flags & kFlagsCacheInPrototypeMapMask);
|
2692
|
+
return bits != 0 ? PROTOTYPE_MAP : OWN_MAP;
|
2693
|
+
}
|
2694
|
+
|
2695
|
+
|
2696
|
+
Code::Flags Code::RemoveTypeFromFlags(Flags flags) {
|
2697
|
+
int bits = flags & ~kFlagsTypeMask;
|
2698
|
+
return static_cast<Flags>(bits);
|
2699
|
+
}
|
2700
|
+
|
2701
|
+
|
2702
|
+
Code* Code::GetCodeFromTargetAddress(Address address) {
|
2703
|
+
HeapObject* code = HeapObject::FromAddress(address - Code::kHeaderSize);
|
2704
|
+
// GetCodeFromTargetAddress might be called when marking objects during mark
|
2705
|
+
// sweep. reinterpret_cast is therefore used instead of the more appropriate
|
2706
|
+
// Code::cast. Code::cast does not work when the object's map is
|
2707
|
+
// marked.
|
2708
|
+
Code* result = reinterpret_cast<Code*>(code);
|
2709
|
+
return result;
|
2710
|
+
}
|
2711
|
+
|
2712
|
+
|
2713
|
+
Object* Code::GetObjectFromEntryAddress(Address location_of_address) {
|
2714
|
+
return HeapObject::
|
2715
|
+
FromAddress(Memory::Address_at(location_of_address) - Code::kHeaderSize);
|
2716
|
+
}
|
2717
|
+
|
2718
|
+
|
2719
|
+
Object* Map::prototype() {
|
2720
|
+
return READ_FIELD(this, kPrototypeOffset);
|
2721
|
+
}
|
2722
|
+
|
2723
|
+
|
2724
|
+
void Map::set_prototype(Object* value, WriteBarrierMode mode) {
|
2725
|
+
ASSERT(value->IsNull() || value->IsJSObject());
|
2726
|
+
WRITE_FIELD(this, kPrototypeOffset, value);
|
2727
|
+
CONDITIONAL_WRITE_BARRIER(this, kPrototypeOffset, mode);
|
2728
|
+
}
|
2729
|
+
|
2730
|
+
|
2731
|
+
MaybeObject* Map::GetFastElementsMap() {
|
2732
|
+
if (has_fast_elements()) return this;
|
2733
|
+
Object* obj;
|
2734
|
+
{ MaybeObject* maybe_obj = CopyDropTransitions();
|
2735
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2736
|
+
}
|
2737
|
+
Map* new_map = Map::cast(obj);
|
2738
|
+
new_map->set_has_fast_elements(true);
|
2739
|
+
Counters::map_slow_to_fast_elements.Increment();
|
2740
|
+
return new_map;
|
2741
|
+
}
|
2742
|
+
|
2743
|
+
|
2744
|
+
MaybeObject* Map::GetSlowElementsMap() {
|
2745
|
+
if (!has_fast_elements()) return this;
|
2746
|
+
Object* obj;
|
2747
|
+
{ MaybeObject* maybe_obj = CopyDropTransitions();
|
2748
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2749
|
+
}
|
2750
|
+
Map* new_map = Map::cast(obj);
|
2751
|
+
new_map->set_has_fast_elements(false);
|
2752
|
+
Counters::map_fast_to_slow_elements.Increment();
|
2753
|
+
return new_map;
|
2754
|
+
}
|
2755
|
+
|
2756
|
+
|
2757
|
+
MaybeObject* Map::GetPixelArrayElementsMap() {
|
2758
|
+
if (has_pixel_array_elements()) return this;
|
2759
|
+
// TODO(danno): Special case empty object map (or most common case)
|
2760
|
+
// to return a pre-canned pixel array map.
|
2761
|
+
Object* obj;
|
2762
|
+
{ MaybeObject* maybe_obj = CopyDropTransitions();
|
2763
|
+
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
|
2764
|
+
}
|
2765
|
+
Map* new_map = Map::cast(obj);
|
2766
|
+
new_map->set_has_fast_elements(false);
|
2767
|
+
new_map->set_has_pixel_array_elements(true);
|
2768
|
+
Counters::map_to_pixel_array_elements.Increment();
|
2769
|
+
return new_map;
|
2770
|
+
}
|
2771
|
+
|
2772
|
+
|
2773
|
+
ACCESSORS(Map, instance_descriptors, DescriptorArray,
|
2774
|
+
kInstanceDescriptorsOffset)
|
2775
|
+
ACCESSORS(Map, code_cache, Object, kCodeCacheOffset)
|
2776
|
+
ACCESSORS(Map, constructor, Object, kConstructorOffset)
|
2777
|
+
|
2778
|
+
ACCESSORS(JSFunction, shared, SharedFunctionInfo, kSharedFunctionInfoOffset)
|
2779
|
+
ACCESSORS(JSFunction, literals, FixedArray, kLiteralsOffset)
|
2780
|
+
ACCESSORS(JSFunction, next_function_link, Object, kNextFunctionLinkOffset)
|
2781
|
+
|
2782
|
+
ACCESSORS(GlobalObject, builtins, JSBuiltinsObject, kBuiltinsOffset)
|
2783
|
+
ACCESSORS(GlobalObject, global_context, Context, kGlobalContextOffset)
|
2784
|
+
ACCESSORS(GlobalObject, global_receiver, JSObject, kGlobalReceiverOffset)
|
2785
|
+
|
2786
|
+
ACCESSORS(JSGlobalProxy, context, Object, kContextOffset)
|
2787
|
+
|
2788
|
+
ACCESSORS(AccessorInfo, getter, Object, kGetterOffset)
|
2789
|
+
ACCESSORS(AccessorInfo, setter, Object, kSetterOffset)
|
2790
|
+
ACCESSORS(AccessorInfo, data, Object, kDataOffset)
|
2791
|
+
ACCESSORS(AccessorInfo, name, Object, kNameOffset)
|
2792
|
+
ACCESSORS(AccessorInfo, flag, Smi, kFlagOffset)
|
2793
|
+
|
2794
|
+
ACCESSORS(AccessCheckInfo, named_callback, Object, kNamedCallbackOffset)
|
2795
|
+
ACCESSORS(AccessCheckInfo, indexed_callback, Object, kIndexedCallbackOffset)
|
2796
|
+
ACCESSORS(AccessCheckInfo, data, Object, kDataOffset)
|
2797
|
+
|
2798
|
+
ACCESSORS(InterceptorInfo, getter, Object, kGetterOffset)
|
2799
|
+
ACCESSORS(InterceptorInfo, setter, Object, kSetterOffset)
|
2800
|
+
ACCESSORS(InterceptorInfo, query, Object, kQueryOffset)
|
2801
|
+
ACCESSORS(InterceptorInfo, deleter, Object, kDeleterOffset)
|
2802
|
+
ACCESSORS(InterceptorInfo, enumerator, Object, kEnumeratorOffset)
|
2803
|
+
ACCESSORS(InterceptorInfo, data, Object, kDataOffset)
|
2804
|
+
|
2805
|
+
ACCESSORS(CallHandlerInfo, callback, Object, kCallbackOffset)
|
2806
|
+
ACCESSORS(CallHandlerInfo, data, Object, kDataOffset)
|
2807
|
+
|
2808
|
+
ACCESSORS(TemplateInfo, tag, Object, kTagOffset)
|
2809
|
+
ACCESSORS(TemplateInfo, property_list, Object, kPropertyListOffset)
|
2810
|
+
|
2811
|
+
ACCESSORS(FunctionTemplateInfo, serial_number, Object, kSerialNumberOffset)
|
2812
|
+
ACCESSORS(FunctionTemplateInfo, call_code, Object, kCallCodeOffset)
|
2813
|
+
ACCESSORS(FunctionTemplateInfo, property_accessors, Object,
|
2814
|
+
kPropertyAccessorsOffset)
|
2815
|
+
ACCESSORS(FunctionTemplateInfo, prototype_template, Object,
|
2816
|
+
kPrototypeTemplateOffset)
|
2817
|
+
ACCESSORS(FunctionTemplateInfo, parent_template, Object, kParentTemplateOffset)
|
2818
|
+
ACCESSORS(FunctionTemplateInfo, named_property_handler, Object,
|
2819
|
+
kNamedPropertyHandlerOffset)
|
2820
|
+
ACCESSORS(FunctionTemplateInfo, indexed_property_handler, Object,
|
2821
|
+
kIndexedPropertyHandlerOffset)
|
2822
|
+
ACCESSORS(FunctionTemplateInfo, instance_template, Object,
|
2823
|
+
kInstanceTemplateOffset)
|
2824
|
+
ACCESSORS(FunctionTemplateInfo, class_name, Object, kClassNameOffset)
|
2825
|
+
ACCESSORS(FunctionTemplateInfo, signature, Object, kSignatureOffset)
|
2826
|
+
ACCESSORS(FunctionTemplateInfo, instance_call_handler, Object,
|
2827
|
+
kInstanceCallHandlerOffset)
|
2828
|
+
ACCESSORS(FunctionTemplateInfo, access_check_info, Object,
|
2829
|
+
kAccessCheckInfoOffset)
|
2830
|
+
ACCESSORS(FunctionTemplateInfo, flag, Smi, kFlagOffset)
|
2831
|
+
|
2832
|
+
ACCESSORS(ObjectTemplateInfo, constructor, Object, kConstructorOffset)
|
2833
|
+
ACCESSORS(ObjectTemplateInfo, internal_field_count, Object,
|
2834
|
+
kInternalFieldCountOffset)
|
2835
|
+
|
2836
|
+
ACCESSORS(SignatureInfo, receiver, Object, kReceiverOffset)
|
2837
|
+
ACCESSORS(SignatureInfo, args, Object, kArgsOffset)
|
2838
|
+
|
2839
|
+
ACCESSORS(TypeSwitchInfo, types, Object, kTypesOffset)
|
2840
|
+
|
2841
|
+
ACCESSORS(Script, source, Object, kSourceOffset)
|
2842
|
+
ACCESSORS(Script, name, Object, kNameOffset)
|
2843
|
+
ACCESSORS(Script, id, Object, kIdOffset)
|
2844
|
+
ACCESSORS(Script, line_offset, Smi, kLineOffsetOffset)
|
2845
|
+
ACCESSORS(Script, column_offset, Smi, kColumnOffsetOffset)
|
2846
|
+
ACCESSORS(Script, data, Object, kDataOffset)
|
2847
|
+
ACCESSORS(Script, context_data, Object, kContextOffset)
|
2848
|
+
ACCESSORS(Script, wrapper, Proxy, kWrapperOffset)
|
2849
|
+
ACCESSORS(Script, type, Smi, kTypeOffset)
|
2850
|
+
ACCESSORS(Script, compilation_type, Smi, kCompilationTypeOffset)
|
2851
|
+
ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
|
2852
|
+
ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset)
|
2853
|
+
ACCESSORS(Script, eval_from_instructions_offset, Smi,
|
2854
|
+
kEvalFrominstructionsOffsetOffset)
|
2855
|
+
|
2856
|
+
#ifdef ENABLE_DEBUGGER_SUPPORT
|
2857
|
+
ACCESSORS(DebugInfo, shared, SharedFunctionInfo, kSharedFunctionInfoIndex)
|
2858
|
+
ACCESSORS(DebugInfo, original_code, Code, kOriginalCodeIndex)
|
2859
|
+
ACCESSORS(DebugInfo, code, Code, kPatchedCodeIndex)
|
2860
|
+
ACCESSORS(DebugInfo, break_points, FixedArray, kBreakPointsStateIndex)
|
2861
|
+
|
2862
|
+
ACCESSORS(BreakPointInfo, code_position, Smi, kCodePositionIndex)
|
2863
|
+
ACCESSORS(BreakPointInfo, source_position, Smi, kSourcePositionIndex)
|
2864
|
+
ACCESSORS(BreakPointInfo, statement_position, Smi, kStatementPositionIndex)
|
2865
|
+
ACCESSORS(BreakPointInfo, break_point_objects, Object, kBreakPointObjectsIndex)
|
2866
|
+
#endif
|
2867
|
+
|
2868
|
+
ACCESSORS(SharedFunctionInfo, name, Object, kNameOffset)
|
2869
|
+
ACCESSORS(SharedFunctionInfo, construct_stub, Code, kConstructStubOffset)
|
2870
|
+
ACCESSORS(SharedFunctionInfo, initial_map, Object, kInitialMapOffset)
|
2871
|
+
ACCESSORS(SharedFunctionInfo, instance_class_name, Object,
|
2872
|
+
kInstanceClassNameOffset)
|
2873
|
+
ACCESSORS(SharedFunctionInfo, function_data, Object, kFunctionDataOffset)
|
2874
|
+
ACCESSORS(SharedFunctionInfo, script, Object, kScriptOffset)
|
2875
|
+
ACCESSORS(SharedFunctionInfo, debug_info, Object, kDebugInfoOffset)
|
2876
|
+
ACCESSORS(SharedFunctionInfo, inferred_name, String, kInferredNameOffset)
|
2877
|
+
ACCESSORS(SharedFunctionInfo, this_property_assignments, Object,
|
2878
|
+
kThisPropertyAssignmentsOffset)
|
2879
|
+
|
2880
|
+
BOOL_ACCESSORS(FunctionTemplateInfo, flag, hidden_prototype,
|
2881
|
+
kHiddenPrototypeBit)
|
2882
|
+
BOOL_ACCESSORS(FunctionTemplateInfo, flag, undetectable, kUndetectableBit)
|
2883
|
+
BOOL_ACCESSORS(FunctionTemplateInfo, flag, needs_access_check,
|
2884
|
+
kNeedsAccessCheckBit)
|
2885
|
+
BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_expression,
|
2886
|
+
kIsExpressionBit)
|
2887
|
+
BOOL_ACCESSORS(SharedFunctionInfo, start_position_and_type, is_toplevel,
|
2888
|
+
kIsTopLevelBit)
|
2889
|
+
BOOL_GETTER(SharedFunctionInfo, compiler_hints,
|
2890
|
+
has_only_simple_this_property_assignments,
|
2891
|
+
kHasOnlySimpleThisPropertyAssignments)
|
2892
|
+
BOOL_ACCESSORS(SharedFunctionInfo,
|
2893
|
+
compiler_hints,
|
2894
|
+
try_full_codegen,
|
2895
|
+
kTryFullCodegen)
|
2896
|
+
BOOL_ACCESSORS(SharedFunctionInfo,
|
2897
|
+
compiler_hints,
|
2898
|
+
allows_lazy_compilation,
|
2899
|
+
kAllowLazyCompilation)
|
2900
|
+
|
2901
|
+
|
2902
|
+
#if V8_HOST_ARCH_32_BIT
|
2903
|
+
SMI_ACCESSORS(SharedFunctionInfo, length, kLengthOffset)
|
2904
|
+
SMI_ACCESSORS(SharedFunctionInfo, formal_parameter_count,
|
2905
|
+
kFormalParameterCountOffset)
|
2906
|
+
SMI_ACCESSORS(SharedFunctionInfo, expected_nof_properties,
|
2907
|
+
kExpectedNofPropertiesOffset)
|
2908
|
+
SMI_ACCESSORS(SharedFunctionInfo, num_literals, kNumLiteralsOffset)
|
2909
|
+
SMI_ACCESSORS(SharedFunctionInfo, start_position_and_type,
|
2910
|
+
kStartPositionAndTypeOffset)
|
2911
|
+
SMI_ACCESSORS(SharedFunctionInfo, end_position, kEndPositionOffset)
|
2912
|
+
SMI_ACCESSORS(SharedFunctionInfo, function_token_position,
|
2913
|
+
kFunctionTokenPositionOffset)
|
2914
|
+
SMI_ACCESSORS(SharedFunctionInfo, compiler_hints,
|
2915
|
+
kCompilerHintsOffset)
|
2916
|
+
SMI_ACCESSORS(SharedFunctionInfo, this_property_assignments_count,
|
2917
|
+
kThisPropertyAssignmentsCountOffset)
|
2918
|
+
SMI_ACCESSORS(SharedFunctionInfo, opt_count, kOptCountOffset)
|
2919
|
+
#else
|
2920
|
+
|
2921
|
+
#define PSEUDO_SMI_ACCESSORS_LO(holder, name, offset) \
|
2922
|
+
STATIC_ASSERT(holder::offset % kPointerSize == 0); \
|
2923
|
+
int holder::name() { \
|
2924
|
+
int value = READ_INT_FIELD(this, offset); \
|
2925
|
+
ASSERT(kHeapObjectTag == 1); \
|
2926
|
+
ASSERT((value & kHeapObjectTag) == 0); \
|
2927
|
+
return value >> 1; \
|
2928
|
+
} \
|
2929
|
+
void holder::set_##name(int value) { \
|
2930
|
+
ASSERT(kHeapObjectTag == 1); \
|
2931
|
+
ASSERT((value & 0xC0000000) == 0xC0000000 || \
|
2932
|
+
(value & 0xC0000000) == 0x000000000); \
|
2933
|
+
WRITE_INT_FIELD(this, \
|
2934
|
+
offset, \
|
2935
|
+
(value << 1) & ~kHeapObjectTag); \
|
2936
|
+
}
|
2937
|
+
|
2938
|
+
#define PSEUDO_SMI_ACCESSORS_HI(holder, name, offset) \
|
2939
|
+
STATIC_ASSERT(holder::offset % kPointerSize == kIntSize); \
|
2940
|
+
INT_ACCESSORS(holder, name, offset)
|
2941
|
+
|
2942
|
+
|
2943
|
+
PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, length, kLengthOffset)
|
2944
|
+
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
|
2945
|
+
formal_parameter_count,
|
2946
|
+
kFormalParameterCountOffset)
|
2947
|
+
|
2948
|
+
PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
|
2949
|
+
expected_nof_properties,
|
2950
|
+
kExpectedNofPropertiesOffset)
|
2951
|
+
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, num_literals, kNumLiteralsOffset)
|
2952
|
+
|
2953
|
+
PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo, end_position, kEndPositionOffset)
|
2954
|
+
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
|
2955
|
+
start_position_and_type,
|
2956
|
+
kStartPositionAndTypeOffset)
|
2957
|
+
|
2958
|
+
PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
|
2959
|
+
function_token_position,
|
2960
|
+
kFunctionTokenPositionOffset)
|
2961
|
+
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo,
|
2962
|
+
compiler_hints,
|
2963
|
+
kCompilerHintsOffset)
|
2964
|
+
|
2965
|
+
PSEUDO_SMI_ACCESSORS_LO(SharedFunctionInfo,
|
2966
|
+
this_property_assignments_count,
|
2967
|
+
kThisPropertyAssignmentsCountOffset)
|
2968
|
+
PSEUDO_SMI_ACCESSORS_HI(SharedFunctionInfo, opt_count, kOptCountOffset)
|
2969
|
+
#endif
|
2970
|
+
|
2971
|
+
|
2972
|
+
int SharedFunctionInfo::construction_count() {
|
2973
|
+
return READ_BYTE_FIELD(this, kConstructionCountOffset);
|
2974
|
+
}
|
2975
|
+
|
2976
|
+
|
2977
|
+
void SharedFunctionInfo::set_construction_count(int value) {
|
2978
|
+
ASSERT(0 <= value && value < 256);
|
2979
|
+
WRITE_BYTE_FIELD(this, kConstructionCountOffset, static_cast<byte>(value));
|
2980
|
+
}
|
2981
|
+
|
2982
|
+
|
2983
|
+
bool SharedFunctionInfo::live_objects_may_exist() {
|
2984
|
+
return (compiler_hints() & (1 << kLiveObjectsMayExist)) != 0;
|
2985
|
+
}
|
2986
|
+
|
2987
|
+
|
2988
|
+
void SharedFunctionInfo::set_live_objects_may_exist(bool value) {
|
2989
|
+
if (value) {
|
2990
|
+
set_compiler_hints(compiler_hints() | (1 << kLiveObjectsMayExist));
|
2991
|
+
} else {
|
2992
|
+
set_compiler_hints(compiler_hints() & ~(1 << kLiveObjectsMayExist));
|
2993
|
+
}
|
2994
|
+
}
|
2995
|
+
|
2996
|
+
|
2997
|
+
bool SharedFunctionInfo::IsInobjectSlackTrackingInProgress() {
|
2998
|
+
return initial_map() != Heap::undefined_value();
|
2999
|
+
}
|
3000
|
+
|
3001
|
+
|
3002
|
+
bool SharedFunctionInfo::optimization_disabled() {
|
3003
|
+
return BooleanBit::get(compiler_hints(), kOptimizationDisabled);
|
3004
|
+
}
|
3005
|
+
|
3006
|
+
|
3007
|
+
void SharedFunctionInfo::set_optimization_disabled(bool disable) {
|
3008
|
+
set_compiler_hints(BooleanBit::set(compiler_hints(),
|
3009
|
+
kOptimizationDisabled,
|
3010
|
+
disable));
|
3011
|
+
// If disabling optimizations we reflect that in the code object so
|
3012
|
+
// it will not be counted as optimizable code.
|
3013
|
+
if ((code()->kind() == Code::FUNCTION) && disable) {
|
3014
|
+
code()->set_optimizable(false);
|
3015
|
+
}
|
3016
|
+
}
|
3017
|
+
|
3018
|
+
|
3019
|
+
bool SharedFunctionInfo::strict_mode() {
|
3020
|
+
return BooleanBit::get(compiler_hints(), kStrictModeFunction);
|
3021
|
+
}
|
3022
|
+
|
3023
|
+
|
3024
|
+
void SharedFunctionInfo::set_strict_mode(bool value) {
|
3025
|
+
set_compiler_hints(BooleanBit::set(compiler_hints(),
|
3026
|
+
kStrictModeFunction,
|
3027
|
+
value));
|
3028
|
+
}
|
3029
|
+
|
3030
|
+
|
3031
|
+
ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset)
|
3032
|
+
ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset)
|
3033
|
+
|
3034
|
+
bool Script::HasValidSource() {
|
3035
|
+
Object* src = this->source();
|
3036
|
+
if (!src->IsString()) return true;
|
3037
|
+
String* src_str = String::cast(src);
|
3038
|
+
if (!StringShape(src_str).IsExternal()) return true;
|
3039
|
+
if (src_str->IsAsciiRepresentation()) {
|
3040
|
+
return ExternalAsciiString::cast(src)->resource() != NULL;
|
3041
|
+
} else if (src_str->IsTwoByteRepresentation()) {
|
3042
|
+
return ExternalTwoByteString::cast(src)->resource() != NULL;
|
3043
|
+
}
|
3044
|
+
return true;
|
3045
|
+
}
|
3046
|
+
|
3047
|
+
|
3048
|
+
void SharedFunctionInfo::DontAdaptArguments() {
|
3049
|
+
ASSERT(code()->kind() == Code::BUILTIN);
|
3050
|
+
set_formal_parameter_count(kDontAdaptArgumentsSentinel);
|
3051
|
+
}
|
3052
|
+
|
3053
|
+
|
3054
|
+
int SharedFunctionInfo::start_position() {
|
3055
|
+
return start_position_and_type() >> kStartPositionShift;
|
3056
|
+
}
|
3057
|
+
|
3058
|
+
|
3059
|
+
void SharedFunctionInfo::set_start_position(int start_position) {
|
3060
|
+
set_start_position_and_type((start_position << kStartPositionShift)
|
3061
|
+
| (start_position_and_type() & ~kStartPositionMask));
|
3062
|
+
}
|
3063
|
+
|
3064
|
+
|
3065
|
+
Code* SharedFunctionInfo::code() {
|
3066
|
+
return Code::cast(READ_FIELD(this, kCodeOffset));
|
3067
|
+
}
|
3068
|
+
|
3069
|
+
|
3070
|
+
Code* SharedFunctionInfo::unchecked_code() {
|
3071
|
+
return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset));
|
3072
|
+
}
|
3073
|
+
|
3074
|
+
|
3075
|
+
void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) {
|
3076
|
+
WRITE_FIELD(this, kCodeOffset, value);
|
3077
|
+
CONDITIONAL_WRITE_BARRIER(this, kCodeOffset, mode);
|
3078
|
+
}
|
3079
|
+
|
3080
|
+
|
3081
|
+
SerializedScopeInfo* SharedFunctionInfo::scope_info() {
|
3082
|
+
return reinterpret_cast<SerializedScopeInfo*>(
|
3083
|
+
READ_FIELD(this, kScopeInfoOffset));
|
3084
|
+
}
|
3085
|
+
|
3086
|
+
|
3087
|
+
void SharedFunctionInfo::set_scope_info(SerializedScopeInfo* value,
|
3088
|
+
WriteBarrierMode mode) {
|
3089
|
+
WRITE_FIELD(this, kScopeInfoOffset, reinterpret_cast<Object*>(value));
|
3090
|
+
CONDITIONAL_WRITE_BARRIER(this, kScopeInfoOffset, mode);
|
3091
|
+
}
|
3092
|
+
|
3093
|
+
|
3094
|
+
Smi* SharedFunctionInfo::deopt_counter() {
|
3095
|
+
return reinterpret_cast<Smi*>(READ_FIELD(this, kDeoptCounterOffset));
|
3096
|
+
}
|
3097
|
+
|
3098
|
+
|
3099
|
+
void SharedFunctionInfo::set_deopt_counter(Smi* value) {
|
3100
|
+
WRITE_FIELD(this, kDeoptCounterOffset, value);
|
3101
|
+
}
|
3102
|
+
|
3103
|
+
|
3104
|
+
bool SharedFunctionInfo::is_compiled() {
|
3105
|
+
return code() != Builtins::builtin(Builtins::LazyCompile);
|
3106
|
+
}
|
3107
|
+
|
3108
|
+
|
3109
|
+
bool SharedFunctionInfo::IsApiFunction() {
|
3110
|
+
return function_data()->IsFunctionTemplateInfo();
|
3111
|
+
}
|
3112
|
+
|
3113
|
+
|
3114
|
+
FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() {
|
3115
|
+
ASSERT(IsApiFunction());
|
3116
|
+
return FunctionTemplateInfo::cast(function_data());
|
3117
|
+
}
|
3118
|
+
|
3119
|
+
|
3120
|
+
bool SharedFunctionInfo::HasBuiltinFunctionId() {
|
3121
|
+
return function_data()->IsSmi();
|
3122
|
+
}
|
3123
|
+
|
3124
|
+
|
3125
|
+
BuiltinFunctionId SharedFunctionInfo::builtin_function_id() {
|
3126
|
+
ASSERT(HasBuiltinFunctionId());
|
3127
|
+
return static_cast<BuiltinFunctionId>(Smi::cast(function_data())->value());
|
3128
|
+
}
|
3129
|
+
|
3130
|
+
|
3131
|
+
int SharedFunctionInfo::code_age() {
|
3132
|
+
return (compiler_hints() >> kCodeAgeShift) & kCodeAgeMask;
|
3133
|
+
}
|
3134
|
+
|
3135
|
+
|
3136
|
+
void SharedFunctionInfo::set_code_age(int code_age) {
|
3137
|
+
set_compiler_hints(compiler_hints() |
|
3138
|
+
((code_age & kCodeAgeMask) << kCodeAgeShift));
|
3139
|
+
}
|
3140
|
+
|
3141
|
+
|
3142
|
+
bool SharedFunctionInfo::has_deoptimization_support() {
|
3143
|
+
Code* code = this->code();
|
3144
|
+
return code->kind() == Code::FUNCTION && code->has_deoptimization_support();
|
3145
|
+
}
|
3146
|
+
|
3147
|
+
|
3148
|
+
bool JSFunction::IsBuiltin() {
|
3149
|
+
return context()->global()->IsJSBuiltinsObject();
|
3150
|
+
}
|
3151
|
+
|
3152
|
+
|
3153
|
+
bool JSFunction::NeedsArgumentsAdaption() {
|
3154
|
+
return shared()->formal_parameter_count() !=
|
3155
|
+
SharedFunctionInfo::kDontAdaptArgumentsSentinel;
|
3156
|
+
}
|
3157
|
+
|
3158
|
+
|
3159
|
+
bool JSFunction::IsOptimized() {
|
3160
|
+
return code()->kind() == Code::OPTIMIZED_FUNCTION;
|
3161
|
+
}
|
3162
|
+
|
3163
|
+
|
3164
|
+
bool JSFunction::IsMarkedForLazyRecompilation() {
|
3165
|
+
return code() == Builtins::builtin(Builtins::LazyRecompile);
|
3166
|
+
}
|
3167
|
+
|
3168
|
+
|
3169
|
+
Code* JSFunction::code() {
|
3170
|
+
return Code::cast(unchecked_code());
|
3171
|
+
}
|
3172
|
+
|
3173
|
+
|
3174
|
+
Code* JSFunction::unchecked_code() {
|
3175
|
+
return reinterpret_cast<Code*>(
|
3176
|
+
Code::GetObjectFromEntryAddress(FIELD_ADDR(this, kCodeEntryOffset)));
|
3177
|
+
}
|
3178
|
+
|
3179
|
+
|
3180
|
+
void JSFunction::set_code(Code* value) {
|
3181
|
+
// Skip the write barrier because code is never in new space.
|
3182
|
+
ASSERT(!Heap::InNewSpace(value));
|
3183
|
+
Address entry = value->entry();
|
3184
|
+
WRITE_INTPTR_FIELD(this, kCodeEntryOffset, reinterpret_cast<intptr_t>(entry));
|
3185
|
+
}
|
3186
|
+
|
3187
|
+
|
3188
|
+
void JSFunction::ReplaceCode(Code* code) {
|
3189
|
+
bool was_optimized = IsOptimized();
|
3190
|
+
bool is_optimized = code->kind() == Code::OPTIMIZED_FUNCTION;
|
3191
|
+
|
3192
|
+
set_code(code);
|
3193
|
+
|
3194
|
+
// Add/remove the function from the list of optimized functions for this
|
3195
|
+
// context based on the state change.
|
3196
|
+
if (!was_optimized && is_optimized) {
|
3197
|
+
context()->global_context()->AddOptimizedFunction(this);
|
3198
|
+
}
|
3199
|
+
if (was_optimized && !is_optimized) {
|
3200
|
+
context()->global_context()->RemoveOptimizedFunction(this);
|
3201
|
+
}
|
3202
|
+
}
|
3203
|
+
|
3204
|
+
|
3205
|
+
Context* JSFunction::context() {
|
3206
|
+
return Context::cast(READ_FIELD(this, kContextOffset));
|
3207
|
+
}
|
3208
|
+
|
3209
|
+
|
3210
|
+
Object* JSFunction::unchecked_context() {
|
3211
|
+
return READ_FIELD(this, kContextOffset);
|
3212
|
+
}
|
3213
|
+
|
3214
|
+
|
3215
|
+
SharedFunctionInfo* JSFunction::unchecked_shared() {
|
3216
|
+
return reinterpret_cast<SharedFunctionInfo*>(
|
3217
|
+
READ_FIELD(this, kSharedFunctionInfoOffset));
|
3218
|
+
}
|
3219
|
+
|
3220
|
+
|
3221
|
+
void JSFunction::set_context(Object* value) {
|
3222
|
+
ASSERT(value == Heap::undefined_value() || value->IsContext());
|
3223
|
+
WRITE_FIELD(this, kContextOffset, value);
|
3224
|
+
WRITE_BARRIER(this, kContextOffset);
|
3225
|
+
}
|
3226
|
+
|
3227
|
+
ACCESSORS(JSFunction, prototype_or_initial_map, Object,
|
3228
|
+
kPrototypeOrInitialMapOffset)
|
3229
|
+
|
3230
|
+
|
3231
|
+
Map* JSFunction::initial_map() {
|
3232
|
+
return Map::cast(prototype_or_initial_map());
|
3233
|
+
}
|
3234
|
+
|
3235
|
+
|
3236
|
+
void JSFunction::set_initial_map(Map* value) {
|
3237
|
+
set_prototype_or_initial_map(value);
|
3238
|
+
}
|
3239
|
+
|
3240
|
+
|
3241
|
+
bool JSFunction::has_initial_map() {
|
3242
|
+
return prototype_or_initial_map()->IsMap();
|
3243
|
+
}
|
3244
|
+
|
3245
|
+
|
3246
|
+
bool JSFunction::has_instance_prototype() {
|
3247
|
+
return has_initial_map() || !prototype_or_initial_map()->IsTheHole();
|
3248
|
+
}
|
3249
|
+
|
3250
|
+
|
3251
|
+
bool JSFunction::has_prototype() {
|
3252
|
+
return map()->has_non_instance_prototype() || has_instance_prototype();
|
3253
|
+
}
|
3254
|
+
|
3255
|
+
|
3256
|
+
Object* JSFunction::instance_prototype() {
|
3257
|
+
ASSERT(has_instance_prototype());
|
3258
|
+
if (has_initial_map()) return initial_map()->prototype();
|
3259
|
+
// When there is no initial map and the prototype is a JSObject, the
|
3260
|
+
// initial map field is used for the prototype field.
|
3261
|
+
return prototype_or_initial_map();
|
3262
|
+
}
|
3263
|
+
|
3264
|
+
|
3265
|
+
Object* JSFunction::prototype() {
|
3266
|
+
ASSERT(has_prototype());
|
3267
|
+
// If the function's prototype property has been set to a non-JSObject
|
3268
|
+
// value, that value is stored in the constructor field of the map.
|
3269
|
+
if (map()->has_non_instance_prototype()) return map()->constructor();
|
3270
|
+
return instance_prototype();
|
3271
|
+
}
|
3272
|
+
|
3273
|
+
bool JSFunction::should_have_prototype() {
|
3274
|
+
return map()->function_with_prototype();
|
3275
|
+
}
|
3276
|
+
|
3277
|
+
|
3278
|
+
bool JSFunction::is_compiled() {
|
3279
|
+
return code() != Builtins::builtin(Builtins::LazyCompile);
|
3280
|
+
}
|
3281
|
+
|
3282
|
+
|
3283
|
+
int JSFunction::NumberOfLiterals() {
|
3284
|
+
return literals()->length();
|
3285
|
+
}
|
3286
|
+
|
3287
|
+
|
3288
|
+
Object* JSBuiltinsObject::javascript_builtin(Builtins::JavaScript id) {
|
3289
|
+
ASSERT(id < kJSBuiltinsCount); // id is unsigned.
|
3290
|
+
return READ_FIELD(this, OffsetOfFunctionWithId(id));
|
3291
|
+
}
|
3292
|
+
|
3293
|
+
|
3294
|
+
void JSBuiltinsObject::set_javascript_builtin(Builtins::JavaScript id,
|
3295
|
+
Object* value) {
|
3296
|
+
ASSERT(id < kJSBuiltinsCount); // id is unsigned.
|
3297
|
+
WRITE_FIELD(this, OffsetOfFunctionWithId(id), value);
|
3298
|
+
WRITE_BARRIER(this, OffsetOfFunctionWithId(id));
|
3299
|
+
}
|
3300
|
+
|
3301
|
+
|
3302
|
+
Code* JSBuiltinsObject::javascript_builtin_code(Builtins::JavaScript id) {
|
3303
|
+
ASSERT(id < kJSBuiltinsCount); // id is unsigned.
|
3304
|
+
return Code::cast(READ_FIELD(this, OffsetOfCodeWithId(id)));
|
3305
|
+
}
|
3306
|
+
|
3307
|
+
|
3308
|
+
void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id,
|
3309
|
+
Code* value) {
|
3310
|
+
ASSERT(id < kJSBuiltinsCount); // id is unsigned.
|
3311
|
+
WRITE_FIELD(this, OffsetOfCodeWithId(id), value);
|
3312
|
+
ASSERT(!Heap::InNewSpace(value));
|
3313
|
+
}
|
3314
|
+
|
3315
|
+
|
3316
|
+
Address Proxy::proxy() {
|
3317
|
+
return AddressFrom<Address>(READ_INTPTR_FIELD(this, kProxyOffset));
|
3318
|
+
}
|
3319
|
+
|
3320
|
+
|
3321
|
+
void Proxy::set_proxy(Address value) {
|
3322
|
+
WRITE_INTPTR_FIELD(this, kProxyOffset, OffsetFrom(value));
|
3323
|
+
}
|
3324
|
+
|
3325
|
+
|
3326
|
+
ACCESSORS(JSValue, value, Object, kValueOffset)
|
3327
|
+
|
3328
|
+
|
3329
|
+
JSValue* JSValue::cast(Object* obj) {
|
3330
|
+
ASSERT(obj->IsJSValue());
|
3331
|
+
ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize);
|
3332
|
+
return reinterpret_cast<JSValue*>(obj);
|
3333
|
+
}
|
3334
|
+
|
3335
|
+
|
3336
|
+
ACCESSORS(JSMessageObject, type, String, kTypeOffset)
|
3337
|
+
ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset)
|
3338
|
+
ACCESSORS(JSMessageObject, script, Object, kScriptOffset)
|
3339
|
+
ACCESSORS(JSMessageObject, stack_trace, Object, kStackTraceOffset)
|
3340
|
+
ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset)
|
3341
|
+
SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
|
3342
|
+
SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
|
3343
|
+
|
3344
|
+
|
3345
|
+
JSMessageObject* JSMessageObject::cast(Object* obj) {
|
3346
|
+
ASSERT(obj->IsJSMessageObject());
|
3347
|
+
ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize);
|
3348
|
+
return reinterpret_cast<JSMessageObject*>(obj);
|
3349
|
+
}
|
3350
|
+
|
3351
|
+
|
3352
|
+
INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
|
3353
|
+
ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
|
3354
|
+
ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
|
3355
|
+
|
3356
|
+
|
3357
|
+
byte* Code::instruction_start() {
|
3358
|
+
return FIELD_ADDR(this, kHeaderSize);
|
3359
|
+
}
|
3360
|
+
|
3361
|
+
|
3362
|
+
byte* Code::instruction_end() {
|
3363
|
+
return instruction_start() + instruction_size();
|
3364
|
+
}
|
3365
|
+
|
3366
|
+
|
3367
|
+
int Code::body_size() {
|
3368
|
+
return RoundUp(instruction_size(), kObjectAlignment);
|
3369
|
+
}
|
3370
|
+
|
3371
|
+
|
3372
|
+
FixedArray* Code::unchecked_deoptimization_data() {
|
3373
|
+
return reinterpret_cast<FixedArray*>(
|
3374
|
+
READ_FIELD(this, kDeoptimizationDataOffset));
|
3375
|
+
}
|
3376
|
+
|
3377
|
+
|
3378
|
+
ByteArray* Code::unchecked_relocation_info() {
|
3379
|
+
return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset));
|
3380
|
+
}
|
3381
|
+
|
3382
|
+
|
3383
|
+
byte* Code::relocation_start() {
|
3384
|
+
return unchecked_relocation_info()->GetDataStartAddress();
|
3385
|
+
}
|
3386
|
+
|
3387
|
+
|
3388
|
+
int Code::relocation_size() {
|
3389
|
+
return unchecked_relocation_info()->length();
|
3390
|
+
}
|
3391
|
+
|
3392
|
+
|
3393
|
+
byte* Code::entry() {
|
3394
|
+
return instruction_start();
|
3395
|
+
}
|
3396
|
+
|
3397
|
+
|
3398
|
+
bool Code::contains(byte* pc) {
|
3399
|
+
return (instruction_start() <= pc) &&
|
3400
|
+
(pc <= instruction_start() + instruction_size());
|
3401
|
+
}
|
3402
|
+
|
3403
|
+
|
3404
|
+
ACCESSORS(JSArray, length, Object, kLengthOffset)
|
3405
|
+
|
3406
|
+
|
3407
|
+
ACCESSORS(JSRegExp, data, Object, kDataOffset)
|
3408
|
+
|
3409
|
+
|
3410
|
+
JSRegExp::Type JSRegExp::TypeTag() {
|
3411
|
+
Object* data = this->data();
|
3412
|
+
if (data->IsUndefined()) return JSRegExp::NOT_COMPILED;
|
3413
|
+
Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex));
|
3414
|
+
return static_cast<JSRegExp::Type>(smi->value());
|
3415
|
+
}
|
3416
|
+
|
3417
|
+
|
3418
|
+
int JSRegExp::CaptureCount() {
|
3419
|
+
switch (TypeTag()) {
|
3420
|
+
case ATOM:
|
3421
|
+
return 0;
|
3422
|
+
case IRREGEXP:
|
3423
|
+
return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value();
|
3424
|
+
default:
|
3425
|
+
UNREACHABLE();
|
3426
|
+
return -1;
|
3427
|
+
}
|
3428
|
+
}
|
3429
|
+
|
3430
|
+
|
3431
|
+
JSRegExp::Flags JSRegExp::GetFlags() {
|
3432
|
+
ASSERT(this->data()->IsFixedArray());
|
3433
|
+
Object* data = this->data();
|
3434
|
+
Smi* smi = Smi::cast(FixedArray::cast(data)->get(kFlagsIndex));
|
3435
|
+
return Flags(smi->value());
|
3436
|
+
}
|
3437
|
+
|
3438
|
+
|
3439
|
+
String* JSRegExp::Pattern() {
|
3440
|
+
ASSERT(this->data()->IsFixedArray());
|
3441
|
+
Object* data = this->data();
|
3442
|
+
String* pattern= String::cast(FixedArray::cast(data)->get(kSourceIndex));
|
3443
|
+
return pattern;
|
3444
|
+
}
|
3445
|
+
|
3446
|
+
|
3447
|
+
Object* JSRegExp::DataAt(int index) {
|
3448
|
+
ASSERT(TypeTag() != NOT_COMPILED);
|
3449
|
+
return FixedArray::cast(data())->get(index);
|
3450
|
+
}
|
3451
|
+
|
3452
|
+
|
3453
|
+
void JSRegExp::SetDataAt(int index, Object* value) {
|
3454
|
+
ASSERT(TypeTag() != NOT_COMPILED);
|
3455
|
+
ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
|
3456
|
+
FixedArray::cast(data())->set(index, value);
|
3457
|
+
}
|
3458
|
+
|
3459
|
+
|
3460
|
+
JSObject::ElementsKind JSObject::GetElementsKind() {
|
3461
|
+
if (map()->has_fast_elements()) {
|
3462
|
+
ASSERT(elements()->map() == Heap::fixed_array_map() ||
|
3463
|
+
elements()->map() == Heap::fixed_cow_array_map());
|
3464
|
+
return FAST_ELEMENTS;
|
3465
|
+
}
|
3466
|
+
HeapObject* array = elements();
|
3467
|
+
if (array->IsFixedArray()) {
|
3468
|
+
// FAST_ELEMENTS or DICTIONARY_ELEMENTS are both stored in a
|
3469
|
+
// FixedArray, but FAST_ELEMENTS is already handled above.
|
3470
|
+
ASSERT(array->IsDictionary());
|
3471
|
+
return DICTIONARY_ELEMENTS;
|
3472
|
+
}
|
3473
|
+
if (array->IsExternalArray()) {
|
3474
|
+
switch (array->map()->instance_type()) {
|
3475
|
+
case EXTERNAL_BYTE_ARRAY_TYPE:
|
3476
|
+
return EXTERNAL_BYTE_ELEMENTS;
|
3477
|
+
case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE:
|
3478
|
+
return EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
|
3479
|
+
case EXTERNAL_SHORT_ARRAY_TYPE:
|
3480
|
+
return EXTERNAL_SHORT_ELEMENTS;
|
3481
|
+
case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE:
|
3482
|
+
return EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
|
3483
|
+
case EXTERNAL_INT_ARRAY_TYPE:
|
3484
|
+
return EXTERNAL_INT_ELEMENTS;
|
3485
|
+
case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE:
|
3486
|
+
return EXTERNAL_UNSIGNED_INT_ELEMENTS;
|
3487
|
+
default:
|
3488
|
+
ASSERT(array->map()->instance_type() == EXTERNAL_FLOAT_ARRAY_TYPE);
|
3489
|
+
return EXTERNAL_FLOAT_ELEMENTS;
|
3490
|
+
}
|
3491
|
+
}
|
3492
|
+
ASSERT(array->IsPixelArray());
|
3493
|
+
return PIXEL_ELEMENTS;
|
3494
|
+
}
|
3495
|
+
|
3496
|
+
|
3497
|
+
bool JSObject::HasFastElements() {
|
3498
|
+
return GetElementsKind() == FAST_ELEMENTS;
|
3499
|
+
}
|
3500
|
+
|
3501
|
+
|
3502
|
+
bool JSObject::HasDictionaryElements() {
|
3503
|
+
return GetElementsKind() == DICTIONARY_ELEMENTS;
|
3504
|
+
}
|
3505
|
+
|
3506
|
+
|
3507
|
+
bool JSObject::HasPixelElements() {
|
3508
|
+
return GetElementsKind() == PIXEL_ELEMENTS;
|
3509
|
+
}
|
3510
|
+
|
3511
|
+
|
3512
|
+
bool JSObject::HasExternalArrayElements() {
|
3513
|
+
return (HasExternalByteElements() ||
|
3514
|
+
HasExternalUnsignedByteElements() ||
|
3515
|
+
HasExternalShortElements() ||
|
3516
|
+
HasExternalUnsignedShortElements() ||
|
3517
|
+
HasExternalIntElements() ||
|
3518
|
+
HasExternalUnsignedIntElements() ||
|
3519
|
+
HasExternalFloatElements());
|
3520
|
+
}
|
3521
|
+
|
3522
|
+
|
3523
|
+
bool JSObject::HasExternalByteElements() {
|
3524
|
+
return GetElementsKind() == EXTERNAL_BYTE_ELEMENTS;
|
3525
|
+
}
|
3526
|
+
|
3527
|
+
|
3528
|
+
bool JSObject::HasExternalUnsignedByteElements() {
|
3529
|
+
return GetElementsKind() == EXTERNAL_UNSIGNED_BYTE_ELEMENTS;
|
3530
|
+
}
|
3531
|
+
|
3532
|
+
|
3533
|
+
bool JSObject::HasExternalShortElements() {
|
3534
|
+
return GetElementsKind() == EXTERNAL_SHORT_ELEMENTS;
|
3535
|
+
}
|
3536
|
+
|
3537
|
+
|
3538
|
+
bool JSObject::HasExternalUnsignedShortElements() {
|
3539
|
+
return GetElementsKind() == EXTERNAL_UNSIGNED_SHORT_ELEMENTS;
|
3540
|
+
}
|
3541
|
+
|
3542
|
+
|
3543
|
+
bool JSObject::HasExternalIntElements() {
|
3544
|
+
return GetElementsKind() == EXTERNAL_INT_ELEMENTS;
|
3545
|
+
}
|
3546
|
+
|
3547
|
+
|
3548
|
+
bool JSObject::HasExternalUnsignedIntElements() {
|
3549
|
+
return GetElementsKind() == EXTERNAL_UNSIGNED_INT_ELEMENTS;
|
3550
|
+
}
|
3551
|
+
|
3552
|
+
|
3553
|
+
bool JSObject::HasExternalFloatElements() {
|
3554
|
+
return GetElementsKind() == EXTERNAL_FLOAT_ELEMENTS;
|
3555
|
+
}
|
3556
|
+
|
3557
|
+
|
3558
|
+
bool JSObject::HasNamedInterceptor() {
|
3559
|
+
return map()->has_named_interceptor();
|
3560
|
+
}
|
3561
|
+
|
3562
|
+
|
3563
|
+
bool JSObject::HasIndexedInterceptor() {
|
3564
|
+
return map()->has_indexed_interceptor();
|
3565
|
+
}
|
3566
|
+
|
3567
|
+
|
3568
|
+
bool JSObject::AllowsSetElementsLength() {
|
3569
|
+
bool result = elements()->IsFixedArray();
|
3570
|
+
ASSERT(result == (!HasPixelElements() && !HasExternalArrayElements()));
|
3571
|
+
return result;
|
3572
|
+
}
|
3573
|
+
|
3574
|
+
|
3575
|
+
MaybeObject* JSObject::EnsureWritableFastElements() {
|
3576
|
+
ASSERT(HasFastElements());
|
3577
|
+
FixedArray* elems = FixedArray::cast(elements());
|
3578
|
+
if (elems->map() != Heap::fixed_cow_array_map()) return elems;
|
3579
|
+
Object* writable_elems;
|
3580
|
+
{ MaybeObject* maybe_writable_elems =
|
3581
|
+
Heap::CopyFixedArrayWithMap(elems, Heap::fixed_array_map());
|
3582
|
+
if (!maybe_writable_elems->ToObject(&writable_elems)) {
|
3583
|
+
return maybe_writable_elems;
|
3584
|
+
}
|
3585
|
+
}
|
3586
|
+
set_elements(FixedArray::cast(writable_elems));
|
3587
|
+
Counters::cow_arrays_converted.Increment();
|
3588
|
+
return writable_elems;
|
3589
|
+
}
|
3590
|
+
|
3591
|
+
|
3592
|
+
StringDictionary* JSObject::property_dictionary() {
|
3593
|
+
ASSERT(!HasFastProperties());
|
3594
|
+
return StringDictionary::cast(properties());
|
3595
|
+
}
|
3596
|
+
|
3597
|
+
|
3598
|
+
NumberDictionary* JSObject::element_dictionary() {
|
3599
|
+
ASSERT(HasDictionaryElements());
|
3600
|
+
return NumberDictionary::cast(elements());
|
3601
|
+
}
|
3602
|
+
|
3603
|
+
|
3604
|
+
bool String::IsHashFieldComputed(uint32_t field) {
|
3605
|
+
return (field & kHashNotComputedMask) == 0;
|
3606
|
+
}
|
3607
|
+
|
3608
|
+
|
3609
|
+
bool String::HasHashCode() {
|
3610
|
+
return IsHashFieldComputed(hash_field());
|
3611
|
+
}
|
3612
|
+
|
3613
|
+
|
3614
|
+
uint32_t String::Hash() {
|
3615
|
+
// Fast case: has hash code already been computed?
|
3616
|
+
uint32_t field = hash_field();
|
3617
|
+
if (IsHashFieldComputed(field)) return field >> kHashShift;
|
3618
|
+
// Slow case: compute hash code and set it.
|
3619
|
+
return ComputeAndSetHash();
|
3620
|
+
}
|
3621
|
+
|
3622
|
+
|
3623
|
+
StringHasher::StringHasher(int length)
|
3624
|
+
: length_(length),
|
3625
|
+
raw_running_hash_(0),
|
3626
|
+
array_index_(0),
|
3627
|
+
is_array_index_(0 < length_ && length_ <= String::kMaxArrayIndexSize),
|
3628
|
+
is_first_char_(true),
|
3629
|
+
is_valid_(true) { }
|
3630
|
+
|
3631
|
+
|
3632
|
+
bool StringHasher::has_trivial_hash() {
|
3633
|
+
return length_ > String::kMaxHashCalcLength;
|
3634
|
+
}
|
3635
|
+
|
3636
|
+
|
3637
|
+
void StringHasher::AddCharacter(uc32 c) {
|
3638
|
+
// Use the Jenkins one-at-a-time hash function to update the hash
|
3639
|
+
// for the given character.
|
3640
|
+
raw_running_hash_ += c;
|
3641
|
+
raw_running_hash_ += (raw_running_hash_ << 10);
|
3642
|
+
raw_running_hash_ ^= (raw_running_hash_ >> 6);
|
3643
|
+
// Incremental array index computation.
|
3644
|
+
if (is_array_index_) {
|
3645
|
+
if (c < '0' || c > '9') {
|
3646
|
+
is_array_index_ = false;
|
3647
|
+
} else {
|
3648
|
+
int d = c - '0';
|
3649
|
+
if (is_first_char_) {
|
3650
|
+
is_first_char_ = false;
|
3651
|
+
if (c == '0' && length_ > 1) {
|
3652
|
+
is_array_index_ = false;
|
3653
|
+
return;
|
3654
|
+
}
|
3655
|
+
}
|
3656
|
+
if (array_index_ > 429496729U - ((d + 2) >> 3)) {
|
3657
|
+
is_array_index_ = false;
|
3658
|
+
} else {
|
3659
|
+
array_index_ = array_index_ * 10 + d;
|
3660
|
+
}
|
3661
|
+
}
|
3662
|
+
}
|
3663
|
+
}
|
3664
|
+
|
3665
|
+
|
3666
|
+
void StringHasher::AddCharacterNoIndex(uc32 c) {
|
3667
|
+
ASSERT(!is_array_index());
|
3668
|
+
raw_running_hash_ += c;
|
3669
|
+
raw_running_hash_ += (raw_running_hash_ << 10);
|
3670
|
+
raw_running_hash_ ^= (raw_running_hash_ >> 6);
|
3671
|
+
}
|
3672
|
+
|
3673
|
+
|
3674
|
+
uint32_t StringHasher::GetHash() {
|
3675
|
+
// Get the calculated raw hash value and do some more bit ops to distribute
|
3676
|
+
// the hash further. Ensure that we never return zero as the hash value.
|
3677
|
+
uint32_t result = raw_running_hash_;
|
3678
|
+
result += (result << 3);
|
3679
|
+
result ^= (result >> 11);
|
3680
|
+
result += (result << 15);
|
3681
|
+
if (result == 0) {
|
3682
|
+
result = 27;
|
3683
|
+
}
|
3684
|
+
return result;
|
3685
|
+
}
|
3686
|
+
|
3687
|
+
|
3688
|
+
bool String::AsArrayIndex(uint32_t* index) {
|
3689
|
+
uint32_t field = hash_field();
|
3690
|
+
if (IsHashFieldComputed(field) && (field & kIsNotArrayIndexMask)) {
|
3691
|
+
return false;
|
3692
|
+
}
|
3693
|
+
return SlowAsArrayIndex(index);
|
3694
|
+
}
|
3695
|
+
|
3696
|
+
|
3697
|
+
Object* JSObject::GetPrototype() {
|
3698
|
+
return JSObject::cast(this)->map()->prototype();
|
3699
|
+
}
|
3700
|
+
|
3701
|
+
|
3702
|
+
PropertyAttributes JSObject::GetPropertyAttribute(String* key) {
|
3703
|
+
return GetPropertyAttributeWithReceiver(this, key);
|
3704
|
+
}
|
3705
|
+
|
3706
|
+
// TODO(504): this may be useful in other places too where JSGlobalProxy
|
3707
|
+
// is used.
|
3708
|
+
Object* JSObject::BypassGlobalProxy() {
|
3709
|
+
if (IsJSGlobalProxy()) {
|
3710
|
+
Object* proto = GetPrototype();
|
3711
|
+
if (proto->IsNull()) return Heap::undefined_value();
|
3712
|
+
ASSERT(proto->IsJSGlobalObject());
|
3713
|
+
return proto;
|
3714
|
+
}
|
3715
|
+
return this;
|
3716
|
+
}
|
3717
|
+
|
3718
|
+
|
3719
|
+
bool JSObject::HasHiddenPropertiesObject() {
|
3720
|
+
ASSERT(!IsJSGlobalProxy());
|
3721
|
+
return GetPropertyAttributePostInterceptor(this,
|
3722
|
+
Heap::hidden_symbol(),
|
3723
|
+
false) != ABSENT;
|
3724
|
+
}
|
3725
|
+
|
3726
|
+
|
3727
|
+
Object* JSObject::GetHiddenPropertiesObject() {
|
3728
|
+
ASSERT(!IsJSGlobalProxy());
|
3729
|
+
PropertyAttributes attributes;
|
3730
|
+
// You can't install a getter on a property indexed by the hidden symbol,
|
3731
|
+
// so we can be sure that GetLocalPropertyPostInterceptor returns a real
|
3732
|
+
// object.
|
3733
|
+
Object* result =
|
3734
|
+
GetLocalPropertyPostInterceptor(this,
|
3735
|
+
Heap::hidden_symbol(),
|
3736
|
+
&attributes)->ToObjectUnchecked();
|
3737
|
+
return result;
|
3738
|
+
}
|
3739
|
+
|
3740
|
+
|
3741
|
+
MaybeObject* JSObject::SetHiddenPropertiesObject(Object* hidden_obj) {
|
3742
|
+
ASSERT(!IsJSGlobalProxy());
|
3743
|
+
return SetPropertyPostInterceptor(Heap::hidden_symbol(),
|
3744
|
+
hidden_obj,
|
3745
|
+
DONT_ENUM,
|
3746
|
+
kNonStrictMode);
|
3747
|
+
}
|
3748
|
+
|
3749
|
+
|
3750
|
+
bool JSObject::HasElement(uint32_t index) {
|
3751
|
+
return HasElementWithReceiver(this, index);
|
3752
|
+
}
|
3753
|
+
|
3754
|
+
|
3755
|
+
bool AccessorInfo::all_can_read() {
|
3756
|
+
return BooleanBit::get(flag(), kAllCanReadBit);
|
3757
|
+
}
|
3758
|
+
|
3759
|
+
|
3760
|
+
void AccessorInfo::set_all_can_read(bool value) {
|
3761
|
+
set_flag(BooleanBit::set(flag(), kAllCanReadBit, value));
|
3762
|
+
}
|
3763
|
+
|
3764
|
+
|
3765
|
+
bool AccessorInfo::all_can_write() {
|
3766
|
+
return BooleanBit::get(flag(), kAllCanWriteBit);
|
3767
|
+
}
|
3768
|
+
|
3769
|
+
|
3770
|
+
void AccessorInfo::set_all_can_write(bool value) {
|
3771
|
+
set_flag(BooleanBit::set(flag(), kAllCanWriteBit, value));
|
3772
|
+
}
|
3773
|
+
|
3774
|
+
|
3775
|
+
bool AccessorInfo::prohibits_overwriting() {
|
3776
|
+
return BooleanBit::get(flag(), kProhibitsOverwritingBit);
|
3777
|
+
}
|
3778
|
+
|
3779
|
+
|
3780
|
+
void AccessorInfo::set_prohibits_overwriting(bool value) {
|
3781
|
+
set_flag(BooleanBit::set(flag(), kProhibitsOverwritingBit, value));
|
3782
|
+
}
|
3783
|
+
|
3784
|
+
|
3785
|
+
PropertyAttributes AccessorInfo::property_attributes() {
|
3786
|
+
return AttributesField::decode(static_cast<uint32_t>(flag()->value()));
|
3787
|
+
}
|
3788
|
+
|
3789
|
+
|
3790
|
+
void AccessorInfo::set_property_attributes(PropertyAttributes attributes) {
|
3791
|
+
ASSERT(AttributesField::is_valid(attributes));
|
3792
|
+
int rest_value = flag()->value() & ~AttributesField::mask();
|
3793
|
+
set_flag(Smi::FromInt(rest_value | AttributesField::encode(attributes)));
|
3794
|
+
}
|
3795
|
+
|
3796
|
+
template<typename Shape, typename Key>
|
3797
|
+
void Dictionary<Shape, Key>::SetEntry(int entry,
|
3798
|
+
Object* key,
|
3799
|
+
Object* value,
|
3800
|
+
PropertyDetails details) {
|
3801
|
+
ASSERT(!key->IsString() || details.IsDeleted() || details.index() > 0);
|
3802
|
+
int index = HashTable<Shape, Key>::EntryToIndex(entry);
|
3803
|
+
AssertNoAllocation no_gc;
|
3804
|
+
WriteBarrierMode mode = FixedArray::GetWriteBarrierMode(no_gc);
|
3805
|
+
FixedArray::set(index, key, mode);
|
3806
|
+
FixedArray::set(index+1, value, mode);
|
3807
|
+
FixedArray::fast_set(this, index+2, details.AsSmi());
|
3808
|
+
}
|
3809
|
+
|
3810
|
+
|
3811
|
+
void Map::ClearCodeCache() {
|
3812
|
+
// No write barrier is needed since empty_fixed_array is not in new space.
|
3813
|
+
// Please note this function is used during marking:
|
3814
|
+
// - MarkCompactCollector::MarkUnmarkedObject
|
3815
|
+
ASSERT(!Heap::InNewSpace(Heap::raw_unchecked_empty_fixed_array()));
|
3816
|
+
WRITE_FIELD(this, kCodeCacheOffset, Heap::raw_unchecked_empty_fixed_array());
|
3817
|
+
}
|
3818
|
+
|
3819
|
+
|
3820
|
+
void JSArray::EnsureSize(int required_size) {
|
3821
|
+
ASSERT(HasFastElements());
|
3822
|
+
FixedArray* elts = FixedArray::cast(elements());
|
3823
|
+
const int kArraySizeThatFitsComfortablyInNewSpace = 128;
|
3824
|
+
if (elts->length() < required_size) {
|
3825
|
+
// Doubling in size would be overkill, but leave some slack to avoid
|
3826
|
+
// constantly growing.
|
3827
|
+
Expand(required_size + (required_size >> 3));
|
3828
|
+
// It's a performance benefit to keep a frequently used array in new-space.
|
3829
|
+
} else if (!Heap::new_space()->Contains(elts) &&
|
3830
|
+
required_size < kArraySizeThatFitsComfortablyInNewSpace) {
|
3831
|
+
// Expand will allocate a new backing store in new space even if the size
|
3832
|
+
// we asked for isn't larger than what we had before.
|
3833
|
+
Expand(required_size);
|
3834
|
+
}
|
3835
|
+
}
|
3836
|
+
|
3837
|
+
|
3838
|
+
void JSArray::set_length(Smi* length) {
|
3839
|
+
set_length(static_cast<Object*>(length), SKIP_WRITE_BARRIER);
|
3840
|
+
}
|
3841
|
+
|
3842
|
+
|
3843
|
+
void JSArray::SetContent(FixedArray* storage) {
|
3844
|
+
set_length(Smi::FromInt(storage->length()));
|
3845
|
+
set_elements(storage);
|
3846
|
+
}
|
3847
|
+
|
3848
|
+
|
3849
|
+
MaybeObject* FixedArray::Copy() {
|
3850
|
+
if (length() == 0) return this;
|
3851
|
+
return Heap::CopyFixedArray(this);
|
3852
|
+
}
|
3853
|
+
|
3854
|
+
|
3855
|
+
int JSObject::BodyDescriptor::SizeOf(Map* map, HeapObject* object) {
|
3856
|
+
return map->instance_size();
|
3857
|
+
}
|
3858
|
+
|
3859
|
+
|
3860
|
+
void Proxy::ProxyIterateBody(ObjectVisitor* v) {
|
3861
|
+
v->VisitExternalReference(
|
3862
|
+
reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset)));
|
3863
|
+
}
|
3864
|
+
|
3865
|
+
|
3866
|
+
template<typename StaticVisitor>
|
3867
|
+
void Proxy::ProxyIterateBody() {
|
3868
|
+
StaticVisitor::VisitExternalReference(
|
3869
|
+
reinterpret_cast<Address *>(FIELD_ADDR(this, kProxyOffset)));
|
3870
|
+
}
|
3871
|
+
|
3872
|
+
|
3873
|
+
void ExternalAsciiString::ExternalAsciiStringIterateBody(ObjectVisitor* v) {
|
3874
|
+
typedef v8::String::ExternalAsciiStringResource Resource;
|
3875
|
+
v->VisitExternalAsciiString(
|
3876
|
+
reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
|
3877
|
+
}
|
3878
|
+
|
3879
|
+
|
3880
|
+
template<typename StaticVisitor>
|
3881
|
+
void ExternalAsciiString::ExternalAsciiStringIterateBody() {
|
3882
|
+
typedef v8::String::ExternalAsciiStringResource Resource;
|
3883
|
+
StaticVisitor::VisitExternalAsciiString(
|
3884
|
+
reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
|
3885
|
+
}
|
3886
|
+
|
3887
|
+
|
3888
|
+
void ExternalTwoByteString::ExternalTwoByteStringIterateBody(ObjectVisitor* v) {
|
3889
|
+
typedef v8::String::ExternalStringResource Resource;
|
3890
|
+
v->VisitExternalTwoByteString(
|
3891
|
+
reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
|
3892
|
+
}
|
3893
|
+
|
3894
|
+
|
3895
|
+
template<typename StaticVisitor>
|
3896
|
+
void ExternalTwoByteString::ExternalTwoByteStringIterateBody() {
|
3897
|
+
typedef v8::String::ExternalStringResource Resource;
|
3898
|
+
StaticVisitor::VisitExternalTwoByteString(
|
3899
|
+
reinterpret_cast<Resource**>(FIELD_ADDR(this, kResourceOffset)));
|
3900
|
+
}
|
3901
|
+
|
3902
|
+
#define SLOT_ADDR(obj, offset) \
|
3903
|
+
reinterpret_cast<Object**>((obj)->address() + offset)
|
3904
|
+
|
3905
|
+
template<int start_offset, int end_offset, int size>
|
3906
|
+
void FixedBodyDescriptor<start_offset, end_offset, size>::IterateBody(
|
3907
|
+
HeapObject* obj,
|
3908
|
+
ObjectVisitor* v) {
|
3909
|
+
v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, end_offset));
|
3910
|
+
}
|
3911
|
+
|
3912
|
+
|
3913
|
+
template<int start_offset>
|
3914
|
+
void FlexibleBodyDescriptor<start_offset>::IterateBody(HeapObject* obj,
|
3915
|
+
int object_size,
|
3916
|
+
ObjectVisitor* v) {
|
3917
|
+
v->VisitPointers(SLOT_ADDR(obj, start_offset), SLOT_ADDR(obj, object_size));
|
3918
|
+
}
|
3919
|
+
|
3920
|
+
#undef SLOT_ADDR
|
3921
|
+
|
3922
|
+
|
3923
|
+
#undef CAST_ACCESSOR
|
3924
|
+
#undef INT_ACCESSORS
|
3925
|
+
#undef SMI_ACCESSORS
|
3926
|
+
#undef ACCESSORS
|
3927
|
+
#undef FIELD_ADDR
|
3928
|
+
#undef READ_FIELD
|
3929
|
+
#undef WRITE_FIELD
|
3930
|
+
#undef WRITE_BARRIER
|
3931
|
+
#undef CONDITIONAL_WRITE_BARRIER
|
3932
|
+
#undef READ_MEMADDR_FIELD
|
3933
|
+
#undef WRITE_MEMADDR_FIELD
|
3934
|
+
#undef READ_DOUBLE_FIELD
|
3935
|
+
#undef WRITE_DOUBLE_FIELD
|
3936
|
+
#undef READ_INT_FIELD
|
3937
|
+
#undef WRITE_INT_FIELD
|
3938
|
+
#undef READ_SHORT_FIELD
|
3939
|
+
#undef WRITE_SHORT_FIELD
|
3940
|
+
#undef READ_BYTE_FIELD
|
3941
|
+
#undef WRITE_BYTE_FIELD
|
3942
|
+
|
3943
|
+
|
3944
|
+
} } // namespace v8::internal
|
3945
|
+
|
3946
|
+
#endif // V8_OBJECTS_INL_H_
|