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,774 @@
|
|
1
|
+
// Copyright 2011 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#include "v8.h"
|
29
|
+
|
30
|
+
#if defined(V8_TARGET_ARCH_IA32)
|
31
|
+
|
32
|
+
#include "codegen.h"
|
33
|
+
#include "deoptimizer.h"
|
34
|
+
#include "full-codegen.h"
|
35
|
+
#include "safepoint-table.h"
|
36
|
+
|
37
|
+
namespace v8 {
|
38
|
+
namespace internal {
|
39
|
+
|
40
|
+
int Deoptimizer::table_entry_size_ = 10;
|
41
|
+
|
42
|
+
|
43
|
+
int Deoptimizer::patch_size() {
|
44
|
+
return Assembler::kCallInstructionLength;
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
static void ZapCodeRange(Address start, Address end) {
|
49
|
+
#ifdef DEBUG
|
50
|
+
ASSERT(start <= end);
|
51
|
+
int size = end - start;
|
52
|
+
CodePatcher destroyer(start, size);
|
53
|
+
while (size-- > 0) destroyer.masm()->int3();
|
54
|
+
#endif
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) {
|
59
|
+
Isolate* isolate = code->GetIsolate();
|
60
|
+
HandleScope scope(isolate);
|
61
|
+
|
62
|
+
// Compute the size of relocation information needed for the code
|
63
|
+
// patching in Deoptimizer::DeoptimizeFunction.
|
64
|
+
int min_reloc_size = 0;
|
65
|
+
Address prev_reloc_address = code->instruction_start();
|
66
|
+
Address code_start_address = code->instruction_start();
|
67
|
+
SafepointTable table(*code);
|
68
|
+
for (unsigned i = 0; i < table.length(); ++i) {
|
69
|
+
Address curr_reloc_address = code_start_address + table.GetPcOffset(i);
|
70
|
+
ASSERT_GE(curr_reloc_address, prev_reloc_address);
|
71
|
+
SafepointEntry safepoint_entry = table.GetEntry(i);
|
72
|
+
int deoptimization_index = safepoint_entry.deoptimization_index();
|
73
|
+
if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
|
74
|
+
// The gap code is needed to get to the state expected at the
|
75
|
+
// bailout and we need to skip the call opcode to get to the
|
76
|
+
// address that needs reloc.
|
77
|
+
curr_reloc_address += safepoint_entry.gap_code_size() + 1;
|
78
|
+
int pc_delta = curr_reloc_address - prev_reloc_address;
|
79
|
+
// We use RUNTIME_ENTRY reloc info which has a size of 2 bytes
|
80
|
+
// if encodable with small pc delta encoding and up to 6 bytes
|
81
|
+
// otherwise.
|
82
|
+
if (pc_delta <= RelocInfo::kMaxSmallPCDelta) {
|
83
|
+
min_reloc_size += 2;
|
84
|
+
} else {
|
85
|
+
min_reloc_size += 6;
|
86
|
+
}
|
87
|
+
prev_reloc_address = curr_reloc_address;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
// If the relocation information is not big enough we create a new
|
92
|
+
// relocation info object that is padded with comments to make it
|
93
|
+
// big enough for lazy doptimization.
|
94
|
+
int reloc_length = code->relocation_info()->length();
|
95
|
+
if (min_reloc_size > reloc_length) {
|
96
|
+
int comment_reloc_size = RelocInfo::kMinRelocCommentSize;
|
97
|
+
// Padding needed.
|
98
|
+
int min_padding = min_reloc_size - reloc_length;
|
99
|
+
// Number of comments needed to take up at least that much space.
|
100
|
+
int additional_comments =
|
101
|
+
(min_padding + comment_reloc_size - 1) / comment_reloc_size;
|
102
|
+
// Actual padding size.
|
103
|
+
int padding = additional_comments * comment_reloc_size;
|
104
|
+
// Allocate new relocation info and copy old relocation to the end
|
105
|
+
// of the new relocation info array because relocation info is
|
106
|
+
// written and read backwards.
|
107
|
+
Factory* factory = isolate->factory();
|
108
|
+
Handle<ByteArray> new_reloc =
|
109
|
+
factory->NewByteArray(reloc_length + padding, TENURED);
|
110
|
+
memcpy(new_reloc->GetDataStartAddress() + padding,
|
111
|
+
code->relocation_info()->GetDataStartAddress(),
|
112
|
+
reloc_length);
|
113
|
+
// Create a relocation writer to write the comments in the padding
|
114
|
+
// space. Use position 0 for everything to ensure short encoding.
|
115
|
+
RelocInfoWriter reloc_info_writer(
|
116
|
+
new_reloc->GetDataStartAddress() + padding, 0);
|
117
|
+
intptr_t comment_string
|
118
|
+
= reinterpret_cast<intptr_t>(RelocInfo::kFillerCommentString);
|
119
|
+
RelocInfo rinfo(0, RelocInfo::COMMENT, comment_string);
|
120
|
+
for (int i = 0; i < additional_comments; ++i) {
|
121
|
+
#ifdef DEBUG
|
122
|
+
byte* pos_before = reloc_info_writer.pos();
|
123
|
+
#endif
|
124
|
+
reloc_info_writer.Write(&rinfo);
|
125
|
+
ASSERT(RelocInfo::kMinRelocCommentSize ==
|
126
|
+
pos_before - reloc_info_writer.pos());
|
127
|
+
}
|
128
|
+
// Replace relocation information on the code object.
|
129
|
+
code->set_relocation_info(*new_reloc);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
|
134
|
+
void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
|
135
|
+
if (!function->IsOptimized()) return;
|
136
|
+
|
137
|
+
Isolate* isolate = function->GetIsolate();
|
138
|
+
HandleScope scope(isolate);
|
139
|
+
AssertNoAllocation no_allocation;
|
140
|
+
|
141
|
+
// Get the optimized code.
|
142
|
+
Code* code = function->code();
|
143
|
+
Address code_start_address = code->instruction_start();
|
144
|
+
|
145
|
+
// We will overwrite the code's relocation info in-place. Relocation info
|
146
|
+
// is written backward. The relocation info is the payload of a byte
|
147
|
+
// array. Later on we will slide this to the start of the byte array and
|
148
|
+
// create a filler object in the remaining space.
|
149
|
+
ByteArray* reloc_info = code->relocation_info();
|
150
|
+
Address reloc_end_address = reloc_info->address() + reloc_info->Size();
|
151
|
+
RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address);
|
152
|
+
|
153
|
+
// For each return after a safepoint insert a call to the corresponding
|
154
|
+
// deoptimization entry. Since the call is a relative encoding, write new
|
155
|
+
// reloc info. We do not need any of the existing reloc info because the
|
156
|
+
// existing code will not be used again (we zap it in debug builds).
|
157
|
+
SafepointTable table(code);
|
158
|
+
Address prev_address = code_start_address;
|
159
|
+
for (unsigned i = 0; i < table.length(); ++i) {
|
160
|
+
Address curr_address = code_start_address + table.GetPcOffset(i);
|
161
|
+
ASSERT_GE(curr_address, prev_address);
|
162
|
+
ZapCodeRange(prev_address, curr_address);
|
163
|
+
|
164
|
+
SafepointEntry safepoint_entry = table.GetEntry(i);
|
165
|
+
int deoptimization_index = safepoint_entry.deoptimization_index();
|
166
|
+
if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
|
167
|
+
// The gap code is needed to get to the state expected at the bailout.
|
168
|
+
curr_address += safepoint_entry.gap_code_size();
|
169
|
+
|
170
|
+
CodePatcher patcher(curr_address, patch_size());
|
171
|
+
Address deopt_entry = GetDeoptimizationEntry(deoptimization_index, LAZY);
|
172
|
+
patcher.masm()->call(deopt_entry, RelocInfo::NONE);
|
173
|
+
|
174
|
+
// We use RUNTIME_ENTRY for deoptimization bailouts.
|
175
|
+
RelocInfo rinfo(curr_address + 1, // 1 after the call opcode.
|
176
|
+
RelocInfo::RUNTIME_ENTRY,
|
177
|
+
reinterpret_cast<intptr_t>(deopt_entry));
|
178
|
+
reloc_info_writer.Write(&rinfo);
|
179
|
+
ASSERT_GE(reloc_info_writer.pos(),
|
180
|
+
reloc_info->address() + ByteArray::kHeaderSize);
|
181
|
+
curr_address += patch_size();
|
182
|
+
}
|
183
|
+
prev_address = curr_address;
|
184
|
+
}
|
185
|
+
ZapCodeRange(prev_address,
|
186
|
+
code_start_address + code->safepoint_table_offset());
|
187
|
+
|
188
|
+
// Move the relocation info to the beginning of the byte array.
|
189
|
+
int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
|
190
|
+
memmove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
|
191
|
+
|
192
|
+
// The relocation info is in place, update the size.
|
193
|
+
reloc_info->set_length(new_reloc_size);
|
194
|
+
|
195
|
+
// Handle the junk part after the new relocation info. We will create
|
196
|
+
// a non-live object in the extra space at the end of the former reloc info.
|
197
|
+
Address junk_address = reloc_info->address() + reloc_info->Size();
|
198
|
+
ASSERT(junk_address <= reloc_end_address);
|
199
|
+
isolate->heap()->CreateFillerObjectAt(junk_address,
|
200
|
+
reloc_end_address - junk_address);
|
201
|
+
|
202
|
+
// Add the deoptimizing code to the list.
|
203
|
+
DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
|
204
|
+
DeoptimizerData* data = isolate->deoptimizer_data();
|
205
|
+
node->set_next(data->deoptimizing_code_list_);
|
206
|
+
data->deoptimizing_code_list_ = node;
|
207
|
+
|
208
|
+
// Set the code for the function to non-optimized version.
|
209
|
+
function->ReplaceCode(function->shared()->code());
|
210
|
+
|
211
|
+
if (FLAG_trace_deopt) {
|
212
|
+
PrintF("[forced deoptimization: ");
|
213
|
+
function->PrintName();
|
214
|
+
PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
|
215
|
+
#ifdef DEBUG
|
216
|
+
if (FLAG_print_code) {
|
217
|
+
code->PrintLn();
|
218
|
+
}
|
219
|
+
#endif
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
|
225
|
+
Code* check_code,
|
226
|
+
Code* replacement_code) {
|
227
|
+
Address call_target_address = pc_after - kIntSize;
|
228
|
+
ASSERT(check_code->entry() ==
|
229
|
+
Assembler::target_address_at(call_target_address));
|
230
|
+
// The stack check code matches the pattern:
|
231
|
+
//
|
232
|
+
// cmp esp, <limit>
|
233
|
+
// jae ok
|
234
|
+
// call <stack guard>
|
235
|
+
// test eax, <loop nesting depth>
|
236
|
+
// ok: ...
|
237
|
+
//
|
238
|
+
// We will patch away the branch so the code is:
|
239
|
+
//
|
240
|
+
// cmp esp, <limit> ;; Not changed
|
241
|
+
// nop
|
242
|
+
// nop
|
243
|
+
// call <on-stack replacment>
|
244
|
+
// test eax, <loop nesting depth>
|
245
|
+
// ok:
|
246
|
+
ASSERT(*(call_target_address - 3) == 0x73 && // jae
|
247
|
+
*(call_target_address - 2) == 0x07 && // offset
|
248
|
+
*(call_target_address - 1) == 0xe8); // call
|
249
|
+
*(call_target_address - 3) = 0x90; // nop
|
250
|
+
*(call_target_address - 2) = 0x90; // nop
|
251
|
+
Assembler::set_target_address_at(call_target_address,
|
252
|
+
replacement_code->entry());
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
|
257
|
+
Code* check_code,
|
258
|
+
Code* replacement_code) {
|
259
|
+
Address call_target_address = pc_after - kIntSize;
|
260
|
+
ASSERT(replacement_code->entry() ==
|
261
|
+
Assembler::target_address_at(call_target_address));
|
262
|
+
// Replace the nops from patching (Deoptimizer::PatchStackCheckCode) to
|
263
|
+
// restore the conditional branch.
|
264
|
+
ASSERT(*(call_target_address - 3) == 0x90 && // nop
|
265
|
+
*(call_target_address - 2) == 0x90 && // nop
|
266
|
+
*(call_target_address - 1) == 0xe8); // call
|
267
|
+
*(call_target_address - 3) = 0x73; // jae
|
268
|
+
*(call_target_address - 2) = 0x07; // offset
|
269
|
+
Assembler::set_target_address_at(call_target_address,
|
270
|
+
check_code->entry());
|
271
|
+
}
|
272
|
+
|
273
|
+
|
274
|
+
static int LookupBailoutId(DeoptimizationInputData* data, unsigned ast_id) {
|
275
|
+
ByteArray* translations = data->TranslationByteArray();
|
276
|
+
int length = data->DeoptCount();
|
277
|
+
for (int i = 0; i < length; i++) {
|
278
|
+
if (static_cast<unsigned>(data->AstId(i)->value()) == ast_id) {
|
279
|
+
TranslationIterator it(translations, data->TranslationIndex(i)->value());
|
280
|
+
int value = it.Next();
|
281
|
+
ASSERT(Translation::BEGIN == static_cast<Translation::Opcode>(value));
|
282
|
+
// Read the number of frames.
|
283
|
+
value = it.Next();
|
284
|
+
if (value == 1) return i;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
UNREACHABLE();
|
288
|
+
return -1;
|
289
|
+
}
|
290
|
+
|
291
|
+
|
292
|
+
void Deoptimizer::DoComputeOsrOutputFrame() {
|
293
|
+
DeoptimizationInputData* data = DeoptimizationInputData::cast(
|
294
|
+
optimized_code_->deoptimization_data());
|
295
|
+
unsigned ast_id = data->OsrAstId()->value();
|
296
|
+
// TODO(kasperl): This should not be the bailout_id_. It should be
|
297
|
+
// the ast id. Confusing.
|
298
|
+
ASSERT(bailout_id_ == ast_id);
|
299
|
+
|
300
|
+
int bailout_id = LookupBailoutId(data, ast_id);
|
301
|
+
unsigned translation_index = data->TranslationIndex(bailout_id)->value();
|
302
|
+
ByteArray* translations = data->TranslationByteArray();
|
303
|
+
|
304
|
+
TranslationIterator iterator(translations, translation_index);
|
305
|
+
Translation::Opcode opcode =
|
306
|
+
static_cast<Translation::Opcode>(iterator.Next());
|
307
|
+
ASSERT(Translation::BEGIN == opcode);
|
308
|
+
USE(opcode);
|
309
|
+
int count = iterator.Next();
|
310
|
+
ASSERT(count == 1);
|
311
|
+
USE(count);
|
312
|
+
|
313
|
+
opcode = static_cast<Translation::Opcode>(iterator.Next());
|
314
|
+
USE(opcode);
|
315
|
+
ASSERT(Translation::FRAME == opcode);
|
316
|
+
unsigned node_id = iterator.Next();
|
317
|
+
USE(node_id);
|
318
|
+
ASSERT(node_id == ast_id);
|
319
|
+
JSFunction* function = JSFunction::cast(ComputeLiteral(iterator.Next()));
|
320
|
+
USE(function);
|
321
|
+
ASSERT(function == function_);
|
322
|
+
unsigned height = iterator.Next();
|
323
|
+
unsigned height_in_bytes = height * kPointerSize;
|
324
|
+
USE(height_in_bytes);
|
325
|
+
|
326
|
+
unsigned fixed_size = ComputeFixedSize(function_);
|
327
|
+
unsigned input_frame_size = input_->GetFrameSize();
|
328
|
+
ASSERT(fixed_size + height_in_bytes == input_frame_size);
|
329
|
+
|
330
|
+
unsigned stack_slot_size = optimized_code_->stack_slots() * kPointerSize;
|
331
|
+
unsigned outgoing_height = data->ArgumentsStackHeight(bailout_id)->value();
|
332
|
+
unsigned outgoing_size = outgoing_height * kPointerSize;
|
333
|
+
unsigned output_frame_size = fixed_size + stack_slot_size + outgoing_size;
|
334
|
+
ASSERT(outgoing_size == 0); // OSR does not happen in the middle of a call.
|
335
|
+
|
336
|
+
if (FLAG_trace_osr) {
|
337
|
+
PrintF("[on-stack replacement: begin 0x%08" V8PRIxPTR " ",
|
338
|
+
reinterpret_cast<intptr_t>(function_));
|
339
|
+
function_->PrintName();
|
340
|
+
PrintF(" => node=%u, frame=%d->%d]\n",
|
341
|
+
ast_id,
|
342
|
+
input_frame_size,
|
343
|
+
output_frame_size);
|
344
|
+
}
|
345
|
+
|
346
|
+
// There's only one output frame in the OSR case.
|
347
|
+
output_count_ = 1;
|
348
|
+
output_ = new FrameDescription*[1];
|
349
|
+
output_[0] = new(output_frame_size) FrameDescription(
|
350
|
+
output_frame_size, function_);
|
351
|
+
|
352
|
+
// Clear the incoming parameters in the optimized frame to avoid
|
353
|
+
// confusing the garbage collector.
|
354
|
+
unsigned output_offset = output_frame_size - kPointerSize;
|
355
|
+
int parameter_count = function_->shared()->formal_parameter_count() + 1;
|
356
|
+
for (int i = 0; i < parameter_count; ++i) {
|
357
|
+
output_[0]->SetFrameSlot(output_offset, 0);
|
358
|
+
output_offset -= kPointerSize;
|
359
|
+
}
|
360
|
+
|
361
|
+
// Translate the incoming parameters. This may overwrite some of the
|
362
|
+
// incoming argument slots we've just cleared.
|
363
|
+
int input_offset = input_frame_size - kPointerSize;
|
364
|
+
bool ok = true;
|
365
|
+
int limit = input_offset - (parameter_count * kPointerSize);
|
366
|
+
while (ok && input_offset > limit) {
|
367
|
+
ok = DoOsrTranslateCommand(&iterator, &input_offset);
|
368
|
+
}
|
369
|
+
|
370
|
+
// There are no translation commands for the caller's pc and fp, the
|
371
|
+
// context, and the function. Set them up explicitly.
|
372
|
+
for (int i = StandardFrameConstants::kCallerPCOffset;
|
373
|
+
ok && i >= StandardFrameConstants::kMarkerOffset;
|
374
|
+
i -= kPointerSize) {
|
375
|
+
uint32_t input_value = input_->GetFrameSlot(input_offset);
|
376
|
+
if (FLAG_trace_osr) {
|
377
|
+
const char* name = "UNKNOWN";
|
378
|
+
switch (i) {
|
379
|
+
case StandardFrameConstants::kCallerPCOffset:
|
380
|
+
name = "caller's pc";
|
381
|
+
break;
|
382
|
+
case StandardFrameConstants::kCallerFPOffset:
|
383
|
+
name = "fp";
|
384
|
+
break;
|
385
|
+
case StandardFrameConstants::kContextOffset:
|
386
|
+
name = "context";
|
387
|
+
break;
|
388
|
+
case StandardFrameConstants::kMarkerOffset:
|
389
|
+
name = "function";
|
390
|
+
break;
|
391
|
+
}
|
392
|
+
PrintF(" [esp + %d] <- 0x%08x ; [esp + %d] (fixed part - %s)\n",
|
393
|
+
output_offset,
|
394
|
+
input_value,
|
395
|
+
input_offset,
|
396
|
+
name);
|
397
|
+
}
|
398
|
+
output_[0]->SetFrameSlot(output_offset, input_->GetFrameSlot(input_offset));
|
399
|
+
input_offset -= kPointerSize;
|
400
|
+
output_offset -= kPointerSize;
|
401
|
+
}
|
402
|
+
|
403
|
+
// Translate the rest of the frame.
|
404
|
+
while (ok && input_offset >= 0) {
|
405
|
+
ok = DoOsrTranslateCommand(&iterator, &input_offset);
|
406
|
+
}
|
407
|
+
|
408
|
+
// If translation of any command failed, continue using the input frame.
|
409
|
+
if (!ok) {
|
410
|
+
delete output_[0];
|
411
|
+
output_[0] = input_;
|
412
|
+
output_[0]->SetPc(reinterpret_cast<uint32_t>(from_));
|
413
|
+
} else {
|
414
|
+
// Setup the frame pointer and the context pointer.
|
415
|
+
output_[0]->SetRegister(ebp.code(), input_->GetRegister(ebp.code()));
|
416
|
+
output_[0]->SetRegister(esi.code(), input_->GetRegister(esi.code()));
|
417
|
+
|
418
|
+
unsigned pc_offset = data->OsrPcOffset()->value();
|
419
|
+
uint32_t pc = reinterpret_cast<uint32_t>(
|
420
|
+
optimized_code_->entry() + pc_offset);
|
421
|
+
output_[0]->SetPc(pc);
|
422
|
+
}
|
423
|
+
Code* continuation =
|
424
|
+
function->GetIsolate()->builtins()->builtin(Builtins::kNotifyOSR);
|
425
|
+
output_[0]->SetContinuation(
|
426
|
+
reinterpret_cast<uint32_t>(continuation->entry()));
|
427
|
+
|
428
|
+
if (FLAG_trace_osr) {
|
429
|
+
PrintF("[on-stack replacement translation %s: 0x%08" V8PRIxPTR " ",
|
430
|
+
ok ? "finished" : "aborted",
|
431
|
+
reinterpret_cast<intptr_t>(function));
|
432
|
+
function->PrintName();
|
433
|
+
PrintF(" => pc=0x%0x]\n", output_[0]->GetPc());
|
434
|
+
}
|
435
|
+
}
|
436
|
+
|
437
|
+
|
438
|
+
void Deoptimizer::DoComputeFrame(TranslationIterator* iterator,
|
439
|
+
int frame_index) {
|
440
|
+
// Read the ast node id, function, and frame height for this output frame.
|
441
|
+
Translation::Opcode opcode =
|
442
|
+
static_cast<Translation::Opcode>(iterator->Next());
|
443
|
+
USE(opcode);
|
444
|
+
ASSERT(Translation::FRAME == opcode);
|
445
|
+
int node_id = iterator->Next();
|
446
|
+
JSFunction* function = JSFunction::cast(ComputeLiteral(iterator->Next()));
|
447
|
+
unsigned height = iterator->Next();
|
448
|
+
unsigned height_in_bytes = height * kPointerSize;
|
449
|
+
if (FLAG_trace_deopt) {
|
450
|
+
PrintF(" translating ");
|
451
|
+
function->PrintName();
|
452
|
+
PrintF(" => node=%d, height=%d\n", node_id, height_in_bytes);
|
453
|
+
}
|
454
|
+
|
455
|
+
// The 'fixed' part of the frame consists of the incoming parameters and
|
456
|
+
// the part described by JavaScriptFrameConstants.
|
457
|
+
unsigned fixed_frame_size = ComputeFixedSize(function);
|
458
|
+
unsigned input_frame_size = input_->GetFrameSize();
|
459
|
+
unsigned output_frame_size = height_in_bytes + fixed_frame_size;
|
460
|
+
|
461
|
+
// Allocate and store the output frame description.
|
462
|
+
FrameDescription* output_frame =
|
463
|
+
new(output_frame_size) FrameDescription(output_frame_size, function);
|
464
|
+
|
465
|
+
bool is_bottommost = (0 == frame_index);
|
466
|
+
bool is_topmost = (output_count_ - 1 == frame_index);
|
467
|
+
ASSERT(frame_index >= 0 && frame_index < output_count_);
|
468
|
+
ASSERT(output_[frame_index] == NULL);
|
469
|
+
output_[frame_index] = output_frame;
|
470
|
+
|
471
|
+
// The top address for the bottommost output frame can be computed from
|
472
|
+
// the input frame pointer and the output frame's height. For all
|
473
|
+
// subsequent output frames, it can be computed from the previous one's
|
474
|
+
// top address and the current frame's size.
|
475
|
+
uint32_t top_address;
|
476
|
+
if (is_bottommost) {
|
477
|
+
// 2 = context and function in the frame.
|
478
|
+
top_address =
|
479
|
+
input_->GetRegister(ebp.code()) - (2 * kPointerSize) - height_in_bytes;
|
480
|
+
} else {
|
481
|
+
top_address = output_[frame_index - 1]->GetTop() - output_frame_size;
|
482
|
+
}
|
483
|
+
output_frame->SetTop(top_address);
|
484
|
+
|
485
|
+
// Compute the incoming parameter translation.
|
486
|
+
int parameter_count = function->shared()->formal_parameter_count() + 1;
|
487
|
+
unsigned output_offset = output_frame_size;
|
488
|
+
unsigned input_offset = input_frame_size;
|
489
|
+
for (int i = 0; i < parameter_count; ++i) {
|
490
|
+
output_offset -= kPointerSize;
|
491
|
+
DoTranslateCommand(iterator, frame_index, output_offset);
|
492
|
+
}
|
493
|
+
input_offset -= (parameter_count * kPointerSize);
|
494
|
+
|
495
|
+
// There are no translation commands for the caller's pc and fp, the
|
496
|
+
// context, and the function. Synthesize their values and set them up
|
497
|
+
// explicitly.
|
498
|
+
//
|
499
|
+
// The caller's pc for the bottommost output frame is the same as in the
|
500
|
+
// input frame. For all subsequent output frames, it can be read from the
|
501
|
+
// previous one. This frame's pc can be computed from the non-optimized
|
502
|
+
// function code and AST id of the bailout.
|
503
|
+
output_offset -= kPointerSize;
|
504
|
+
input_offset -= kPointerSize;
|
505
|
+
intptr_t value;
|
506
|
+
if (is_bottommost) {
|
507
|
+
value = input_->GetFrameSlot(input_offset);
|
508
|
+
} else {
|
509
|
+
value = output_[frame_index - 1]->GetPc();
|
510
|
+
}
|
511
|
+
output_frame->SetFrameSlot(output_offset, value);
|
512
|
+
if (FLAG_trace_deopt) {
|
513
|
+
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's pc\n",
|
514
|
+
top_address + output_offset, output_offset, value);
|
515
|
+
}
|
516
|
+
|
517
|
+
// The caller's frame pointer for the bottommost output frame is the same
|
518
|
+
// as in the input frame. For all subsequent output frames, it can be
|
519
|
+
// read from the previous one. Also compute and set this frame's frame
|
520
|
+
// pointer.
|
521
|
+
output_offset -= kPointerSize;
|
522
|
+
input_offset -= kPointerSize;
|
523
|
+
if (is_bottommost) {
|
524
|
+
value = input_->GetFrameSlot(input_offset);
|
525
|
+
} else {
|
526
|
+
value = output_[frame_index - 1]->GetFp();
|
527
|
+
}
|
528
|
+
output_frame->SetFrameSlot(output_offset, value);
|
529
|
+
intptr_t fp_value = top_address + output_offset;
|
530
|
+
ASSERT(!is_bottommost || input_->GetRegister(ebp.code()) == fp_value);
|
531
|
+
output_frame->SetFp(fp_value);
|
532
|
+
if (is_topmost) output_frame->SetRegister(ebp.code(), fp_value);
|
533
|
+
if (FLAG_trace_deopt) {
|
534
|
+
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
|
535
|
+
fp_value, output_offset, value);
|
536
|
+
}
|
537
|
+
|
538
|
+
// For the bottommost output frame the context can be gotten from the input
|
539
|
+
// frame. For all subsequent output frames it can be gotten from the function
|
540
|
+
// so long as we don't inline functions that need local contexts.
|
541
|
+
output_offset -= kPointerSize;
|
542
|
+
input_offset -= kPointerSize;
|
543
|
+
if (is_bottommost) {
|
544
|
+
value = input_->GetFrameSlot(input_offset);
|
545
|
+
} else {
|
546
|
+
value = reinterpret_cast<uint32_t>(function->context());
|
547
|
+
}
|
548
|
+
output_frame->SetFrameSlot(output_offset, value);
|
549
|
+
if (is_topmost) output_frame->SetRegister(esi.code(), value);
|
550
|
+
if (FLAG_trace_deopt) {
|
551
|
+
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
|
552
|
+
top_address + output_offset, output_offset, value);
|
553
|
+
}
|
554
|
+
|
555
|
+
// The function was mentioned explicitly in the BEGIN_FRAME.
|
556
|
+
output_offset -= kPointerSize;
|
557
|
+
input_offset -= kPointerSize;
|
558
|
+
value = reinterpret_cast<uint32_t>(function);
|
559
|
+
// The function for the bottommost output frame should also agree with the
|
560
|
+
// input frame.
|
561
|
+
ASSERT(!is_bottommost || input_->GetFrameSlot(input_offset) == value);
|
562
|
+
output_frame->SetFrameSlot(output_offset, value);
|
563
|
+
if (FLAG_trace_deopt) {
|
564
|
+
PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function\n",
|
565
|
+
top_address + output_offset, output_offset, value);
|
566
|
+
}
|
567
|
+
|
568
|
+
// Translate the rest of the frame.
|
569
|
+
for (unsigned i = 0; i < height; ++i) {
|
570
|
+
output_offset -= kPointerSize;
|
571
|
+
DoTranslateCommand(iterator, frame_index, output_offset);
|
572
|
+
}
|
573
|
+
ASSERT(0 == output_offset);
|
574
|
+
|
575
|
+
// Compute this frame's PC, state, and continuation.
|
576
|
+
Code* non_optimized_code = function->shared()->code();
|
577
|
+
FixedArray* raw_data = non_optimized_code->deoptimization_data();
|
578
|
+
DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data);
|
579
|
+
Address start = non_optimized_code->instruction_start();
|
580
|
+
unsigned pc_and_state = GetOutputInfo(data, node_id, function->shared());
|
581
|
+
unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
|
582
|
+
uint32_t pc_value = reinterpret_cast<uint32_t>(start + pc_offset);
|
583
|
+
output_frame->SetPc(pc_value);
|
584
|
+
|
585
|
+
FullCodeGenerator::State state =
|
586
|
+
FullCodeGenerator::StateField::decode(pc_and_state);
|
587
|
+
output_frame->SetState(Smi::FromInt(state));
|
588
|
+
|
589
|
+
// Set the continuation for the topmost frame.
|
590
|
+
if (is_topmost) {
|
591
|
+
Builtins* builtins = isolate_->builtins();
|
592
|
+
Code* continuation = (bailout_type_ == EAGER)
|
593
|
+
? builtins->builtin(Builtins::kNotifyDeoptimized)
|
594
|
+
: builtins->builtin(Builtins::kNotifyLazyDeoptimized);
|
595
|
+
output_frame->SetContinuation(
|
596
|
+
reinterpret_cast<uint32_t>(continuation->entry()));
|
597
|
+
}
|
598
|
+
|
599
|
+
if (output_count_ - 1 == frame_index) iterator->Done();
|
600
|
+
}
|
601
|
+
|
602
|
+
|
603
|
+
#define __ masm()->
|
604
|
+
|
605
|
+
void Deoptimizer::EntryGenerator::Generate() {
|
606
|
+
GeneratePrologue();
|
607
|
+
CpuFeatures::Scope scope(SSE2);
|
608
|
+
|
609
|
+
Isolate* isolate = masm()->isolate();
|
610
|
+
|
611
|
+
// Save all general purpose registers before messing with them.
|
612
|
+
const int kNumberOfRegisters = Register::kNumRegisters;
|
613
|
+
|
614
|
+
const int kDoubleRegsSize = kDoubleSize *
|
615
|
+
XMMRegister::kNumAllocatableRegisters;
|
616
|
+
__ sub(Operand(esp), Immediate(kDoubleRegsSize));
|
617
|
+
for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
|
618
|
+
XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
|
619
|
+
int offset = i * kDoubleSize;
|
620
|
+
__ movdbl(Operand(esp, offset), xmm_reg);
|
621
|
+
}
|
622
|
+
|
623
|
+
__ pushad();
|
624
|
+
|
625
|
+
const int kSavedRegistersAreaSize = kNumberOfRegisters * kPointerSize +
|
626
|
+
kDoubleRegsSize;
|
627
|
+
|
628
|
+
// Get the bailout id from the stack.
|
629
|
+
__ mov(ebx, Operand(esp, kSavedRegistersAreaSize));
|
630
|
+
|
631
|
+
// Get the address of the location in the code object if possible
|
632
|
+
// and compute the fp-to-sp delta in register edx.
|
633
|
+
if (type() == EAGER) {
|
634
|
+
__ Set(ecx, Immediate(0));
|
635
|
+
__ lea(edx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize));
|
636
|
+
} else {
|
637
|
+
__ mov(ecx, Operand(esp, kSavedRegistersAreaSize + 1 * kPointerSize));
|
638
|
+
__ lea(edx, Operand(esp, kSavedRegistersAreaSize + 2 * kPointerSize));
|
639
|
+
}
|
640
|
+
__ sub(edx, Operand(ebp));
|
641
|
+
__ neg(edx);
|
642
|
+
|
643
|
+
// Allocate a new deoptimizer object.
|
644
|
+
__ PrepareCallCFunction(6, eax);
|
645
|
+
__ mov(eax, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
|
646
|
+
__ mov(Operand(esp, 0 * kPointerSize), eax); // Function.
|
647
|
+
__ mov(Operand(esp, 1 * kPointerSize), Immediate(type())); // Bailout type.
|
648
|
+
__ mov(Operand(esp, 2 * kPointerSize), ebx); // Bailout id.
|
649
|
+
__ mov(Operand(esp, 3 * kPointerSize), ecx); // Code address or 0.
|
650
|
+
__ mov(Operand(esp, 4 * kPointerSize), edx); // Fp-to-sp delta.
|
651
|
+
__ mov(Operand(esp, 5 * kPointerSize),
|
652
|
+
Immediate(ExternalReference::isolate_address()));
|
653
|
+
__ CallCFunction(ExternalReference::new_deoptimizer_function(isolate), 6);
|
654
|
+
|
655
|
+
// Preserve deoptimizer object in register eax and get the input
|
656
|
+
// frame descriptor pointer.
|
657
|
+
__ mov(ebx, Operand(eax, Deoptimizer::input_offset()));
|
658
|
+
|
659
|
+
// Fill in the input registers.
|
660
|
+
for (int i = kNumberOfRegisters - 1; i >= 0; i--) {
|
661
|
+
int offset = (i * kPointerSize) + FrameDescription::registers_offset();
|
662
|
+
__ pop(Operand(ebx, offset));
|
663
|
+
}
|
664
|
+
|
665
|
+
// Fill in the double input registers.
|
666
|
+
int double_regs_offset = FrameDescription::double_registers_offset();
|
667
|
+
for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
|
668
|
+
int dst_offset = i * kDoubleSize + double_regs_offset;
|
669
|
+
int src_offset = i * kDoubleSize;
|
670
|
+
__ movdbl(xmm0, Operand(esp, src_offset));
|
671
|
+
__ movdbl(Operand(ebx, dst_offset), xmm0);
|
672
|
+
}
|
673
|
+
|
674
|
+
// Remove the bailout id and the double registers from the stack.
|
675
|
+
if (type() == EAGER) {
|
676
|
+
__ add(Operand(esp), Immediate(kDoubleRegsSize + kPointerSize));
|
677
|
+
} else {
|
678
|
+
__ add(Operand(esp), Immediate(kDoubleRegsSize + 2 * kPointerSize));
|
679
|
+
}
|
680
|
+
|
681
|
+
// Compute a pointer to the unwinding limit in register ecx; that is
|
682
|
+
// the first stack slot not part of the input frame.
|
683
|
+
__ mov(ecx, Operand(ebx, FrameDescription::frame_size_offset()));
|
684
|
+
__ add(ecx, Operand(esp));
|
685
|
+
|
686
|
+
// Unwind the stack down to - but not including - the unwinding
|
687
|
+
// limit and copy the contents of the activation frame to the input
|
688
|
+
// frame description.
|
689
|
+
__ lea(edx, Operand(ebx, FrameDescription::frame_content_offset()));
|
690
|
+
Label pop_loop;
|
691
|
+
__ bind(&pop_loop);
|
692
|
+
__ pop(Operand(edx, 0));
|
693
|
+
__ add(Operand(edx), Immediate(sizeof(uint32_t)));
|
694
|
+
__ cmp(ecx, Operand(esp));
|
695
|
+
__ j(not_equal, &pop_loop);
|
696
|
+
|
697
|
+
// Compute the output frame in the deoptimizer.
|
698
|
+
__ push(eax);
|
699
|
+
__ PrepareCallCFunction(1, ebx);
|
700
|
+
__ mov(Operand(esp, 0 * kPointerSize), eax);
|
701
|
+
__ CallCFunction(
|
702
|
+
ExternalReference::compute_output_frames_function(isolate), 1);
|
703
|
+
__ pop(eax);
|
704
|
+
|
705
|
+
// Replace the current frame with the output frames.
|
706
|
+
Label outer_push_loop, inner_push_loop;
|
707
|
+
// Outer loop state: eax = current FrameDescription**, edx = one past the
|
708
|
+
// last FrameDescription**.
|
709
|
+
__ mov(edx, Operand(eax, Deoptimizer::output_count_offset()));
|
710
|
+
__ mov(eax, Operand(eax, Deoptimizer::output_offset()));
|
711
|
+
__ lea(edx, Operand(eax, edx, times_4, 0));
|
712
|
+
__ bind(&outer_push_loop);
|
713
|
+
// Inner loop state: ebx = current FrameDescription*, ecx = loop index.
|
714
|
+
__ mov(ebx, Operand(eax, 0));
|
715
|
+
__ mov(ecx, Operand(ebx, FrameDescription::frame_size_offset()));
|
716
|
+
__ bind(&inner_push_loop);
|
717
|
+
__ sub(Operand(ecx), Immediate(sizeof(uint32_t)));
|
718
|
+
__ push(Operand(ebx, ecx, times_1, FrameDescription::frame_content_offset()));
|
719
|
+
__ test(ecx, Operand(ecx));
|
720
|
+
__ j(not_zero, &inner_push_loop);
|
721
|
+
__ add(Operand(eax), Immediate(kPointerSize));
|
722
|
+
__ cmp(eax, Operand(edx));
|
723
|
+
__ j(below, &outer_push_loop);
|
724
|
+
|
725
|
+
// In case of OSR, we have to restore the XMM registers.
|
726
|
+
if (type() == OSR) {
|
727
|
+
for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; ++i) {
|
728
|
+
XMMRegister xmm_reg = XMMRegister::FromAllocationIndex(i);
|
729
|
+
int src_offset = i * kDoubleSize + double_regs_offset;
|
730
|
+
__ movdbl(xmm_reg, Operand(ebx, src_offset));
|
731
|
+
}
|
732
|
+
}
|
733
|
+
|
734
|
+
// Push state, pc, and continuation from the last output frame.
|
735
|
+
if (type() != OSR) {
|
736
|
+
__ push(Operand(ebx, FrameDescription::state_offset()));
|
737
|
+
}
|
738
|
+
__ push(Operand(ebx, FrameDescription::pc_offset()));
|
739
|
+
__ push(Operand(ebx, FrameDescription::continuation_offset()));
|
740
|
+
|
741
|
+
|
742
|
+
// Push the registers from the last output frame.
|
743
|
+
for (int i = 0; i < kNumberOfRegisters; i++) {
|
744
|
+
int offset = (i * kPointerSize) + FrameDescription::registers_offset();
|
745
|
+
__ push(Operand(ebx, offset));
|
746
|
+
}
|
747
|
+
|
748
|
+
// Restore the registers from the stack.
|
749
|
+
__ popad();
|
750
|
+
|
751
|
+
// Return to the continuation point.
|
752
|
+
__ ret(0);
|
753
|
+
}
|
754
|
+
|
755
|
+
|
756
|
+
void Deoptimizer::TableEntryGenerator::GeneratePrologue() {
|
757
|
+
// Create a sequence of deoptimization entries.
|
758
|
+
Label done;
|
759
|
+
for (int i = 0; i < count(); i++) {
|
760
|
+
int start = masm()->pc_offset();
|
761
|
+
USE(start);
|
762
|
+
__ push_imm32(i);
|
763
|
+
__ jmp(&done);
|
764
|
+
ASSERT(masm()->pc_offset() - start == table_entry_size_);
|
765
|
+
}
|
766
|
+
__ bind(&done);
|
767
|
+
}
|
768
|
+
|
769
|
+
#undef __
|
770
|
+
|
771
|
+
|
772
|
+
} } // namespace v8::internal
|
773
|
+
|
774
|
+
#endif // V8_TARGET_ARCH_IA32
|