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,112 @@
|
|
1
|
+
// Copyright 2011 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#ifndef V8_AST_INL_H_
|
29
|
+
#define V8_AST_INL_H_
|
30
|
+
|
31
|
+
#include "v8.h"
|
32
|
+
|
33
|
+
#include "ast.h"
|
34
|
+
#include "scopes.h"
|
35
|
+
|
36
|
+
namespace v8 {
|
37
|
+
namespace internal {
|
38
|
+
|
39
|
+
|
40
|
+
SwitchStatement::SwitchStatement(ZoneStringList* labels)
|
41
|
+
: BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
|
42
|
+
tag_(NULL), cases_(NULL) {
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
Block::Block(ZoneStringList* labels, int capacity, bool is_initializer_block)
|
47
|
+
: BreakableStatement(labels, TARGET_FOR_NAMED_ONLY),
|
48
|
+
statements_(capacity),
|
49
|
+
is_initializer_block_(is_initializer_block) {
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
BreakableStatement::BreakableStatement(ZoneStringList* labels, Type type)
|
54
|
+
: labels_(labels),
|
55
|
+
type_(type),
|
56
|
+
entry_id_(GetNextId()),
|
57
|
+
exit_id_(GetNextId()) {
|
58
|
+
ASSERT(labels == NULL || labels->length() > 0);
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
IterationStatement::IterationStatement(ZoneStringList* labels)
|
63
|
+
: BreakableStatement(labels, TARGET_FOR_ANONYMOUS),
|
64
|
+
body_(NULL),
|
65
|
+
continue_target_(),
|
66
|
+
osr_entry_id_(GetNextId()) {
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
DoWhileStatement::DoWhileStatement(ZoneStringList* labels)
|
71
|
+
: IterationStatement(labels),
|
72
|
+
cond_(NULL),
|
73
|
+
condition_position_(-1),
|
74
|
+
continue_id_(GetNextId()),
|
75
|
+
back_edge_id_(GetNextId()) {
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
WhileStatement::WhileStatement(ZoneStringList* labels)
|
80
|
+
: IterationStatement(labels),
|
81
|
+
cond_(NULL),
|
82
|
+
may_have_function_literal_(true),
|
83
|
+
body_id_(GetNextId()) {
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
ForStatement::ForStatement(ZoneStringList* labels)
|
88
|
+
: IterationStatement(labels),
|
89
|
+
init_(NULL),
|
90
|
+
cond_(NULL),
|
91
|
+
next_(NULL),
|
92
|
+
may_have_function_literal_(true),
|
93
|
+
loop_variable_(NULL),
|
94
|
+
continue_id_(GetNextId()),
|
95
|
+
body_id_(GetNextId()) {
|
96
|
+
}
|
97
|
+
|
98
|
+
|
99
|
+
ForInStatement::ForInStatement(ZoneStringList* labels)
|
100
|
+
: IterationStatement(labels), each_(NULL), enumerable_(NULL),
|
101
|
+
assignment_id_(GetNextId()) {
|
102
|
+
}
|
103
|
+
|
104
|
+
|
105
|
+
bool FunctionLiteral::strict_mode() const {
|
106
|
+
return scope()->is_strict_mode();
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
} } // namespace v8::internal
|
111
|
+
|
112
|
+
#endif // V8_AST_INL_H_
|
@@ -0,0 +1,1146 @@
|
|
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 "ast.h"
|
31
|
+
#include "parser.h"
|
32
|
+
#include "scopes.h"
|
33
|
+
#include "string-stream.h"
|
34
|
+
#include "type-info.h"
|
35
|
+
|
36
|
+
namespace v8 {
|
37
|
+
namespace internal {
|
38
|
+
|
39
|
+
AstSentinels::AstSentinels()
|
40
|
+
: this_proxy_(true),
|
41
|
+
identifier_proxy_(false),
|
42
|
+
valid_left_hand_side_sentinel_(),
|
43
|
+
this_property_(&this_proxy_, NULL, 0),
|
44
|
+
call_sentinel_(NULL, NULL, 0) {
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
// ----------------------------------------------------------------------------
|
49
|
+
// All the Accept member functions for each syntax tree node type.
|
50
|
+
|
51
|
+
void Slot::Accept(AstVisitor* v) { v->VisitSlot(this); }
|
52
|
+
|
53
|
+
#define DECL_ACCEPT(type) \
|
54
|
+
void type::Accept(AstVisitor* v) { v->Visit##type(this); }
|
55
|
+
AST_NODE_LIST(DECL_ACCEPT)
|
56
|
+
#undef DECL_ACCEPT
|
57
|
+
|
58
|
+
|
59
|
+
// ----------------------------------------------------------------------------
|
60
|
+
// Implementation of other node functionality.
|
61
|
+
|
62
|
+
Assignment* ExpressionStatement::StatementAsSimpleAssignment() {
|
63
|
+
return (expression()->AsAssignment() != NULL &&
|
64
|
+
!expression()->AsAssignment()->is_compound())
|
65
|
+
? expression()->AsAssignment()
|
66
|
+
: NULL;
|
67
|
+
}
|
68
|
+
|
69
|
+
|
70
|
+
CountOperation* ExpressionStatement::StatementAsCountOperation() {
|
71
|
+
return expression()->AsCountOperation();
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
VariableProxy::VariableProxy(Variable* var)
|
76
|
+
: name_(var->name()),
|
77
|
+
var_(NULL), // Will be set by the call to BindTo.
|
78
|
+
is_this_(var->is_this()),
|
79
|
+
inside_with_(false),
|
80
|
+
is_trivial_(false),
|
81
|
+
position_(RelocInfo::kNoPosition) {
|
82
|
+
BindTo(var);
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
VariableProxy::VariableProxy(Handle<String> name,
|
87
|
+
bool is_this,
|
88
|
+
bool inside_with,
|
89
|
+
int position)
|
90
|
+
: name_(name),
|
91
|
+
var_(NULL),
|
92
|
+
is_this_(is_this),
|
93
|
+
inside_with_(inside_with),
|
94
|
+
is_trivial_(false),
|
95
|
+
position_(position) {
|
96
|
+
// Names must be canonicalized for fast equality checks.
|
97
|
+
ASSERT(name->IsSymbol());
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
VariableProxy::VariableProxy(bool is_this)
|
102
|
+
: var_(NULL),
|
103
|
+
is_this_(is_this),
|
104
|
+
inside_with_(false),
|
105
|
+
is_trivial_(false) {
|
106
|
+
}
|
107
|
+
|
108
|
+
|
109
|
+
void VariableProxy::BindTo(Variable* var) {
|
110
|
+
ASSERT(var_ == NULL); // must be bound only once
|
111
|
+
ASSERT(var != NULL); // must bind
|
112
|
+
ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name()));
|
113
|
+
// Ideally CONST-ness should match. However, this is very hard to achieve
|
114
|
+
// because we don't know the exact semantics of conflicting (const and
|
115
|
+
// non-const) multiple variable declarations, const vars introduced via
|
116
|
+
// eval() etc. Const-ness and variable declarations are a complete mess
|
117
|
+
// in JS. Sigh...
|
118
|
+
var_ = var;
|
119
|
+
var->set_is_used(true);
|
120
|
+
}
|
121
|
+
|
122
|
+
|
123
|
+
Assignment::Assignment(Token::Value op,
|
124
|
+
Expression* target,
|
125
|
+
Expression* value,
|
126
|
+
int pos)
|
127
|
+
: op_(op),
|
128
|
+
target_(target),
|
129
|
+
value_(value),
|
130
|
+
pos_(pos),
|
131
|
+
binary_operation_(NULL),
|
132
|
+
compound_load_id_(kNoNumber),
|
133
|
+
assignment_id_(GetNextId()),
|
134
|
+
block_start_(false),
|
135
|
+
block_end_(false),
|
136
|
+
is_monomorphic_(false),
|
137
|
+
receiver_types_(NULL) {
|
138
|
+
ASSERT(Token::IsAssignmentOp(op));
|
139
|
+
if (is_compound()) {
|
140
|
+
binary_operation_ =
|
141
|
+
new BinaryOperation(binary_op(), target, value, pos + 1);
|
142
|
+
compound_load_id_ = GetNextId();
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
|
147
|
+
Token::Value Assignment::binary_op() const {
|
148
|
+
switch (op_) {
|
149
|
+
case Token::ASSIGN_BIT_OR: return Token::BIT_OR;
|
150
|
+
case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR;
|
151
|
+
case Token::ASSIGN_BIT_AND: return Token::BIT_AND;
|
152
|
+
case Token::ASSIGN_SHL: return Token::SHL;
|
153
|
+
case Token::ASSIGN_SAR: return Token::SAR;
|
154
|
+
case Token::ASSIGN_SHR: return Token::SHR;
|
155
|
+
case Token::ASSIGN_ADD: return Token::ADD;
|
156
|
+
case Token::ASSIGN_SUB: return Token::SUB;
|
157
|
+
case Token::ASSIGN_MUL: return Token::MUL;
|
158
|
+
case Token::ASSIGN_DIV: return Token::DIV;
|
159
|
+
case Token::ASSIGN_MOD: return Token::MOD;
|
160
|
+
default: UNREACHABLE();
|
161
|
+
}
|
162
|
+
return Token::ILLEGAL;
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
bool FunctionLiteral::AllowsLazyCompilation() {
|
167
|
+
return scope()->AllowsLazyCompilation();
|
168
|
+
}
|
169
|
+
|
170
|
+
|
171
|
+
ObjectLiteral::Property::Property(Literal* key, Expression* value) {
|
172
|
+
emit_store_ = true;
|
173
|
+
key_ = key;
|
174
|
+
value_ = value;
|
175
|
+
Object* k = *key->handle();
|
176
|
+
if (k->IsSymbol() && HEAP->Proto_symbol()->Equals(String::cast(k))) {
|
177
|
+
kind_ = PROTOTYPE;
|
178
|
+
} else if (value_->AsMaterializedLiteral() != NULL) {
|
179
|
+
kind_ = MATERIALIZED_LITERAL;
|
180
|
+
} else if (value_->AsLiteral() != NULL) {
|
181
|
+
kind_ = CONSTANT;
|
182
|
+
} else {
|
183
|
+
kind_ = COMPUTED;
|
184
|
+
}
|
185
|
+
}
|
186
|
+
|
187
|
+
|
188
|
+
ObjectLiteral::Property::Property(bool is_getter, FunctionLiteral* value) {
|
189
|
+
emit_store_ = true;
|
190
|
+
key_ = new Literal(value->name());
|
191
|
+
value_ = value;
|
192
|
+
kind_ = is_getter ? GETTER : SETTER;
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
bool ObjectLiteral::Property::IsCompileTimeValue() {
|
197
|
+
return kind_ == CONSTANT ||
|
198
|
+
(kind_ == MATERIALIZED_LITERAL &&
|
199
|
+
CompileTimeValue::IsCompileTimeValue(value_));
|
200
|
+
}
|
201
|
+
|
202
|
+
|
203
|
+
void ObjectLiteral::Property::set_emit_store(bool emit_store) {
|
204
|
+
emit_store_ = emit_store;
|
205
|
+
}
|
206
|
+
|
207
|
+
|
208
|
+
bool ObjectLiteral::Property::emit_store() {
|
209
|
+
return emit_store_;
|
210
|
+
}
|
211
|
+
|
212
|
+
|
213
|
+
bool IsEqualString(void* first, void* second) {
|
214
|
+
ASSERT((*reinterpret_cast<String**>(first))->IsString());
|
215
|
+
ASSERT((*reinterpret_cast<String**>(second))->IsString());
|
216
|
+
Handle<String> h1(reinterpret_cast<String**>(first));
|
217
|
+
Handle<String> h2(reinterpret_cast<String**>(second));
|
218
|
+
return (*h1)->Equals(*h2);
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
bool IsEqualNumber(void* first, void* second) {
|
223
|
+
ASSERT((*reinterpret_cast<Object**>(first))->IsNumber());
|
224
|
+
ASSERT((*reinterpret_cast<Object**>(second))->IsNumber());
|
225
|
+
|
226
|
+
Handle<Object> h1(reinterpret_cast<Object**>(first));
|
227
|
+
Handle<Object> h2(reinterpret_cast<Object**>(second));
|
228
|
+
if (h1->IsSmi()) {
|
229
|
+
return h2->IsSmi() && *h1 == *h2;
|
230
|
+
}
|
231
|
+
if (h2->IsSmi()) return false;
|
232
|
+
Handle<HeapNumber> n1 = Handle<HeapNumber>::cast(h1);
|
233
|
+
Handle<HeapNumber> n2 = Handle<HeapNumber>::cast(h2);
|
234
|
+
ASSERT(isfinite(n1->value()));
|
235
|
+
ASSERT(isfinite(n2->value()));
|
236
|
+
return n1->value() == n2->value();
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
void ObjectLiteral::CalculateEmitStore() {
|
241
|
+
HashMap properties(&IsEqualString);
|
242
|
+
HashMap elements(&IsEqualNumber);
|
243
|
+
for (int i = this->properties()->length() - 1; i >= 0; i--) {
|
244
|
+
ObjectLiteral::Property* property = this->properties()->at(i);
|
245
|
+
Literal* literal = property->key();
|
246
|
+
Handle<Object> handle = literal->handle();
|
247
|
+
|
248
|
+
if (handle->IsNull()) {
|
249
|
+
continue;
|
250
|
+
}
|
251
|
+
|
252
|
+
uint32_t hash;
|
253
|
+
HashMap* table;
|
254
|
+
void* key;
|
255
|
+
Factory* factory = Isolate::Current()->factory();
|
256
|
+
if (handle->IsSymbol()) {
|
257
|
+
Handle<String> name(String::cast(*handle));
|
258
|
+
if (name->AsArrayIndex(&hash)) {
|
259
|
+
Handle<Object> key_handle = factory->NewNumberFromUint(hash);
|
260
|
+
key = key_handle.location();
|
261
|
+
table = &elements;
|
262
|
+
} else {
|
263
|
+
key = name.location();
|
264
|
+
hash = name->Hash();
|
265
|
+
table = &properties;
|
266
|
+
}
|
267
|
+
} else if (handle->ToArrayIndex(&hash)) {
|
268
|
+
key = handle.location();
|
269
|
+
table = &elements;
|
270
|
+
} else {
|
271
|
+
ASSERT(handle->IsNumber());
|
272
|
+
double num = handle->Number();
|
273
|
+
char arr[100];
|
274
|
+
Vector<char> buffer(arr, ARRAY_SIZE(arr));
|
275
|
+
const char* str = DoubleToCString(num, buffer);
|
276
|
+
Handle<String> name = factory->NewStringFromAscii(CStrVector(str));
|
277
|
+
key = name.location();
|
278
|
+
hash = name->Hash();
|
279
|
+
table = &properties;
|
280
|
+
}
|
281
|
+
// If the key of a computed property is in the table, do not emit
|
282
|
+
// a store for the property later.
|
283
|
+
if (property->kind() == ObjectLiteral::Property::COMPUTED) {
|
284
|
+
if (table->Lookup(key, hash, false) != NULL) {
|
285
|
+
property->set_emit_store(false);
|
286
|
+
}
|
287
|
+
}
|
288
|
+
// Add key to the table.
|
289
|
+
table->Lookup(key, hash, true);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
void TargetCollector::AddTarget(Label* target) {
|
295
|
+
// Add the label to the collector, but discard duplicates.
|
296
|
+
int length = targets_->length();
|
297
|
+
for (int i = 0; i < length; i++) {
|
298
|
+
if (targets_->at(i) == target) return;
|
299
|
+
}
|
300
|
+
targets_->Add(target);
|
301
|
+
}
|
302
|
+
|
303
|
+
|
304
|
+
bool UnaryOperation::ResultOverwriteAllowed() {
|
305
|
+
switch (op_) {
|
306
|
+
case Token::BIT_NOT:
|
307
|
+
case Token::SUB:
|
308
|
+
return true;
|
309
|
+
default:
|
310
|
+
return false;
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
|
315
|
+
bool BinaryOperation::ResultOverwriteAllowed() {
|
316
|
+
switch (op_) {
|
317
|
+
case Token::COMMA:
|
318
|
+
case Token::OR:
|
319
|
+
case Token::AND:
|
320
|
+
return false;
|
321
|
+
case Token::BIT_OR:
|
322
|
+
case Token::BIT_XOR:
|
323
|
+
case Token::BIT_AND:
|
324
|
+
case Token::SHL:
|
325
|
+
case Token::SAR:
|
326
|
+
case Token::SHR:
|
327
|
+
case Token::ADD:
|
328
|
+
case Token::SUB:
|
329
|
+
case Token::MUL:
|
330
|
+
case Token::DIV:
|
331
|
+
case Token::MOD:
|
332
|
+
return true;
|
333
|
+
default:
|
334
|
+
UNREACHABLE();
|
335
|
+
}
|
336
|
+
return false;
|
337
|
+
}
|
338
|
+
|
339
|
+
|
340
|
+
// ----------------------------------------------------------------------------
|
341
|
+
// Inlining support
|
342
|
+
|
343
|
+
bool Declaration::IsInlineable() const {
|
344
|
+
UNREACHABLE();
|
345
|
+
return false;
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
bool TargetCollector::IsInlineable() const {
|
350
|
+
UNREACHABLE();
|
351
|
+
return false;
|
352
|
+
}
|
353
|
+
|
354
|
+
|
355
|
+
bool Slot::IsInlineable() const {
|
356
|
+
UNREACHABLE();
|
357
|
+
return false;
|
358
|
+
}
|
359
|
+
|
360
|
+
|
361
|
+
bool ForInStatement::IsInlineable() const {
|
362
|
+
return false;
|
363
|
+
}
|
364
|
+
|
365
|
+
|
366
|
+
bool WithEnterStatement::IsInlineable() const {
|
367
|
+
return false;
|
368
|
+
}
|
369
|
+
|
370
|
+
|
371
|
+
bool WithExitStatement::IsInlineable() const {
|
372
|
+
return false;
|
373
|
+
}
|
374
|
+
|
375
|
+
|
376
|
+
bool SwitchStatement::IsInlineable() const {
|
377
|
+
return false;
|
378
|
+
}
|
379
|
+
|
380
|
+
|
381
|
+
bool TryStatement::IsInlineable() const {
|
382
|
+
return false;
|
383
|
+
}
|
384
|
+
|
385
|
+
|
386
|
+
bool TryCatchStatement::IsInlineable() const {
|
387
|
+
return false;
|
388
|
+
}
|
389
|
+
|
390
|
+
|
391
|
+
bool TryFinallyStatement::IsInlineable() const {
|
392
|
+
return false;
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
bool CatchExtensionObject::IsInlineable() const {
|
397
|
+
return false;
|
398
|
+
}
|
399
|
+
|
400
|
+
|
401
|
+
bool DebuggerStatement::IsInlineable() const {
|
402
|
+
return false;
|
403
|
+
}
|
404
|
+
|
405
|
+
|
406
|
+
bool Throw::IsInlineable() const {
|
407
|
+
return exception()->IsInlineable();
|
408
|
+
}
|
409
|
+
|
410
|
+
|
411
|
+
bool MaterializedLiteral::IsInlineable() const {
|
412
|
+
// TODO(1322): Allow materialized literals.
|
413
|
+
return false;
|
414
|
+
}
|
415
|
+
|
416
|
+
|
417
|
+
bool FunctionLiteral::IsInlineable() const {
|
418
|
+
// TODO(1322): Allow materialized literals.
|
419
|
+
return false;
|
420
|
+
}
|
421
|
+
|
422
|
+
|
423
|
+
bool ThisFunction::IsInlineable() const {
|
424
|
+
return false;
|
425
|
+
}
|
426
|
+
|
427
|
+
|
428
|
+
bool SharedFunctionInfoLiteral::IsInlineable() const {
|
429
|
+
return false;
|
430
|
+
}
|
431
|
+
|
432
|
+
|
433
|
+
bool ValidLeftHandSideSentinel::IsInlineable() const {
|
434
|
+
UNREACHABLE();
|
435
|
+
return false;
|
436
|
+
}
|
437
|
+
|
438
|
+
|
439
|
+
bool ForStatement::IsInlineable() const {
|
440
|
+
return (init() == NULL || init()->IsInlineable())
|
441
|
+
&& (cond() == NULL || cond()->IsInlineable())
|
442
|
+
&& (next() == NULL || next()->IsInlineable())
|
443
|
+
&& body()->IsInlineable();
|
444
|
+
}
|
445
|
+
|
446
|
+
|
447
|
+
bool WhileStatement::IsInlineable() const {
|
448
|
+
return cond()->IsInlineable()
|
449
|
+
&& body()->IsInlineable();
|
450
|
+
}
|
451
|
+
|
452
|
+
|
453
|
+
bool DoWhileStatement::IsInlineable() const {
|
454
|
+
return cond()->IsInlineable()
|
455
|
+
&& body()->IsInlineable();
|
456
|
+
}
|
457
|
+
|
458
|
+
|
459
|
+
bool ContinueStatement::IsInlineable() const {
|
460
|
+
return true;
|
461
|
+
}
|
462
|
+
|
463
|
+
|
464
|
+
bool BreakStatement::IsInlineable() const {
|
465
|
+
return true;
|
466
|
+
}
|
467
|
+
|
468
|
+
|
469
|
+
bool EmptyStatement::IsInlineable() const {
|
470
|
+
return true;
|
471
|
+
}
|
472
|
+
|
473
|
+
|
474
|
+
bool Literal::IsInlineable() const {
|
475
|
+
return true;
|
476
|
+
}
|
477
|
+
|
478
|
+
|
479
|
+
bool Block::IsInlineable() const {
|
480
|
+
const int count = statements_.length();
|
481
|
+
for (int i = 0; i < count; ++i) {
|
482
|
+
if (!statements_[i]->IsInlineable()) return false;
|
483
|
+
}
|
484
|
+
return true;
|
485
|
+
}
|
486
|
+
|
487
|
+
|
488
|
+
bool ExpressionStatement::IsInlineable() const {
|
489
|
+
return expression()->IsInlineable();
|
490
|
+
}
|
491
|
+
|
492
|
+
|
493
|
+
bool IfStatement::IsInlineable() const {
|
494
|
+
return condition()->IsInlineable()
|
495
|
+
&& then_statement()->IsInlineable()
|
496
|
+
&& else_statement()->IsInlineable();
|
497
|
+
}
|
498
|
+
|
499
|
+
|
500
|
+
bool ReturnStatement::IsInlineable() const {
|
501
|
+
return expression()->IsInlineable();
|
502
|
+
}
|
503
|
+
|
504
|
+
|
505
|
+
bool Conditional::IsInlineable() const {
|
506
|
+
return condition()->IsInlineable() && then_expression()->IsInlineable() &&
|
507
|
+
else_expression()->IsInlineable();
|
508
|
+
}
|
509
|
+
|
510
|
+
|
511
|
+
bool VariableProxy::IsInlineable() const {
|
512
|
+
return var()->is_global() || var()->IsStackAllocated();
|
513
|
+
}
|
514
|
+
|
515
|
+
|
516
|
+
bool Assignment::IsInlineable() const {
|
517
|
+
return target()->IsInlineable() && value()->IsInlineable();
|
518
|
+
}
|
519
|
+
|
520
|
+
|
521
|
+
bool Property::IsInlineable() const {
|
522
|
+
return obj()->IsInlineable() && key()->IsInlineable();
|
523
|
+
}
|
524
|
+
|
525
|
+
|
526
|
+
bool Call::IsInlineable() const {
|
527
|
+
if (!expression()->IsInlineable()) return false;
|
528
|
+
const int count = arguments()->length();
|
529
|
+
for (int i = 0; i < count; ++i) {
|
530
|
+
if (!arguments()->at(i)->IsInlineable()) return false;
|
531
|
+
}
|
532
|
+
return true;
|
533
|
+
}
|
534
|
+
|
535
|
+
|
536
|
+
bool CallNew::IsInlineable() const {
|
537
|
+
if (!expression()->IsInlineable()) return false;
|
538
|
+
const int count = arguments()->length();
|
539
|
+
for (int i = 0; i < count; ++i) {
|
540
|
+
if (!arguments()->at(i)->IsInlineable()) return false;
|
541
|
+
}
|
542
|
+
return true;
|
543
|
+
}
|
544
|
+
|
545
|
+
|
546
|
+
bool CallRuntime::IsInlineable() const {
|
547
|
+
const int count = arguments()->length();
|
548
|
+
for (int i = 0; i < count; ++i) {
|
549
|
+
if (!arguments()->at(i)->IsInlineable()) return false;
|
550
|
+
}
|
551
|
+
return true;
|
552
|
+
}
|
553
|
+
|
554
|
+
|
555
|
+
bool UnaryOperation::IsInlineable() const {
|
556
|
+
return expression()->IsInlineable();
|
557
|
+
}
|
558
|
+
|
559
|
+
|
560
|
+
bool BinaryOperation::IsInlineable() const {
|
561
|
+
return left()->IsInlineable() && right()->IsInlineable();
|
562
|
+
}
|
563
|
+
|
564
|
+
|
565
|
+
bool CompareOperation::IsInlineable() const {
|
566
|
+
return left()->IsInlineable() && right()->IsInlineable();
|
567
|
+
}
|
568
|
+
|
569
|
+
|
570
|
+
bool CompareToNull::IsInlineable() const {
|
571
|
+
return expression()->IsInlineable();
|
572
|
+
}
|
573
|
+
|
574
|
+
|
575
|
+
bool CountOperation::IsInlineable() const {
|
576
|
+
return expression()->IsInlineable();
|
577
|
+
}
|
578
|
+
|
579
|
+
|
580
|
+
// ----------------------------------------------------------------------------
|
581
|
+
// Recording of type feedback
|
582
|
+
|
583
|
+
void Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
584
|
+
// Record type feedback from the oracle in the AST.
|
585
|
+
is_monomorphic_ = oracle->LoadIsMonomorphic(this);
|
586
|
+
if (key()->IsPropertyName()) {
|
587
|
+
if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_ArrayLength)) {
|
588
|
+
is_array_length_ = true;
|
589
|
+
} else if (oracle->LoadIsBuiltin(this, Builtins::kLoadIC_StringLength)) {
|
590
|
+
is_string_length_ = true;
|
591
|
+
} else if (oracle->LoadIsBuiltin(this,
|
592
|
+
Builtins::kLoadIC_FunctionPrototype)) {
|
593
|
+
is_function_prototype_ = true;
|
594
|
+
} else {
|
595
|
+
Literal* lit_key = key()->AsLiteral();
|
596
|
+
ASSERT(lit_key != NULL && lit_key->handle()->IsString());
|
597
|
+
Handle<String> name = Handle<String>::cast(lit_key->handle());
|
598
|
+
ZoneMapList* types = oracle->LoadReceiverTypes(this, name);
|
599
|
+
receiver_types_ = types;
|
600
|
+
}
|
601
|
+
} else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) {
|
602
|
+
is_string_access_ = true;
|
603
|
+
} else if (is_monomorphic_) {
|
604
|
+
monomorphic_receiver_type_ = oracle->LoadMonomorphicReceiverType(this);
|
605
|
+
if (monomorphic_receiver_type_->has_external_array_elements()) {
|
606
|
+
set_external_array_type(oracle->GetKeyedLoadExternalArrayType(this));
|
607
|
+
}
|
608
|
+
}
|
609
|
+
}
|
610
|
+
|
611
|
+
|
612
|
+
void Assignment::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
613
|
+
Property* prop = target()->AsProperty();
|
614
|
+
ASSERT(prop != NULL);
|
615
|
+
is_monomorphic_ = oracle->StoreIsMonomorphic(this);
|
616
|
+
if (prop->key()->IsPropertyName()) {
|
617
|
+
Literal* lit_key = prop->key()->AsLiteral();
|
618
|
+
ASSERT(lit_key != NULL && lit_key->handle()->IsString());
|
619
|
+
Handle<String> name = Handle<String>::cast(lit_key->handle());
|
620
|
+
ZoneMapList* types = oracle->StoreReceiverTypes(this, name);
|
621
|
+
receiver_types_ = types;
|
622
|
+
} else if (is_monomorphic_) {
|
623
|
+
// Record receiver type for monomorphic keyed loads.
|
624
|
+
monomorphic_receiver_type_ = oracle->StoreMonomorphicReceiverType(this);
|
625
|
+
if (monomorphic_receiver_type_->has_external_array_elements()) {
|
626
|
+
set_external_array_type(oracle->GetKeyedStoreExternalArrayType(this));
|
627
|
+
}
|
628
|
+
}
|
629
|
+
}
|
630
|
+
|
631
|
+
|
632
|
+
void CountOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
633
|
+
is_monomorphic_ = oracle->StoreIsMonomorphic(this);
|
634
|
+
if (is_monomorphic_) {
|
635
|
+
// Record receiver type for monomorphic keyed loads.
|
636
|
+
monomorphic_receiver_type_ = oracle->StoreMonomorphicReceiverType(this);
|
637
|
+
if (monomorphic_receiver_type_->has_external_array_elements()) {
|
638
|
+
set_external_array_type(oracle->GetKeyedStoreExternalArrayType(this));
|
639
|
+
}
|
640
|
+
}
|
641
|
+
}
|
642
|
+
|
643
|
+
|
644
|
+
void CaseClause::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
645
|
+
TypeInfo info = oracle->SwitchType(this);
|
646
|
+
if (info.IsSmi()) {
|
647
|
+
compare_type_ = SMI_ONLY;
|
648
|
+
} else if (info.IsNonPrimitive()) {
|
649
|
+
compare_type_ = OBJECT_ONLY;
|
650
|
+
} else {
|
651
|
+
ASSERT(compare_type_ == NONE);
|
652
|
+
}
|
653
|
+
}
|
654
|
+
|
655
|
+
|
656
|
+
static bool CanCallWithoutIC(Handle<JSFunction> target, int arity) {
|
657
|
+
SharedFunctionInfo* info = target->shared();
|
658
|
+
// If the number of formal parameters of the target function does
|
659
|
+
// not match the number of arguments we're passing, we don't want to
|
660
|
+
// deal with it. Otherwise, we can call it directly.
|
661
|
+
return !target->NeedsArgumentsAdaption() ||
|
662
|
+
info->formal_parameter_count() == arity;
|
663
|
+
}
|
664
|
+
|
665
|
+
|
666
|
+
bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) {
|
667
|
+
if (check_type_ == RECEIVER_MAP_CHECK) {
|
668
|
+
// For primitive checks the holder is set up to point to the
|
669
|
+
// corresponding prototype object, i.e. one step of the algorithm
|
670
|
+
// below has been already performed.
|
671
|
+
// For non-primitive checks we clear it to allow computing targets
|
672
|
+
// for polymorphic calls.
|
673
|
+
holder_ = Handle<JSObject>::null();
|
674
|
+
}
|
675
|
+
while (true) {
|
676
|
+
LookupResult lookup;
|
677
|
+
type->LookupInDescriptors(NULL, *name, &lookup);
|
678
|
+
// If the function wasn't found directly in the map, we start
|
679
|
+
// looking upwards through the prototype chain.
|
680
|
+
if (!lookup.IsFound() && type->prototype()->IsJSObject()) {
|
681
|
+
holder_ = Handle<JSObject>(JSObject::cast(type->prototype()));
|
682
|
+
type = Handle<Map>(holder()->map());
|
683
|
+
} else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) {
|
684
|
+
target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type));
|
685
|
+
return CanCallWithoutIC(target_, arguments()->length());
|
686
|
+
} else {
|
687
|
+
return false;
|
688
|
+
}
|
689
|
+
}
|
690
|
+
}
|
691
|
+
|
692
|
+
|
693
|
+
bool Call::ComputeGlobalTarget(Handle<GlobalObject> global,
|
694
|
+
LookupResult* lookup) {
|
695
|
+
target_ = Handle<JSFunction>::null();
|
696
|
+
cell_ = Handle<JSGlobalPropertyCell>::null();
|
697
|
+
ASSERT(lookup->IsProperty() &&
|
698
|
+
lookup->type() == NORMAL &&
|
699
|
+
lookup->holder() == *global);
|
700
|
+
cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(lookup));
|
701
|
+
if (cell_->value()->IsJSFunction()) {
|
702
|
+
Handle<JSFunction> candidate(JSFunction::cast(cell_->value()));
|
703
|
+
// If the function is in new space we assume it's more likely to
|
704
|
+
// change and thus prefer the general IC code.
|
705
|
+
if (!HEAP->InNewSpace(*candidate) &&
|
706
|
+
CanCallWithoutIC(candidate, arguments()->length())) {
|
707
|
+
target_ = candidate;
|
708
|
+
return true;
|
709
|
+
}
|
710
|
+
}
|
711
|
+
return false;
|
712
|
+
}
|
713
|
+
|
714
|
+
|
715
|
+
void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
|
716
|
+
CallKind call_kind) {
|
717
|
+
Property* property = expression()->AsProperty();
|
718
|
+
ASSERT(property != NULL);
|
719
|
+
// Specialize for the receiver types seen at runtime.
|
720
|
+
Literal* key = property->key()->AsLiteral();
|
721
|
+
ASSERT(key != NULL && key->handle()->IsString());
|
722
|
+
Handle<String> name = Handle<String>::cast(key->handle());
|
723
|
+
receiver_types_ = oracle->CallReceiverTypes(this, name, call_kind);
|
724
|
+
#ifdef DEBUG
|
725
|
+
if (FLAG_enable_slow_asserts) {
|
726
|
+
if (receiver_types_ != NULL) {
|
727
|
+
int length = receiver_types_->length();
|
728
|
+
for (int i = 0; i < length; i++) {
|
729
|
+
Handle<Map> map = receiver_types_->at(i);
|
730
|
+
ASSERT(!map.is_null() && *map != NULL);
|
731
|
+
}
|
732
|
+
}
|
733
|
+
}
|
734
|
+
#endif
|
735
|
+
is_monomorphic_ = oracle->CallIsMonomorphic(this);
|
736
|
+
check_type_ = oracle->GetCallCheckType(this);
|
737
|
+
if (is_monomorphic_) {
|
738
|
+
Handle<Map> map;
|
739
|
+
if (receiver_types_ != NULL && receiver_types_->length() > 0) {
|
740
|
+
ASSERT(check_type_ == RECEIVER_MAP_CHECK);
|
741
|
+
map = receiver_types_->at(0);
|
742
|
+
} else {
|
743
|
+
ASSERT(check_type_ != RECEIVER_MAP_CHECK);
|
744
|
+
holder_ = Handle<JSObject>(
|
745
|
+
oracle->GetPrototypeForPrimitiveCheck(check_type_));
|
746
|
+
map = Handle<Map>(holder_->map());
|
747
|
+
}
|
748
|
+
is_monomorphic_ = ComputeTarget(map, name);
|
749
|
+
}
|
750
|
+
}
|
751
|
+
|
752
|
+
|
753
|
+
void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
|
754
|
+
TypeInfo info = oracle->CompareType(this);
|
755
|
+
if (info.IsSmi()) {
|
756
|
+
compare_type_ = SMI_ONLY;
|
757
|
+
} else if (info.IsNonPrimitive()) {
|
758
|
+
compare_type_ = OBJECT_ONLY;
|
759
|
+
} else {
|
760
|
+
ASSERT(compare_type_ == NONE);
|
761
|
+
}
|
762
|
+
}
|
763
|
+
|
764
|
+
|
765
|
+
// ----------------------------------------------------------------------------
|
766
|
+
// Implementation of AstVisitor
|
767
|
+
|
768
|
+
bool AstVisitor::CheckStackOverflow() {
|
769
|
+
if (stack_overflow_) return true;
|
770
|
+
StackLimitCheck check(isolate_);
|
771
|
+
if (!check.HasOverflowed()) return false;
|
772
|
+
return (stack_overflow_ = true);
|
773
|
+
}
|
774
|
+
|
775
|
+
|
776
|
+
void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) {
|
777
|
+
for (int i = 0; i < declarations->length(); i++) {
|
778
|
+
Visit(declarations->at(i));
|
779
|
+
}
|
780
|
+
}
|
781
|
+
|
782
|
+
|
783
|
+
void AstVisitor::VisitStatements(ZoneList<Statement*>* statements) {
|
784
|
+
for (int i = 0; i < statements->length(); i++) {
|
785
|
+
Visit(statements->at(i));
|
786
|
+
}
|
787
|
+
}
|
788
|
+
|
789
|
+
|
790
|
+
void AstVisitor::VisitExpressions(ZoneList<Expression*>* expressions) {
|
791
|
+
for (int i = 0; i < expressions->length(); i++) {
|
792
|
+
// The variable statement visiting code may pass NULL expressions
|
793
|
+
// to this code. Maybe this should be handled by introducing an
|
794
|
+
// undefined expression or literal? Revisit this code if this
|
795
|
+
// changes
|
796
|
+
Expression* expression = expressions->at(i);
|
797
|
+
if (expression != NULL) Visit(expression);
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
|
802
|
+
// ----------------------------------------------------------------------------
|
803
|
+
// Regular expressions
|
804
|
+
|
805
|
+
#define MAKE_ACCEPT(Name) \
|
806
|
+
void* RegExp##Name::Accept(RegExpVisitor* visitor, void* data) { \
|
807
|
+
return visitor->Visit##Name(this, data); \
|
808
|
+
}
|
809
|
+
FOR_EACH_REG_EXP_TREE_TYPE(MAKE_ACCEPT)
|
810
|
+
#undef MAKE_ACCEPT
|
811
|
+
|
812
|
+
#define MAKE_TYPE_CASE(Name) \
|
813
|
+
RegExp##Name* RegExpTree::As##Name() { \
|
814
|
+
return NULL; \
|
815
|
+
} \
|
816
|
+
bool RegExpTree::Is##Name() { return false; }
|
817
|
+
FOR_EACH_REG_EXP_TREE_TYPE(MAKE_TYPE_CASE)
|
818
|
+
#undef MAKE_TYPE_CASE
|
819
|
+
|
820
|
+
#define MAKE_TYPE_CASE(Name) \
|
821
|
+
RegExp##Name* RegExp##Name::As##Name() { \
|
822
|
+
return this; \
|
823
|
+
} \
|
824
|
+
bool RegExp##Name::Is##Name() { return true; }
|
825
|
+
FOR_EACH_REG_EXP_TREE_TYPE(MAKE_TYPE_CASE)
|
826
|
+
#undef MAKE_TYPE_CASE
|
827
|
+
|
828
|
+
RegExpEmpty RegExpEmpty::kInstance;
|
829
|
+
|
830
|
+
|
831
|
+
static Interval ListCaptureRegisters(ZoneList<RegExpTree*>* children) {
|
832
|
+
Interval result = Interval::Empty();
|
833
|
+
for (int i = 0; i < children->length(); i++)
|
834
|
+
result = result.Union(children->at(i)->CaptureRegisters());
|
835
|
+
return result;
|
836
|
+
}
|
837
|
+
|
838
|
+
|
839
|
+
Interval RegExpAlternative::CaptureRegisters() {
|
840
|
+
return ListCaptureRegisters(nodes());
|
841
|
+
}
|
842
|
+
|
843
|
+
|
844
|
+
Interval RegExpDisjunction::CaptureRegisters() {
|
845
|
+
return ListCaptureRegisters(alternatives());
|
846
|
+
}
|
847
|
+
|
848
|
+
|
849
|
+
Interval RegExpLookahead::CaptureRegisters() {
|
850
|
+
return body()->CaptureRegisters();
|
851
|
+
}
|
852
|
+
|
853
|
+
|
854
|
+
Interval RegExpCapture::CaptureRegisters() {
|
855
|
+
Interval self(StartRegister(index()), EndRegister(index()));
|
856
|
+
return self.Union(body()->CaptureRegisters());
|
857
|
+
}
|
858
|
+
|
859
|
+
|
860
|
+
Interval RegExpQuantifier::CaptureRegisters() {
|
861
|
+
return body()->CaptureRegisters();
|
862
|
+
}
|
863
|
+
|
864
|
+
|
865
|
+
bool RegExpAssertion::IsAnchoredAtStart() {
|
866
|
+
return type() == RegExpAssertion::START_OF_INPUT;
|
867
|
+
}
|
868
|
+
|
869
|
+
|
870
|
+
bool RegExpAssertion::IsAnchoredAtEnd() {
|
871
|
+
return type() == RegExpAssertion::END_OF_INPUT;
|
872
|
+
}
|
873
|
+
|
874
|
+
|
875
|
+
bool RegExpAlternative::IsAnchoredAtStart() {
|
876
|
+
ZoneList<RegExpTree*>* nodes = this->nodes();
|
877
|
+
for (int i = 0; i < nodes->length(); i++) {
|
878
|
+
RegExpTree* node = nodes->at(i);
|
879
|
+
if (node->IsAnchoredAtStart()) { return true; }
|
880
|
+
if (node->max_match() > 0) { return false; }
|
881
|
+
}
|
882
|
+
return false;
|
883
|
+
}
|
884
|
+
|
885
|
+
|
886
|
+
bool RegExpAlternative::IsAnchoredAtEnd() {
|
887
|
+
ZoneList<RegExpTree*>* nodes = this->nodes();
|
888
|
+
for (int i = nodes->length() - 1; i >= 0; i--) {
|
889
|
+
RegExpTree* node = nodes->at(i);
|
890
|
+
if (node->IsAnchoredAtEnd()) { return true; }
|
891
|
+
if (node->max_match() > 0) { return false; }
|
892
|
+
}
|
893
|
+
return false;
|
894
|
+
}
|
895
|
+
|
896
|
+
|
897
|
+
bool RegExpDisjunction::IsAnchoredAtStart() {
|
898
|
+
ZoneList<RegExpTree*>* alternatives = this->alternatives();
|
899
|
+
for (int i = 0; i < alternatives->length(); i++) {
|
900
|
+
if (!alternatives->at(i)->IsAnchoredAtStart())
|
901
|
+
return false;
|
902
|
+
}
|
903
|
+
return true;
|
904
|
+
}
|
905
|
+
|
906
|
+
|
907
|
+
bool RegExpDisjunction::IsAnchoredAtEnd() {
|
908
|
+
ZoneList<RegExpTree*>* alternatives = this->alternatives();
|
909
|
+
for (int i = 0; i < alternatives->length(); i++) {
|
910
|
+
if (!alternatives->at(i)->IsAnchoredAtEnd())
|
911
|
+
return false;
|
912
|
+
}
|
913
|
+
return true;
|
914
|
+
}
|
915
|
+
|
916
|
+
|
917
|
+
bool RegExpLookahead::IsAnchoredAtStart() {
|
918
|
+
return is_positive() && body()->IsAnchoredAtStart();
|
919
|
+
}
|
920
|
+
|
921
|
+
|
922
|
+
bool RegExpCapture::IsAnchoredAtStart() {
|
923
|
+
return body()->IsAnchoredAtStart();
|
924
|
+
}
|
925
|
+
|
926
|
+
|
927
|
+
bool RegExpCapture::IsAnchoredAtEnd() {
|
928
|
+
return body()->IsAnchoredAtEnd();
|
929
|
+
}
|
930
|
+
|
931
|
+
|
932
|
+
// Convert regular expression trees to a simple sexp representation.
|
933
|
+
// This representation should be different from the input grammar
|
934
|
+
// in as many cases as possible, to make it more difficult for incorrect
|
935
|
+
// parses to look as correct ones which is likely if the input and
|
936
|
+
// output formats are alike.
|
937
|
+
class RegExpUnparser: public RegExpVisitor {
|
938
|
+
public:
|
939
|
+
RegExpUnparser();
|
940
|
+
void VisitCharacterRange(CharacterRange that);
|
941
|
+
SmartPointer<const char> ToString() { return stream_.ToCString(); }
|
942
|
+
#define MAKE_CASE(Name) virtual void* Visit##Name(RegExp##Name*, void* data);
|
943
|
+
FOR_EACH_REG_EXP_TREE_TYPE(MAKE_CASE)
|
944
|
+
#undef MAKE_CASE
|
945
|
+
private:
|
946
|
+
StringStream* stream() { return &stream_; }
|
947
|
+
HeapStringAllocator alloc_;
|
948
|
+
StringStream stream_;
|
949
|
+
};
|
950
|
+
|
951
|
+
|
952
|
+
RegExpUnparser::RegExpUnparser() : stream_(&alloc_) {
|
953
|
+
}
|
954
|
+
|
955
|
+
|
956
|
+
void* RegExpUnparser::VisitDisjunction(RegExpDisjunction* that, void* data) {
|
957
|
+
stream()->Add("(|");
|
958
|
+
for (int i = 0; i < that->alternatives()->length(); i++) {
|
959
|
+
stream()->Add(" ");
|
960
|
+
that->alternatives()->at(i)->Accept(this, data);
|
961
|
+
}
|
962
|
+
stream()->Add(")");
|
963
|
+
return NULL;
|
964
|
+
}
|
965
|
+
|
966
|
+
|
967
|
+
void* RegExpUnparser::VisitAlternative(RegExpAlternative* that, void* data) {
|
968
|
+
stream()->Add("(:");
|
969
|
+
for (int i = 0; i < that->nodes()->length(); i++) {
|
970
|
+
stream()->Add(" ");
|
971
|
+
that->nodes()->at(i)->Accept(this, data);
|
972
|
+
}
|
973
|
+
stream()->Add(")");
|
974
|
+
return NULL;
|
975
|
+
}
|
976
|
+
|
977
|
+
|
978
|
+
void RegExpUnparser::VisitCharacterRange(CharacterRange that) {
|
979
|
+
stream()->Add("%k", that.from());
|
980
|
+
if (!that.IsSingleton()) {
|
981
|
+
stream()->Add("-%k", that.to());
|
982
|
+
}
|
983
|
+
}
|
984
|
+
|
985
|
+
|
986
|
+
|
987
|
+
void* RegExpUnparser::VisitCharacterClass(RegExpCharacterClass* that,
|
988
|
+
void* data) {
|
989
|
+
if (that->is_negated())
|
990
|
+
stream()->Add("^");
|
991
|
+
stream()->Add("[");
|
992
|
+
for (int i = 0; i < that->ranges()->length(); i++) {
|
993
|
+
if (i > 0) stream()->Add(" ");
|
994
|
+
VisitCharacterRange(that->ranges()->at(i));
|
995
|
+
}
|
996
|
+
stream()->Add("]");
|
997
|
+
return NULL;
|
998
|
+
}
|
999
|
+
|
1000
|
+
|
1001
|
+
void* RegExpUnparser::VisitAssertion(RegExpAssertion* that, void* data) {
|
1002
|
+
switch (that->type()) {
|
1003
|
+
case RegExpAssertion::START_OF_INPUT:
|
1004
|
+
stream()->Add("@^i");
|
1005
|
+
break;
|
1006
|
+
case RegExpAssertion::END_OF_INPUT:
|
1007
|
+
stream()->Add("@$i");
|
1008
|
+
break;
|
1009
|
+
case RegExpAssertion::START_OF_LINE:
|
1010
|
+
stream()->Add("@^l");
|
1011
|
+
break;
|
1012
|
+
case RegExpAssertion::END_OF_LINE:
|
1013
|
+
stream()->Add("@$l");
|
1014
|
+
break;
|
1015
|
+
case RegExpAssertion::BOUNDARY:
|
1016
|
+
stream()->Add("@b");
|
1017
|
+
break;
|
1018
|
+
case RegExpAssertion::NON_BOUNDARY:
|
1019
|
+
stream()->Add("@B");
|
1020
|
+
break;
|
1021
|
+
}
|
1022
|
+
return NULL;
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
|
1026
|
+
void* RegExpUnparser::VisitAtom(RegExpAtom* that, void* data) {
|
1027
|
+
stream()->Add("'");
|
1028
|
+
Vector<const uc16> chardata = that->data();
|
1029
|
+
for (int i = 0; i < chardata.length(); i++) {
|
1030
|
+
stream()->Add("%k", chardata[i]);
|
1031
|
+
}
|
1032
|
+
stream()->Add("'");
|
1033
|
+
return NULL;
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
|
1037
|
+
void* RegExpUnparser::VisitText(RegExpText* that, void* data) {
|
1038
|
+
if (that->elements()->length() == 1) {
|
1039
|
+
that->elements()->at(0).data.u_atom->Accept(this, data);
|
1040
|
+
} else {
|
1041
|
+
stream()->Add("(!");
|
1042
|
+
for (int i = 0; i < that->elements()->length(); i++) {
|
1043
|
+
stream()->Add(" ");
|
1044
|
+
that->elements()->at(i).data.u_atom->Accept(this, data);
|
1045
|
+
}
|
1046
|
+
stream()->Add(")");
|
1047
|
+
}
|
1048
|
+
return NULL;
|
1049
|
+
}
|
1050
|
+
|
1051
|
+
|
1052
|
+
void* RegExpUnparser::VisitQuantifier(RegExpQuantifier* that, void* data) {
|
1053
|
+
stream()->Add("(# %i ", that->min());
|
1054
|
+
if (that->max() == RegExpTree::kInfinity) {
|
1055
|
+
stream()->Add("- ");
|
1056
|
+
} else {
|
1057
|
+
stream()->Add("%i ", that->max());
|
1058
|
+
}
|
1059
|
+
stream()->Add(that->is_greedy() ? "g " : that->is_possessive() ? "p " : "n ");
|
1060
|
+
that->body()->Accept(this, data);
|
1061
|
+
stream()->Add(")");
|
1062
|
+
return NULL;
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
|
1066
|
+
void* RegExpUnparser::VisitCapture(RegExpCapture* that, void* data) {
|
1067
|
+
stream()->Add("(^ ");
|
1068
|
+
that->body()->Accept(this, data);
|
1069
|
+
stream()->Add(")");
|
1070
|
+
return NULL;
|
1071
|
+
}
|
1072
|
+
|
1073
|
+
|
1074
|
+
void* RegExpUnparser::VisitLookahead(RegExpLookahead* that, void* data) {
|
1075
|
+
stream()->Add("(-> ");
|
1076
|
+
stream()->Add(that->is_positive() ? "+ " : "- ");
|
1077
|
+
that->body()->Accept(this, data);
|
1078
|
+
stream()->Add(")");
|
1079
|
+
return NULL;
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
|
1083
|
+
void* RegExpUnparser::VisitBackReference(RegExpBackReference* that,
|
1084
|
+
void* data) {
|
1085
|
+
stream()->Add("(<- %i)", that->index());
|
1086
|
+
return NULL;
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
|
1090
|
+
void* RegExpUnparser::VisitEmpty(RegExpEmpty* that, void* data) {
|
1091
|
+
stream()->Put('%');
|
1092
|
+
return NULL;
|
1093
|
+
}
|
1094
|
+
|
1095
|
+
|
1096
|
+
SmartPointer<const char> RegExpTree::ToString() {
|
1097
|
+
RegExpUnparser unparser;
|
1098
|
+
Accept(&unparser, NULL);
|
1099
|
+
return unparser.ToString();
|
1100
|
+
}
|
1101
|
+
|
1102
|
+
|
1103
|
+
RegExpDisjunction::RegExpDisjunction(ZoneList<RegExpTree*>* alternatives)
|
1104
|
+
: alternatives_(alternatives) {
|
1105
|
+
ASSERT(alternatives->length() > 1);
|
1106
|
+
RegExpTree* first_alternative = alternatives->at(0);
|
1107
|
+
min_match_ = first_alternative->min_match();
|
1108
|
+
max_match_ = first_alternative->max_match();
|
1109
|
+
for (int i = 1; i < alternatives->length(); i++) {
|
1110
|
+
RegExpTree* alternative = alternatives->at(i);
|
1111
|
+
min_match_ = Min(min_match_, alternative->min_match());
|
1112
|
+
max_match_ = Max(max_match_, alternative->max_match());
|
1113
|
+
}
|
1114
|
+
}
|
1115
|
+
|
1116
|
+
|
1117
|
+
RegExpAlternative::RegExpAlternative(ZoneList<RegExpTree*>* nodes)
|
1118
|
+
: nodes_(nodes) {
|
1119
|
+
ASSERT(nodes->length() > 1);
|
1120
|
+
min_match_ = 0;
|
1121
|
+
max_match_ = 0;
|
1122
|
+
for (int i = 0; i < nodes->length(); i++) {
|
1123
|
+
RegExpTree* node = nodes->at(i);
|
1124
|
+
min_match_ += node->min_match();
|
1125
|
+
int node_max_match = node->max_match();
|
1126
|
+
if (kInfinity - max_match_ < node_max_match) {
|
1127
|
+
max_match_ = kInfinity;
|
1128
|
+
} else {
|
1129
|
+
max_match_ += node->max_match();
|
1130
|
+
}
|
1131
|
+
}
|
1132
|
+
}
|
1133
|
+
|
1134
|
+
|
1135
|
+
CaseClause::CaseClause(Expression* label,
|
1136
|
+
ZoneList<Statement*>* statements,
|
1137
|
+
int pos)
|
1138
|
+
: label_(label),
|
1139
|
+
statements_(statements),
|
1140
|
+
position_(pos),
|
1141
|
+
compare_type_(NONE),
|
1142
|
+
compare_id_(AstNode::GetNextId()),
|
1143
|
+
entry_id_(AstNode::GetNextId()) {
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
} } // namespace v8::internal
|