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,670 @@
|
|
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
|
+
// Features shared by parsing and pre-parsing scanners.
|
29
|
+
|
30
|
+
#ifndef V8_SCANNER_BASE_H_
|
31
|
+
#define V8_SCANNER_BASE_H_
|
32
|
+
|
33
|
+
#include "allocation.h"
|
34
|
+
#include "char-predicates.h"
|
35
|
+
#include "checks.h"
|
36
|
+
#include "globals.h"
|
37
|
+
#include "token.h"
|
38
|
+
#include "unicode-inl.h"
|
39
|
+
#include "utils.h"
|
40
|
+
|
41
|
+
namespace v8 {
|
42
|
+
namespace internal {
|
43
|
+
|
44
|
+
// Returns the value (0 .. 15) of a hexadecimal character c.
|
45
|
+
// If c is not a legal hexadecimal character, returns a value < 0.
|
46
|
+
inline int HexValue(uc32 c) {
|
47
|
+
c -= '0';
|
48
|
+
if (static_cast<unsigned>(c) <= 9) return c;
|
49
|
+
c = (c | 0x20) - ('a' - '0'); // detect 0x11..0x16 and 0x31..0x36.
|
50
|
+
if (static_cast<unsigned>(c) <= 5) return c + 10;
|
51
|
+
return -1;
|
52
|
+
}
|
53
|
+
|
54
|
+
|
55
|
+
// ---------------------------------------------------------------------
|
56
|
+
// Buffered stream of characters, using an internal UC16 buffer.
|
57
|
+
|
58
|
+
class UC16CharacterStream {
|
59
|
+
public:
|
60
|
+
UC16CharacterStream() : pos_(0) { }
|
61
|
+
virtual ~UC16CharacterStream() { }
|
62
|
+
|
63
|
+
// Returns and advances past the next UC16 character in the input
|
64
|
+
// stream. If there are no more characters, it returns a negative
|
65
|
+
// value.
|
66
|
+
inline uc32 Advance() {
|
67
|
+
if (buffer_cursor_ < buffer_end_ || ReadBlock()) {
|
68
|
+
pos_++;
|
69
|
+
return static_cast<uc32>(*(buffer_cursor_++));
|
70
|
+
}
|
71
|
+
// Note: currently the following increment is necessary to avoid a
|
72
|
+
// parser problem! The scanner treats the final kEndOfInput as
|
73
|
+
// a character with a position, and does math relative to that
|
74
|
+
// position.
|
75
|
+
pos_++;
|
76
|
+
|
77
|
+
return kEndOfInput;
|
78
|
+
}
|
79
|
+
|
80
|
+
// Return the current position in the character stream.
|
81
|
+
// Starts at zero.
|
82
|
+
inline unsigned pos() const { return pos_; }
|
83
|
+
|
84
|
+
// Skips forward past the next character_count UC16 characters
|
85
|
+
// in the input, or until the end of input if that comes sooner.
|
86
|
+
// Returns the number of characters actually skipped. If less
|
87
|
+
// than character_count,
|
88
|
+
inline unsigned SeekForward(unsigned character_count) {
|
89
|
+
unsigned buffered_chars =
|
90
|
+
static_cast<unsigned>(buffer_end_ - buffer_cursor_);
|
91
|
+
if (character_count <= buffered_chars) {
|
92
|
+
buffer_cursor_ += character_count;
|
93
|
+
pos_ += character_count;
|
94
|
+
return character_count;
|
95
|
+
}
|
96
|
+
return SlowSeekForward(character_count);
|
97
|
+
}
|
98
|
+
|
99
|
+
// Pushes back the most recently read UC16 character (or negative
|
100
|
+
// value if at end of input), i.e., the value returned by the most recent
|
101
|
+
// call to Advance.
|
102
|
+
// Must not be used right after calling SeekForward.
|
103
|
+
virtual void PushBack(int32_t character) = 0;
|
104
|
+
|
105
|
+
protected:
|
106
|
+
static const uc32 kEndOfInput = -1;
|
107
|
+
|
108
|
+
// Ensures that the buffer_cursor_ points to the character at
|
109
|
+
// position pos_ of the input, if possible. If the position
|
110
|
+
// is at or after the end of the input, return false. If there
|
111
|
+
// are more characters available, return true.
|
112
|
+
virtual bool ReadBlock() = 0;
|
113
|
+
virtual unsigned SlowSeekForward(unsigned character_count) = 0;
|
114
|
+
|
115
|
+
const uc16* buffer_cursor_;
|
116
|
+
const uc16* buffer_end_;
|
117
|
+
unsigned pos_;
|
118
|
+
};
|
119
|
+
|
120
|
+
|
121
|
+
class UnicodeCache {
|
122
|
+
// ---------------------------------------------------------------------
|
123
|
+
// Caching predicates used by scanners.
|
124
|
+
public:
|
125
|
+
UnicodeCache() {}
|
126
|
+
typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder;
|
127
|
+
|
128
|
+
StaticResource<Utf8Decoder>* utf8_decoder() {
|
129
|
+
return &utf8_decoder_;
|
130
|
+
}
|
131
|
+
|
132
|
+
bool IsIdentifierStart(unibrow::uchar c) { return kIsIdentifierStart.get(c); }
|
133
|
+
bool IsIdentifierPart(unibrow::uchar c) { return kIsIdentifierPart.get(c); }
|
134
|
+
bool IsLineTerminator(unibrow::uchar c) { return kIsLineTerminator.get(c); }
|
135
|
+
bool IsWhiteSpace(unibrow::uchar c) { return kIsWhiteSpace.get(c); }
|
136
|
+
|
137
|
+
private:
|
138
|
+
|
139
|
+
unibrow::Predicate<IdentifierStart, 128> kIsIdentifierStart;
|
140
|
+
unibrow::Predicate<IdentifierPart, 128> kIsIdentifierPart;
|
141
|
+
unibrow::Predicate<unibrow::LineTerminator, 128> kIsLineTerminator;
|
142
|
+
unibrow::Predicate<unibrow::WhiteSpace, 128> kIsWhiteSpace;
|
143
|
+
StaticResource<Utf8Decoder> utf8_decoder_;
|
144
|
+
|
145
|
+
DISALLOW_COPY_AND_ASSIGN(UnicodeCache);
|
146
|
+
};
|
147
|
+
|
148
|
+
|
149
|
+
// ----------------------------------------------------------------------------
|
150
|
+
// LiteralBuffer - Collector of chars of literals.
|
151
|
+
|
152
|
+
class LiteralBuffer {
|
153
|
+
public:
|
154
|
+
LiteralBuffer() : is_ascii_(true), position_(0), backing_store_() { }
|
155
|
+
|
156
|
+
~LiteralBuffer() {
|
157
|
+
if (backing_store_.length() > 0) {
|
158
|
+
backing_store_.Dispose();
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
162
|
+
inline void AddChar(uc16 character) {
|
163
|
+
if (position_ >= backing_store_.length()) ExpandBuffer();
|
164
|
+
if (is_ascii_) {
|
165
|
+
if (character < kMaxAsciiCharCodeU) {
|
166
|
+
backing_store_[position_] = static_cast<byte>(character);
|
167
|
+
position_ += kASCIISize;
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
ConvertToUC16();
|
171
|
+
}
|
172
|
+
*reinterpret_cast<uc16*>(&backing_store_[position_]) = character;
|
173
|
+
position_ += kUC16Size;
|
174
|
+
}
|
175
|
+
|
176
|
+
bool is_ascii() { return is_ascii_; }
|
177
|
+
|
178
|
+
Vector<const uc16> uc16_literal() {
|
179
|
+
ASSERT(!is_ascii_);
|
180
|
+
ASSERT((position_ & 0x1) == 0);
|
181
|
+
return Vector<const uc16>(
|
182
|
+
reinterpret_cast<const uc16*>(backing_store_.start()),
|
183
|
+
position_ >> 1);
|
184
|
+
}
|
185
|
+
|
186
|
+
Vector<const char> ascii_literal() {
|
187
|
+
ASSERT(is_ascii_);
|
188
|
+
return Vector<const char>(
|
189
|
+
reinterpret_cast<const char*>(backing_store_.start()),
|
190
|
+
position_);
|
191
|
+
}
|
192
|
+
|
193
|
+
int length() {
|
194
|
+
return is_ascii_ ? position_ : (position_ >> 1);
|
195
|
+
}
|
196
|
+
|
197
|
+
void Reset() {
|
198
|
+
position_ = 0;
|
199
|
+
is_ascii_ = true;
|
200
|
+
}
|
201
|
+
private:
|
202
|
+
static const int kInitialCapacity = 16;
|
203
|
+
static const int kGrowthFactory = 4;
|
204
|
+
static const int kMinConversionSlack = 256;
|
205
|
+
static const int kMaxGrowth = 1 * MB;
|
206
|
+
inline int NewCapacity(int min_capacity) {
|
207
|
+
int capacity = Max(min_capacity, backing_store_.length());
|
208
|
+
int new_capacity = Min(capacity * kGrowthFactory, capacity + kMaxGrowth);
|
209
|
+
return new_capacity;
|
210
|
+
}
|
211
|
+
|
212
|
+
void ExpandBuffer() {
|
213
|
+
Vector<byte> new_store = Vector<byte>::New(NewCapacity(kInitialCapacity));
|
214
|
+
memcpy(new_store.start(), backing_store_.start(), position_);
|
215
|
+
backing_store_.Dispose();
|
216
|
+
backing_store_ = new_store;
|
217
|
+
}
|
218
|
+
|
219
|
+
void ConvertToUC16() {
|
220
|
+
ASSERT(is_ascii_);
|
221
|
+
Vector<byte> new_store;
|
222
|
+
int new_content_size = position_ * kUC16Size;
|
223
|
+
if (new_content_size >= backing_store_.length()) {
|
224
|
+
// Ensure room for all currently read characters as UC16 as well
|
225
|
+
// as the character about to be stored.
|
226
|
+
new_store = Vector<byte>::New(NewCapacity(new_content_size));
|
227
|
+
} else {
|
228
|
+
new_store = backing_store_;
|
229
|
+
}
|
230
|
+
char* src = reinterpret_cast<char*>(backing_store_.start());
|
231
|
+
uc16* dst = reinterpret_cast<uc16*>(new_store.start());
|
232
|
+
for (int i = position_ - 1; i >= 0; i--) {
|
233
|
+
dst[i] = src[i];
|
234
|
+
}
|
235
|
+
if (new_store.start() != backing_store_.start()) {
|
236
|
+
backing_store_.Dispose();
|
237
|
+
backing_store_ = new_store;
|
238
|
+
}
|
239
|
+
position_ = new_content_size;
|
240
|
+
is_ascii_ = false;
|
241
|
+
}
|
242
|
+
|
243
|
+
bool is_ascii_;
|
244
|
+
int position_;
|
245
|
+
Vector<byte> backing_store_;
|
246
|
+
|
247
|
+
DISALLOW_COPY_AND_ASSIGN(LiteralBuffer);
|
248
|
+
};
|
249
|
+
|
250
|
+
|
251
|
+
// ----------------------------------------------------------------------------
|
252
|
+
// Scanner base-class.
|
253
|
+
|
254
|
+
// Generic functionality used by both JSON and JavaScript scanners.
|
255
|
+
class Scanner {
|
256
|
+
public:
|
257
|
+
// -1 is outside of the range of any real source code.
|
258
|
+
static const int kNoOctalLocation = -1;
|
259
|
+
|
260
|
+
typedef unibrow::Utf8InputBuffer<1024> Utf8Decoder;
|
261
|
+
|
262
|
+
class LiteralScope {
|
263
|
+
public:
|
264
|
+
explicit LiteralScope(Scanner* self);
|
265
|
+
~LiteralScope();
|
266
|
+
void Complete();
|
267
|
+
|
268
|
+
private:
|
269
|
+
Scanner* scanner_;
|
270
|
+
bool complete_;
|
271
|
+
};
|
272
|
+
|
273
|
+
explicit Scanner(UnicodeCache* scanner_contants);
|
274
|
+
|
275
|
+
// Returns the current token again.
|
276
|
+
Token::Value current_token() { return current_.token; }
|
277
|
+
|
278
|
+
// One token look-ahead (past the token returned by Next()).
|
279
|
+
Token::Value peek() const { return next_.token; }
|
280
|
+
|
281
|
+
struct Location {
|
282
|
+
Location(int b, int e) : beg_pos(b), end_pos(e) { }
|
283
|
+
Location() : beg_pos(0), end_pos(0) { }
|
284
|
+
|
285
|
+
bool IsValid() const {
|
286
|
+
return beg_pos >= 0 && end_pos >= beg_pos;
|
287
|
+
}
|
288
|
+
|
289
|
+
static Location invalid() { return Location(-1, -1); }
|
290
|
+
|
291
|
+
int beg_pos;
|
292
|
+
int end_pos;
|
293
|
+
};
|
294
|
+
|
295
|
+
// Returns the location information for the current token
|
296
|
+
// (the token returned by Next()).
|
297
|
+
Location location() const { return current_.location; }
|
298
|
+
Location peek_location() const { return next_.location; }
|
299
|
+
|
300
|
+
// Returns the literal string, if any, for the current token (the
|
301
|
+
// token returned by Next()). The string is 0-terminated and in
|
302
|
+
// UTF-8 format; they may contain 0-characters. Literal strings are
|
303
|
+
// collected for identifiers, strings, and numbers.
|
304
|
+
// These functions only give the correct result if the literal
|
305
|
+
// was scanned between calls to StartLiteral() and TerminateLiteral().
|
306
|
+
bool is_literal_ascii() {
|
307
|
+
ASSERT_NOT_NULL(current_.literal_chars);
|
308
|
+
return current_.literal_chars->is_ascii();
|
309
|
+
}
|
310
|
+
Vector<const char> literal_ascii_string() {
|
311
|
+
ASSERT_NOT_NULL(current_.literal_chars);
|
312
|
+
return current_.literal_chars->ascii_literal();
|
313
|
+
}
|
314
|
+
Vector<const uc16> literal_uc16_string() {
|
315
|
+
ASSERT_NOT_NULL(current_.literal_chars);
|
316
|
+
return current_.literal_chars->uc16_literal();
|
317
|
+
}
|
318
|
+
int literal_length() const {
|
319
|
+
ASSERT_NOT_NULL(current_.literal_chars);
|
320
|
+
return current_.literal_chars->length();
|
321
|
+
}
|
322
|
+
|
323
|
+
bool literal_contains_escapes() const {
|
324
|
+
Location location = current_.location;
|
325
|
+
int source_length = (location.end_pos - location.beg_pos);
|
326
|
+
if (current_.token == Token::STRING) {
|
327
|
+
// Subtract delimiters.
|
328
|
+
source_length -= 2;
|
329
|
+
}
|
330
|
+
return current_.literal_chars->length() != source_length;
|
331
|
+
}
|
332
|
+
|
333
|
+
// Returns the literal string for the next token (the token that
|
334
|
+
// would be returned if Next() were called).
|
335
|
+
bool is_next_literal_ascii() {
|
336
|
+
ASSERT_NOT_NULL(next_.literal_chars);
|
337
|
+
return next_.literal_chars->is_ascii();
|
338
|
+
}
|
339
|
+
Vector<const char> next_literal_ascii_string() {
|
340
|
+
ASSERT_NOT_NULL(next_.literal_chars);
|
341
|
+
return next_.literal_chars->ascii_literal();
|
342
|
+
}
|
343
|
+
Vector<const uc16> next_literal_uc16_string() {
|
344
|
+
ASSERT_NOT_NULL(next_.literal_chars);
|
345
|
+
return next_.literal_chars->uc16_literal();
|
346
|
+
}
|
347
|
+
int next_literal_length() const {
|
348
|
+
ASSERT_NOT_NULL(next_.literal_chars);
|
349
|
+
return next_.literal_chars->length();
|
350
|
+
}
|
351
|
+
|
352
|
+
static const int kCharacterLookaheadBufferSize = 1;
|
353
|
+
|
354
|
+
protected:
|
355
|
+
// The current and look-ahead token.
|
356
|
+
struct TokenDesc {
|
357
|
+
Token::Value token;
|
358
|
+
Location location;
|
359
|
+
LiteralBuffer* literal_chars;
|
360
|
+
};
|
361
|
+
|
362
|
+
// Call this after setting source_ to the input.
|
363
|
+
void Init() {
|
364
|
+
// Set c0_ (one character ahead)
|
365
|
+
ASSERT(kCharacterLookaheadBufferSize == 1);
|
366
|
+
Advance();
|
367
|
+
// Initialize current_ to not refer to a literal.
|
368
|
+
current_.literal_chars = NULL;
|
369
|
+
}
|
370
|
+
|
371
|
+
// Literal buffer support
|
372
|
+
inline void StartLiteral() {
|
373
|
+
LiteralBuffer* free_buffer = (current_.literal_chars == &literal_buffer1_) ?
|
374
|
+
&literal_buffer2_ : &literal_buffer1_;
|
375
|
+
free_buffer->Reset();
|
376
|
+
next_.literal_chars = free_buffer;
|
377
|
+
}
|
378
|
+
|
379
|
+
inline void AddLiteralChar(uc32 c) {
|
380
|
+
ASSERT_NOT_NULL(next_.literal_chars);
|
381
|
+
next_.literal_chars->AddChar(c);
|
382
|
+
}
|
383
|
+
|
384
|
+
// Complete scanning of a literal.
|
385
|
+
inline void TerminateLiteral() {
|
386
|
+
// Does nothing in the current implementation.
|
387
|
+
}
|
388
|
+
|
389
|
+
// Stops scanning of a literal and drop the collected characters,
|
390
|
+
// e.g., due to an encountered error.
|
391
|
+
inline void DropLiteral() {
|
392
|
+
next_.literal_chars = NULL;
|
393
|
+
}
|
394
|
+
|
395
|
+
inline void AddLiteralCharAdvance() {
|
396
|
+
AddLiteralChar(c0_);
|
397
|
+
Advance();
|
398
|
+
}
|
399
|
+
|
400
|
+
// Low-level scanning support.
|
401
|
+
void Advance() { c0_ = source_->Advance(); }
|
402
|
+
void PushBack(uc32 ch) {
|
403
|
+
source_->PushBack(c0_);
|
404
|
+
c0_ = ch;
|
405
|
+
}
|
406
|
+
|
407
|
+
inline Token::Value Select(Token::Value tok) {
|
408
|
+
Advance();
|
409
|
+
return tok;
|
410
|
+
}
|
411
|
+
|
412
|
+
inline Token::Value Select(uc32 next, Token::Value then, Token::Value else_) {
|
413
|
+
Advance();
|
414
|
+
if (c0_ == next) {
|
415
|
+
Advance();
|
416
|
+
return then;
|
417
|
+
} else {
|
418
|
+
return else_;
|
419
|
+
}
|
420
|
+
}
|
421
|
+
|
422
|
+
uc32 ScanHexEscape(uc32 c, int length);
|
423
|
+
|
424
|
+
// Return the current source position.
|
425
|
+
int source_pos() {
|
426
|
+
return source_->pos() - kCharacterLookaheadBufferSize;
|
427
|
+
}
|
428
|
+
|
429
|
+
UnicodeCache* unicode_cache_;
|
430
|
+
|
431
|
+
// Buffers collecting literal strings, numbers, etc.
|
432
|
+
LiteralBuffer literal_buffer1_;
|
433
|
+
LiteralBuffer literal_buffer2_;
|
434
|
+
|
435
|
+
TokenDesc current_; // desc for current token (as returned by Next())
|
436
|
+
TokenDesc next_; // desc for next token (one token look-ahead)
|
437
|
+
|
438
|
+
// Input stream. Must be initialized to an UC16CharacterStream.
|
439
|
+
UC16CharacterStream* source_;
|
440
|
+
|
441
|
+
// One Unicode character look-ahead; c0_ < 0 at the end of the input.
|
442
|
+
uc32 c0_;
|
443
|
+
};
|
444
|
+
|
445
|
+
// ----------------------------------------------------------------------------
|
446
|
+
// JavaScriptScanner - base logic for JavaScript scanning.
|
447
|
+
|
448
|
+
class JavaScriptScanner : public Scanner {
|
449
|
+
public:
|
450
|
+
// A LiteralScope that disables recording of some types of JavaScript
|
451
|
+
// literals. If the scanner is configured to not record the specific
|
452
|
+
// type of literal, the scope will not call StartLiteral.
|
453
|
+
class LiteralScope {
|
454
|
+
public:
|
455
|
+
explicit LiteralScope(JavaScriptScanner* self)
|
456
|
+
: scanner_(self), complete_(false) {
|
457
|
+
scanner_->StartLiteral();
|
458
|
+
}
|
459
|
+
~LiteralScope() {
|
460
|
+
if (!complete_) scanner_->DropLiteral();
|
461
|
+
}
|
462
|
+
void Complete() {
|
463
|
+
scanner_->TerminateLiteral();
|
464
|
+
complete_ = true;
|
465
|
+
}
|
466
|
+
|
467
|
+
private:
|
468
|
+
JavaScriptScanner* scanner_;
|
469
|
+
bool complete_;
|
470
|
+
};
|
471
|
+
|
472
|
+
explicit JavaScriptScanner(UnicodeCache* scanner_contants);
|
473
|
+
|
474
|
+
// Returns the next token.
|
475
|
+
Token::Value Next();
|
476
|
+
|
477
|
+
// Returns true if there was a line terminator before the peek'ed token.
|
478
|
+
bool has_line_terminator_before_next() const {
|
479
|
+
return has_line_terminator_before_next_;
|
480
|
+
}
|
481
|
+
|
482
|
+
// Scans the input as a regular expression pattern, previous
|
483
|
+
// character(s) must be /(=). Returns true if a pattern is scanned.
|
484
|
+
bool ScanRegExpPattern(bool seen_equal);
|
485
|
+
// Returns true if regexp flags are scanned (always since flags can
|
486
|
+
// be empty).
|
487
|
+
bool ScanRegExpFlags();
|
488
|
+
|
489
|
+
// Tells whether the buffer contains an identifier (no escapes).
|
490
|
+
// Used for checking if a property name is an identifier.
|
491
|
+
static bool IsIdentifier(unibrow::CharacterStream* buffer);
|
492
|
+
|
493
|
+
// Scans octal escape sequence. Also accepts "\0" decimal escape sequence.
|
494
|
+
uc32 ScanOctalEscape(uc32 c, int length);
|
495
|
+
|
496
|
+
// Returns the location of the last seen octal literal
|
497
|
+
Location octal_position() const { return octal_pos_; }
|
498
|
+
void clear_octal_position() { octal_pos_ = Location::invalid(); }
|
499
|
+
|
500
|
+
// Seek forward to the given position. This operation does not
|
501
|
+
// work in general, for instance when there are pushed back
|
502
|
+
// characters, but works for seeking forward until simple delimiter
|
503
|
+
// tokens, which is what it is used for.
|
504
|
+
void SeekForward(int pos);
|
505
|
+
|
506
|
+
protected:
|
507
|
+
bool SkipWhiteSpace();
|
508
|
+
Token::Value SkipSingleLineComment();
|
509
|
+
Token::Value SkipMultiLineComment();
|
510
|
+
|
511
|
+
// Scans a single JavaScript token.
|
512
|
+
void Scan();
|
513
|
+
|
514
|
+
void ScanDecimalDigits();
|
515
|
+
Token::Value ScanNumber(bool seen_period);
|
516
|
+
Token::Value ScanIdentifierOrKeyword();
|
517
|
+
Token::Value ScanIdentifierSuffix(LiteralScope* literal);
|
518
|
+
|
519
|
+
void ScanEscape();
|
520
|
+
Token::Value ScanString();
|
521
|
+
|
522
|
+
// Scans a possible HTML comment -- begins with '<!'.
|
523
|
+
Token::Value ScanHtmlComment();
|
524
|
+
|
525
|
+
// Decodes a unicode escape-sequence which is part of an identifier.
|
526
|
+
// If the escape sequence cannot be decoded the result is kBadChar.
|
527
|
+
uc32 ScanIdentifierUnicodeEscape();
|
528
|
+
|
529
|
+
// Start position of the octal literal last scanned.
|
530
|
+
Location octal_pos_;
|
531
|
+
|
532
|
+
bool has_line_terminator_before_next_;
|
533
|
+
};
|
534
|
+
|
535
|
+
|
536
|
+
// ----------------------------------------------------------------------------
|
537
|
+
// Keyword matching state machine.
|
538
|
+
|
539
|
+
class KeywordMatcher {
|
540
|
+
// Incrementally recognize keywords.
|
541
|
+
//
|
542
|
+
// Recognized keywords:
|
543
|
+
// break case catch const* continue debugger* default delete do else
|
544
|
+
// finally false for function if in instanceof native* new null
|
545
|
+
// return switch this throw true try typeof var void while with
|
546
|
+
//
|
547
|
+
// *: Actually "future reserved keywords". These are the only ones we
|
548
|
+
// recognize, the remaining are allowed as identifiers.
|
549
|
+
// In ES5 strict mode, we should disallow all reserved keywords.
|
550
|
+
public:
|
551
|
+
KeywordMatcher()
|
552
|
+
: state_(INITIAL),
|
553
|
+
token_(Token::IDENTIFIER),
|
554
|
+
keyword_(NULL),
|
555
|
+
counter_(0),
|
556
|
+
keyword_token_(Token::ILLEGAL) {}
|
557
|
+
|
558
|
+
Token::Value token() { return token_; }
|
559
|
+
|
560
|
+
inline bool AddChar(unibrow::uchar input) {
|
561
|
+
if (state_ != UNMATCHABLE) {
|
562
|
+
Step(input);
|
563
|
+
}
|
564
|
+
return state_ != UNMATCHABLE;
|
565
|
+
}
|
566
|
+
|
567
|
+
void Fail() {
|
568
|
+
token_ = Token::IDENTIFIER;
|
569
|
+
state_ = UNMATCHABLE;
|
570
|
+
}
|
571
|
+
|
572
|
+
private:
|
573
|
+
enum State {
|
574
|
+
UNMATCHABLE,
|
575
|
+
INITIAL,
|
576
|
+
KEYWORD_PREFIX,
|
577
|
+
KEYWORD_MATCHED,
|
578
|
+
C,
|
579
|
+
CA,
|
580
|
+
CO,
|
581
|
+
CON,
|
582
|
+
D,
|
583
|
+
DE,
|
584
|
+
E,
|
585
|
+
EX,
|
586
|
+
F,
|
587
|
+
I,
|
588
|
+
IM,
|
589
|
+
IMP,
|
590
|
+
IN,
|
591
|
+
N,
|
592
|
+
P,
|
593
|
+
PR,
|
594
|
+
S,
|
595
|
+
T,
|
596
|
+
TH,
|
597
|
+
TR,
|
598
|
+
V,
|
599
|
+
W
|
600
|
+
};
|
601
|
+
|
602
|
+
struct FirstState {
|
603
|
+
const char* keyword;
|
604
|
+
State state;
|
605
|
+
Token::Value token;
|
606
|
+
};
|
607
|
+
|
608
|
+
// Range of possible first characters of a keyword.
|
609
|
+
static const unsigned int kFirstCharRangeMin = 'b';
|
610
|
+
static const unsigned int kFirstCharRangeMax = 'y';
|
611
|
+
static const unsigned int kFirstCharRangeLength =
|
612
|
+
kFirstCharRangeMax - kFirstCharRangeMin + 1;
|
613
|
+
// State map for first keyword character range.
|
614
|
+
static FirstState first_states_[kFirstCharRangeLength];
|
615
|
+
|
616
|
+
// If input equals keyword's character at position, continue matching keyword
|
617
|
+
// from that position.
|
618
|
+
inline bool MatchKeywordStart(unibrow::uchar input,
|
619
|
+
const char* keyword,
|
620
|
+
int position,
|
621
|
+
Token::Value token_if_match) {
|
622
|
+
if (input != static_cast<unibrow::uchar>(keyword[position])) {
|
623
|
+
return false;
|
624
|
+
}
|
625
|
+
state_ = KEYWORD_PREFIX;
|
626
|
+
this->keyword_ = keyword;
|
627
|
+
this->counter_ = position + 1;
|
628
|
+
this->keyword_token_ = token_if_match;
|
629
|
+
return true;
|
630
|
+
}
|
631
|
+
|
632
|
+
// If input equals match character, transition to new state and return true.
|
633
|
+
inline bool MatchState(unibrow::uchar input, char match, State new_state) {
|
634
|
+
if (input != static_cast<unibrow::uchar>(match)) {
|
635
|
+
return false;
|
636
|
+
}
|
637
|
+
state_ = new_state;
|
638
|
+
return true;
|
639
|
+
}
|
640
|
+
|
641
|
+
inline bool MatchKeyword(unibrow::uchar input,
|
642
|
+
char match,
|
643
|
+
State new_state,
|
644
|
+
Token::Value keyword_token) {
|
645
|
+
if (input != static_cast<unibrow::uchar>(match)) {
|
646
|
+
return false;
|
647
|
+
}
|
648
|
+
state_ = new_state;
|
649
|
+
token_ = keyword_token;
|
650
|
+
return true;
|
651
|
+
}
|
652
|
+
|
653
|
+
void Step(unibrow::uchar input);
|
654
|
+
|
655
|
+
// Current state.
|
656
|
+
State state_;
|
657
|
+
// Token for currently added characters.
|
658
|
+
Token::Value token_;
|
659
|
+
|
660
|
+
// Matching a specific keyword string (there is only one possible valid
|
661
|
+
// keyword with the current prefix).
|
662
|
+
const char* keyword_;
|
663
|
+
int counter_;
|
664
|
+
Token::Value keyword_token_;
|
665
|
+
};
|
666
|
+
|
667
|
+
|
668
|
+
} } // namespace v8::internal
|
669
|
+
|
670
|
+
#endif // V8_SCANNER_BASE_H_
|