libv8-sgonyea 3.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.gitmodules +3 -0
- data/Gemfile +4 -0
- data/README.md +76 -0
- data/Rakefile +113 -0
- data/ext/libv8/extconf.rb +28 -0
- data/lib/libv8.rb +15 -0
- data/lib/libv8/Makefile +30 -0
- data/lib/libv8/detect_cpu.rb +27 -0
- data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
- data/lib/libv8/v8/.gitignore +35 -0
- data/lib/libv8/v8/AUTHORS +44 -0
- data/lib/libv8/v8/ChangeLog +2839 -0
- data/lib/libv8/v8/LICENSE +52 -0
- data/lib/libv8/v8/LICENSE.strongtalk +29 -0
- data/lib/libv8/v8/LICENSE.v8 +26 -0
- data/lib/libv8/v8/LICENSE.valgrind +45 -0
- data/lib/libv8/v8/SConstruct +1478 -0
- data/lib/libv8/v8/build/README.txt +49 -0
- data/lib/libv8/v8/build/all.gyp +18 -0
- data/lib/libv8/v8/build/armu.gypi +32 -0
- data/lib/libv8/v8/build/common.gypi +144 -0
- data/lib/libv8/v8/build/gyp_v8 +145 -0
- data/lib/libv8/v8/include/v8-debug.h +395 -0
- data/lib/libv8/v8/include/v8-preparser.h +117 -0
- data/lib/libv8/v8/include/v8-profiler.h +505 -0
- data/lib/libv8/v8/include/v8-testing.h +104 -0
- data/lib/libv8/v8/include/v8.h +4124 -0
- data/lib/libv8/v8/include/v8stdint.h +53 -0
- data/lib/libv8/v8/preparser/SConscript +38 -0
- data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
- data/lib/libv8/v8/src/SConscript +368 -0
- data/lib/libv8/v8/src/accessors.cc +767 -0
- data/lib/libv8/v8/src/accessors.h +123 -0
- data/lib/libv8/v8/src/allocation-inl.h +49 -0
- data/lib/libv8/v8/src/allocation.cc +122 -0
- data/lib/libv8/v8/src/allocation.h +143 -0
- data/lib/libv8/v8/src/api.cc +5845 -0
- data/lib/libv8/v8/src/api.h +574 -0
- data/lib/libv8/v8/src/apinatives.js +110 -0
- data/lib/libv8/v8/src/apiutils.h +73 -0
- data/lib/libv8/v8/src/arguments.h +118 -0
- data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
- data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
- data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
- data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
- data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
- data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
- data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
- data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
- data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
- data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
- data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
- data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
- data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
- data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
- data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
- data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
- data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
- data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
- data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
- data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
- data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
- data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
- data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
- data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
- data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
- data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
- data/lib/libv8/v8/src/array.js +1366 -0
- data/lib/libv8/v8/src/assembler.cc +1207 -0
- data/lib/libv8/v8/src/assembler.h +858 -0
- data/lib/libv8/v8/src/ast-inl.h +112 -0
- data/lib/libv8/v8/src/ast.cc +1146 -0
- data/lib/libv8/v8/src/ast.h +2188 -0
- data/lib/libv8/v8/src/atomicops.h +167 -0
- data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
- data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
- data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
- data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
- data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
- data/lib/libv8/v8/src/bignum.cc +768 -0
- data/lib/libv8/v8/src/bignum.h +140 -0
- data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
- data/lib/libv8/v8/src/bootstrapper.h +188 -0
- data/lib/libv8/v8/src/builtins.cc +1707 -0
- data/lib/libv8/v8/src/builtins.h +371 -0
- data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
- data/lib/libv8/v8/src/cached-powers.cc +177 -0
- data/lib/libv8/v8/src/cached-powers.h +65 -0
- data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
- data/lib/libv8/v8/src/char-predicates.h +67 -0
- data/lib/libv8/v8/src/checks.cc +110 -0
- data/lib/libv8/v8/src/checks.h +296 -0
- data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
- data/lib/libv8/v8/src/circular-queue.cc +122 -0
- data/lib/libv8/v8/src/circular-queue.h +103 -0
- data/lib/libv8/v8/src/code-stubs.cc +267 -0
- data/lib/libv8/v8/src/code-stubs.h +1011 -0
- data/lib/libv8/v8/src/code.h +70 -0
- data/lib/libv8/v8/src/codegen.cc +231 -0
- data/lib/libv8/v8/src/codegen.h +84 -0
- data/lib/libv8/v8/src/compilation-cache.cc +540 -0
- data/lib/libv8/v8/src/compilation-cache.h +287 -0
- data/lib/libv8/v8/src/compiler.cc +786 -0
- data/lib/libv8/v8/src/compiler.h +312 -0
- data/lib/libv8/v8/src/contexts.cc +347 -0
- data/lib/libv8/v8/src/contexts.h +391 -0
- data/lib/libv8/v8/src/conversions-inl.h +106 -0
- data/lib/libv8/v8/src/conversions.cc +1131 -0
- data/lib/libv8/v8/src/conversions.h +135 -0
- data/lib/libv8/v8/src/counters.cc +93 -0
- data/lib/libv8/v8/src/counters.h +254 -0
- data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
- data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
- data/lib/libv8/v8/src/cpu-profiler.h +302 -0
- data/lib/libv8/v8/src/cpu.h +69 -0
- data/lib/libv8/v8/src/d8-debug.cc +367 -0
- data/lib/libv8/v8/src/d8-debug.h +158 -0
- data/lib/libv8/v8/src/d8-posix.cc +695 -0
- data/lib/libv8/v8/src/d8-readline.cc +130 -0
- data/lib/libv8/v8/src/d8-windows.cc +42 -0
- data/lib/libv8/v8/src/d8.cc +803 -0
- data/lib/libv8/v8/src/d8.gyp +91 -0
- data/lib/libv8/v8/src/d8.h +235 -0
- data/lib/libv8/v8/src/d8.js +2798 -0
- data/lib/libv8/v8/src/data-flow.cc +66 -0
- data/lib/libv8/v8/src/data-flow.h +205 -0
- data/lib/libv8/v8/src/date.js +1103 -0
- data/lib/libv8/v8/src/dateparser-inl.h +127 -0
- data/lib/libv8/v8/src/dateparser.cc +178 -0
- data/lib/libv8/v8/src/dateparser.h +266 -0
- data/lib/libv8/v8/src/debug-agent.cc +447 -0
- data/lib/libv8/v8/src/debug-agent.h +129 -0
- data/lib/libv8/v8/src/debug-debugger.js +2569 -0
- data/lib/libv8/v8/src/debug.cc +3165 -0
- data/lib/libv8/v8/src/debug.h +1057 -0
- data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
- data/lib/libv8/v8/src/deoptimizer.h +602 -0
- data/lib/libv8/v8/src/disasm.h +80 -0
- data/lib/libv8/v8/src/disassembler.cc +343 -0
- data/lib/libv8/v8/src/disassembler.h +58 -0
- data/lib/libv8/v8/src/diy-fp.cc +58 -0
- data/lib/libv8/v8/src/diy-fp.h +117 -0
- data/lib/libv8/v8/src/double.h +238 -0
- data/lib/libv8/v8/src/dtoa.cc +103 -0
- data/lib/libv8/v8/src/dtoa.h +85 -0
- data/lib/libv8/v8/src/execution.cc +849 -0
- data/lib/libv8/v8/src/execution.h +297 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
- data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
- data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
- data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
- data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
- data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
- data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
- data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
- data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
- data/lib/libv8/v8/src/factory.cc +1222 -0
- data/lib/libv8/v8/src/factory.h +442 -0
- data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
- data/lib/libv8/v8/src/fast-dtoa.h +83 -0
- data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
- data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
- data/lib/libv8/v8/src/flag-definitions.h +560 -0
- data/lib/libv8/v8/src/flags.cc +551 -0
- data/lib/libv8/v8/src/flags.h +79 -0
- data/lib/libv8/v8/src/frames-inl.h +247 -0
- data/lib/libv8/v8/src/frames.cc +1243 -0
- data/lib/libv8/v8/src/frames.h +870 -0
- data/lib/libv8/v8/src/full-codegen.cc +1374 -0
- data/lib/libv8/v8/src/full-codegen.h +771 -0
- data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
- data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
- data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
- data/lib/libv8/v8/src/gdb-jit.h +143 -0
- data/lib/libv8/v8/src/global-handles.cc +665 -0
- data/lib/libv8/v8/src/global-handles.h +284 -0
- data/lib/libv8/v8/src/globals.h +325 -0
- data/lib/libv8/v8/src/handles-inl.h +177 -0
- data/lib/libv8/v8/src/handles.cc +987 -0
- data/lib/libv8/v8/src/handles.h +382 -0
- data/lib/libv8/v8/src/hashmap.cc +230 -0
- data/lib/libv8/v8/src/hashmap.h +123 -0
- data/lib/libv8/v8/src/heap-inl.h +704 -0
- data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
- data/lib/libv8/v8/src/heap-profiler.h +397 -0
- data/lib/libv8/v8/src/heap.cc +5930 -0
- data/lib/libv8/v8/src/heap.h +2268 -0
- data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
- data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
- data/lib/libv8/v8/src/hydrogen.cc +6239 -0
- data/lib/libv8/v8/src/hydrogen.h +1202 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
- data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
- data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
- data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
- data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
- data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
- data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
- data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
- data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
- data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
- data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
- data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
- data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
- data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
- data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
- data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
- data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
- data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
- data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
- data/lib/libv8/v8/src/ic-inl.h +130 -0
- data/lib/libv8/v8/src/ic.cc +2577 -0
- data/lib/libv8/v8/src/ic.h +736 -0
- data/lib/libv8/v8/src/inspector.cc +63 -0
- data/lib/libv8/v8/src/inspector.h +62 -0
- data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
- data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
- data/lib/libv8/v8/src/isolate-inl.h +50 -0
- data/lib/libv8/v8/src/isolate.cc +1869 -0
- data/lib/libv8/v8/src/isolate.h +1382 -0
- data/lib/libv8/v8/src/json-parser.cc +504 -0
- data/lib/libv8/v8/src/json-parser.h +161 -0
- data/lib/libv8/v8/src/json.js +342 -0
- data/lib/libv8/v8/src/jsregexp.cc +5385 -0
- data/lib/libv8/v8/src/jsregexp.h +1492 -0
- data/lib/libv8/v8/src/list-inl.h +212 -0
- data/lib/libv8/v8/src/list.h +174 -0
- data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
- data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
- data/lib/libv8/v8/src/lithium-allocator.h +630 -0
- data/lib/libv8/v8/src/lithium.cc +190 -0
- data/lib/libv8/v8/src/lithium.h +597 -0
- data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
- data/lib/libv8/v8/src/liveedit.cc +1691 -0
- data/lib/libv8/v8/src/liveedit.h +180 -0
- data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
- data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
- data/lib/libv8/v8/src/liveobjectlist.h +322 -0
- data/lib/libv8/v8/src/log-inl.h +59 -0
- data/lib/libv8/v8/src/log-utils.cc +428 -0
- data/lib/libv8/v8/src/log-utils.h +231 -0
- data/lib/libv8/v8/src/log.cc +1993 -0
- data/lib/libv8/v8/src/log.h +476 -0
- data/lib/libv8/v8/src/macro-assembler.h +120 -0
- data/lib/libv8/v8/src/macros.py +178 -0
- data/lib/libv8/v8/src/mark-compact.cc +3143 -0
- data/lib/libv8/v8/src/mark-compact.h +506 -0
- data/lib/libv8/v8/src/math.js +264 -0
- data/lib/libv8/v8/src/messages.cc +179 -0
- data/lib/libv8/v8/src/messages.h +113 -0
- data/lib/libv8/v8/src/messages.js +1096 -0
- data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
- data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
- data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
- data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
- data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
- data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
- data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
- data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
- data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
- data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
- data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
- data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
- data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
- data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
- data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
- data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
- data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
- data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
- data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
- data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
- data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
- data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
- data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
- data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
- data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
- data/lib/libv8/v8/src/mksnapshot.cc +328 -0
- data/lib/libv8/v8/src/natives.h +64 -0
- data/lib/libv8/v8/src/objects-debug.cc +738 -0
- data/lib/libv8/v8/src/objects-inl.h +4323 -0
- data/lib/libv8/v8/src/objects-printer.cc +829 -0
- data/lib/libv8/v8/src/objects-visiting.cc +148 -0
- data/lib/libv8/v8/src/objects-visiting.h +424 -0
- data/lib/libv8/v8/src/objects.cc +10585 -0
- data/lib/libv8/v8/src/objects.h +6838 -0
- data/lib/libv8/v8/src/parser.cc +4997 -0
- data/lib/libv8/v8/src/parser.h +765 -0
- data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
- data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
- data/lib/libv8/v8/src/platform-linux.cc +1149 -0
- data/lib/libv8/v8/src/platform-macos.cc +830 -0
- data/lib/libv8/v8/src/platform-nullos.cc +479 -0
- data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
- data/lib/libv8/v8/src/platform-posix.cc +424 -0
- data/lib/libv8/v8/src/platform-solaris.cc +762 -0
- data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
- data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
- data/lib/libv8/v8/src/platform-tls.h +50 -0
- data/lib/libv8/v8/src/platform-win32.cc +2021 -0
- data/lib/libv8/v8/src/platform.h +667 -0
- data/lib/libv8/v8/src/preparse-data-format.h +62 -0
- data/lib/libv8/v8/src/preparse-data.cc +183 -0
- data/lib/libv8/v8/src/preparse-data.h +225 -0
- data/lib/libv8/v8/src/preparser-api.cc +220 -0
- data/lib/libv8/v8/src/preparser.cc +1450 -0
- data/lib/libv8/v8/src/preparser.h +493 -0
- data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
- data/lib/libv8/v8/src/prettyprinter.h +223 -0
- data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
- data/lib/libv8/v8/src/profile-generator.cc +3098 -0
- data/lib/libv8/v8/src/profile-generator.h +1126 -0
- data/lib/libv8/v8/src/property.cc +105 -0
- data/lib/libv8/v8/src/property.h +365 -0
- data/lib/libv8/v8/src/proxy.js +83 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
- data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
- data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
- data/lib/libv8/v8/src/regexp-stack.cc +111 -0
- data/lib/libv8/v8/src/regexp-stack.h +147 -0
- data/lib/libv8/v8/src/regexp.js +483 -0
- data/lib/libv8/v8/src/rewriter.cc +360 -0
- data/lib/libv8/v8/src/rewriter.h +50 -0
- data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
- data/lib/libv8/v8/src/runtime-profiler.h +201 -0
- data/lib/libv8/v8/src/runtime.cc +12227 -0
- data/lib/libv8/v8/src/runtime.h +652 -0
- data/lib/libv8/v8/src/runtime.js +649 -0
- data/lib/libv8/v8/src/safepoint-table.cc +256 -0
- data/lib/libv8/v8/src/safepoint-table.h +270 -0
- data/lib/libv8/v8/src/scanner-base.cc +952 -0
- data/lib/libv8/v8/src/scanner-base.h +670 -0
- data/lib/libv8/v8/src/scanner.cc +345 -0
- data/lib/libv8/v8/src/scanner.h +146 -0
- data/lib/libv8/v8/src/scopeinfo.cc +646 -0
- data/lib/libv8/v8/src/scopeinfo.h +254 -0
- data/lib/libv8/v8/src/scopes.cc +1150 -0
- data/lib/libv8/v8/src/scopes.h +507 -0
- data/lib/libv8/v8/src/serialize.cc +1574 -0
- data/lib/libv8/v8/src/serialize.h +589 -0
- data/lib/libv8/v8/src/shell.h +55 -0
- data/lib/libv8/v8/src/simulator.h +43 -0
- data/lib/libv8/v8/src/small-pointer-list.h +163 -0
- data/lib/libv8/v8/src/smart-pointer.h +109 -0
- data/lib/libv8/v8/src/snapshot-common.cc +83 -0
- data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
- data/lib/libv8/v8/src/snapshot.h +91 -0
- data/lib/libv8/v8/src/spaces-inl.h +529 -0
- data/lib/libv8/v8/src/spaces.cc +3145 -0
- data/lib/libv8/v8/src/spaces.h +2369 -0
- data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
- data/lib/libv8/v8/src/splay-tree.h +205 -0
- data/lib/libv8/v8/src/string-search.cc +41 -0
- data/lib/libv8/v8/src/string-search.h +568 -0
- data/lib/libv8/v8/src/string-stream.cc +592 -0
- data/lib/libv8/v8/src/string-stream.h +191 -0
- data/lib/libv8/v8/src/string.js +994 -0
- data/lib/libv8/v8/src/strtod.cc +440 -0
- data/lib/libv8/v8/src/strtod.h +40 -0
- data/lib/libv8/v8/src/stub-cache.cc +1965 -0
- data/lib/libv8/v8/src/stub-cache.h +924 -0
- data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
- data/lib/libv8/v8/src/token.cc +63 -0
- data/lib/libv8/v8/src/token.h +288 -0
- data/lib/libv8/v8/src/type-info.cc +507 -0
- data/lib/libv8/v8/src/type-info.h +272 -0
- data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
- data/lib/libv8/v8/src/unbound-queue.h +69 -0
- data/lib/libv8/v8/src/unicode-inl.h +238 -0
- data/lib/libv8/v8/src/unicode.cc +1624 -0
- data/lib/libv8/v8/src/unicode.h +280 -0
- data/lib/libv8/v8/src/uri.js +408 -0
- data/lib/libv8/v8/src/utils-inl.h +48 -0
- data/lib/libv8/v8/src/utils.cc +371 -0
- data/lib/libv8/v8/src/utils.h +800 -0
- data/lib/libv8/v8/src/v8-counters.cc +62 -0
- data/lib/libv8/v8/src/v8-counters.h +314 -0
- data/lib/libv8/v8/src/v8.cc +213 -0
- data/lib/libv8/v8/src/v8.h +131 -0
- data/lib/libv8/v8/src/v8checks.h +64 -0
- data/lib/libv8/v8/src/v8dll-main.cc +44 -0
- data/lib/libv8/v8/src/v8globals.h +512 -0
- data/lib/libv8/v8/src/v8memory.h +82 -0
- data/lib/libv8/v8/src/v8natives.js +1310 -0
- data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
- data/lib/libv8/v8/src/v8threads.cc +464 -0
- data/lib/libv8/v8/src/v8threads.h +165 -0
- data/lib/libv8/v8/src/v8utils.h +319 -0
- data/lib/libv8/v8/src/variables.cc +114 -0
- data/lib/libv8/v8/src/variables.h +167 -0
- data/lib/libv8/v8/src/version.cc +116 -0
- data/lib/libv8/v8/src/version.h +68 -0
- data/lib/libv8/v8/src/vm-state-inl.h +138 -0
- data/lib/libv8/v8/src/vm-state.h +71 -0
- data/lib/libv8/v8/src/win32-headers.h +96 -0
- data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
- data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
- data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
- data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
- data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
- data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
- data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
- data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
- data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
- data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
- data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
- data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
- data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
- data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
- data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
- data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
- data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
- data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
- data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
- data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
- data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
- data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
- data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
- data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
- data/lib/libv8/v8/src/zone-inl.h +140 -0
- data/lib/libv8/v8/src/zone.cc +196 -0
- data/lib/libv8/v8/src/zone.h +240 -0
- data/lib/libv8/v8/tools/codemap.js +265 -0
- data/lib/libv8/v8/tools/consarray.js +93 -0
- data/lib/libv8/v8/tools/csvparser.js +78 -0
- data/lib/libv8/v8/tools/disasm.py +92 -0
- data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
- data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
- data/lib/libv8/v8/tools/gcmole/README +62 -0
- data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
- data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
- data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
- data/lib/libv8/v8/tools/grokdump.py +841 -0
- data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
- data/lib/libv8/v8/tools/js2c.py +364 -0
- data/lib/libv8/v8/tools/jsmin.py +280 -0
- data/lib/libv8/v8/tools/linux-tick-processor +35 -0
- data/lib/libv8/v8/tools/ll_prof.py +942 -0
- data/lib/libv8/v8/tools/logreader.js +185 -0
- data/lib/libv8/v8/tools/mac-nm +18 -0
- data/lib/libv8/v8/tools/mac-tick-processor +6 -0
- data/lib/libv8/v8/tools/oom_dump/README +31 -0
- data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
- data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
- data/lib/libv8/v8/tools/presubmit.py +305 -0
- data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
- data/lib/libv8/v8/tools/profile.js +751 -0
- data/lib/libv8/v8/tools/profile_view.js +219 -0
- data/lib/libv8/v8/tools/run-valgrind.py +77 -0
- data/lib/libv8/v8/tools/splaytree.js +316 -0
- data/lib/libv8/v8/tools/stats-viewer.py +468 -0
- data/lib/libv8/v8/tools/test.py +1510 -0
- data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
- data/lib/libv8/v8/tools/tickprocessor.js +877 -0
- data/lib/libv8/v8/tools/utils.py +96 -0
- data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
- data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
- data/lib/libv8/version.rb +5 -0
- data/libv8.gemspec +36 -0
- metadata +578 -0
@@ -0,0 +1,1769 @@
|
|
1
|
+
// Copyright 2011 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#include "v8.h"
|
29
|
+
|
30
|
+
#include "factory.h"
|
31
|
+
#include "hydrogen.h"
|
32
|
+
|
33
|
+
#if V8_TARGET_ARCH_IA32
|
34
|
+
#include "ia32/lithium-ia32.h"
|
35
|
+
#elif V8_TARGET_ARCH_X64
|
36
|
+
#include "x64/lithium-x64.h"
|
37
|
+
#elif V8_TARGET_ARCH_ARM
|
38
|
+
#include "arm/lithium-arm.h"
|
39
|
+
#elif V8_TARGET_ARCH_MIPS
|
40
|
+
#include "mips/lithium-mips.h"
|
41
|
+
#else
|
42
|
+
#error Unsupported target architecture.
|
43
|
+
#endif
|
44
|
+
|
45
|
+
namespace v8 {
|
46
|
+
namespace internal {
|
47
|
+
|
48
|
+
#define DEFINE_COMPILE(type) \
|
49
|
+
LInstruction* H##type::CompileToLithium(LChunkBuilder* builder) { \
|
50
|
+
return builder->Do##type(this); \
|
51
|
+
}
|
52
|
+
HYDROGEN_CONCRETE_INSTRUCTION_LIST(DEFINE_COMPILE)
|
53
|
+
#undef DEFINE_COMPILE
|
54
|
+
|
55
|
+
|
56
|
+
const char* Representation::Mnemonic() const {
|
57
|
+
switch (kind_) {
|
58
|
+
case kNone: return "v";
|
59
|
+
case kTagged: return "t";
|
60
|
+
case kDouble: return "d";
|
61
|
+
case kInteger32: return "i";
|
62
|
+
case kExternal: return "x";
|
63
|
+
default:
|
64
|
+
UNREACHABLE();
|
65
|
+
return NULL;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
void HValue::AssumeRepresentation(Representation r) {
|
71
|
+
if (CheckFlag(kFlexibleRepresentation)) {
|
72
|
+
ChangeRepresentation(r);
|
73
|
+
// The representation of the value is dictated by type feedback and
|
74
|
+
// will not be changed later.
|
75
|
+
ClearFlag(kFlexibleRepresentation);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
static int32_t ConvertAndSetOverflow(int64_t result, bool* overflow) {
|
81
|
+
if (result > kMaxInt) {
|
82
|
+
*overflow = true;
|
83
|
+
return kMaxInt;
|
84
|
+
}
|
85
|
+
if (result < kMinInt) {
|
86
|
+
*overflow = true;
|
87
|
+
return kMinInt;
|
88
|
+
}
|
89
|
+
return static_cast<int32_t>(result);
|
90
|
+
}
|
91
|
+
|
92
|
+
|
93
|
+
static int32_t AddWithoutOverflow(int32_t a, int32_t b, bool* overflow) {
|
94
|
+
int64_t result = static_cast<int64_t>(a) + static_cast<int64_t>(b);
|
95
|
+
return ConvertAndSetOverflow(result, overflow);
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
static int32_t SubWithoutOverflow(int32_t a, int32_t b, bool* overflow) {
|
100
|
+
int64_t result = static_cast<int64_t>(a) - static_cast<int64_t>(b);
|
101
|
+
return ConvertAndSetOverflow(result, overflow);
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
static int32_t MulWithoutOverflow(int32_t a, int32_t b, bool* overflow) {
|
106
|
+
int64_t result = static_cast<int64_t>(a) * static_cast<int64_t>(b);
|
107
|
+
return ConvertAndSetOverflow(result, overflow);
|
108
|
+
}
|
109
|
+
|
110
|
+
|
111
|
+
int32_t Range::Mask() const {
|
112
|
+
if (lower_ == upper_) return lower_;
|
113
|
+
if (lower_ >= 0) {
|
114
|
+
int32_t res = 1;
|
115
|
+
while (res < upper_) {
|
116
|
+
res = (res << 1) | 1;
|
117
|
+
}
|
118
|
+
return res;
|
119
|
+
}
|
120
|
+
return 0xffffffff;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
void Range::AddConstant(int32_t value) {
|
125
|
+
if (value == 0) return;
|
126
|
+
bool may_overflow = false; // Overflow is ignored here.
|
127
|
+
lower_ = AddWithoutOverflow(lower_, value, &may_overflow);
|
128
|
+
upper_ = AddWithoutOverflow(upper_, value, &may_overflow);
|
129
|
+
Verify();
|
130
|
+
}
|
131
|
+
|
132
|
+
|
133
|
+
void Range::Intersect(Range* other) {
|
134
|
+
upper_ = Min(upper_, other->upper_);
|
135
|
+
lower_ = Max(lower_, other->lower_);
|
136
|
+
bool b = CanBeMinusZero() && other->CanBeMinusZero();
|
137
|
+
set_can_be_minus_zero(b);
|
138
|
+
}
|
139
|
+
|
140
|
+
|
141
|
+
void Range::Union(Range* other) {
|
142
|
+
upper_ = Max(upper_, other->upper_);
|
143
|
+
lower_ = Min(lower_, other->lower_);
|
144
|
+
bool b = CanBeMinusZero() || other->CanBeMinusZero();
|
145
|
+
set_can_be_minus_zero(b);
|
146
|
+
}
|
147
|
+
|
148
|
+
|
149
|
+
void Range::Sar(int32_t value) {
|
150
|
+
int32_t bits = value & 0x1F;
|
151
|
+
lower_ = lower_ >> bits;
|
152
|
+
upper_ = upper_ >> bits;
|
153
|
+
set_can_be_minus_zero(false);
|
154
|
+
}
|
155
|
+
|
156
|
+
|
157
|
+
void Range::Shl(int32_t value) {
|
158
|
+
int32_t bits = value & 0x1F;
|
159
|
+
int old_lower = lower_;
|
160
|
+
int old_upper = upper_;
|
161
|
+
lower_ = lower_ << bits;
|
162
|
+
upper_ = upper_ << bits;
|
163
|
+
if (old_lower != lower_ >> bits || old_upper != upper_ >> bits) {
|
164
|
+
upper_ = kMaxInt;
|
165
|
+
lower_ = kMinInt;
|
166
|
+
}
|
167
|
+
set_can_be_minus_zero(false);
|
168
|
+
}
|
169
|
+
|
170
|
+
|
171
|
+
bool Range::AddAndCheckOverflow(Range* other) {
|
172
|
+
bool may_overflow = false;
|
173
|
+
lower_ = AddWithoutOverflow(lower_, other->lower(), &may_overflow);
|
174
|
+
upper_ = AddWithoutOverflow(upper_, other->upper(), &may_overflow);
|
175
|
+
KeepOrder();
|
176
|
+
Verify();
|
177
|
+
return may_overflow;
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
bool Range::SubAndCheckOverflow(Range* other) {
|
182
|
+
bool may_overflow = false;
|
183
|
+
lower_ = SubWithoutOverflow(lower_, other->upper(), &may_overflow);
|
184
|
+
upper_ = SubWithoutOverflow(upper_, other->lower(), &may_overflow);
|
185
|
+
KeepOrder();
|
186
|
+
Verify();
|
187
|
+
return may_overflow;
|
188
|
+
}
|
189
|
+
|
190
|
+
|
191
|
+
void Range::KeepOrder() {
|
192
|
+
if (lower_ > upper_) {
|
193
|
+
int32_t tmp = lower_;
|
194
|
+
lower_ = upper_;
|
195
|
+
upper_ = tmp;
|
196
|
+
}
|
197
|
+
}
|
198
|
+
|
199
|
+
|
200
|
+
void Range::Verify() const {
|
201
|
+
ASSERT(lower_ <= upper_);
|
202
|
+
}
|
203
|
+
|
204
|
+
|
205
|
+
bool Range::MulAndCheckOverflow(Range* other) {
|
206
|
+
bool may_overflow = false;
|
207
|
+
int v1 = MulWithoutOverflow(lower_, other->lower(), &may_overflow);
|
208
|
+
int v2 = MulWithoutOverflow(lower_, other->upper(), &may_overflow);
|
209
|
+
int v3 = MulWithoutOverflow(upper_, other->lower(), &may_overflow);
|
210
|
+
int v4 = MulWithoutOverflow(upper_, other->upper(), &may_overflow);
|
211
|
+
lower_ = Min(Min(v1, v2), Min(v3, v4));
|
212
|
+
upper_ = Max(Max(v1, v2), Max(v3, v4));
|
213
|
+
Verify();
|
214
|
+
return may_overflow;
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
const char* HType::ToString() {
|
219
|
+
switch (type_) {
|
220
|
+
case kTagged: return "tagged";
|
221
|
+
case kTaggedPrimitive: return "primitive";
|
222
|
+
case kTaggedNumber: return "number";
|
223
|
+
case kSmi: return "smi";
|
224
|
+
case kHeapNumber: return "heap-number";
|
225
|
+
case kString: return "string";
|
226
|
+
case kBoolean: return "boolean";
|
227
|
+
case kNonPrimitive: return "non-primitive";
|
228
|
+
case kJSArray: return "array";
|
229
|
+
case kJSObject: return "object";
|
230
|
+
case kUninitialized: return "uninitialized";
|
231
|
+
}
|
232
|
+
UNREACHABLE();
|
233
|
+
return "Unreachable code";
|
234
|
+
}
|
235
|
+
|
236
|
+
|
237
|
+
const char* HType::ToShortString() {
|
238
|
+
switch (type_) {
|
239
|
+
case kTagged: return "t";
|
240
|
+
case kTaggedPrimitive: return "p";
|
241
|
+
case kTaggedNumber: return "n";
|
242
|
+
case kSmi: return "m";
|
243
|
+
case kHeapNumber: return "h";
|
244
|
+
case kString: return "s";
|
245
|
+
case kBoolean: return "b";
|
246
|
+
case kNonPrimitive: return "r";
|
247
|
+
case kJSArray: return "a";
|
248
|
+
case kJSObject: return "o";
|
249
|
+
case kUninitialized: return "z";
|
250
|
+
}
|
251
|
+
UNREACHABLE();
|
252
|
+
return "Unreachable code";
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
HType HType::TypeFromValue(Handle<Object> value) {
|
257
|
+
HType result = HType::Tagged();
|
258
|
+
if (value->IsSmi()) {
|
259
|
+
result = HType::Smi();
|
260
|
+
} else if (value->IsHeapNumber()) {
|
261
|
+
result = HType::HeapNumber();
|
262
|
+
} else if (value->IsString()) {
|
263
|
+
result = HType::String();
|
264
|
+
} else if (value->IsBoolean()) {
|
265
|
+
result = HType::Boolean();
|
266
|
+
} else if (value->IsJSObject()) {
|
267
|
+
result = HType::JSObject();
|
268
|
+
} else if (value->IsJSArray()) {
|
269
|
+
result = HType::JSArray();
|
270
|
+
}
|
271
|
+
return result;
|
272
|
+
}
|
273
|
+
|
274
|
+
|
275
|
+
bool HValue::IsDefinedAfter(HBasicBlock* other) const {
|
276
|
+
return block()->block_id() > other->block_id();
|
277
|
+
}
|
278
|
+
|
279
|
+
|
280
|
+
HUseIterator::HUseIterator(HUseListNode* head) : next_(head) {
|
281
|
+
Advance();
|
282
|
+
}
|
283
|
+
|
284
|
+
|
285
|
+
void HUseIterator::Advance() {
|
286
|
+
current_ = next_;
|
287
|
+
if (current_ != NULL) {
|
288
|
+
next_ = current_->tail();
|
289
|
+
value_ = current_->value();
|
290
|
+
index_ = current_->index();
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
|
295
|
+
int HValue::UseCount() const {
|
296
|
+
int count = 0;
|
297
|
+
for (HUseIterator it(uses()); !it.Done(); it.Advance()) ++count;
|
298
|
+
return count;
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
HUseListNode* HValue::RemoveUse(HValue* value, int index) {
|
303
|
+
HUseListNode* previous = NULL;
|
304
|
+
HUseListNode* current = use_list_;
|
305
|
+
while (current != NULL) {
|
306
|
+
if (current->value() == value && current->index() == index) {
|
307
|
+
if (previous == NULL) {
|
308
|
+
use_list_ = current->tail();
|
309
|
+
} else {
|
310
|
+
previous->set_tail(current->tail());
|
311
|
+
}
|
312
|
+
break;
|
313
|
+
}
|
314
|
+
|
315
|
+
previous = current;
|
316
|
+
current = current->tail();
|
317
|
+
}
|
318
|
+
|
319
|
+
#ifdef DEBUG
|
320
|
+
// Do not reuse use list nodes in debug mode, zap them.
|
321
|
+
if (current != NULL) {
|
322
|
+
HUseListNode* temp =
|
323
|
+
new HUseListNode(current->value(), current->index(), NULL);
|
324
|
+
current->Zap();
|
325
|
+
current = temp;
|
326
|
+
}
|
327
|
+
#endif
|
328
|
+
return current;
|
329
|
+
}
|
330
|
+
|
331
|
+
|
332
|
+
bool HValue::Equals(HValue* other) {
|
333
|
+
if (other->opcode() != opcode()) return false;
|
334
|
+
if (!other->representation().Equals(representation())) return false;
|
335
|
+
if (!other->type_.Equals(type_)) return false;
|
336
|
+
if (other->flags() != flags()) return false;
|
337
|
+
if (OperandCount() != other->OperandCount()) return false;
|
338
|
+
for (int i = 0; i < OperandCount(); ++i) {
|
339
|
+
if (OperandAt(i)->id() != other->OperandAt(i)->id()) return false;
|
340
|
+
}
|
341
|
+
bool result = DataEquals(other);
|
342
|
+
ASSERT(!result || Hashcode() == other->Hashcode());
|
343
|
+
return result;
|
344
|
+
}
|
345
|
+
|
346
|
+
|
347
|
+
intptr_t HValue::Hashcode() {
|
348
|
+
intptr_t result = opcode();
|
349
|
+
int count = OperandCount();
|
350
|
+
for (int i = 0; i < count; ++i) {
|
351
|
+
result = result * 19 + OperandAt(i)->id() + (result >> 7);
|
352
|
+
}
|
353
|
+
return result;
|
354
|
+
}
|
355
|
+
|
356
|
+
|
357
|
+
const char* HValue::Mnemonic() const {
|
358
|
+
switch (opcode()) {
|
359
|
+
#define MAKE_CASE(type) case k##type: return #type;
|
360
|
+
HYDROGEN_CONCRETE_INSTRUCTION_LIST(MAKE_CASE)
|
361
|
+
#undef MAKE_CASE
|
362
|
+
case kPhi: return "Phi";
|
363
|
+
default: return "";
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
|
368
|
+
void HValue::SetOperandAt(int index, HValue* value) {
|
369
|
+
RegisterUse(index, value);
|
370
|
+
InternalSetOperandAt(index, value);
|
371
|
+
}
|
372
|
+
|
373
|
+
|
374
|
+
void HValue::DeleteAndReplaceWith(HValue* other) {
|
375
|
+
// We replace all uses first, so Delete can assert that there are none.
|
376
|
+
if (other != NULL) ReplaceAllUsesWith(other);
|
377
|
+
ASSERT(HasNoUses());
|
378
|
+
ClearOperands();
|
379
|
+
DeleteFromGraph();
|
380
|
+
}
|
381
|
+
|
382
|
+
|
383
|
+
void HValue::ReplaceAllUsesWith(HValue* other) {
|
384
|
+
while (use_list_ != NULL) {
|
385
|
+
HUseListNode* list_node = use_list_;
|
386
|
+
HValue* value = list_node->value();
|
387
|
+
ASSERT(!value->block()->IsStartBlock());
|
388
|
+
value->InternalSetOperandAt(list_node->index(), other);
|
389
|
+
use_list_ = list_node->tail();
|
390
|
+
list_node->set_tail(other->use_list_);
|
391
|
+
other->use_list_ = list_node;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
void HValue::ClearOperands() {
|
397
|
+
for (int i = 0; i < OperandCount(); ++i) {
|
398
|
+
SetOperandAt(i, NULL);
|
399
|
+
}
|
400
|
+
}
|
401
|
+
|
402
|
+
|
403
|
+
void HValue::SetBlock(HBasicBlock* block) {
|
404
|
+
ASSERT(block_ == NULL || block == NULL);
|
405
|
+
block_ = block;
|
406
|
+
if (id_ == kNoNumber && block != NULL) {
|
407
|
+
id_ = block->graph()->GetNextValueID(this);
|
408
|
+
}
|
409
|
+
}
|
410
|
+
|
411
|
+
|
412
|
+
void HValue::PrintTypeTo(StringStream* stream) {
|
413
|
+
if (!representation().IsTagged() || type().Equals(HType::Tagged())) return;
|
414
|
+
stream->Add(" type[%s]", type().ToString());
|
415
|
+
}
|
416
|
+
|
417
|
+
|
418
|
+
void HValue::PrintRangeTo(StringStream* stream) {
|
419
|
+
if (range() == NULL || range()->IsMostGeneric()) return;
|
420
|
+
stream->Add(" range[%d,%d,m0=%d]",
|
421
|
+
range()->lower(),
|
422
|
+
range()->upper(),
|
423
|
+
static_cast<int>(range()->CanBeMinusZero()));
|
424
|
+
}
|
425
|
+
|
426
|
+
|
427
|
+
void HValue::PrintChangesTo(StringStream* stream) {
|
428
|
+
int changes_flags = (flags() & HValue::ChangesFlagsMask());
|
429
|
+
if (changes_flags == 0) return;
|
430
|
+
stream->Add(" changes[");
|
431
|
+
if (changes_flags == AllSideEffects()) {
|
432
|
+
stream->Add("*");
|
433
|
+
} else {
|
434
|
+
bool add_comma = false;
|
435
|
+
#define PRINT_DO(type) \
|
436
|
+
if (changes_flags & (1 << kChanges##type)) { \
|
437
|
+
if (add_comma) stream->Add(","); \
|
438
|
+
add_comma = true; \
|
439
|
+
stream->Add(#type); \
|
440
|
+
}
|
441
|
+
GVN_FLAG_LIST(PRINT_DO);
|
442
|
+
#undef PRINT_DO
|
443
|
+
}
|
444
|
+
stream->Add("]");
|
445
|
+
}
|
446
|
+
|
447
|
+
|
448
|
+
void HValue::PrintNameTo(StringStream* stream) {
|
449
|
+
stream->Add("%s%d", representation_.Mnemonic(), id());
|
450
|
+
}
|
451
|
+
|
452
|
+
|
453
|
+
bool HValue::UpdateInferredType() {
|
454
|
+
HType type = CalculateInferredType();
|
455
|
+
bool result = (!type.Equals(type_));
|
456
|
+
type_ = type;
|
457
|
+
return result;
|
458
|
+
}
|
459
|
+
|
460
|
+
|
461
|
+
void HValue::RegisterUse(int index, HValue* new_value) {
|
462
|
+
HValue* old_value = OperandAt(index);
|
463
|
+
if (old_value == new_value) return;
|
464
|
+
|
465
|
+
HUseListNode* removed = NULL;
|
466
|
+
if (old_value != NULL) {
|
467
|
+
removed = old_value->RemoveUse(this, index);
|
468
|
+
}
|
469
|
+
|
470
|
+
if (new_value != NULL) {
|
471
|
+
if (removed == NULL) {
|
472
|
+
new_value->use_list_ =
|
473
|
+
new HUseListNode(this, index, new_value->use_list_);
|
474
|
+
} else {
|
475
|
+
removed->set_tail(new_value->use_list_);
|
476
|
+
new_value->use_list_ = removed;
|
477
|
+
}
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
|
482
|
+
void HValue::AddNewRange(Range* r) {
|
483
|
+
if (!HasRange()) ComputeInitialRange();
|
484
|
+
if (!HasRange()) range_ = new Range();
|
485
|
+
ASSERT(HasRange());
|
486
|
+
r->StackUpon(range_);
|
487
|
+
range_ = r;
|
488
|
+
}
|
489
|
+
|
490
|
+
|
491
|
+
void HValue::RemoveLastAddedRange() {
|
492
|
+
ASSERT(HasRange());
|
493
|
+
ASSERT(range_->next() != NULL);
|
494
|
+
range_ = range_->next();
|
495
|
+
}
|
496
|
+
|
497
|
+
|
498
|
+
void HValue::ComputeInitialRange() {
|
499
|
+
ASSERT(!HasRange());
|
500
|
+
range_ = InferRange();
|
501
|
+
ASSERT(HasRange());
|
502
|
+
}
|
503
|
+
|
504
|
+
|
505
|
+
void HInstruction::PrintTo(StringStream* stream) {
|
506
|
+
PrintMnemonicTo(stream);
|
507
|
+
PrintDataTo(stream);
|
508
|
+
PrintRangeTo(stream);
|
509
|
+
PrintChangesTo(stream);
|
510
|
+
PrintTypeTo(stream);
|
511
|
+
}
|
512
|
+
|
513
|
+
|
514
|
+
void HInstruction::PrintMnemonicTo(StringStream* stream) {
|
515
|
+
stream->Add("%s", Mnemonic());
|
516
|
+
if (HasSideEffects()) stream->Add("*");
|
517
|
+
stream->Add(" ");
|
518
|
+
}
|
519
|
+
|
520
|
+
|
521
|
+
void HInstruction::Unlink() {
|
522
|
+
ASSERT(IsLinked());
|
523
|
+
ASSERT(!IsControlInstruction()); // Must never move control instructions.
|
524
|
+
ASSERT(!IsBlockEntry()); // Doesn't make sense to delete these.
|
525
|
+
ASSERT(previous_ != NULL);
|
526
|
+
previous_->next_ = next_;
|
527
|
+
if (next_ == NULL) {
|
528
|
+
ASSERT(block()->last() == this);
|
529
|
+
block()->set_last(previous_);
|
530
|
+
} else {
|
531
|
+
next_->previous_ = previous_;
|
532
|
+
}
|
533
|
+
clear_block();
|
534
|
+
}
|
535
|
+
|
536
|
+
|
537
|
+
void HInstruction::InsertBefore(HInstruction* next) {
|
538
|
+
ASSERT(!IsLinked());
|
539
|
+
ASSERT(!next->IsBlockEntry());
|
540
|
+
ASSERT(!IsControlInstruction());
|
541
|
+
ASSERT(!next->block()->IsStartBlock());
|
542
|
+
ASSERT(next->previous_ != NULL);
|
543
|
+
HInstruction* prev = next->previous();
|
544
|
+
prev->next_ = this;
|
545
|
+
next->previous_ = this;
|
546
|
+
next_ = next;
|
547
|
+
previous_ = prev;
|
548
|
+
SetBlock(next->block());
|
549
|
+
}
|
550
|
+
|
551
|
+
|
552
|
+
void HInstruction::InsertAfter(HInstruction* previous) {
|
553
|
+
ASSERT(!IsLinked());
|
554
|
+
ASSERT(!previous->IsControlInstruction());
|
555
|
+
ASSERT(!IsControlInstruction() || previous->next_ == NULL);
|
556
|
+
HBasicBlock* block = previous->block();
|
557
|
+
// Never insert anything except constants into the start block after finishing
|
558
|
+
// it.
|
559
|
+
if (block->IsStartBlock() && block->IsFinished() && !IsConstant()) {
|
560
|
+
ASSERT(block->end()->SecondSuccessor() == NULL);
|
561
|
+
InsertAfter(block->end()->FirstSuccessor()->first());
|
562
|
+
return;
|
563
|
+
}
|
564
|
+
|
565
|
+
// If we're inserting after an instruction with side-effects that is
|
566
|
+
// followed by a simulate instruction, we need to insert after the
|
567
|
+
// simulate instruction instead.
|
568
|
+
HInstruction* next = previous->next_;
|
569
|
+
if (previous->HasSideEffects() && next != NULL) {
|
570
|
+
ASSERT(next->IsSimulate());
|
571
|
+
previous = next;
|
572
|
+
next = previous->next_;
|
573
|
+
}
|
574
|
+
|
575
|
+
previous_ = previous;
|
576
|
+
next_ = next;
|
577
|
+
SetBlock(block);
|
578
|
+
previous->next_ = this;
|
579
|
+
if (next != NULL) next->previous_ = this;
|
580
|
+
}
|
581
|
+
|
582
|
+
|
583
|
+
#ifdef DEBUG
|
584
|
+
void HInstruction::Verify() {
|
585
|
+
// Verify that input operands are defined before use.
|
586
|
+
HBasicBlock* cur_block = block();
|
587
|
+
for (int i = 0; i < OperandCount(); ++i) {
|
588
|
+
HValue* other_operand = OperandAt(i);
|
589
|
+
HBasicBlock* other_block = other_operand->block();
|
590
|
+
if (cur_block == other_block) {
|
591
|
+
if (!other_operand->IsPhi()) {
|
592
|
+
HInstruction* cur = cur_block->first();
|
593
|
+
while (cur != NULL) {
|
594
|
+
ASSERT(cur != this); // We should reach other_operand before!
|
595
|
+
if (cur == other_operand) break;
|
596
|
+
cur = cur->next();
|
597
|
+
}
|
598
|
+
// Must reach other operand in the same block!
|
599
|
+
ASSERT(cur == other_operand);
|
600
|
+
}
|
601
|
+
} else {
|
602
|
+
// If the following assert fires, you may have forgotten an
|
603
|
+
// AddInstruction.
|
604
|
+
ASSERT(other_block->Dominates(cur_block));
|
605
|
+
}
|
606
|
+
}
|
607
|
+
|
608
|
+
// Verify that instructions that may have side-effects are followed
|
609
|
+
// by a simulate instruction.
|
610
|
+
if (HasSideEffects() && !IsOsrEntry()) {
|
611
|
+
ASSERT(next()->IsSimulate());
|
612
|
+
}
|
613
|
+
|
614
|
+
// Verify that instructions that can be eliminated by GVN have overridden
|
615
|
+
// HValue::DataEquals. The default implementation is UNREACHABLE. We
|
616
|
+
// don't actually care whether DataEquals returns true or false here.
|
617
|
+
if (CheckFlag(kUseGVN)) DataEquals(this);
|
618
|
+
}
|
619
|
+
#endif
|
620
|
+
|
621
|
+
|
622
|
+
void HUnaryCall::PrintDataTo(StringStream* stream) {
|
623
|
+
value()->PrintNameTo(stream);
|
624
|
+
stream->Add(" ");
|
625
|
+
stream->Add("#%d", argument_count());
|
626
|
+
}
|
627
|
+
|
628
|
+
|
629
|
+
void HBinaryCall::PrintDataTo(StringStream* stream) {
|
630
|
+
first()->PrintNameTo(stream);
|
631
|
+
stream->Add(" ");
|
632
|
+
second()->PrintNameTo(stream);
|
633
|
+
stream->Add(" ");
|
634
|
+
stream->Add("#%d", argument_count());
|
635
|
+
}
|
636
|
+
|
637
|
+
|
638
|
+
void HCallConstantFunction::PrintDataTo(StringStream* stream) {
|
639
|
+
if (IsApplyFunction()) {
|
640
|
+
stream->Add("optimized apply ");
|
641
|
+
} else {
|
642
|
+
stream->Add("%o ", function()->shared()->DebugName());
|
643
|
+
}
|
644
|
+
stream->Add("#%d", argument_count());
|
645
|
+
}
|
646
|
+
|
647
|
+
|
648
|
+
void HCallNamed::PrintDataTo(StringStream* stream) {
|
649
|
+
stream->Add("%o ", *name());
|
650
|
+
HUnaryCall::PrintDataTo(stream);
|
651
|
+
}
|
652
|
+
|
653
|
+
|
654
|
+
void HCallGlobal::PrintDataTo(StringStream* stream) {
|
655
|
+
stream->Add("%o ", *name());
|
656
|
+
HUnaryCall::PrintDataTo(stream);
|
657
|
+
}
|
658
|
+
|
659
|
+
|
660
|
+
void HCallKnownGlobal::PrintDataTo(StringStream* stream) {
|
661
|
+
stream->Add("o ", target()->shared()->DebugName());
|
662
|
+
stream->Add("#%d", argument_count());
|
663
|
+
}
|
664
|
+
|
665
|
+
|
666
|
+
void HCallRuntime::PrintDataTo(StringStream* stream) {
|
667
|
+
stream->Add("%o ", *name());
|
668
|
+
stream->Add("#%d", argument_count());
|
669
|
+
}
|
670
|
+
|
671
|
+
|
672
|
+
void HClassOfTest::PrintDataTo(StringStream* stream) {
|
673
|
+
stream->Add("class_of_test(");
|
674
|
+
value()->PrintNameTo(stream);
|
675
|
+
stream->Add(", \"%o\")", *class_name());
|
676
|
+
}
|
677
|
+
|
678
|
+
|
679
|
+
void HAccessArgumentsAt::PrintDataTo(StringStream* stream) {
|
680
|
+
arguments()->PrintNameTo(stream);
|
681
|
+
stream->Add("[");
|
682
|
+
index()->PrintNameTo(stream);
|
683
|
+
stream->Add("], length ");
|
684
|
+
length()->PrintNameTo(stream);
|
685
|
+
}
|
686
|
+
|
687
|
+
|
688
|
+
void HControlInstruction::PrintDataTo(StringStream* stream) {
|
689
|
+
if (FirstSuccessor() != NULL) {
|
690
|
+
int first_id = FirstSuccessor()->block_id();
|
691
|
+
if (SecondSuccessor() == NULL) {
|
692
|
+
stream->Add(" B%d", first_id);
|
693
|
+
} else {
|
694
|
+
int second_id = SecondSuccessor()->block_id();
|
695
|
+
stream->Add(" goto (B%d, B%d)", first_id, second_id);
|
696
|
+
}
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
700
|
+
|
701
|
+
void HUnaryControlInstruction::PrintDataTo(StringStream* stream) {
|
702
|
+
value()->PrintNameTo(stream);
|
703
|
+
HControlInstruction::PrintDataTo(stream);
|
704
|
+
}
|
705
|
+
|
706
|
+
|
707
|
+
void HCompareMap::PrintDataTo(StringStream* stream) {
|
708
|
+
value()->PrintNameTo(stream);
|
709
|
+
stream->Add(" (%p)", *map());
|
710
|
+
HControlInstruction::PrintDataTo(stream);
|
711
|
+
}
|
712
|
+
|
713
|
+
|
714
|
+
const char* HUnaryMathOperation::OpName() const {
|
715
|
+
switch (op()) {
|
716
|
+
case kMathFloor: return "floor";
|
717
|
+
case kMathRound: return "round";
|
718
|
+
case kMathCeil: return "ceil";
|
719
|
+
case kMathAbs: return "abs";
|
720
|
+
case kMathLog: return "log";
|
721
|
+
case kMathSin: return "sin";
|
722
|
+
case kMathCos: return "cos";
|
723
|
+
case kMathTan: return "tan";
|
724
|
+
case kMathASin: return "asin";
|
725
|
+
case kMathACos: return "acos";
|
726
|
+
case kMathATan: return "atan";
|
727
|
+
case kMathExp: return "exp";
|
728
|
+
case kMathSqrt: return "sqrt";
|
729
|
+
default: break;
|
730
|
+
}
|
731
|
+
return "(unknown operation)";
|
732
|
+
}
|
733
|
+
|
734
|
+
|
735
|
+
void HUnaryMathOperation::PrintDataTo(StringStream* stream) {
|
736
|
+
const char* name = OpName();
|
737
|
+
stream->Add("%s ", name);
|
738
|
+
value()->PrintNameTo(stream);
|
739
|
+
}
|
740
|
+
|
741
|
+
|
742
|
+
void HUnaryOperation::PrintDataTo(StringStream* stream) {
|
743
|
+
value()->PrintNameTo(stream);
|
744
|
+
}
|
745
|
+
|
746
|
+
|
747
|
+
void HHasInstanceType::PrintDataTo(StringStream* stream) {
|
748
|
+
value()->PrintNameTo(stream);
|
749
|
+
switch (from_) {
|
750
|
+
case FIRST_JS_OBJECT_TYPE:
|
751
|
+
if (to_ == LAST_TYPE) stream->Add(" spec_object");
|
752
|
+
break;
|
753
|
+
case JS_REGEXP_TYPE:
|
754
|
+
if (to_ == JS_REGEXP_TYPE) stream->Add(" reg_exp");
|
755
|
+
break;
|
756
|
+
case JS_ARRAY_TYPE:
|
757
|
+
if (to_ == JS_ARRAY_TYPE) stream->Add(" array");
|
758
|
+
break;
|
759
|
+
case JS_FUNCTION_TYPE:
|
760
|
+
if (to_ == JS_FUNCTION_TYPE) stream->Add(" function");
|
761
|
+
break;
|
762
|
+
default:
|
763
|
+
break;
|
764
|
+
}
|
765
|
+
}
|
766
|
+
|
767
|
+
|
768
|
+
void HTypeofIs::PrintDataTo(StringStream* stream) {
|
769
|
+
value()->PrintNameTo(stream);
|
770
|
+
stream->Add(" == ");
|
771
|
+
stream->Add(type_literal_->ToAsciiVector());
|
772
|
+
}
|
773
|
+
|
774
|
+
|
775
|
+
void HChange::PrintDataTo(StringStream* stream) {
|
776
|
+
HUnaryOperation::PrintDataTo(stream);
|
777
|
+
stream->Add(" %s to %s", from_.Mnemonic(), to().Mnemonic());
|
778
|
+
|
779
|
+
if (CanTruncateToInt32()) stream->Add(" truncating-int32");
|
780
|
+
if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
|
781
|
+
}
|
782
|
+
|
783
|
+
|
784
|
+
void HCheckInstanceType::GetCheckInterval(InstanceType* first,
|
785
|
+
InstanceType* last) {
|
786
|
+
ASSERT(is_interval_check());
|
787
|
+
switch (check_) {
|
788
|
+
case IS_JS_OBJECT_OR_JS_FUNCTION:
|
789
|
+
STATIC_ASSERT((LAST_JS_OBJECT_TYPE + 1) == JS_FUNCTION_TYPE);
|
790
|
+
*first = FIRST_JS_OBJECT_TYPE;
|
791
|
+
*last = JS_FUNCTION_TYPE;
|
792
|
+
return;
|
793
|
+
case IS_JS_ARRAY:
|
794
|
+
*first = *last = JS_ARRAY_TYPE;
|
795
|
+
return;
|
796
|
+
default:
|
797
|
+
UNREACHABLE();
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
|
802
|
+
void HCheckInstanceType::GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag) {
|
803
|
+
ASSERT(!is_interval_check());
|
804
|
+
switch (check_) {
|
805
|
+
case IS_STRING:
|
806
|
+
*mask = kIsNotStringMask;
|
807
|
+
*tag = kStringTag;
|
808
|
+
return;
|
809
|
+
case IS_SYMBOL:
|
810
|
+
*mask = kIsSymbolMask;
|
811
|
+
*tag = kSymbolTag;
|
812
|
+
return;
|
813
|
+
default:
|
814
|
+
UNREACHABLE();
|
815
|
+
}
|
816
|
+
}
|
817
|
+
|
818
|
+
|
819
|
+
void HCheckMap::PrintDataTo(StringStream* stream) {
|
820
|
+
value()->PrintNameTo(stream);
|
821
|
+
stream->Add(" %p", *map());
|
822
|
+
}
|
823
|
+
|
824
|
+
|
825
|
+
void HCheckFunction::PrintDataTo(StringStream* stream) {
|
826
|
+
value()->PrintNameTo(stream);
|
827
|
+
stream->Add(" %p", *target());
|
828
|
+
}
|
829
|
+
|
830
|
+
|
831
|
+
void HCallStub::PrintDataTo(StringStream* stream) {
|
832
|
+
stream->Add("%s ",
|
833
|
+
CodeStub::MajorName(major_key_, false));
|
834
|
+
HUnaryCall::PrintDataTo(stream);
|
835
|
+
}
|
836
|
+
|
837
|
+
|
838
|
+
void HInstanceOf::PrintDataTo(StringStream* stream) {
|
839
|
+
left()->PrintNameTo(stream);
|
840
|
+
stream->Add(" ");
|
841
|
+
right()->PrintNameTo(stream);
|
842
|
+
stream->Add(" ");
|
843
|
+
context()->PrintNameTo(stream);
|
844
|
+
}
|
845
|
+
|
846
|
+
|
847
|
+
Range* HValue::InferRange() {
|
848
|
+
if (representation().IsTagged()) {
|
849
|
+
// Tagged values are always in int32 range when converted to integer,
|
850
|
+
// but they can contain -0.
|
851
|
+
Range* result = new Range();
|
852
|
+
result->set_can_be_minus_zero(true);
|
853
|
+
return result;
|
854
|
+
} else if (representation().IsNone()) {
|
855
|
+
return NULL;
|
856
|
+
} else {
|
857
|
+
// Untagged integer32 cannot be -0 and we don't compute ranges for
|
858
|
+
// untagged doubles.
|
859
|
+
return new Range();
|
860
|
+
}
|
861
|
+
}
|
862
|
+
|
863
|
+
|
864
|
+
Range* HConstant::InferRange() {
|
865
|
+
if (has_int32_value_) {
|
866
|
+
Range* result = new Range(int32_value_, int32_value_);
|
867
|
+
result->set_can_be_minus_zero(false);
|
868
|
+
return result;
|
869
|
+
}
|
870
|
+
return HValue::InferRange();
|
871
|
+
}
|
872
|
+
|
873
|
+
|
874
|
+
Range* HPhi::InferRange() {
|
875
|
+
if (representation().IsInteger32()) {
|
876
|
+
if (block()->IsLoopHeader()) {
|
877
|
+
Range* range = new Range(kMinInt, kMaxInt);
|
878
|
+
return range;
|
879
|
+
} else {
|
880
|
+
Range* range = OperandAt(0)->range()->Copy();
|
881
|
+
for (int i = 1; i < OperandCount(); ++i) {
|
882
|
+
range->Union(OperandAt(i)->range());
|
883
|
+
}
|
884
|
+
return range;
|
885
|
+
}
|
886
|
+
} else {
|
887
|
+
return HValue::InferRange();
|
888
|
+
}
|
889
|
+
}
|
890
|
+
|
891
|
+
|
892
|
+
Range* HAdd::InferRange() {
|
893
|
+
if (representation().IsInteger32()) {
|
894
|
+
Range* a = left()->range();
|
895
|
+
Range* b = right()->range();
|
896
|
+
Range* res = a->Copy();
|
897
|
+
if (!res->AddAndCheckOverflow(b)) {
|
898
|
+
ClearFlag(kCanOverflow);
|
899
|
+
}
|
900
|
+
bool m0 = a->CanBeMinusZero() && b->CanBeMinusZero();
|
901
|
+
res->set_can_be_minus_zero(m0);
|
902
|
+
return res;
|
903
|
+
} else {
|
904
|
+
return HValue::InferRange();
|
905
|
+
}
|
906
|
+
}
|
907
|
+
|
908
|
+
|
909
|
+
Range* HSub::InferRange() {
|
910
|
+
if (representation().IsInteger32()) {
|
911
|
+
Range* a = left()->range();
|
912
|
+
Range* b = right()->range();
|
913
|
+
Range* res = a->Copy();
|
914
|
+
if (!res->SubAndCheckOverflow(b)) {
|
915
|
+
ClearFlag(kCanOverflow);
|
916
|
+
}
|
917
|
+
res->set_can_be_minus_zero(a->CanBeMinusZero() && b->CanBeZero());
|
918
|
+
return res;
|
919
|
+
} else {
|
920
|
+
return HValue::InferRange();
|
921
|
+
}
|
922
|
+
}
|
923
|
+
|
924
|
+
|
925
|
+
Range* HMul::InferRange() {
|
926
|
+
if (representation().IsInteger32()) {
|
927
|
+
Range* a = left()->range();
|
928
|
+
Range* b = right()->range();
|
929
|
+
Range* res = a->Copy();
|
930
|
+
if (!res->MulAndCheckOverflow(b)) {
|
931
|
+
ClearFlag(kCanOverflow);
|
932
|
+
}
|
933
|
+
bool m0 = (a->CanBeZero() && b->CanBeNegative()) ||
|
934
|
+
(a->CanBeNegative() && b->CanBeZero());
|
935
|
+
res->set_can_be_minus_zero(m0);
|
936
|
+
return res;
|
937
|
+
} else {
|
938
|
+
return HValue::InferRange();
|
939
|
+
}
|
940
|
+
}
|
941
|
+
|
942
|
+
|
943
|
+
Range* HDiv::InferRange() {
|
944
|
+
if (representation().IsInteger32()) {
|
945
|
+
Range* result = new Range();
|
946
|
+
if (left()->range()->CanBeMinusZero()) {
|
947
|
+
result->set_can_be_minus_zero(true);
|
948
|
+
}
|
949
|
+
|
950
|
+
if (left()->range()->CanBeZero() && right()->range()->CanBeNegative()) {
|
951
|
+
result->set_can_be_minus_zero(true);
|
952
|
+
}
|
953
|
+
|
954
|
+
if (right()->range()->Includes(-1) && left()->range()->Includes(kMinInt)) {
|
955
|
+
SetFlag(HValue::kCanOverflow);
|
956
|
+
}
|
957
|
+
|
958
|
+
if (!right()->range()->CanBeZero()) {
|
959
|
+
ClearFlag(HValue::kCanBeDivByZero);
|
960
|
+
}
|
961
|
+
return result;
|
962
|
+
} else {
|
963
|
+
return HValue::InferRange();
|
964
|
+
}
|
965
|
+
}
|
966
|
+
|
967
|
+
|
968
|
+
Range* HMod::InferRange() {
|
969
|
+
if (representation().IsInteger32()) {
|
970
|
+
Range* a = left()->range();
|
971
|
+
Range* result = new Range();
|
972
|
+
if (a->CanBeMinusZero() || a->CanBeNegative()) {
|
973
|
+
result->set_can_be_minus_zero(true);
|
974
|
+
}
|
975
|
+
if (!right()->range()->CanBeZero()) {
|
976
|
+
ClearFlag(HValue::kCanBeDivByZero);
|
977
|
+
}
|
978
|
+
return result;
|
979
|
+
} else {
|
980
|
+
return HValue::InferRange();
|
981
|
+
}
|
982
|
+
}
|
983
|
+
|
984
|
+
|
985
|
+
void HPhi::PrintTo(StringStream* stream) {
|
986
|
+
stream->Add("[");
|
987
|
+
for (int i = 0; i < OperandCount(); ++i) {
|
988
|
+
HValue* value = OperandAt(i);
|
989
|
+
stream->Add(" ");
|
990
|
+
value->PrintNameTo(stream);
|
991
|
+
stream->Add(" ");
|
992
|
+
}
|
993
|
+
stream->Add(" uses%d_%di_%dd_%dt]",
|
994
|
+
UseCount(),
|
995
|
+
int32_non_phi_uses() + int32_indirect_uses(),
|
996
|
+
double_non_phi_uses() + double_indirect_uses(),
|
997
|
+
tagged_non_phi_uses() + tagged_indirect_uses());
|
998
|
+
}
|
999
|
+
|
1000
|
+
|
1001
|
+
void HPhi::AddInput(HValue* value) {
|
1002
|
+
inputs_.Add(NULL);
|
1003
|
+
SetOperandAt(OperandCount() - 1, value);
|
1004
|
+
// Mark phis that may have 'arguments' directly or indirectly as an operand.
|
1005
|
+
if (!CheckFlag(kIsArguments) && value->CheckFlag(kIsArguments)) {
|
1006
|
+
SetFlag(kIsArguments);
|
1007
|
+
}
|
1008
|
+
}
|
1009
|
+
|
1010
|
+
|
1011
|
+
bool HPhi::HasRealUses() {
|
1012
|
+
for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
|
1013
|
+
if (!it.value()->IsPhi()) return true;
|
1014
|
+
}
|
1015
|
+
return false;
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
|
1019
|
+
HValue* HPhi::GetRedundantReplacement() {
|
1020
|
+
HValue* candidate = NULL;
|
1021
|
+
int count = OperandCount();
|
1022
|
+
int position = 0;
|
1023
|
+
while (position < count && candidate == NULL) {
|
1024
|
+
HValue* current = OperandAt(position++);
|
1025
|
+
if (current != this) candidate = current;
|
1026
|
+
}
|
1027
|
+
while (position < count) {
|
1028
|
+
HValue* current = OperandAt(position++);
|
1029
|
+
if (current != this && current != candidate) return NULL;
|
1030
|
+
}
|
1031
|
+
ASSERT(candidate != this);
|
1032
|
+
return candidate;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
|
1036
|
+
void HPhi::DeleteFromGraph() {
|
1037
|
+
ASSERT(block() != NULL);
|
1038
|
+
block()->RemovePhi(this);
|
1039
|
+
ASSERT(block() == NULL);
|
1040
|
+
}
|
1041
|
+
|
1042
|
+
|
1043
|
+
void HPhi::InitRealUses(int phi_id) {
|
1044
|
+
// Initialize real uses.
|
1045
|
+
phi_id_ = phi_id;
|
1046
|
+
for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
|
1047
|
+
HValue* value = it.value();
|
1048
|
+
if (!value->IsPhi()) {
|
1049
|
+
Representation rep = value->RequiredInputRepresentation(it.index());
|
1050
|
+
++non_phi_uses_[rep.kind()];
|
1051
|
+
}
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
|
1056
|
+
void HPhi::AddNonPhiUsesFrom(HPhi* other) {
|
1057
|
+
for (int i = 0; i < Representation::kNumRepresentations; i++) {
|
1058
|
+
indirect_uses_[i] += other->non_phi_uses_[i];
|
1059
|
+
}
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
|
1063
|
+
void HPhi::AddIndirectUsesTo(int* dest) {
|
1064
|
+
for (int i = 0; i < Representation::kNumRepresentations; i++) {
|
1065
|
+
dest[i] += indirect_uses_[i];
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
|
1070
|
+
void HSimulate::PrintDataTo(StringStream* stream) {
|
1071
|
+
stream->Add("id=%d ", ast_id());
|
1072
|
+
if (pop_count_ > 0) stream->Add("pop %d", pop_count_);
|
1073
|
+
if (values_.length() > 0) {
|
1074
|
+
if (pop_count_ > 0) stream->Add(" /");
|
1075
|
+
for (int i = 0; i < values_.length(); ++i) {
|
1076
|
+
if (!HasAssignedIndexAt(i)) {
|
1077
|
+
stream->Add(" push ");
|
1078
|
+
} else {
|
1079
|
+
stream->Add(" var[%d] = ", GetAssignedIndexAt(i));
|
1080
|
+
}
|
1081
|
+
values_[i]->PrintNameTo(stream);
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
|
1087
|
+
void HEnterInlined::PrintDataTo(StringStream* stream) {
|
1088
|
+
SmartPointer<char> name = function()->debug_name()->ToCString();
|
1089
|
+
stream->Add("%s, id=%d", *name, function()->id());
|
1090
|
+
}
|
1091
|
+
|
1092
|
+
|
1093
|
+
HConstant::HConstant(Handle<Object> handle, Representation r)
|
1094
|
+
: handle_(handle),
|
1095
|
+
has_int32_value_(false),
|
1096
|
+
has_double_value_(false),
|
1097
|
+
int32_value_(0),
|
1098
|
+
double_value_(0) {
|
1099
|
+
set_representation(r);
|
1100
|
+
SetFlag(kUseGVN);
|
1101
|
+
if (handle_->IsNumber()) {
|
1102
|
+
double n = handle_->Number();
|
1103
|
+
double roundtrip_value = static_cast<double>(static_cast<int32_t>(n));
|
1104
|
+
has_int32_value_ = BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(n);
|
1105
|
+
if (has_int32_value_) int32_value_ = static_cast<int32_t>(n);
|
1106
|
+
double_value_ = n;
|
1107
|
+
has_double_value_ = true;
|
1108
|
+
}
|
1109
|
+
}
|
1110
|
+
|
1111
|
+
|
1112
|
+
HConstant* HConstant::CopyToRepresentation(Representation r) const {
|
1113
|
+
if (r.IsInteger32() && !has_int32_value_) return NULL;
|
1114
|
+
if (r.IsDouble() && !has_double_value_) return NULL;
|
1115
|
+
return new HConstant(handle_, r);
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
|
1119
|
+
HConstant* HConstant::CopyToTruncatedInt32() const {
|
1120
|
+
if (!has_double_value_) return NULL;
|
1121
|
+
int32_t truncated = NumberToInt32(*handle_);
|
1122
|
+
return new HConstant(FACTORY->NewNumberFromInt(truncated),
|
1123
|
+
Representation::Integer32());
|
1124
|
+
}
|
1125
|
+
|
1126
|
+
|
1127
|
+
bool HConstant::ToBoolean() const {
|
1128
|
+
// Converts the constant's boolean value according to
|
1129
|
+
// ECMAScript section 9.2 ToBoolean conversion.
|
1130
|
+
if (HasInteger32Value()) return Integer32Value() != 0;
|
1131
|
+
if (HasDoubleValue()) {
|
1132
|
+
double v = DoubleValue();
|
1133
|
+
return v != 0 && !isnan(v);
|
1134
|
+
}
|
1135
|
+
if (handle()->IsTrue()) return true;
|
1136
|
+
if (handle()->IsFalse()) return false;
|
1137
|
+
if (handle()->IsUndefined()) return false;
|
1138
|
+
if (handle()->IsNull()) return false;
|
1139
|
+
if (handle()->IsString() &&
|
1140
|
+
String::cast(*handle())->length() == 0) return false;
|
1141
|
+
return true;
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
void HConstant::PrintDataTo(StringStream* stream) {
|
1145
|
+
handle()->ShortPrint(stream);
|
1146
|
+
}
|
1147
|
+
|
1148
|
+
|
1149
|
+
bool HArrayLiteral::IsCopyOnWrite() const {
|
1150
|
+
return constant_elements()->map() == HEAP->fixed_cow_array_map();
|
1151
|
+
}
|
1152
|
+
|
1153
|
+
|
1154
|
+
void HBinaryOperation::PrintDataTo(StringStream* stream) {
|
1155
|
+
left()->PrintNameTo(stream);
|
1156
|
+
stream->Add(" ");
|
1157
|
+
right()->PrintNameTo(stream);
|
1158
|
+
if (CheckFlag(kCanOverflow)) stream->Add(" !");
|
1159
|
+
if (CheckFlag(kBailoutOnMinusZero)) stream->Add(" -0?");
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
|
1163
|
+
Range* HBitAnd::InferRange() {
|
1164
|
+
int32_t left_mask = (left()->range() != NULL)
|
1165
|
+
? left()->range()->Mask()
|
1166
|
+
: 0xffffffff;
|
1167
|
+
int32_t right_mask = (right()->range() != NULL)
|
1168
|
+
? right()->range()->Mask()
|
1169
|
+
: 0xffffffff;
|
1170
|
+
int32_t result_mask = left_mask & right_mask;
|
1171
|
+
return (result_mask >= 0)
|
1172
|
+
? new Range(0, result_mask)
|
1173
|
+
: HValue::InferRange();
|
1174
|
+
}
|
1175
|
+
|
1176
|
+
|
1177
|
+
Range* HBitOr::InferRange() {
|
1178
|
+
int32_t left_mask = (left()->range() != NULL)
|
1179
|
+
? left()->range()->Mask()
|
1180
|
+
: 0xffffffff;
|
1181
|
+
int32_t right_mask = (right()->range() != NULL)
|
1182
|
+
? right()->range()->Mask()
|
1183
|
+
: 0xffffffff;
|
1184
|
+
int32_t result_mask = left_mask | right_mask;
|
1185
|
+
return (result_mask >= 0)
|
1186
|
+
? new Range(0, result_mask)
|
1187
|
+
: HValue::InferRange();
|
1188
|
+
}
|
1189
|
+
|
1190
|
+
|
1191
|
+
Range* HSar::InferRange() {
|
1192
|
+
if (right()->IsConstant()) {
|
1193
|
+
HConstant* c = HConstant::cast(right());
|
1194
|
+
if (c->HasInteger32Value()) {
|
1195
|
+
Range* result = (left()->range() != NULL)
|
1196
|
+
? left()->range()->Copy()
|
1197
|
+
: new Range();
|
1198
|
+
result->Sar(c->Integer32Value());
|
1199
|
+
return result;
|
1200
|
+
}
|
1201
|
+
}
|
1202
|
+
return HValue::InferRange();
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
|
1206
|
+
Range* HShl::InferRange() {
|
1207
|
+
if (right()->IsConstant()) {
|
1208
|
+
HConstant* c = HConstant::cast(right());
|
1209
|
+
if (c->HasInteger32Value()) {
|
1210
|
+
Range* result = (left()->range() != NULL)
|
1211
|
+
? left()->range()->Copy()
|
1212
|
+
: new Range();
|
1213
|
+
result->Shl(c->Integer32Value());
|
1214
|
+
return result;
|
1215
|
+
}
|
1216
|
+
}
|
1217
|
+
return HValue::InferRange();
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
|
1221
|
+
|
1222
|
+
void HCompare::PrintDataTo(StringStream* stream) {
|
1223
|
+
stream->Add(Token::Name(token()));
|
1224
|
+
stream->Add(" ");
|
1225
|
+
HBinaryOperation::PrintDataTo(stream);
|
1226
|
+
}
|
1227
|
+
|
1228
|
+
|
1229
|
+
void HCompare::SetInputRepresentation(Representation r) {
|
1230
|
+
input_representation_ = r;
|
1231
|
+
if (r.IsTagged()) {
|
1232
|
+
SetAllSideEffects();
|
1233
|
+
ClearFlag(kUseGVN);
|
1234
|
+
} else {
|
1235
|
+
ClearAllSideEffects();
|
1236
|
+
SetFlag(kUseGVN);
|
1237
|
+
}
|
1238
|
+
}
|
1239
|
+
|
1240
|
+
|
1241
|
+
void HParameter::PrintDataTo(StringStream* stream) {
|
1242
|
+
stream->Add("%u", index());
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
|
1246
|
+
void HLoadNamedField::PrintDataTo(StringStream* stream) {
|
1247
|
+
object()->PrintNameTo(stream);
|
1248
|
+
stream->Add(" @%d%s", offset(), is_in_object() ? "[in-object]" : "");
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
|
1252
|
+
HLoadNamedFieldPolymorphic::HLoadNamedFieldPolymorphic(HValue* object,
|
1253
|
+
ZoneMapList* types,
|
1254
|
+
Handle<String> name)
|
1255
|
+
: HUnaryOperation(object),
|
1256
|
+
types_(Min(types->length(), kMaxLoadPolymorphism)),
|
1257
|
+
name_(name),
|
1258
|
+
need_generic_(false) {
|
1259
|
+
set_representation(Representation::Tagged());
|
1260
|
+
SetFlag(kDependsOnMaps);
|
1261
|
+
for (int i = 0;
|
1262
|
+
i < types->length() && types_.length() < kMaxLoadPolymorphism;
|
1263
|
+
++i) {
|
1264
|
+
Handle<Map> map = types->at(i);
|
1265
|
+
LookupResult lookup;
|
1266
|
+
map->LookupInDescriptors(NULL, *name, &lookup);
|
1267
|
+
if (lookup.IsProperty()) {
|
1268
|
+
switch (lookup.type()) {
|
1269
|
+
case FIELD: {
|
1270
|
+
int index = lookup.GetLocalFieldIndexFromMap(*map);
|
1271
|
+
if (index < 0) {
|
1272
|
+
SetFlag(kDependsOnInobjectFields);
|
1273
|
+
} else {
|
1274
|
+
SetFlag(kDependsOnBackingStoreFields);
|
1275
|
+
}
|
1276
|
+
types_.Add(types->at(i));
|
1277
|
+
break;
|
1278
|
+
}
|
1279
|
+
case CONSTANT_FUNCTION:
|
1280
|
+
types_.Add(types->at(i));
|
1281
|
+
break;
|
1282
|
+
default:
|
1283
|
+
break;
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
if (types_.length() == types->length() && FLAG_deoptimize_uncommon_cases) {
|
1289
|
+
SetFlag(kUseGVN);
|
1290
|
+
} else {
|
1291
|
+
SetAllSideEffects();
|
1292
|
+
need_generic_ = true;
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
|
1296
|
+
|
1297
|
+
bool HLoadNamedFieldPolymorphic::DataEquals(HValue* value) {
|
1298
|
+
HLoadNamedFieldPolymorphic* other = HLoadNamedFieldPolymorphic::cast(value);
|
1299
|
+
if (types_.length() != other->types()->length()) return false;
|
1300
|
+
if (!name_.is_identical_to(other->name())) return false;
|
1301
|
+
if (need_generic_ != other->need_generic_) return false;
|
1302
|
+
for (int i = 0; i < types_.length(); i++) {
|
1303
|
+
bool found = false;
|
1304
|
+
for (int j = 0; j < types_.length(); j++) {
|
1305
|
+
if (types_.at(j).is_identical_to(other->types()->at(i))) {
|
1306
|
+
found = true;
|
1307
|
+
break;
|
1308
|
+
}
|
1309
|
+
}
|
1310
|
+
if (!found) return false;
|
1311
|
+
}
|
1312
|
+
return true;
|
1313
|
+
}
|
1314
|
+
|
1315
|
+
|
1316
|
+
void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
|
1317
|
+
object()->PrintNameTo(stream);
|
1318
|
+
stream->Add("[");
|
1319
|
+
key()->PrintNameTo(stream);
|
1320
|
+
stream->Add("]");
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
|
1324
|
+
bool HLoadKeyedFastElement::RequiresHoleCheck() const {
|
1325
|
+
for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
|
1326
|
+
HValue* use = it.value();
|
1327
|
+
if (!use->IsChange()) return true;
|
1328
|
+
}
|
1329
|
+
return false;
|
1330
|
+
}
|
1331
|
+
|
1332
|
+
|
1333
|
+
void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
|
1334
|
+
object()->PrintNameTo(stream);
|
1335
|
+
stream->Add("[");
|
1336
|
+
key()->PrintNameTo(stream);
|
1337
|
+
stream->Add("]");
|
1338
|
+
}
|
1339
|
+
|
1340
|
+
|
1341
|
+
void HLoadKeyedSpecializedArrayElement::PrintDataTo(
|
1342
|
+
StringStream* stream) {
|
1343
|
+
external_pointer()->PrintNameTo(stream);
|
1344
|
+
stream->Add(".");
|
1345
|
+
switch (array_type()) {
|
1346
|
+
case kExternalByteArray:
|
1347
|
+
stream->Add("byte");
|
1348
|
+
break;
|
1349
|
+
case kExternalUnsignedByteArray:
|
1350
|
+
stream->Add("u_byte");
|
1351
|
+
break;
|
1352
|
+
case kExternalShortArray:
|
1353
|
+
stream->Add("short");
|
1354
|
+
break;
|
1355
|
+
case kExternalUnsignedShortArray:
|
1356
|
+
stream->Add("u_short");
|
1357
|
+
break;
|
1358
|
+
case kExternalIntArray:
|
1359
|
+
stream->Add("int");
|
1360
|
+
break;
|
1361
|
+
case kExternalUnsignedIntArray:
|
1362
|
+
stream->Add("u_int");
|
1363
|
+
break;
|
1364
|
+
case kExternalFloatArray:
|
1365
|
+
stream->Add("float");
|
1366
|
+
break;
|
1367
|
+
case kExternalDoubleArray:
|
1368
|
+
stream->Add("double");
|
1369
|
+
break;
|
1370
|
+
case kExternalPixelArray:
|
1371
|
+
stream->Add("pixel");
|
1372
|
+
break;
|
1373
|
+
}
|
1374
|
+
stream->Add("[");
|
1375
|
+
key()->PrintNameTo(stream);
|
1376
|
+
stream->Add("]");
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
|
1380
|
+
void HStoreNamedGeneric::PrintDataTo(StringStream* stream) {
|
1381
|
+
object()->PrintNameTo(stream);
|
1382
|
+
stream->Add(".");
|
1383
|
+
ASSERT(name()->IsString());
|
1384
|
+
stream->Add(*String::cast(*name())->ToCString());
|
1385
|
+
stream->Add(" = ");
|
1386
|
+
value()->PrintNameTo(stream);
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
|
1390
|
+
void HStoreNamedField::PrintDataTo(StringStream* stream) {
|
1391
|
+
object()->PrintNameTo(stream);
|
1392
|
+
stream->Add(".");
|
1393
|
+
ASSERT(name()->IsString());
|
1394
|
+
stream->Add(*String::cast(*name())->ToCString());
|
1395
|
+
stream->Add(" = ");
|
1396
|
+
value()->PrintNameTo(stream);
|
1397
|
+
if (!transition().is_null()) {
|
1398
|
+
stream->Add(" (transition map %p)", *transition());
|
1399
|
+
}
|
1400
|
+
}
|
1401
|
+
|
1402
|
+
|
1403
|
+
void HStoreKeyedFastElement::PrintDataTo(StringStream* stream) {
|
1404
|
+
object()->PrintNameTo(stream);
|
1405
|
+
stream->Add("[");
|
1406
|
+
key()->PrintNameTo(stream);
|
1407
|
+
stream->Add("] = ");
|
1408
|
+
value()->PrintNameTo(stream);
|
1409
|
+
}
|
1410
|
+
|
1411
|
+
|
1412
|
+
void HStoreKeyedGeneric::PrintDataTo(StringStream* stream) {
|
1413
|
+
object()->PrintNameTo(stream);
|
1414
|
+
stream->Add("[");
|
1415
|
+
key()->PrintNameTo(stream);
|
1416
|
+
stream->Add("] = ");
|
1417
|
+
value()->PrintNameTo(stream);
|
1418
|
+
}
|
1419
|
+
|
1420
|
+
|
1421
|
+
void HStoreKeyedSpecializedArrayElement::PrintDataTo(
|
1422
|
+
StringStream* stream) {
|
1423
|
+
external_pointer()->PrintNameTo(stream);
|
1424
|
+
stream->Add(".");
|
1425
|
+
switch (array_type()) {
|
1426
|
+
case kExternalByteArray:
|
1427
|
+
stream->Add("byte");
|
1428
|
+
break;
|
1429
|
+
case kExternalUnsignedByteArray:
|
1430
|
+
stream->Add("u_byte");
|
1431
|
+
break;
|
1432
|
+
case kExternalShortArray:
|
1433
|
+
stream->Add("short");
|
1434
|
+
break;
|
1435
|
+
case kExternalUnsignedShortArray:
|
1436
|
+
stream->Add("u_short");
|
1437
|
+
break;
|
1438
|
+
case kExternalIntArray:
|
1439
|
+
stream->Add("int");
|
1440
|
+
break;
|
1441
|
+
case kExternalUnsignedIntArray:
|
1442
|
+
stream->Add("u_int");
|
1443
|
+
break;
|
1444
|
+
case kExternalFloatArray:
|
1445
|
+
stream->Add("float");
|
1446
|
+
break;
|
1447
|
+
case kExternalDoubleArray:
|
1448
|
+
stream->Add("double");
|
1449
|
+
break;
|
1450
|
+
case kExternalPixelArray:
|
1451
|
+
stream->Add("pixel");
|
1452
|
+
break;
|
1453
|
+
}
|
1454
|
+
stream->Add("[");
|
1455
|
+
key()->PrintNameTo(stream);
|
1456
|
+
stream->Add("] = ");
|
1457
|
+
value()->PrintNameTo(stream);
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
|
1461
|
+
void HLoadGlobalCell::PrintDataTo(StringStream* stream) {
|
1462
|
+
stream->Add("[%p]", *cell());
|
1463
|
+
if (check_hole_value()) stream->Add(" (deleteable/read-only)");
|
1464
|
+
}
|
1465
|
+
|
1466
|
+
|
1467
|
+
void HLoadGlobalGeneric::PrintDataTo(StringStream* stream) {
|
1468
|
+
stream->Add("%o ", *name());
|
1469
|
+
}
|
1470
|
+
|
1471
|
+
|
1472
|
+
void HStoreGlobalCell::PrintDataTo(StringStream* stream) {
|
1473
|
+
stream->Add("[%p] = ", *cell());
|
1474
|
+
value()->PrintNameTo(stream);
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
|
1478
|
+
void HStoreGlobalGeneric::PrintDataTo(StringStream* stream) {
|
1479
|
+
stream->Add("%o = ", *name());
|
1480
|
+
value()->PrintNameTo(stream);
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
|
1484
|
+
void HLoadContextSlot::PrintDataTo(StringStream* stream) {
|
1485
|
+
value()->PrintNameTo(stream);
|
1486
|
+
stream->Add("[%d]", slot_index());
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
|
1490
|
+
void HStoreContextSlot::PrintDataTo(StringStream* stream) {
|
1491
|
+
context()->PrintNameTo(stream);
|
1492
|
+
stream->Add("[%d] = ", slot_index());
|
1493
|
+
value()->PrintNameTo(stream);
|
1494
|
+
}
|
1495
|
+
|
1496
|
+
|
1497
|
+
// Implementation of type inference and type conversions. Calculates
|
1498
|
+
// the inferred type of this instruction based on the input operands.
|
1499
|
+
|
1500
|
+
HType HValue::CalculateInferredType() {
|
1501
|
+
return type_;
|
1502
|
+
}
|
1503
|
+
|
1504
|
+
|
1505
|
+
HType HCheckMap::CalculateInferredType() {
|
1506
|
+
return value()->type();
|
1507
|
+
}
|
1508
|
+
|
1509
|
+
|
1510
|
+
HType HCheckFunction::CalculateInferredType() {
|
1511
|
+
return value()->type();
|
1512
|
+
}
|
1513
|
+
|
1514
|
+
|
1515
|
+
HType HCheckNonSmi::CalculateInferredType() {
|
1516
|
+
// TODO(kasperl): Is there any way to signal that this isn't a smi?
|
1517
|
+
return HType::Tagged();
|
1518
|
+
}
|
1519
|
+
|
1520
|
+
|
1521
|
+
HType HCheckSmi::CalculateInferredType() {
|
1522
|
+
return HType::Smi();
|
1523
|
+
}
|
1524
|
+
|
1525
|
+
|
1526
|
+
HType HPhi::CalculateInferredType() {
|
1527
|
+
HType result = HType::Uninitialized();
|
1528
|
+
for (int i = 0; i < OperandCount(); ++i) {
|
1529
|
+
HType current = OperandAt(i)->type();
|
1530
|
+
result = result.Combine(current);
|
1531
|
+
}
|
1532
|
+
return result;
|
1533
|
+
}
|
1534
|
+
|
1535
|
+
|
1536
|
+
HType HConstant::CalculateInferredType() {
|
1537
|
+
return HType::TypeFromValue(handle_);
|
1538
|
+
}
|
1539
|
+
|
1540
|
+
|
1541
|
+
HType HCompare::CalculateInferredType() {
|
1542
|
+
return HType::Boolean();
|
1543
|
+
}
|
1544
|
+
|
1545
|
+
|
1546
|
+
HType HCompareJSObjectEq::CalculateInferredType() {
|
1547
|
+
return HType::Boolean();
|
1548
|
+
}
|
1549
|
+
|
1550
|
+
|
1551
|
+
HType HUnaryPredicate::CalculateInferredType() {
|
1552
|
+
return HType::Boolean();
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
|
1556
|
+
HType HBitwiseBinaryOperation::CalculateInferredType() {
|
1557
|
+
return HType::TaggedNumber();
|
1558
|
+
}
|
1559
|
+
|
1560
|
+
|
1561
|
+
HType HArithmeticBinaryOperation::CalculateInferredType() {
|
1562
|
+
return HType::TaggedNumber();
|
1563
|
+
}
|
1564
|
+
|
1565
|
+
|
1566
|
+
HType HAdd::CalculateInferredType() {
|
1567
|
+
return HType::Tagged();
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
|
1571
|
+
HType HBitAnd::CalculateInferredType() {
|
1572
|
+
return HType::TaggedNumber();
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
|
1576
|
+
HType HBitXor::CalculateInferredType() {
|
1577
|
+
return HType::TaggedNumber();
|
1578
|
+
}
|
1579
|
+
|
1580
|
+
|
1581
|
+
HType HBitOr::CalculateInferredType() {
|
1582
|
+
return HType::TaggedNumber();
|
1583
|
+
}
|
1584
|
+
|
1585
|
+
|
1586
|
+
HType HBitNot::CalculateInferredType() {
|
1587
|
+
return HType::TaggedNumber();
|
1588
|
+
}
|
1589
|
+
|
1590
|
+
|
1591
|
+
HType HUnaryMathOperation::CalculateInferredType() {
|
1592
|
+
return HType::TaggedNumber();
|
1593
|
+
}
|
1594
|
+
|
1595
|
+
|
1596
|
+
HType HShl::CalculateInferredType() {
|
1597
|
+
return HType::TaggedNumber();
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
|
1601
|
+
HType HShr::CalculateInferredType() {
|
1602
|
+
return HType::TaggedNumber();
|
1603
|
+
}
|
1604
|
+
|
1605
|
+
|
1606
|
+
HType HSar::CalculateInferredType() {
|
1607
|
+
return HType::TaggedNumber();
|
1608
|
+
}
|
1609
|
+
|
1610
|
+
|
1611
|
+
HValue* HUnaryMathOperation::EnsureAndPropagateNotMinusZero(
|
1612
|
+
BitVector* visited) {
|
1613
|
+
visited->Add(id());
|
1614
|
+
if (representation().IsInteger32() &&
|
1615
|
+
!value()->representation().IsInteger32()) {
|
1616
|
+
if (value()->range() == NULL || value()->range()->CanBeMinusZero()) {
|
1617
|
+
SetFlag(kBailoutOnMinusZero);
|
1618
|
+
}
|
1619
|
+
}
|
1620
|
+
if (RequiredInputRepresentation(0).IsInteger32() &&
|
1621
|
+
representation().IsInteger32()) {
|
1622
|
+
return value();
|
1623
|
+
}
|
1624
|
+
return NULL;
|
1625
|
+
}
|
1626
|
+
|
1627
|
+
|
1628
|
+
|
1629
|
+
HValue* HChange::EnsureAndPropagateNotMinusZero(BitVector* visited) {
|
1630
|
+
visited->Add(id());
|
1631
|
+
if (from().IsInteger32()) return NULL;
|
1632
|
+
if (CanTruncateToInt32()) return NULL;
|
1633
|
+
if (value()->range() == NULL || value()->range()->CanBeMinusZero()) {
|
1634
|
+
SetFlag(kBailoutOnMinusZero);
|
1635
|
+
}
|
1636
|
+
ASSERT(!from().IsInteger32() || !to().IsInteger32());
|
1637
|
+
return NULL;
|
1638
|
+
}
|
1639
|
+
|
1640
|
+
|
1641
|
+
HValue* HForceRepresentation::EnsureAndPropagateNotMinusZero(
|
1642
|
+
BitVector* visited) {
|
1643
|
+
visited->Add(id());
|
1644
|
+
return value();
|
1645
|
+
}
|
1646
|
+
|
1647
|
+
|
1648
|
+
HValue* HMod::EnsureAndPropagateNotMinusZero(BitVector* visited) {
|
1649
|
+
visited->Add(id());
|
1650
|
+
if (range() == NULL || range()->CanBeMinusZero()) {
|
1651
|
+
SetFlag(kBailoutOnMinusZero);
|
1652
|
+
return left();
|
1653
|
+
}
|
1654
|
+
return NULL;
|
1655
|
+
}
|
1656
|
+
|
1657
|
+
|
1658
|
+
HValue* HDiv::EnsureAndPropagateNotMinusZero(BitVector* visited) {
|
1659
|
+
visited->Add(id());
|
1660
|
+
if (range() == NULL || range()->CanBeMinusZero()) {
|
1661
|
+
SetFlag(kBailoutOnMinusZero);
|
1662
|
+
}
|
1663
|
+
return NULL;
|
1664
|
+
}
|
1665
|
+
|
1666
|
+
|
1667
|
+
HValue* HMul::EnsureAndPropagateNotMinusZero(BitVector* visited) {
|
1668
|
+
visited->Add(id());
|
1669
|
+
if (range() == NULL || range()->CanBeMinusZero()) {
|
1670
|
+
SetFlag(kBailoutOnMinusZero);
|
1671
|
+
}
|
1672
|
+
return NULL;
|
1673
|
+
}
|
1674
|
+
|
1675
|
+
|
1676
|
+
HValue* HSub::EnsureAndPropagateNotMinusZero(BitVector* visited) {
|
1677
|
+
visited->Add(id());
|
1678
|
+
// Propagate to the left argument. If the left argument cannot be -0, then
|
1679
|
+
// the result of the add operation cannot be either.
|
1680
|
+
if (range() == NULL || range()->CanBeMinusZero()) {
|
1681
|
+
return left();
|
1682
|
+
}
|
1683
|
+
return NULL;
|
1684
|
+
}
|
1685
|
+
|
1686
|
+
|
1687
|
+
HValue* HAdd::EnsureAndPropagateNotMinusZero(BitVector* visited) {
|
1688
|
+
visited->Add(id());
|
1689
|
+
// Propagate to the left argument. If the left argument cannot be -0, then
|
1690
|
+
// the result of the sub operation cannot be either.
|
1691
|
+
if (range() == NULL || range()->CanBeMinusZero()) {
|
1692
|
+
return left();
|
1693
|
+
}
|
1694
|
+
return NULL;
|
1695
|
+
}
|
1696
|
+
|
1697
|
+
|
1698
|
+
void HIn::PrintDataTo(StringStream* stream) {
|
1699
|
+
key()->PrintNameTo(stream);
|
1700
|
+
stream->Add(" ");
|
1701
|
+
object()->PrintNameTo(stream);
|
1702
|
+
}
|
1703
|
+
|
1704
|
+
|
1705
|
+
// Node-specific verification code is only included in debug mode.
|
1706
|
+
#ifdef DEBUG
|
1707
|
+
|
1708
|
+
void HPhi::Verify() {
|
1709
|
+
ASSERT(OperandCount() == block()->predecessors()->length());
|
1710
|
+
for (int i = 0; i < OperandCount(); ++i) {
|
1711
|
+
HValue* value = OperandAt(i);
|
1712
|
+
HBasicBlock* defining_block = value->block();
|
1713
|
+
HBasicBlock* predecessor_block = block()->predecessors()->at(i);
|
1714
|
+
ASSERT(defining_block == predecessor_block ||
|
1715
|
+
defining_block->Dominates(predecessor_block));
|
1716
|
+
}
|
1717
|
+
}
|
1718
|
+
|
1719
|
+
|
1720
|
+
void HSimulate::Verify() {
|
1721
|
+
HInstruction::Verify();
|
1722
|
+
ASSERT(HasAstId());
|
1723
|
+
}
|
1724
|
+
|
1725
|
+
|
1726
|
+
void HBoundsCheck::Verify() {
|
1727
|
+
HInstruction::Verify();
|
1728
|
+
ASSERT(HasNoUses());
|
1729
|
+
}
|
1730
|
+
|
1731
|
+
|
1732
|
+
void HCheckSmi::Verify() {
|
1733
|
+
HInstruction::Verify();
|
1734
|
+
ASSERT(HasNoUses());
|
1735
|
+
}
|
1736
|
+
|
1737
|
+
|
1738
|
+
void HCheckNonSmi::Verify() {
|
1739
|
+
HInstruction::Verify();
|
1740
|
+
ASSERT(HasNoUses());
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
|
1744
|
+
void HCheckInstanceType::Verify() {
|
1745
|
+
HInstruction::Verify();
|
1746
|
+
ASSERT(HasNoUses());
|
1747
|
+
}
|
1748
|
+
|
1749
|
+
|
1750
|
+
void HCheckMap::Verify() {
|
1751
|
+
HInstruction::Verify();
|
1752
|
+
ASSERT(HasNoUses());
|
1753
|
+
}
|
1754
|
+
|
1755
|
+
|
1756
|
+
void HCheckFunction::Verify() {
|
1757
|
+
HInstruction::Verify();
|
1758
|
+
ASSERT(HasNoUses());
|
1759
|
+
}
|
1760
|
+
|
1761
|
+
|
1762
|
+
void HCheckPrototypeMaps::Verify() {
|
1763
|
+
HInstruction::Verify();
|
1764
|
+
ASSERT(HasNoUses());
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
#endif
|
1768
|
+
|
1769
|
+
} } // namespace v8::internal
|