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,1144 @@
|
|
1
|
+
// Copyright (c) 1994-2006 Sun Microsystems Inc.
|
2
|
+
// All Rights Reserved.
|
3
|
+
//
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
5
|
+
// modification, are permitted provided that the following conditions are
|
6
|
+
// met:
|
7
|
+
//
|
8
|
+
// - Redistributions of source code must retain the above copyright notice,
|
9
|
+
// this list of conditions and the following disclaimer.
|
10
|
+
//
|
11
|
+
// - Redistribution in binary form must reproduce the above copyright
|
12
|
+
// notice, this list of conditions and the following disclaimer in the
|
13
|
+
// documentation and/or other materials provided with the distribution.
|
14
|
+
//
|
15
|
+
// - Neither the name of Sun Microsystems or the names of contributors may
|
16
|
+
// be used to endorse or promote products derived from this software without
|
17
|
+
// specific prior written permission.
|
18
|
+
//
|
19
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
20
|
+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
22
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
23
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
24
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
25
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
26
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
27
|
+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
28
|
+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
29
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
|
31
|
+
// The original source code covered by the above license above has been
|
32
|
+
// modified significantly by Google Inc.
|
33
|
+
// Copyright 2011 the V8 project authors. All rights reserved.
|
34
|
+
|
35
|
+
// A light-weight IA32 Assembler.
|
36
|
+
|
37
|
+
#ifndef V8_IA32_ASSEMBLER_IA32_H_
|
38
|
+
#define V8_IA32_ASSEMBLER_IA32_H_
|
39
|
+
|
40
|
+
#include "isolate.h"
|
41
|
+
#include "serialize.h"
|
42
|
+
|
43
|
+
namespace v8 {
|
44
|
+
namespace internal {
|
45
|
+
|
46
|
+
// CPU Registers.
|
47
|
+
//
|
48
|
+
// 1) We would prefer to use an enum, but enum values are assignment-
|
49
|
+
// compatible with int, which has caused code-generation bugs.
|
50
|
+
//
|
51
|
+
// 2) We would prefer to use a class instead of a struct but we don't like
|
52
|
+
// the register initialization to depend on the particular initialization
|
53
|
+
// order (which appears to be different on OS X, Linux, and Windows for the
|
54
|
+
// installed versions of C++ we tried). Using a struct permits C-style
|
55
|
+
// "initialization". Also, the Register objects cannot be const as this
|
56
|
+
// forces initialization stubs in MSVC, making us dependent on initialization
|
57
|
+
// order.
|
58
|
+
//
|
59
|
+
// 3) By not using an enum, we are possibly preventing the compiler from
|
60
|
+
// doing certain constant folds, which may significantly reduce the
|
61
|
+
// code generated for some assembly instructions (because they boil down
|
62
|
+
// to a few constants). If this is a problem, we could change the code
|
63
|
+
// such that we use an enum in optimized mode, and the struct in debug
|
64
|
+
// mode. This way we get the compile-time error checking in debug mode
|
65
|
+
// and best performance in optimized code.
|
66
|
+
//
|
67
|
+
struct Register {
|
68
|
+
static const int kNumAllocatableRegisters = 6;
|
69
|
+
static const int kNumRegisters = 8;
|
70
|
+
|
71
|
+
static inline const char* AllocationIndexToString(int index);
|
72
|
+
|
73
|
+
static inline int ToAllocationIndex(Register reg);
|
74
|
+
|
75
|
+
static inline Register FromAllocationIndex(int index);
|
76
|
+
|
77
|
+
static Register from_code(int code) {
|
78
|
+
Register r = { code };
|
79
|
+
return r;
|
80
|
+
}
|
81
|
+
bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; }
|
82
|
+
bool is(Register reg) const { return code_ == reg.code_; }
|
83
|
+
// eax, ebx, ecx and edx are byte registers, the rest are not.
|
84
|
+
bool is_byte_register() const { return code_ <= 3; }
|
85
|
+
int code() const {
|
86
|
+
ASSERT(is_valid());
|
87
|
+
return code_;
|
88
|
+
}
|
89
|
+
int bit() const {
|
90
|
+
ASSERT(is_valid());
|
91
|
+
return 1 << code_;
|
92
|
+
}
|
93
|
+
|
94
|
+
// Unfortunately we can't make this private in a struct.
|
95
|
+
int code_;
|
96
|
+
};
|
97
|
+
|
98
|
+
|
99
|
+
const Register eax = { 0 };
|
100
|
+
const Register ecx = { 1 };
|
101
|
+
const Register edx = { 2 };
|
102
|
+
const Register ebx = { 3 };
|
103
|
+
const Register esp = { 4 };
|
104
|
+
const Register ebp = { 5 };
|
105
|
+
const Register esi = { 6 };
|
106
|
+
const Register edi = { 7 };
|
107
|
+
const Register no_reg = { -1 };
|
108
|
+
|
109
|
+
|
110
|
+
inline const char* Register::AllocationIndexToString(int index) {
|
111
|
+
ASSERT(index >= 0 && index < kNumAllocatableRegisters);
|
112
|
+
// This is the mapping of allocation indices to registers.
|
113
|
+
const char* const kNames[] = { "eax", "ecx", "edx", "ebx", "esi", "edi" };
|
114
|
+
return kNames[index];
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
inline int Register::ToAllocationIndex(Register reg) {
|
119
|
+
ASSERT(reg.is_valid() && !reg.is(esp) && !reg.is(ebp));
|
120
|
+
return (reg.code() >= 6) ? reg.code() - 2 : reg.code();
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
inline Register Register::FromAllocationIndex(int index) {
|
125
|
+
ASSERT(index >= 0 && index < kNumAllocatableRegisters);
|
126
|
+
return (index >= 4) ? from_code(index + 2) : from_code(index);
|
127
|
+
}
|
128
|
+
|
129
|
+
|
130
|
+
struct XMMRegister {
|
131
|
+
static const int kNumAllocatableRegisters = 7;
|
132
|
+
static const int kNumRegisters = 8;
|
133
|
+
|
134
|
+
static int ToAllocationIndex(XMMRegister reg) {
|
135
|
+
ASSERT(reg.code() != 0);
|
136
|
+
return reg.code() - 1;
|
137
|
+
}
|
138
|
+
|
139
|
+
static XMMRegister FromAllocationIndex(int index) {
|
140
|
+
ASSERT(index >= 0 && index < kNumAllocatableRegisters);
|
141
|
+
return from_code(index + 1);
|
142
|
+
}
|
143
|
+
|
144
|
+
static const char* AllocationIndexToString(int index) {
|
145
|
+
ASSERT(index >= 0 && index < kNumAllocatableRegisters);
|
146
|
+
const char* const names[] = {
|
147
|
+
"xmm1",
|
148
|
+
"xmm2",
|
149
|
+
"xmm3",
|
150
|
+
"xmm4",
|
151
|
+
"xmm5",
|
152
|
+
"xmm6",
|
153
|
+
"xmm7"
|
154
|
+
};
|
155
|
+
return names[index];
|
156
|
+
}
|
157
|
+
|
158
|
+
static XMMRegister from_code(int code) {
|
159
|
+
XMMRegister r = { code };
|
160
|
+
return r;
|
161
|
+
}
|
162
|
+
|
163
|
+
bool is_valid() const { return 0 <= code_ && code_ < kNumRegisters; }
|
164
|
+
bool is(XMMRegister reg) const { return code_ == reg.code_; }
|
165
|
+
int code() const {
|
166
|
+
ASSERT(is_valid());
|
167
|
+
return code_;
|
168
|
+
}
|
169
|
+
|
170
|
+
int code_;
|
171
|
+
};
|
172
|
+
|
173
|
+
|
174
|
+
const XMMRegister xmm0 = { 0 };
|
175
|
+
const XMMRegister xmm1 = { 1 };
|
176
|
+
const XMMRegister xmm2 = { 2 };
|
177
|
+
const XMMRegister xmm3 = { 3 };
|
178
|
+
const XMMRegister xmm4 = { 4 };
|
179
|
+
const XMMRegister xmm5 = { 5 };
|
180
|
+
const XMMRegister xmm6 = { 6 };
|
181
|
+
const XMMRegister xmm7 = { 7 };
|
182
|
+
|
183
|
+
|
184
|
+
typedef XMMRegister DoubleRegister;
|
185
|
+
|
186
|
+
|
187
|
+
enum Condition {
|
188
|
+
// any value < 0 is considered no_condition
|
189
|
+
no_condition = -1,
|
190
|
+
|
191
|
+
overflow = 0,
|
192
|
+
no_overflow = 1,
|
193
|
+
below = 2,
|
194
|
+
above_equal = 3,
|
195
|
+
equal = 4,
|
196
|
+
not_equal = 5,
|
197
|
+
below_equal = 6,
|
198
|
+
above = 7,
|
199
|
+
negative = 8,
|
200
|
+
positive = 9,
|
201
|
+
parity_even = 10,
|
202
|
+
parity_odd = 11,
|
203
|
+
less = 12,
|
204
|
+
greater_equal = 13,
|
205
|
+
less_equal = 14,
|
206
|
+
greater = 15,
|
207
|
+
|
208
|
+
// aliases
|
209
|
+
carry = below,
|
210
|
+
not_carry = above_equal,
|
211
|
+
zero = equal,
|
212
|
+
not_zero = not_equal,
|
213
|
+
sign = negative,
|
214
|
+
not_sign = positive
|
215
|
+
};
|
216
|
+
|
217
|
+
|
218
|
+
// Returns the equivalent of !cc.
|
219
|
+
// Negation of the default no_condition (-1) results in a non-default
|
220
|
+
// no_condition value (-2). As long as tests for no_condition check
|
221
|
+
// for condition < 0, this will work as expected.
|
222
|
+
inline Condition NegateCondition(Condition cc) {
|
223
|
+
return static_cast<Condition>(cc ^ 1);
|
224
|
+
}
|
225
|
+
|
226
|
+
|
227
|
+
// Corresponds to transposing the operands of a comparison.
|
228
|
+
inline Condition ReverseCondition(Condition cc) {
|
229
|
+
switch (cc) {
|
230
|
+
case below:
|
231
|
+
return above;
|
232
|
+
case above:
|
233
|
+
return below;
|
234
|
+
case above_equal:
|
235
|
+
return below_equal;
|
236
|
+
case below_equal:
|
237
|
+
return above_equal;
|
238
|
+
case less:
|
239
|
+
return greater;
|
240
|
+
case greater:
|
241
|
+
return less;
|
242
|
+
case greater_equal:
|
243
|
+
return less_equal;
|
244
|
+
case less_equal:
|
245
|
+
return greater_equal;
|
246
|
+
default:
|
247
|
+
return cc;
|
248
|
+
};
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
// -----------------------------------------------------------------------------
|
253
|
+
// Machine instruction Immediates
|
254
|
+
|
255
|
+
class Immediate BASE_EMBEDDED {
|
256
|
+
public:
|
257
|
+
inline explicit Immediate(int x);
|
258
|
+
inline explicit Immediate(const ExternalReference& ext);
|
259
|
+
inline explicit Immediate(Handle<Object> handle);
|
260
|
+
inline explicit Immediate(Smi* value);
|
261
|
+
inline explicit Immediate(Address addr);
|
262
|
+
|
263
|
+
static Immediate CodeRelativeOffset(Label* label) {
|
264
|
+
return Immediate(label);
|
265
|
+
}
|
266
|
+
|
267
|
+
bool is_zero() const { return x_ == 0 && rmode_ == RelocInfo::NONE; }
|
268
|
+
bool is_int8() const {
|
269
|
+
return -128 <= x_ && x_ < 128 && rmode_ == RelocInfo::NONE;
|
270
|
+
}
|
271
|
+
bool is_int16() const {
|
272
|
+
return -32768 <= x_ && x_ < 32768 && rmode_ == RelocInfo::NONE;
|
273
|
+
}
|
274
|
+
|
275
|
+
private:
|
276
|
+
inline explicit Immediate(Label* value);
|
277
|
+
|
278
|
+
int x_;
|
279
|
+
RelocInfo::Mode rmode_;
|
280
|
+
|
281
|
+
friend class Assembler;
|
282
|
+
friend class MacroAssembler;
|
283
|
+
};
|
284
|
+
|
285
|
+
|
286
|
+
// -----------------------------------------------------------------------------
|
287
|
+
// Machine instruction Operands
|
288
|
+
|
289
|
+
enum ScaleFactor {
|
290
|
+
times_1 = 0,
|
291
|
+
times_2 = 1,
|
292
|
+
times_4 = 2,
|
293
|
+
times_8 = 3,
|
294
|
+
times_int_size = times_4,
|
295
|
+
times_half_pointer_size = times_2,
|
296
|
+
times_pointer_size = times_4,
|
297
|
+
times_twice_pointer_size = times_8
|
298
|
+
};
|
299
|
+
|
300
|
+
|
301
|
+
class Operand BASE_EMBEDDED {
|
302
|
+
public:
|
303
|
+
// reg
|
304
|
+
INLINE(explicit Operand(Register reg));
|
305
|
+
|
306
|
+
// XMM reg
|
307
|
+
INLINE(explicit Operand(XMMRegister xmm_reg));
|
308
|
+
|
309
|
+
// [disp/r]
|
310
|
+
INLINE(explicit Operand(int32_t disp, RelocInfo::Mode rmode));
|
311
|
+
// disp only must always be relocated
|
312
|
+
|
313
|
+
// [base + disp/r]
|
314
|
+
explicit Operand(Register base, int32_t disp,
|
315
|
+
RelocInfo::Mode rmode = RelocInfo::NONE);
|
316
|
+
|
317
|
+
// [base + index*scale + disp/r]
|
318
|
+
explicit Operand(Register base,
|
319
|
+
Register index,
|
320
|
+
ScaleFactor scale,
|
321
|
+
int32_t disp,
|
322
|
+
RelocInfo::Mode rmode = RelocInfo::NONE);
|
323
|
+
|
324
|
+
// [index*scale + disp/r]
|
325
|
+
explicit Operand(Register index,
|
326
|
+
ScaleFactor scale,
|
327
|
+
int32_t disp,
|
328
|
+
RelocInfo::Mode rmode = RelocInfo::NONE);
|
329
|
+
|
330
|
+
static Operand StaticVariable(const ExternalReference& ext) {
|
331
|
+
return Operand(reinterpret_cast<int32_t>(ext.address()),
|
332
|
+
RelocInfo::EXTERNAL_REFERENCE);
|
333
|
+
}
|
334
|
+
|
335
|
+
static Operand StaticArray(Register index,
|
336
|
+
ScaleFactor scale,
|
337
|
+
const ExternalReference& arr) {
|
338
|
+
return Operand(index, scale, reinterpret_cast<int32_t>(arr.address()),
|
339
|
+
RelocInfo::EXTERNAL_REFERENCE);
|
340
|
+
}
|
341
|
+
|
342
|
+
static Operand Cell(Handle<JSGlobalPropertyCell> cell) {
|
343
|
+
return Operand(reinterpret_cast<int32_t>(cell.location()),
|
344
|
+
RelocInfo::GLOBAL_PROPERTY_CELL);
|
345
|
+
}
|
346
|
+
|
347
|
+
// Returns true if this Operand is a wrapper for the specified register.
|
348
|
+
bool is_reg(Register reg) const;
|
349
|
+
|
350
|
+
private:
|
351
|
+
byte buf_[6];
|
352
|
+
// The number of bytes in buf_.
|
353
|
+
unsigned int len_;
|
354
|
+
// Only valid if len_ > 4.
|
355
|
+
RelocInfo::Mode rmode_;
|
356
|
+
|
357
|
+
// Set the ModRM byte without an encoded 'reg' register. The
|
358
|
+
// register is encoded later as part of the emit_operand operation.
|
359
|
+
inline void set_modrm(int mod, Register rm);
|
360
|
+
|
361
|
+
inline void set_sib(ScaleFactor scale, Register index, Register base);
|
362
|
+
inline void set_disp8(int8_t disp);
|
363
|
+
inline void set_dispr(int32_t disp, RelocInfo::Mode rmode);
|
364
|
+
|
365
|
+
friend class Assembler;
|
366
|
+
};
|
367
|
+
|
368
|
+
|
369
|
+
// -----------------------------------------------------------------------------
|
370
|
+
// A Displacement describes the 32bit immediate field of an instruction which
|
371
|
+
// may be used together with a Label in order to refer to a yet unknown code
|
372
|
+
// position. Displacements stored in the instruction stream are used to describe
|
373
|
+
// the instruction and to chain a list of instructions using the same Label.
|
374
|
+
// A Displacement contains 2 different fields:
|
375
|
+
//
|
376
|
+
// next field: position of next displacement in the chain (0 = end of list)
|
377
|
+
// type field: instruction type
|
378
|
+
//
|
379
|
+
// A next value of null (0) indicates the end of a chain (note that there can
|
380
|
+
// be no displacement at position zero, because there is always at least one
|
381
|
+
// instruction byte before the displacement).
|
382
|
+
//
|
383
|
+
// Displacement _data field layout
|
384
|
+
//
|
385
|
+
// |31.....2|1......0|
|
386
|
+
// [ next | type |
|
387
|
+
|
388
|
+
class Displacement BASE_EMBEDDED {
|
389
|
+
public:
|
390
|
+
enum Type {
|
391
|
+
UNCONDITIONAL_JUMP,
|
392
|
+
CODE_RELATIVE,
|
393
|
+
OTHER
|
394
|
+
};
|
395
|
+
|
396
|
+
int data() const { return data_; }
|
397
|
+
Type type() const { return TypeField::decode(data_); }
|
398
|
+
void next(Label* L) const {
|
399
|
+
int n = NextField::decode(data_);
|
400
|
+
n > 0 ? L->link_to(n) : L->Unuse();
|
401
|
+
}
|
402
|
+
void link_to(Label* L) { init(L, type()); }
|
403
|
+
|
404
|
+
explicit Displacement(int data) { data_ = data; }
|
405
|
+
|
406
|
+
Displacement(Label* L, Type type) { init(L, type); }
|
407
|
+
|
408
|
+
void print() {
|
409
|
+
PrintF("%s (%x) ", (type() == UNCONDITIONAL_JUMP ? "jmp" : "[other]"),
|
410
|
+
NextField::decode(data_));
|
411
|
+
}
|
412
|
+
|
413
|
+
private:
|
414
|
+
int data_;
|
415
|
+
|
416
|
+
class TypeField: public BitField<Type, 0, 2> {};
|
417
|
+
class NextField: public BitField<int, 2, 32-2> {};
|
418
|
+
|
419
|
+
void init(Label* L, Type type);
|
420
|
+
};
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
// CpuFeatures keeps track of which features are supported by the target CPU.
|
425
|
+
// Supported features must be enabled by a Scope before use.
|
426
|
+
// Example:
|
427
|
+
// if (CpuFeatures::IsSupported(SSE2)) {
|
428
|
+
// CpuFeatures::Scope fscope(SSE2);
|
429
|
+
// // Generate SSE2 floating point code.
|
430
|
+
// } else {
|
431
|
+
// // Generate standard x87 floating point code.
|
432
|
+
// }
|
433
|
+
class CpuFeatures : public AllStatic {
|
434
|
+
public:
|
435
|
+
// Detect features of the target CPU. Set safe defaults if the serializer
|
436
|
+
// is enabled (snapshots must be portable).
|
437
|
+
static void Probe();
|
438
|
+
|
439
|
+
// Check whether a feature is supported by the target CPU.
|
440
|
+
static bool IsSupported(CpuFeature f) {
|
441
|
+
ASSERT(initialized_);
|
442
|
+
if (f == SSE2 && !FLAG_enable_sse2) return false;
|
443
|
+
if (f == SSE3 && !FLAG_enable_sse3) return false;
|
444
|
+
if (f == SSE4_1 && !FLAG_enable_sse4_1) return false;
|
445
|
+
if (f == CMOV && !FLAG_enable_cmov) return false;
|
446
|
+
if (f == RDTSC && !FLAG_enable_rdtsc) return false;
|
447
|
+
return (supported_ & (static_cast<uint64_t>(1) << f)) != 0;
|
448
|
+
}
|
449
|
+
|
450
|
+
#ifdef DEBUG
|
451
|
+
// Check whether a feature is currently enabled.
|
452
|
+
static bool IsEnabled(CpuFeature f) {
|
453
|
+
ASSERT(initialized_);
|
454
|
+
Isolate* isolate = Isolate::UncheckedCurrent();
|
455
|
+
if (isolate == NULL) {
|
456
|
+
// When no isolate is available, work as if we're running in
|
457
|
+
// release mode.
|
458
|
+
return IsSupported(f);
|
459
|
+
}
|
460
|
+
uint64_t enabled = isolate->enabled_cpu_features();
|
461
|
+
return (enabled & (static_cast<uint64_t>(1) << f)) != 0;
|
462
|
+
}
|
463
|
+
#endif
|
464
|
+
|
465
|
+
// Enable a specified feature within a scope.
|
466
|
+
class Scope BASE_EMBEDDED {
|
467
|
+
#ifdef DEBUG
|
468
|
+
public:
|
469
|
+
explicit Scope(CpuFeature f) {
|
470
|
+
uint64_t mask = static_cast<uint64_t>(1) << f;
|
471
|
+
ASSERT(CpuFeatures::IsSupported(f));
|
472
|
+
ASSERT(!Serializer::enabled() ||
|
473
|
+
(CpuFeatures::found_by_runtime_probing_ & mask) == 0);
|
474
|
+
isolate_ = Isolate::UncheckedCurrent();
|
475
|
+
old_enabled_ = 0;
|
476
|
+
if (isolate_ != NULL) {
|
477
|
+
old_enabled_ = isolate_->enabled_cpu_features();
|
478
|
+
isolate_->set_enabled_cpu_features(old_enabled_ | mask);
|
479
|
+
}
|
480
|
+
}
|
481
|
+
~Scope() {
|
482
|
+
ASSERT_EQ(Isolate::UncheckedCurrent(), isolate_);
|
483
|
+
if (isolate_ != NULL) {
|
484
|
+
isolate_->set_enabled_cpu_features(old_enabled_);
|
485
|
+
}
|
486
|
+
}
|
487
|
+
private:
|
488
|
+
Isolate* isolate_;
|
489
|
+
uint64_t old_enabled_;
|
490
|
+
#else
|
491
|
+
public:
|
492
|
+
explicit Scope(CpuFeature f) {}
|
493
|
+
#endif
|
494
|
+
};
|
495
|
+
|
496
|
+
class TryForceFeatureScope BASE_EMBEDDED {
|
497
|
+
public:
|
498
|
+
explicit TryForceFeatureScope(CpuFeature f)
|
499
|
+
: old_supported_(CpuFeatures::supported_) {
|
500
|
+
if (CanForce()) {
|
501
|
+
CpuFeatures::supported_ |= (static_cast<uint64_t>(1) << f);
|
502
|
+
}
|
503
|
+
}
|
504
|
+
|
505
|
+
~TryForceFeatureScope() {
|
506
|
+
if (CanForce()) {
|
507
|
+
CpuFeatures::supported_ = old_supported_;
|
508
|
+
}
|
509
|
+
}
|
510
|
+
|
511
|
+
private:
|
512
|
+
static bool CanForce() {
|
513
|
+
// It's only safe to temporarily force support of CPU features
|
514
|
+
// when there's only a single isolate, which is guaranteed when
|
515
|
+
// the serializer is enabled.
|
516
|
+
return Serializer::enabled();
|
517
|
+
}
|
518
|
+
|
519
|
+
const uint64_t old_supported_;
|
520
|
+
};
|
521
|
+
|
522
|
+
private:
|
523
|
+
#ifdef DEBUG
|
524
|
+
static bool initialized_;
|
525
|
+
#endif
|
526
|
+
static uint64_t supported_;
|
527
|
+
static uint64_t found_by_runtime_probing_;
|
528
|
+
|
529
|
+
DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
|
530
|
+
};
|
531
|
+
|
532
|
+
|
533
|
+
class Assembler : public AssemblerBase {
|
534
|
+
private:
|
535
|
+
// We check before assembling an instruction that there is sufficient
|
536
|
+
// space to write an instruction and its relocation information.
|
537
|
+
// The relocation writer's position must be kGap bytes above the end of
|
538
|
+
// the generated instructions. This leaves enough space for the
|
539
|
+
// longest possible ia32 instruction, 15 bytes, and the longest possible
|
540
|
+
// relocation information encoding, RelocInfoWriter::kMaxLength == 16.
|
541
|
+
// (There is a 15 byte limit on ia32 instruction length that rules out some
|
542
|
+
// otherwise valid instructions.)
|
543
|
+
// This allows for a single, fast space check per instruction.
|
544
|
+
static const int kGap = 32;
|
545
|
+
|
546
|
+
public:
|
547
|
+
// Create an assembler. Instructions and relocation information are emitted
|
548
|
+
// into a buffer, with the instructions starting from the beginning and the
|
549
|
+
// relocation information starting from the end of the buffer. See CodeDesc
|
550
|
+
// for a detailed comment on the layout (globals.h).
|
551
|
+
//
|
552
|
+
// If the provided buffer is NULL, the assembler allocates and grows its own
|
553
|
+
// buffer, and buffer_size determines the initial buffer size. The buffer is
|
554
|
+
// owned by the assembler and deallocated upon destruction of the assembler.
|
555
|
+
//
|
556
|
+
// If the provided buffer is not NULL, the assembler uses the provided buffer
|
557
|
+
// for code generation and assumes its size to be buffer_size. If the buffer
|
558
|
+
// is too small, a fatal error occurs. No deallocation of the buffer is done
|
559
|
+
// upon destruction of the assembler.
|
560
|
+
// TODO(vitalyr): the assembler does not need an isolate.
|
561
|
+
Assembler(Isolate* isolate, void* buffer, int buffer_size);
|
562
|
+
~Assembler();
|
563
|
+
|
564
|
+
// Overrides the default provided by FLAG_debug_code.
|
565
|
+
void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
|
566
|
+
|
567
|
+
// GetCode emits any pending (non-emitted) code and fills the descriptor
|
568
|
+
// desc. GetCode() is idempotent; it returns the same result if no other
|
569
|
+
// Assembler functions are invoked in between GetCode() calls.
|
570
|
+
void GetCode(CodeDesc* desc);
|
571
|
+
|
572
|
+
// Read/Modify the code target in the branch/call instruction at pc.
|
573
|
+
inline static Address target_address_at(Address pc);
|
574
|
+
inline static void set_target_address_at(Address pc, Address target);
|
575
|
+
|
576
|
+
// This sets the branch destination (which is in the instruction on x86).
|
577
|
+
// This is for calls and branches within generated code.
|
578
|
+
inline static void set_target_at(Address instruction_payload,
|
579
|
+
Address target) {
|
580
|
+
set_target_address_at(instruction_payload, target);
|
581
|
+
}
|
582
|
+
|
583
|
+
// This sets the branch destination (which is in the instruction on x86).
|
584
|
+
// This is for calls and branches to runtime code.
|
585
|
+
inline static void set_external_target_at(Address instruction_payload,
|
586
|
+
Address target) {
|
587
|
+
set_target_address_at(instruction_payload, target);
|
588
|
+
}
|
589
|
+
|
590
|
+
static const int kCallTargetSize = kPointerSize;
|
591
|
+
static const int kExternalTargetSize = kPointerSize;
|
592
|
+
|
593
|
+
// Distance between the address of the code target in the call instruction
|
594
|
+
// and the return address
|
595
|
+
static const int kCallTargetAddressOffset = kPointerSize;
|
596
|
+
// Distance between start of patched return sequence and the emitted address
|
597
|
+
// to jump to.
|
598
|
+
static const int kPatchReturnSequenceAddressOffset = 1; // JMP imm32.
|
599
|
+
|
600
|
+
// Distance between start of patched debug break slot and the emitted address
|
601
|
+
// to jump to.
|
602
|
+
static const int kPatchDebugBreakSlotAddressOffset = 1; // JMP imm32.
|
603
|
+
|
604
|
+
static const int kCallInstructionLength = 5;
|
605
|
+
static const int kJSReturnSequenceLength = 6;
|
606
|
+
|
607
|
+
// The debug break slot must be able to contain a call instruction.
|
608
|
+
static const int kDebugBreakSlotLength = kCallInstructionLength;
|
609
|
+
|
610
|
+
// One byte opcode for test eax,0xXXXXXXXX.
|
611
|
+
static const byte kTestEaxByte = 0xA9;
|
612
|
+
// One byte opcode for test al, 0xXX.
|
613
|
+
static const byte kTestAlByte = 0xA8;
|
614
|
+
// One byte opcode for nop.
|
615
|
+
static const byte kNopByte = 0x90;
|
616
|
+
|
617
|
+
// One byte opcode for a short unconditional jump.
|
618
|
+
static const byte kJmpShortOpcode = 0xEB;
|
619
|
+
// One byte prefix for a short conditional jump.
|
620
|
+
static const byte kJccShortPrefix = 0x70;
|
621
|
+
static const byte kJncShortOpcode = kJccShortPrefix | not_carry;
|
622
|
+
static const byte kJcShortOpcode = kJccShortPrefix | carry;
|
623
|
+
|
624
|
+
// ---------------------------------------------------------------------------
|
625
|
+
// Code generation
|
626
|
+
//
|
627
|
+
// - function names correspond one-to-one to ia32 instruction mnemonics
|
628
|
+
// - unless specified otherwise, instructions operate on 32bit operands
|
629
|
+
// - instructions on 8bit (byte) operands/registers have a trailing '_b'
|
630
|
+
// - instructions on 16bit (word) operands/registers have a trailing '_w'
|
631
|
+
// - naming conflicts with C++ keywords are resolved via a trailing '_'
|
632
|
+
|
633
|
+
// NOTE ON INTERFACE: Currently, the interface is not very consistent
|
634
|
+
// in the sense that some operations (e.g. mov()) can be called in more
|
635
|
+
// the one way to generate the same instruction: The Register argument
|
636
|
+
// can in some cases be replaced with an Operand(Register) argument.
|
637
|
+
// This should be cleaned up and made more orthogonal. The questions
|
638
|
+
// is: should we always use Operands instead of Registers where an
|
639
|
+
// Operand is possible, or should we have a Register (overloaded) form
|
640
|
+
// instead? We must be careful to make sure that the selected instruction
|
641
|
+
// is obvious from the parameters to avoid hard-to-find code generation
|
642
|
+
// bugs.
|
643
|
+
|
644
|
+
// Insert the smallest number of nop instructions
|
645
|
+
// possible to align the pc offset to a multiple
|
646
|
+
// of m. m must be a power of 2.
|
647
|
+
void Align(int m);
|
648
|
+
// Aligns code to something that's optimal for a jump target for the platform.
|
649
|
+
void CodeTargetAlign();
|
650
|
+
|
651
|
+
// Stack
|
652
|
+
void pushad();
|
653
|
+
void popad();
|
654
|
+
|
655
|
+
void pushfd();
|
656
|
+
void popfd();
|
657
|
+
|
658
|
+
void push(const Immediate& x);
|
659
|
+
void push_imm32(int32_t imm32);
|
660
|
+
void push(Register src);
|
661
|
+
void push(const Operand& src);
|
662
|
+
|
663
|
+
void pop(Register dst);
|
664
|
+
void pop(const Operand& dst);
|
665
|
+
|
666
|
+
void enter(const Immediate& size);
|
667
|
+
void leave();
|
668
|
+
|
669
|
+
// Moves
|
670
|
+
void mov_b(Register dst, const Operand& src);
|
671
|
+
void mov_b(const Operand& dst, int8_t imm8);
|
672
|
+
void mov_b(const Operand& dst, Register src);
|
673
|
+
|
674
|
+
void mov_w(Register dst, const Operand& src);
|
675
|
+
void mov_w(const Operand& dst, Register src);
|
676
|
+
|
677
|
+
void mov(Register dst, int32_t imm32);
|
678
|
+
void mov(Register dst, const Immediate& x);
|
679
|
+
void mov(Register dst, Handle<Object> handle);
|
680
|
+
void mov(Register dst, const Operand& src);
|
681
|
+
void mov(Register dst, Register src);
|
682
|
+
void mov(const Operand& dst, const Immediate& x);
|
683
|
+
void mov(const Operand& dst, Handle<Object> handle);
|
684
|
+
void mov(const Operand& dst, Register src);
|
685
|
+
|
686
|
+
void movsx_b(Register dst, const Operand& src);
|
687
|
+
|
688
|
+
void movsx_w(Register dst, const Operand& src);
|
689
|
+
|
690
|
+
void movzx_b(Register dst, const Operand& src);
|
691
|
+
|
692
|
+
void movzx_w(Register dst, const Operand& src);
|
693
|
+
|
694
|
+
// Conditional moves
|
695
|
+
void cmov(Condition cc, Register dst, int32_t imm32);
|
696
|
+
void cmov(Condition cc, Register dst, Handle<Object> handle);
|
697
|
+
void cmov(Condition cc, Register dst, const Operand& src);
|
698
|
+
|
699
|
+
// Flag management.
|
700
|
+
void cld();
|
701
|
+
|
702
|
+
// Repetitive string instructions.
|
703
|
+
void rep_movs();
|
704
|
+
void rep_stos();
|
705
|
+
void stos();
|
706
|
+
|
707
|
+
// Exchange two registers
|
708
|
+
void xchg(Register dst, Register src);
|
709
|
+
|
710
|
+
// Arithmetics
|
711
|
+
void adc(Register dst, int32_t imm32);
|
712
|
+
void adc(Register dst, const Operand& src);
|
713
|
+
|
714
|
+
void add(Register dst, const Operand& src);
|
715
|
+
void add(const Operand& dst, const Immediate& x);
|
716
|
+
|
717
|
+
void and_(Register dst, int32_t imm32);
|
718
|
+
void and_(Register dst, const Immediate& x);
|
719
|
+
void and_(Register dst, const Operand& src);
|
720
|
+
void and_(const Operand& src, Register dst);
|
721
|
+
void and_(const Operand& dst, const Immediate& x);
|
722
|
+
|
723
|
+
void cmpb(const Operand& op, int8_t imm8);
|
724
|
+
void cmpb(Register src, const Operand& dst);
|
725
|
+
void cmpb(const Operand& dst, Register src);
|
726
|
+
void cmpb_al(const Operand& op);
|
727
|
+
void cmpw_ax(const Operand& op);
|
728
|
+
void cmpw(const Operand& op, Immediate imm16);
|
729
|
+
void cmp(Register reg, int32_t imm32);
|
730
|
+
void cmp(Register reg, Handle<Object> handle);
|
731
|
+
void cmp(Register reg, const Operand& op);
|
732
|
+
void cmp(const Operand& op, const Immediate& imm);
|
733
|
+
void cmp(const Operand& op, Handle<Object> handle);
|
734
|
+
|
735
|
+
void dec_b(Register dst);
|
736
|
+
void dec_b(const Operand& dst);
|
737
|
+
|
738
|
+
void dec(Register dst);
|
739
|
+
void dec(const Operand& dst);
|
740
|
+
|
741
|
+
void cdq();
|
742
|
+
|
743
|
+
void idiv(Register src);
|
744
|
+
|
745
|
+
// Signed multiply instructions.
|
746
|
+
void imul(Register src); // edx:eax = eax * src.
|
747
|
+
void imul(Register dst, const Operand& src); // dst = dst * src.
|
748
|
+
void imul(Register dst, Register src, int32_t imm32); // dst = src * imm32.
|
749
|
+
|
750
|
+
void inc(Register dst);
|
751
|
+
void inc(const Operand& dst);
|
752
|
+
|
753
|
+
void lea(Register dst, const Operand& src);
|
754
|
+
|
755
|
+
// Unsigned multiply instruction.
|
756
|
+
void mul(Register src); // edx:eax = eax * reg.
|
757
|
+
|
758
|
+
void neg(Register dst);
|
759
|
+
|
760
|
+
void not_(Register dst);
|
761
|
+
|
762
|
+
void or_(Register dst, int32_t imm32);
|
763
|
+
void or_(Register dst, const Operand& src);
|
764
|
+
void or_(const Operand& dst, Register src);
|
765
|
+
void or_(const Operand& dst, const Immediate& x);
|
766
|
+
|
767
|
+
void rcl(Register dst, uint8_t imm8);
|
768
|
+
void rcr(Register dst, uint8_t imm8);
|
769
|
+
|
770
|
+
void sar(Register dst, uint8_t imm8);
|
771
|
+
void sar_cl(Register dst);
|
772
|
+
|
773
|
+
void sbb(Register dst, const Operand& src);
|
774
|
+
|
775
|
+
void shld(Register dst, const Operand& src);
|
776
|
+
|
777
|
+
void shl(Register dst, uint8_t imm8);
|
778
|
+
void shl_cl(Register dst);
|
779
|
+
|
780
|
+
void shrd(Register dst, const Operand& src);
|
781
|
+
|
782
|
+
void shr(Register dst, uint8_t imm8);
|
783
|
+
void shr_cl(Register dst);
|
784
|
+
|
785
|
+
void subb(const Operand& dst, int8_t imm8);
|
786
|
+
void subb(Register dst, const Operand& src);
|
787
|
+
void sub(const Operand& dst, const Immediate& x);
|
788
|
+
void sub(Register dst, const Operand& src);
|
789
|
+
void sub(const Operand& dst, Register src);
|
790
|
+
|
791
|
+
void test(Register reg, const Immediate& imm);
|
792
|
+
void test(Register reg, const Operand& op);
|
793
|
+
void test_b(Register reg, const Operand& op);
|
794
|
+
void test(const Operand& op, const Immediate& imm);
|
795
|
+
void test_b(const Operand& op, uint8_t imm8);
|
796
|
+
|
797
|
+
void xor_(Register dst, int32_t imm32);
|
798
|
+
void xor_(Register dst, const Operand& src);
|
799
|
+
void xor_(const Operand& src, Register dst);
|
800
|
+
void xor_(const Operand& dst, const Immediate& x);
|
801
|
+
|
802
|
+
// Bit operations.
|
803
|
+
void bt(const Operand& dst, Register src);
|
804
|
+
void bts(const Operand& dst, Register src);
|
805
|
+
|
806
|
+
// Miscellaneous
|
807
|
+
void hlt();
|
808
|
+
void int3();
|
809
|
+
void nop();
|
810
|
+
void rdtsc();
|
811
|
+
void ret(int imm16);
|
812
|
+
|
813
|
+
// Label operations & relative jumps (PPUM Appendix D)
|
814
|
+
//
|
815
|
+
// Takes a branch opcode (cc) and a label (L) and generates
|
816
|
+
// either a backward branch or a forward branch and links it
|
817
|
+
// to the label fixup chain. Usage:
|
818
|
+
//
|
819
|
+
// Label L; // unbound label
|
820
|
+
// j(cc, &L); // forward branch to unbound label
|
821
|
+
// bind(&L); // bind label to the current pc
|
822
|
+
// j(cc, &L); // backward branch to bound label
|
823
|
+
// bind(&L); // illegal: a label may be bound only once
|
824
|
+
//
|
825
|
+
// Note: The same Label can be used for forward and backward branches
|
826
|
+
// but it may be bound only once.
|
827
|
+
|
828
|
+
void bind(Label* L); // binds an unbound label L to the current code position
|
829
|
+
|
830
|
+
// Calls
|
831
|
+
void call(Label* L);
|
832
|
+
void call(byte* entry, RelocInfo::Mode rmode);
|
833
|
+
int CallSize(const Operand& adr);
|
834
|
+
void call(const Operand& adr);
|
835
|
+
int CallSize(Handle<Code> code, RelocInfo::Mode mode);
|
836
|
+
void call(Handle<Code> code,
|
837
|
+
RelocInfo::Mode rmode,
|
838
|
+
unsigned ast_id = kNoASTId);
|
839
|
+
|
840
|
+
// Jumps
|
841
|
+
// unconditional jump to L
|
842
|
+
void jmp(Label* L, Label::Distance distance = Label::kFar);
|
843
|
+
void jmp(byte* entry, RelocInfo::Mode rmode);
|
844
|
+
void jmp(const Operand& adr);
|
845
|
+
void jmp(Handle<Code> code, RelocInfo::Mode rmode);
|
846
|
+
|
847
|
+
// Conditional jumps
|
848
|
+
void j(Condition cc,
|
849
|
+
Label* L,
|
850
|
+
Label::Distance distance = Label::kFar);
|
851
|
+
void j(Condition cc, byte* entry, RelocInfo::Mode rmode);
|
852
|
+
void j(Condition cc, Handle<Code> code);
|
853
|
+
|
854
|
+
// Floating-point operations
|
855
|
+
void fld(int i);
|
856
|
+
void fstp(int i);
|
857
|
+
|
858
|
+
void fld1();
|
859
|
+
void fldz();
|
860
|
+
void fldpi();
|
861
|
+
void fldln2();
|
862
|
+
|
863
|
+
void fld_s(const Operand& adr);
|
864
|
+
void fld_d(const Operand& adr);
|
865
|
+
|
866
|
+
void fstp_s(const Operand& adr);
|
867
|
+
void fstp_d(const Operand& adr);
|
868
|
+
void fst_d(const Operand& adr);
|
869
|
+
|
870
|
+
void fild_s(const Operand& adr);
|
871
|
+
void fild_d(const Operand& adr);
|
872
|
+
|
873
|
+
void fist_s(const Operand& adr);
|
874
|
+
|
875
|
+
void fistp_s(const Operand& adr);
|
876
|
+
void fistp_d(const Operand& adr);
|
877
|
+
|
878
|
+
// The fisttp instructions require SSE3.
|
879
|
+
void fisttp_s(const Operand& adr);
|
880
|
+
void fisttp_d(const Operand& adr);
|
881
|
+
|
882
|
+
void fabs();
|
883
|
+
void fchs();
|
884
|
+
void fcos();
|
885
|
+
void fsin();
|
886
|
+
void fyl2x();
|
887
|
+
|
888
|
+
void fadd(int i);
|
889
|
+
void fsub(int i);
|
890
|
+
void fmul(int i);
|
891
|
+
void fdiv(int i);
|
892
|
+
|
893
|
+
void fisub_s(const Operand& adr);
|
894
|
+
|
895
|
+
void faddp(int i = 1);
|
896
|
+
void fsubp(int i = 1);
|
897
|
+
void fsubrp(int i = 1);
|
898
|
+
void fmulp(int i = 1);
|
899
|
+
void fdivp(int i = 1);
|
900
|
+
void fprem();
|
901
|
+
void fprem1();
|
902
|
+
|
903
|
+
void fxch(int i = 1);
|
904
|
+
void fincstp();
|
905
|
+
void ffree(int i = 0);
|
906
|
+
|
907
|
+
void ftst();
|
908
|
+
void fucomp(int i);
|
909
|
+
void fucompp();
|
910
|
+
void fucomi(int i);
|
911
|
+
void fucomip();
|
912
|
+
void fcompp();
|
913
|
+
void fnstsw_ax();
|
914
|
+
void fwait();
|
915
|
+
void fnclex();
|
916
|
+
|
917
|
+
void frndint();
|
918
|
+
|
919
|
+
void sahf();
|
920
|
+
void setcc(Condition cc, Register reg);
|
921
|
+
|
922
|
+
void cpuid();
|
923
|
+
|
924
|
+
// SSE2 instructions
|
925
|
+
void cvttss2si(Register dst, const Operand& src);
|
926
|
+
void cvttsd2si(Register dst, const Operand& src);
|
927
|
+
|
928
|
+
void cvtsi2sd(XMMRegister dst, const Operand& src);
|
929
|
+
void cvtss2sd(XMMRegister dst, XMMRegister src);
|
930
|
+
void cvtsd2ss(XMMRegister dst, XMMRegister src);
|
931
|
+
|
932
|
+
void addsd(XMMRegister dst, XMMRegister src);
|
933
|
+
void subsd(XMMRegister dst, XMMRegister src);
|
934
|
+
void mulsd(XMMRegister dst, XMMRegister src);
|
935
|
+
void divsd(XMMRegister dst, XMMRegister src);
|
936
|
+
void xorpd(XMMRegister dst, XMMRegister src);
|
937
|
+
void xorps(XMMRegister dst, XMMRegister src);
|
938
|
+
void sqrtsd(XMMRegister dst, XMMRegister src);
|
939
|
+
|
940
|
+
void andpd(XMMRegister dst, XMMRegister src);
|
941
|
+
|
942
|
+
void ucomisd(XMMRegister dst, XMMRegister src);
|
943
|
+
void movmskpd(Register dst, XMMRegister src);
|
944
|
+
|
945
|
+
void cmpltsd(XMMRegister dst, XMMRegister src);
|
946
|
+
|
947
|
+
void movaps(XMMRegister dst, XMMRegister src);
|
948
|
+
|
949
|
+
void movdqa(XMMRegister dst, const Operand& src);
|
950
|
+
void movdqa(const Operand& dst, XMMRegister src);
|
951
|
+
void movdqu(XMMRegister dst, const Operand& src);
|
952
|
+
void movdqu(const Operand& dst, XMMRegister src);
|
953
|
+
|
954
|
+
// Use either movsd or movlpd.
|
955
|
+
void movdbl(XMMRegister dst, const Operand& src);
|
956
|
+
void movdbl(const Operand& dst, XMMRegister src);
|
957
|
+
|
958
|
+
void movd(XMMRegister dst, const Operand& src);
|
959
|
+
void movd(const Operand& src, XMMRegister dst);
|
960
|
+
void movsd(XMMRegister dst, XMMRegister src);
|
961
|
+
|
962
|
+
void movss(XMMRegister dst, const Operand& src);
|
963
|
+
void movss(const Operand& src, XMMRegister dst);
|
964
|
+
void movss(XMMRegister dst, XMMRegister src);
|
965
|
+
|
966
|
+
void pand(XMMRegister dst, XMMRegister src);
|
967
|
+
void pxor(XMMRegister dst, XMMRegister src);
|
968
|
+
void por(XMMRegister dst, XMMRegister src);
|
969
|
+
void ptest(XMMRegister dst, XMMRegister src);
|
970
|
+
|
971
|
+
void psllq(XMMRegister reg, int8_t shift);
|
972
|
+
void psllq(XMMRegister dst, XMMRegister src);
|
973
|
+
void psrlq(XMMRegister reg, int8_t shift);
|
974
|
+
void psrlq(XMMRegister dst, XMMRegister src);
|
975
|
+
void pshufd(XMMRegister dst, XMMRegister src, int8_t shuffle);
|
976
|
+
void pextrd(const Operand& dst, XMMRegister src, int8_t offset);
|
977
|
+
void pinsrd(XMMRegister dst, const Operand& src, int8_t offset);
|
978
|
+
|
979
|
+
// Parallel XMM operations.
|
980
|
+
void movntdqa(XMMRegister src, const Operand& dst);
|
981
|
+
void movntdq(const Operand& dst, XMMRegister src);
|
982
|
+
// Prefetch src position into cache level.
|
983
|
+
// Level 1, 2 or 3 specifies CPU cache level. Level 0 specifies a
|
984
|
+
// non-temporal
|
985
|
+
void prefetch(const Operand& src, int level);
|
986
|
+
// TODO(lrn): Need SFENCE for movnt?
|
987
|
+
|
988
|
+
// Debugging
|
989
|
+
void Print();
|
990
|
+
|
991
|
+
// Check the code size generated from label to here.
|
992
|
+
int SizeOfCodeGeneratedSince(Label* l) { return pc_offset() - l->pos(); }
|
993
|
+
|
994
|
+
// Mark address of the ExitJSFrame code.
|
995
|
+
void RecordJSReturn();
|
996
|
+
|
997
|
+
// Mark address of a debug break slot.
|
998
|
+
void RecordDebugBreakSlot();
|
999
|
+
|
1000
|
+
// Record a comment relocation entry that can be used by a disassembler.
|
1001
|
+
// Use --code-comments to enable, or provide "force = true" flag to always
|
1002
|
+
// write a comment.
|
1003
|
+
void RecordComment(const char* msg, bool force = false);
|
1004
|
+
|
1005
|
+
// Writes a single byte or word of data in the code stream. Used for
|
1006
|
+
// inline tables, e.g., jump-tables.
|
1007
|
+
void db(uint8_t data);
|
1008
|
+
void dd(uint32_t data);
|
1009
|
+
|
1010
|
+
int pc_offset() const { return pc_ - buffer_; }
|
1011
|
+
|
1012
|
+
// Check if there is less than kGap bytes available in the buffer.
|
1013
|
+
// If this is the case, we need to grow the buffer before emitting
|
1014
|
+
// an instruction or relocation information.
|
1015
|
+
inline bool overflow() const { return pc_ >= reloc_info_writer.pos() - kGap; }
|
1016
|
+
|
1017
|
+
// Get the number of bytes available in the buffer.
|
1018
|
+
inline int available_space() const { return reloc_info_writer.pos() - pc_; }
|
1019
|
+
|
1020
|
+
static bool IsNop(Address addr) { return *addr == 0x90; }
|
1021
|
+
|
1022
|
+
PositionsRecorder* positions_recorder() { return &positions_recorder_; }
|
1023
|
+
|
1024
|
+
int relocation_writer_size() {
|
1025
|
+
return (buffer_ + buffer_size_) - reloc_info_writer.pos();
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
// Avoid overflows for displacements etc.
|
1029
|
+
static const int kMaximalBufferSize = 512*MB;
|
1030
|
+
static const int kMinimalBufferSize = 4*KB;
|
1031
|
+
|
1032
|
+
protected:
|
1033
|
+
bool emit_debug_code() const { return emit_debug_code_; }
|
1034
|
+
|
1035
|
+
void movsd(XMMRegister dst, const Operand& src);
|
1036
|
+
void movsd(const Operand& dst, XMMRegister src);
|
1037
|
+
|
1038
|
+
void emit_sse_operand(XMMRegister reg, const Operand& adr);
|
1039
|
+
void emit_sse_operand(XMMRegister dst, XMMRegister src);
|
1040
|
+
void emit_sse_operand(Register dst, XMMRegister src);
|
1041
|
+
|
1042
|
+
byte* addr_at(int pos) { return buffer_ + pos; }
|
1043
|
+
|
1044
|
+
private:
|
1045
|
+
byte byte_at(int pos) { return buffer_[pos]; }
|
1046
|
+
void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
|
1047
|
+
uint32_t long_at(int pos) {
|
1048
|
+
return *reinterpret_cast<uint32_t*>(addr_at(pos));
|
1049
|
+
}
|
1050
|
+
void long_at_put(int pos, uint32_t x) {
|
1051
|
+
*reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
// code emission
|
1055
|
+
void GrowBuffer();
|
1056
|
+
inline void emit(uint32_t x);
|
1057
|
+
inline void emit(Handle<Object> handle);
|
1058
|
+
inline void emit(uint32_t x,
|
1059
|
+
RelocInfo::Mode rmode,
|
1060
|
+
unsigned ast_id = kNoASTId);
|
1061
|
+
inline void emit(const Immediate& x);
|
1062
|
+
inline void emit_w(const Immediate& x);
|
1063
|
+
|
1064
|
+
// Emit the code-object-relative offset of the label's position
|
1065
|
+
inline void emit_code_relative_offset(Label* label);
|
1066
|
+
|
1067
|
+
// instruction generation
|
1068
|
+
void emit_arith_b(int op1, int op2, Register dst, int imm8);
|
1069
|
+
|
1070
|
+
// Emit a basic arithmetic instruction (i.e. first byte of the family is 0x81)
|
1071
|
+
// with a given destination expression and an immediate operand. It attempts
|
1072
|
+
// to use the shortest encoding possible.
|
1073
|
+
// sel specifies the /n in the modrm byte (see the Intel PRM).
|
1074
|
+
void emit_arith(int sel, Operand dst, const Immediate& x);
|
1075
|
+
|
1076
|
+
void emit_operand(Register reg, const Operand& adr);
|
1077
|
+
|
1078
|
+
void emit_farith(int b1, int b2, int i);
|
1079
|
+
|
1080
|
+
// labels
|
1081
|
+
void print(Label* L);
|
1082
|
+
void bind_to(Label* L, int pos);
|
1083
|
+
|
1084
|
+
// displacements
|
1085
|
+
inline Displacement disp_at(Label* L);
|
1086
|
+
inline void disp_at_put(Label* L, Displacement disp);
|
1087
|
+
inline void emit_disp(Label* L, Displacement::Type type);
|
1088
|
+
inline void emit_near_disp(Label* L);
|
1089
|
+
|
1090
|
+
// record reloc info for current pc_
|
1091
|
+
void RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data = 0);
|
1092
|
+
|
1093
|
+
friend class CodePatcher;
|
1094
|
+
friend class EnsureSpace;
|
1095
|
+
|
1096
|
+
// Code buffer:
|
1097
|
+
// The buffer into which code and relocation info are generated.
|
1098
|
+
byte* buffer_;
|
1099
|
+
int buffer_size_;
|
1100
|
+
// True if the assembler owns the buffer, false if buffer is external.
|
1101
|
+
bool own_buffer_;
|
1102
|
+
|
1103
|
+
// code generation
|
1104
|
+
byte* pc_; // the program counter; moves forward
|
1105
|
+
RelocInfoWriter reloc_info_writer;
|
1106
|
+
|
1107
|
+
PositionsRecorder positions_recorder_;
|
1108
|
+
|
1109
|
+
bool emit_debug_code_;
|
1110
|
+
|
1111
|
+
friend class PositionsRecorder;
|
1112
|
+
};
|
1113
|
+
|
1114
|
+
|
1115
|
+
// Helper class that ensures that there is enough space for generating
|
1116
|
+
// instructions and relocation information. The constructor makes
|
1117
|
+
// sure that there is enough space and (in debug mode) the destructor
|
1118
|
+
// checks that we did not generate too much.
|
1119
|
+
class EnsureSpace BASE_EMBEDDED {
|
1120
|
+
public:
|
1121
|
+
explicit EnsureSpace(Assembler* assembler) : assembler_(assembler) {
|
1122
|
+
if (assembler_->overflow()) assembler_->GrowBuffer();
|
1123
|
+
#ifdef DEBUG
|
1124
|
+
space_before_ = assembler_->available_space();
|
1125
|
+
#endif
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
#ifdef DEBUG
|
1129
|
+
~EnsureSpace() {
|
1130
|
+
int bytes_generated = space_before_ - assembler_->available_space();
|
1131
|
+
ASSERT(bytes_generated < assembler_->kGap);
|
1132
|
+
}
|
1133
|
+
#endif
|
1134
|
+
|
1135
|
+
private:
|
1136
|
+
Assembler* assembler_;
|
1137
|
+
#ifdef DEBUG
|
1138
|
+
int space_before_;
|
1139
|
+
#endif
|
1140
|
+
};
|
1141
|
+
|
1142
|
+
} } // namespace v8::internal
|
1143
|
+
|
1144
|
+
#endif // V8_IA32_ASSEMBLER_IA32_H_
|