therubyracer 0.6.3 → 0.7.0.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of therubyracer might be problematic. Click here for more details.
- data/Rakefile +10 -9
- data/ext/v8/callbacks.cpp +15 -8
- data/ext/v8/converters.cpp +7 -8
- data/ext/v8/converters.h +0 -2
- data/ext/v8/extconf.rb +2 -0
- data/ext/v8/rr.cpp +169 -0
- data/ext/v8/rr.h +34 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/AUTHORS +8 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/ChangeLog +198 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/LICENSE +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/SConstruct +152 -38
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/include/v8-debug.h +52 -4
- data/ext/v8/upstream/2.1.10/include/v8-profiler.h +176 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/include/v8.h +227 -48
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/SConscript +60 -10
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/accessors.cc +5 -39
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/accessors.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/allocation.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/allocation.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/api.cc +477 -57
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/api.h +8 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/apinatives.js +1 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/apiutils.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arguments.h +5 -6
- data/ext/v8/upstream/{2.0.6/src/arm/assembler-thumb2-inl.h → 2.1.10/src/arm/assembler-arm-inl.h} +42 -27
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-arm.cc +430 -216
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-arm.h +199 -110
- data/ext/v8/upstream/{2.0.6/src/arm/assembler-arm-inl.h → 2.1.10/src/arm/assembler-thumb2-inl.h} +4 -18
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-thumb2.cc +142 -85
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/assembler-thumb2.h +18 -9
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/builtins-arm.cc +127 -87
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/codegen-arm-inl.h +3 -5
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/codegen-arm.cc +4634 -1427
- data/ext/v8/upstream/2.1.10/src/arm/codegen-arm.h +946 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/constants-arm.cc +21 -3
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/constants-arm.h +39 -13
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/cpu-arm.cc +9 -3
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/debug-arm.cc +34 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/disasm-arm.cc +262 -117
- data/ext/v8/upstream/2.1.10/src/arm/fast-codegen-arm.cc +238 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/frames-arm.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/frames-arm.h +0 -0
- data/ext/v8/upstream/{2.0.6/src/arm/fast-codegen-arm.cc → 2.1.10/src/arm/full-codegen-arm.cc} +453 -283
- data/ext/v8/upstream/2.1.10/src/arm/ic-arm.cc +1833 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/jump-target-arm.cc +3 -29
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/macro-assembler-arm.cc +564 -104
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/macro-assembler-arm.h +255 -46
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/regexp-macro-assembler-arm.cc +78 -104
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/regexp-macro-assembler-arm.h +6 -22
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm-inl.h +0 -3
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/register-allocator-arm.h +2 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/simulator-arm.cc +557 -180
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/simulator-arm.h +52 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/arm/stub-cache-arm.cc +904 -240
- data/ext/v8/upstream/2.1.10/src/arm/virtual-frame-arm.cc +668 -0
- data/ext/v8/upstream/2.1.10/src/arm/virtual-frame-arm.h +503 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/array.js +82 -109
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/assembler.cc +49 -13
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/assembler.h +27 -5
- data/ext/v8/upstream/2.1.10/src/ast.cc +1138 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ast.h +354 -53
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bootstrapper.cc +609 -501
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bootstrapper.h +27 -8
- data/ext/v8/upstream/2.1.10/src/builtins.cc +1512 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/builtins.h +41 -25
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/bytecodes-irregexp.h +0 -0
- data/ext/v8/upstream/2.1.10/src/cached-powers.h +119 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/char-predicates-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/char-predicates.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/checks.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/checks.h +25 -1
- data/ext/v8/upstream/2.1.10/src/circular-queue-inl.h +101 -0
- data/ext/v8/upstream/2.1.10/src/circular-queue.cc +121 -0
- data/ext/v8/upstream/2.1.10/src/circular-queue.h +129 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code-stubs.cc +23 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code-stubs.h +16 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/code.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen-inl.h +6 -34
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen.cc +73 -92
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/codegen.h +164 -68
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/compilation-cache.cc +117 -73
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/compilation-cache.h +18 -17
- data/ext/v8/upstream/2.1.10/src/compiler.cc +623 -0
- data/ext/v8/upstream/2.1.10/src/compiler.h +299 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/contexts.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/contexts.h +8 -11
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/conversions-inl.h +28 -13
- data/ext/v8/upstream/2.1.10/src/conversions.cc +1105 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/conversions.h +9 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/counters.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/counters.h +1 -1
- data/ext/v8/upstream/2.1.10/src/cpu-profiler-inl.h +99 -0
- data/ext/v8/upstream/2.1.10/src/cpu-profiler.cc +494 -0
- data/ext/v8/upstream/2.1.10/src/cpu-profiler.h +277 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/cpu.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-debug.cc +15 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-debug.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-posix.cc +18 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-readline.cc +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8-windows.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.cc +10 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.h +2 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/d8.js +43 -38
- data/ext/v8/upstream/2.1.10/src/data-flow.cc +755 -0
- data/ext/v8/upstream/2.1.10/src/data-flow.h +278 -0
- data/ext/v8/upstream/{2.0.6/src/date-delay.js → 2.1.10/src/date.js} +100 -110
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser-inl.h +11 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser.cc +24 -26
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dateparser.h +8 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug-agent.cc +3 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug-agent.h +0 -0
- data/ext/v8/upstream/{2.0.6/src/debug-delay.js → 2.1.10/src/debug-debugger.js} +111 -15
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug.cc +156 -96
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/debug.h +53 -5
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disasm.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disassembler.cc +2 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/disassembler.h +0 -0
- data/ext/v8/upstream/2.1.10/src/diy-fp.cc +58 -0
- data/ext/v8/upstream/2.1.10/src/diy-fp.h +117 -0
- data/ext/v8/upstream/2.1.10/src/double.h +169 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/dtoa-config.c +4 -3
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/execution.cc +22 -22
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/execution.h +17 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/factory.cc +70 -46
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/factory.h +27 -17
- data/ext/v8/upstream/2.1.10/src/fast-codegen.cc +746 -0
- data/ext/v8/upstream/2.1.10/src/fast-codegen.h +161 -0
- data/ext/v8/upstream/2.1.10/src/fast-dtoa.cc +512 -0
- data/ext/v8/upstream/2.1.10/src/fast-dtoa.h +59 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flag-definitions.h +32 -11
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flags.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/flags.h +0 -0
- data/ext/v8/upstream/2.1.10/src/flow-graph.cc +763 -0
- data/ext/v8/upstream/2.1.10/src/flow-graph.h +180 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frame-element.cc +1 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frame-element.h +49 -11
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames-inl.h +2 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames.cc +91 -17
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/frames.h +24 -2
- data/ext/v8/upstream/{2.0.6/src/fast-codegen.cc → 2.1.10/src/full-codegen.cc} +549 -198
- data/ext/v8/upstream/{2.0.6/src/fast-codegen.h → 2.1.10/src/full-codegen.h} +109 -29
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/func-name-inferrer.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/func-name-inferrer.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/global-handles.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/global-handles.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/globals.h +67 -43
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles.cc +124 -129
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/handles.h +33 -15
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/hashmap.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/hashmap.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-inl.h +56 -12
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-profiler.cc +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap-profiler.h +2 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap.cc +413 -221
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/heap.h +192 -67
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32-inl.h +6 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32.cc +187 -32
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/assembler-ia32.h +31 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/builtins-ia32.cc +160 -133
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/codegen-ia32-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/codegen-ia32.cc +5533 -2177
- data/ext/v8/upstream/{2.0.6/src/x64/codegen-x64.h → 2.1.10/src/ia32/codegen-ia32.h} +453 -134
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/cpu-ia32.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/debug-ia32.cc +63 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/disasm-ia32.cc +99 -16
- data/ext/v8/upstream/2.1.10/src/ia32/fast-codegen-ia32.cc +950 -0
- data/ext/v8/upstream/2.1.10/src/ia32/fast-codegen-ia32.h +155 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/frames-ia32.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/frames-ia32.h +0 -0
- data/ext/v8/upstream/{2.0.6/src/ia32/fast-codegen-ia32.cc → 2.1.10/src/ia32/full-codegen-ia32.cc} +454 -253
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/ic-ia32.cc +545 -390
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/jump-target-ia32.cc +1 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/macro-assembler-ia32.cc +330 -139
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/macro-assembler-ia32.h +96 -30
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/regexp-macro-assembler-ia32.cc +73 -89
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/regexp-macro-assembler-ia32.h +6 -21
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32.cc +59 -5
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/register-allocator-ia32.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/simulator-ia32.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/simulator-ia32.h +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/stub-cache-ia32.cc +745 -303
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/virtual-frame-ia32.cc +278 -71
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ia32/virtual-frame-ia32.h +78 -22
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic.cc +172 -89
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/ic.h +51 -20
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/interpreter-irregexp.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/interpreter-irregexp.h +0 -0
- data/ext/v8/upstream/{2.0.6/src/json-delay.js → 2.1.10/src/json.js} +26 -12
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jsregexp.cc +151 -118
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jsregexp.h +31 -7
- data/ext/v8/upstream/2.1.10/src/jump-target-heavy-inl.h +51 -0
- data/ext/v8/upstream/{2.0.6/src/jump-target.cc → 2.1.10/src/jump-target-heavy.cc} +164 -184
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jump-target-inl.h +8 -9
- data/ext/v8/upstream/{2.0.6/src/usage-analyzer.h → 2.1.10/src/jump-target-light-inl.h} +9 -7
- data/ext/v8/upstream/2.1.10/src/jump-target-light.cc +86 -0
- data/ext/v8/upstream/2.1.10/src/jump-target.cc +155 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/jump-target.h +6 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/list-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/list.h +2 -1
- data/ext/v8/upstream/2.1.10/src/liveedit-debugger.js +944 -0
- data/ext/v8/upstream/2.1.10/src/liveedit.cc +1468 -0
- data/ext/v8/upstream/2.1.10/src/liveedit.h +170 -0
- data/ext/v8/upstream/2.1.10/src/log-inl.h +59 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log-utils.cc +3 -9
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log-utils.h +1 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log.cc +198 -95
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/log.h +50 -49
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/macro-assembler.h +9 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/macros.py +30 -11
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mark-compact.cc +464 -152
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mark-compact.h +41 -20
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/math.js +9 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/memory.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.cc +1 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/messages.js +46 -9
- data/ext/v8/upstream/2.1.10/src/mips/assembler-mips-inl.h +215 -0
- data/ext/v8/upstream/2.1.10/src/mips/assembler-mips.cc +1208 -0
- data/ext/v8/upstream/2.1.10/src/mips/assembler-mips.h +665 -0
- data/ext/v8/upstream/2.1.10/src/mips/builtins-mips.cc +202 -0
- data/ext/v8/upstream/2.1.10/src/mips/codegen-mips-inl.h +70 -0
- data/ext/v8/upstream/2.1.10/src/mips/codegen-mips.cc +1428 -0
- data/ext/v8/upstream/{2.0.6/src/arm/codegen-arm.h → 2.1.10/src/mips/codegen-mips.h} +103 -205
- data/ext/v8/upstream/2.1.10/src/mips/constants-mips.cc +323 -0
- data/ext/v8/upstream/2.1.10/src/mips/constants-mips.h +525 -0
- data/ext/v8/upstream/2.1.10/src/mips/cpu-mips.cc +69 -0
- data/ext/v8/upstream/2.1.10/src/mips/debug-mips.cc +128 -0
- data/ext/v8/upstream/2.1.10/src/mips/disasm-mips.cc +784 -0
- data/ext/v8/upstream/2.1.10/src/mips/fast-codegen-mips.cc +74 -0
- data/ext/v8/upstream/2.1.10/src/mips/frames-mips.cc +99 -0
- data/ext/v8/upstream/2.1.10/src/mips/frames-mips.h +164 -0
- data/ext/v8/upstream/2.1.10/src/mips/full-codegen-mips.cc +273 -0
- data/ext/v8/upstream/2.1.10/src/mips/ic-mips.cc +217 -0
- data/ext/v8/upstream/2.1.10/src/mips/jump-target-mips.cc +172 -0
- data/ext/v8/upstream/2.1.10/src/mips/macro-assembler-mips.cc +1323 -0
- data/ext/v8/upstream/2.1.10/src/mips/macro-assembler-mips.h +461 -0
- data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips-inl.h +137 -0
- data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips.cc +60 -0
- data/ext/v8/upstream/2.1.10/src/mips/register-allocator-mips.h +46 -0
- data/ext/v8/upstream/2.1.10/src/mips/simulator-mips.cc +1648 -0
- data/ext/v8/upstream/2.1.10/src/mips/simulator-mips.h +311 -0
- data/ext/v8/upstream/2.1.10/src/mips/stub-cache-mips.cc +400 -0
- data/ext/v8/upstream/2.1.10/src/mips/virtual-frame-mips.cc +316 -0
- data/ext/v8/upstream/{2.0.6/src/arm/virtual-frame-arm.h → 2.1.10/src/mips/virtual-frame-mips.h} +87 -71
- data/ext/v8/upstream/{2.0.6/src/mirror-delay.js → 2.1.10/src/mirror-debugger.js} +51 -45
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/mksnapshot.cc +97 -10
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/natives.h +6 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects-debug.cc +47 -5
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects-inl.h +154 -38
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects.cc +528 -280
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/objects.h +302 -95
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/oprofile-agent.cc +25 -33
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/oprofile-agent.h +9 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/parser.cc +444 -72
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/parser.h +4 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-freebsd.cc +32 -13
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-linux.cc +59 -25
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-macos.cc +30 -13
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-nullos.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-openbsd.cc +21 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-posix.cc +0 -18
- data/ext/v8/upstream/2.1.10/src/platform-solaris.cc +607 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform-win32.cc +16 -17
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/platform.h +25 -8
- data/ext/v8/upstream/2.1.10/src/powers-ten.h +2461 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/prettyprinter.cc +49 -29
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/prettyprinter.h +3 -1
- data/ext/v8/upstream/2.1.10/src/profile-generator-inl.h +124 -0
- data/ext/v8/upstream/2.1.10/src/profile-generator.cc +583 -0
- data/ext/v8/upstream/2.1.10/src/profile-generator.h +364 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/property.cc +1 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/property.h +12 -24
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp-inl.h +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp.cc +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-irregexp.h +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-tracer.cc +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler-tracer.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler.cc +33 -10
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-macro-assembler.h +12 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-stack.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/regexp-stack.h +0 -0
- data/ext/v8/upstream/{2.0.6/src/regexp-delay.js → 2.1.10/src/regexp.js} +180 -58
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator-inl.h +68 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator.cc +5 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/register-allocator.h +42 -17
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/rewriter.cc +110 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/rewriter.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.cc +2733 -623
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.h +43 -20
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/runtime.js +46 -35
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scanner.cc +278 -36
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scanner.h +97 -26
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopeinfo.cc +3 -3
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopeinfo.h +1 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopes.cc +11 -12
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/scopes.h +0 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/serialize.cc +298 -175
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/serialize.h +184 -40
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/shell.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/simulator.h +2 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/smart-pointer.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/snapshot-common.cc +16 -31
- data/ext/v8/upstream/2.1.10/src/snapshot-empty.cc +50 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/snapshot.h +13 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces-inl.h +35 -27
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces.cc +256 -42
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/spaces.h +136 -42
- data/ext/v8/upstream/{2.0.6/src/zone-inl.h → 2.1.10/src/splay-tree-inl.h} +102 -89
- data/ext/v8/upstream/2.1.10/src/splay-tree.h +203 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string-stream.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string-stream.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/string.js +260 -149
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/stub-cache.cc +195 -69
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/stub-cache.h +127 -12
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/dtoa/COPYING +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/dtoa/dtoa.c +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/third_party/valgrind/valgrind.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/token.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/token.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/top.cc +26 -31
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/top.h +3 -4
- data/ext/v8/upstream/2.1.10/src/type-info.cc +53 -0
- data/ext/v8/upstream/2.1.10/src/type-info.h +244 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/unicode.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/uri.js +6 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/utils.cc +0 -37
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/utils.h +121 -50
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8-counters.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8-counters.h +130 -98
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8.cc +42 -11
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8.h +4 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8natives.js +202 -37
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8threads.cc +11 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/v8threads.h +15 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/variables.cc +7 -51
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/variables.h +5 -35
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/version.cc +3 -3
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/version.h +0 -0
- data/ext/v8/upstream/2.1.10/src/virtual-frame-heavy-inl.h +152 -0
- data/ext/v8/upstream/{2.0.6/src/virtual-frame.cc → 2.1.10/src/virtual-frame-heavy.cc} +107 -176
- data/ext/v8/upstream/2.1.10/src/virtual-frame-inl.h +39 -0
- data/ext/v8/upstream/2.1.10/src/virtual-frame-light-inl.h +69 -0
- data/ext/v8/upstream/2.1.10/src/virtual-frame-light.cc +49 -0
- data/ext/v8/upstream/2.1.10/src/virtual-frame.cc +49 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/virtual-frame.h +2 -0
- data/ext/v8/upstream/{2.0.6/src/log-inl.h → 2.1.10/src/vm-state-inl.h} +28 -20
- data/ext/v8/upstream/{2.0.6/src/snapshot-empty.cc → 2.1.10/src/vm-state.cc} +5 -6
- data/ext/v8/upstream/2.1.10/src/vm-state.h +75 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64-inl.h +11 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64.cc +285 -93
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/assembler-x64.h +81 -78
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/builtins-x64.cc +130 -87
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/codegen-x64-inl.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/codegen-x64.cc +4520 -1317
- data/ext/v8/upstream/{2.0.6/src/ia32/codegen-ia32.h → 2.1.10/src/x64/codegen-x64.h} +362 -141
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/cpu-x64.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/debug-x64.cc +20 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/disasm-x64.cc +121 -44
- data/ext/v8/upstream/2.1.10/src/x64/fast-codegen-x64.cc +246 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/frames-x64.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/frames-x64.h +0 -0
- data/ext/v8/upstream/{2.0.6/src/x64/fast-codegen-x64.cc → 2.1.10/src/x64/full-codegen-x64.cc} +404 -231
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/ic-x64.cc +346 -117
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/jump-target-x64.cc +1 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/macro-assembler-x64.cc +537 -181
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/macro-assembler-x64.h +140 -34
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/regexp-macro-assembler-x64.cc +74 -96
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/regexp-macro-assembler-x64.h +8 -25
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64-inl.h +1 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64.cc +3 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/register-allocator-x64.h +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/simulator-x64.cc +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/simulator-x64.h +2 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/stub-cache-x64.cc +785 -288
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/virtual-frame-x64.cc +128 -52
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/x64/virtual-frame-x64.h +40 -19
- data/ext/v8/upstream/2.1.10/src/zone-inl.h +82 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/zone.cc +1 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/src/zone.h +6 -90
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/codemap.js +12 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/consarray.js +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/csvparser.js +22 -37
- data/ext/v8/upstream/2.1.10/tools/generate-ten-powers.scm +286 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/gyp/v8.gyp +86 -24
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/js2c.py +22 -22
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/jsmin.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/linux-tick-processor +10 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/linux-tick-processor.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/logreader.js +34 -16
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/mac-nm +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/mac-tick-processor +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/annotate +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/common +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/dump +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/report +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/reset +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/run +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/shutdown +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/oprofile/start +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/presubmit.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/process-heap-prof.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/profile.js +70 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/profile_view.js +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/run-valgrind.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/splaytree.js +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/splaytree.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/stats-viewer.py +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/test.py +7 -7
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor-driver.js +7 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor.js +140 -9
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/tickprocessor.py +40 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/utils.py +6 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/README.txt +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/arm.vsprops +1 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/common.vsprops +1 -2
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8.vcproj +0 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8_arm.vcproj +193 -199
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8_x64.vcproj +16 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/d8js2c.cmd +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/debug.vsprops +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/ia32.vsprops +5 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/js2c.cmd +1 -1
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/release.vsprops +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8.sln +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8.vcproj +11 -7
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_arm.sln +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_arm.vcproj +227 -223
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base.vcproj +137 -5
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base_arm.vcproj +116 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_base_x64.vcproj +125 -4
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest.vcproj +12 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest_arm.vcproj +12 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_cctest_x64.vcproj +11 -11
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_mksnapshot.vcproj +0 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_mksnapshot_x64.vcproj +0 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample.vcproj +0 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample_arm.vcproj +145 -151
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_process_sample_x64.vcproj +16 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample.vcproj +0 -6
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample_arm.vcproj +145 -151
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_shell_sample_x64.vcproj +16 -8
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot.vcproj +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_cc.vcproj +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_cc_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_snapshot_x64.vcproj +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_x64.sln +0 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/v8_x64.vcproj +11 -7
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/visual_studio/x64.vsprops +5 -1
- data/ext/v8/upstream/2.1.10/tools/windows-tick-processor.bat +29 -0
- data/ext/v8/upstream/{2.0.6 → 2.1.10}/tools/windows-tick-processor.py +0 -0
- data/ext/v8/upstream/Makefile +8 -2
- data/ext/v8/v8.cpp +21 -73
- data/ext/v8/v8_array.cpp +56 -0
- data/ext/v8/v8_array.h +8 -0
- data/ext/v8/v8_callbacks.cpp +121 -0
- data/ext/v8/v8_callbacks.h +8 -0
- data/ext/v8/v8_cxt.cpp +74 -77
- data/ext/v8/v8_cxt.h +2 -9
- data/ext/v8/v8_date.cpp +26 -0
- data/ext/v8/v8_date.h +6 -0
- data/ext/v8/v8_exception.cpp +55 -0
- data/ext/v8/v8_exception.h +6 -0
- data/ext/v8/v8_external.cpp +50 -0
- data/ext/v8/v8_external.h +8 -0
- data/ext/v8/v8_func.cpp +76 -18
- data/ext/v8/v8_func.h +5 -4
- data/ext/v8/v8_msg.cpp +55 -46
- data/ext/v8/v8_msg.h +3 -11
- data/ext/v8/v8_obj.cpp +67 -36
- data/ext/v8/v8_obj.h +6 -8
- data/ext/v8/v8_ref.cpp +25 -9
- data/ext/v8/v8_ref.h +3 -5
- data/ext/v8/v8_script.cpp +17 -10
- data/ext/v8/v8_script.h +3 -3
- data/ext/v8/v8_str.cpp +34 -6
- data/ext/v8/v8_str.h +4 -2
- data/ext/v8/v8_template.cpp +195 -33
- data/ext/v8/v8_template.h +4 -5
- data/ext/v8/v8_try_catch.cpp +99 -0
- data/ext/v8/v8_try_catch.h +5 -0
- data/ext/v8/v8_value.cpp +164 -0
- data/ext/v8/v8_value.h +10 -0
- data/lib/v8.rb +3 -1
- data/lib/v8/access.rb +60 -0
- data/lib/v8/array.rb +15 -0
- data/lib/v8/callbacks.rb +88 -0
- data/lib/v8/cli.rb +1 -1
- data/lib/v8/context.rb +55 -66
- data/lib/v8/function.rb +20 -2
- data/lib/v8/object.rb +14 -12
- data/lib/v8/ruby_error.rb +3 -0
- data/lib/v8/to.rb +59 -7
- data/spec/ext/cxt_spec.rb +2 -15
- data/spec/ext/func_spec.rb +17 -10
- data/spec/ext/try_catch_spec.rb +32 -0
- data/spec/foo.rb +17 -0
- data/spec/redjs/jsapi_spec.rb +173 -96
- data/spec/spec_helper.rb +7 -0
- data/spec/v8/to_spec.rb +0 -1
- data/therubyracer.gemspec +6 -6
- metadata +493 -386
- data/ext/v8/upstream/2.0.6/src/arm/ic-arm.cc +0 -849
- data/ext/v8/upstream/2.0.6/src/arm/virtual-frame-arm.cc +0 -412
- data/ext/v8/upstream/2.0.6/src/ast.cc +0 -512
- data/ext/v8/upstream/2.0.6/src/builtins.cc +0 -851
- data/ext/v8/upstream/2.0.6/src/compiler.cc +0 -1132
- data/ext/v8/upstream/2.0.6/src/compiler.h +0 -107
- data/ext/v8/upstream/2.0.6/src/conversions.cc +0 -709
- data/ext/v8/upstream/2.0.6/src/usage-analyzer.cc +0 -426
- data/ext/v8/upstream/2.0.6/tools/windows-tick-processor.bat +0 -5
- data/ext/v8/upstream/no-strict-aliasing.patch +0 -13
- data/ext/v8/v8_standalone.cpp +0 -69
- data/ext/v8/v8_standalone.h +0 -31
- data/spec/ext/obj_spec.rb +0 -13
@@ -28,6 +28,14 @@
|
|
28
28
|
#ifndef V8_JUMP_TARGET_INL_H_
|
29
29
|
#define V8_JUMP_TARGET_INL_H_
|
30
30
|
|
31
|
+
#include "virtual-frame-inl.h"
|
32
|
+
|
33
|
+
#if V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X64
|
34
|
+
#include "jump-target-heavy-inl.h"
|
35
|
+
#else
|
36
|
+
#include "jump-target-light-inl.h"
|
37
|
+
#endif
|
38
|
+
|
31
39
|
namespace v8 {
|
32
40
|
namespace internal {
|
33
41
|
|
@@ -35,15 +43,6 @@ CodeGenerator* JumpTarget::cgen() {
|
|
35
43
|
return CodeGeneratorScope::Current();
|
36
44
|
}
|
37
45
|
|
38
|
-
void JumpTarget::InitializeEntryElement(int index, FrameElement* target) {
|
39
|
-
entry_frame_->elements_[index].clear_copied();
|
40
|
-
if (target->is_register()) {
|
41
|
-
entry_frame_->set_register_location(target->reg(), index);
|
42
|
-
} else if (target->is_copy()) {
|
43
|
-
entry_frame_->elements_[target->index()].set_copied();
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
46
|
} } // namespace v8::internal
|
48
47
|
|
49
48
|
#endif // V8_JUMP_TARGET_INL_H_
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright
|
1
|
+
// Copyright 2010 the V8 project authors. All rights reserved.
|
2
2
|
// Redistribution and use in source and binary forms, with or without
|
3
3
|
// modification, are permitted provided that the following conditions are
|
4
4
|
// met:
|
@@ -25,16 +25,18 @@
|
|
25
25
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
26
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
27
|
|
28
|
-
#ifndef
|
29
|
-
#define
|
28
|
+
#ifndef V8_JUMP_TARGET_LIGHT_INL_H_
|
29
|
+
#define V8_JUMP_TARGET_LIGHT_INL_H_
|
30
|
+
|
31
|
+
#include "virtual-frame-inl.h"
|
30
32
|
|
31
33
|
namespace v8 {
|
32
34
|
namespace internal {
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
void JumpTarget::InitializeEntryElement(int index, FrameElement* target) {
|
37
|
+
UNIMPLEMENTED();
|
38
|
+
}
|
37
39
|
|
38
40
|
} } // namespace v8::internal
|
39
41
|
|
40
|
-
#endif //
|
42
|
+
#endif // V8_JUMP_TARGET_LIGHT_INL_H_
|
@@ -0,0 +1,86 @@
|
|
1
|
+
// Copyright 2010 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#include "v8.h"
|
29
|
+
|
30
|
+
#include "codegen-inl.h"
|
31
|
+
#include "jump-target-inl.h"
|
32
|
+
|
33
|
+
namespace v8 {
|
34
|
+
namespace internal {
|
35
|
+
|
36
|
+
|
37
|
+
void JumpTarget::Jump(Result* arg) {
|
38
|
+
UNIMPLEMENTED();
|
39
|
+
}
|
40
|
+
|
41
|
+
|
42
|
+
void JumpTarget::Branch(Condition cc, Result* arg, Hint hint) {
|
43
|
+
UNIMPLEMENTED();
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
void JumpTarget::Branch(Condition cc, Result* arg0, Result* arg1, Hint hint) {
|
48
|
+
UNIMPLEMENTED();
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
void BreakTarget::Branch(Condition cc, Result* arg, Hint hint) {
|
53
|
+
UNIMPLEMENTED();
|
54
|
+
}
|
55
|
+
|
56
|
+
|
57
|
+
void JumpTarget::Bind(Result* arg) {
|
58
|
+
UNIMPLEMENTED();
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
void JumpTarget::Bind(Result* arg0, Result* arg1) {
|
63
|
+
UNIMPLEMENTED();
|
64
|
+
}
|
65
|
+
|
66
|
+
|
67
|
+
void JumpTarget::ComputeEntryFrame() {
|
68
|
+
UNIMPLEMENTED();
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
DeferredCode::DeferredCode()
|
73
|
+
: masm_(CodeGeneratorScope::Current()->masm()),
|
74
|
+
statement_position_(masm_->current_statement_position()),
|
75
|
+
position_(masm_->current_position()) {
|
76
|
+
ASSERT(statement_position_ != RelocInfo::kNoPosition);
|
77
|
+
ASSERT(position_ != RelocInfo::kNoPosition);
|
78
|
+
|
79
|
+
CodeGeneratorScope::Current()->AddDeferred(this);
|
80
|
+
|
81
|
+
#ifdef DEBUG
|
82
|
+
CodeGeneratorScope::Current()->frame()->AssertIsSpilled();
|
83
|
+
#endif
|
84
|
+
}
|
85
|
+
|
86
|
+
} } // namespace v8::internal
|
@@ -0,0 +1,155 @@
|
|
1
|
+
// Copyright 2009 the V8 project authors. All rights reserved.
|
2
|
+
// Redistribution and use in source and binary forms, with or without
|
3
|
+
// modification, are permitted provided that the following conditions are
|
4
|
+
// met:
|
5
|
+
//
|
6
|
+
// * Redistributions of source code must retain the above copyright
|
7
|
+
// notice, this list of conditions and the following disclaimer.
|
8
|
+
// * Redistributions in binary form must reproduce the above
|
9
|
+
// copyright notice, this list of conditions and the following
|
10
|
+
// disclaimer in the documentation and/or other materials provided
|
11
|
+
// with the distribution.
|
12
|
+
// * Neither the name of Google Inc. nor the names of its
|
13
|
+
// contributors may be used to endorse or promote products derived
|
14
|
+
// from this software without specific prior written permission.
|
15
|
+
//
|
16
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
17
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
18
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
19
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
20
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
21
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
26
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
|
28
|
+
#include "v8.h"
|
29
|
+
|
30
|
+
#include "codegen-inl.h"
|
31
|
+
#include "jump-target-inl.h"
|
32
|
+
#include "register-allocator-inl.h"
|
33
|
+
|
34
|
+
namespace v8 {
|
35
|
+
namespace internal {
|
36
|
+
|
37
|
+
// -------------------------------------------------------------------------
|
38
|
+
// JumpTarget implementation.
|
39
|
+
|
40
|
+
bool JumpTarget::compiling_deferred_code_ = false;
|
41
|
+
|
42
|
+
|
43
|
+
void JumpTarget::Unuse() {
|
44
|
+
reaching_frames_.Clear();
|
45
|
+
merge_labels_.Clear();
|
46
|
+
entry_frame_ = NULL;
|
47
|
+
entry_label_.Unuse();
|
48
|
+
}
|
49
|
+
|
50
|
+
|
51
|
+
void JumpTarget::Jump() {
|
52
|
+
DoJump();
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
void JumpTarget::Branch(Condition cc, Hint hint) {
|
57
|
+
DoBranch(cc, hint);
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
void JumpTarget::Bind() {
|
62
|
+
DoBind();
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
void JumpTarget::AddReachingFrame(VirtualFrame* frame) {
|
67
|
+
ASSERT(reaching_frames_.length() == merge_labels_.length());
|
68
|
+
ASSERT(entry_frame_ == NULL);
|
69
|
+
Label fresh;
|
70
|
+
merge_labels_.Add(fresh);
|
71
|
+
reaching_frames_.Add(frame);
|
72
|
+
}
|
73
|
+
|
74
|
+
|
75
|
+
// -------------------------------------------------------------------------
|
76
|
+
// BreakTarget implementation.
|
77
|
+
|
78
|
+
void BreakTarget::set_direction(Directionality direction) {
|
79
|
+
JumpTarget::set_direction(direction);
|
80
|
+
ASSERT(cgen()->has_valid_frame());
|
81
|
+
expected_height_ = cgen()->frame()->height();
|
82
|
+
}
|
83
|
+
|
84
|
+
|
85
|
+
void BreakTarget::CopyTo(BreakTarget* destination) {
|
86
|
+
ASSERT(destination != NULL);
|
87
|
+
destination->direction_ = direction_;
|
88
|
+
destination->reaching_frames_.Rewind(0);
|
89
|
+
destination->reaching_frames_.AddAll(reaching_frames_);
|
90
|
+
destination->merge_labels_.Rewind(0);
|
91
|
+
destination->merge_labels_.AddAll(merge_labels_);
|
92
|
+
destination->entry_frame_ = entry_frame_;
|
93
|
+
destination->entry_label_ = entry_label_;
|
94
|
+
destination->expected_height_ = expected_height_;
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
void BreakTarget::Branch(Condition cc, Hint hint) {
|
99
|
+
ASSERT(cgen()->has_valid_frame());
|
100
|
+
|
101
|
+
int count = cgen()->frame()->height() - expected_height_;
|
102
|
+
if (count > 0) {
|
103
|
+
// We negate and branch here rather than using DoBranch's negate
|
104
|
+
// and branch. This gives us a hook to remove statement state
|
105
|
+
// from the frame.
|
106
|
+
JumpTarget fall_through;
|
107
|
+
// Branch to fall through will not negate, because it is a
|
108
|
+
// forward-only target.
|
109
|
+
fall_through.Branch(NegateCondition(cc), NegateHint(hint));
|
110
|
+
Jump(); // May emit merge code here.
|
111
|
+
fall_through.Bind();
|
112
|
+
} else {
|
113
|
+
DoBranch(cc, hint);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
// -------------------------------------------------------------------------
|
119
|
+
// ShadowTarget implementation.
|
120
|
+
|
121
|
+
ShadowTarget::ShadowTarget(BreakTarget* shadowed) {
|
122
|
+
ASSERT(shadowed != NULL);
|
123
|
+
other_target_ = shadowed;
|
124
|
+
|
125
|
+
#ifdef DEBUG
|
126
|
+
is_shadowing_ = true;
|
127
|
+
#endif
|
128
|
+
// While shadowing this shadow target saves the state of the original.
|
129
|
+
shadowed->CopyTo(this);
|
130
|
+
|
131
|
+
// The original's state is reset.
|
132
|
+
shadowed->Unuse();
|
133
|
+
ASSERT(cgen()->has_valid_frame());
|
134
|
+
shadowed->set_expected_height(cgen()->frame()->height());
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
void ShadowTarget::StopShadowing() {
|
139
|
+
ASSERT(is_shadowing_);
|
140
|
+
|
141
|
+
// The states of this target, which was shadowed, and the original
|
142
|
+
// target, which was shadowing, are swapped.
|
143
|
+
BreakTarget temp;
|
144
|
+
other_target_->CopyTo(&temp);
|
145
|
+
CopyTo(other_target_);
|
146
|
+
temp.CopyTo(this);
|
147
|
+
temp.Unuse();
|
148
|
+
|
149
|
+
#ifdef DEBUG
|
150
|
+
is_shadowing_ = false;
|
151
|
+
#endif
|
152
|
+
}
|
153
|
+
|
154
|
+
|
155
|
+
} } // namespace v8::internal
|
@@ -29,6 +29,7 @@
|
|
29
29
|
#define V8_JUMP_TARGET_H_
|
30
30
|
|
31
31
|
#include "macro-assembler.h"
|
32
|
+
#include "zone-inl.h"
|
32
33
|
|
33
34
|
namespace v8 {
|
34
35
|
namespace internal {
|
@@ -116,12 +117,17 @@ class JumpTarget : public ZoneObject { // Shadows are dynamically allocated.
|
|
116
117
|
// the target and the fall-through.
|
117
118
|
virtual void Branch(Condition cc, Hint hint = no_hint);
|
118
119
|
virtual void Branch(Condition cc, Result* arg, Hint hint = no_hint);
|
120
|
+
virtual void Branch(Condition cc,
|
121
|
+
Result* arg0,
|
122
|
+
Result* arg1,
|
123
|
+
Hint hint = no_hint);
|
119
124
|
|
120
125
|
// Bind a jump target. If there is no current frame at the binding
|
121
126
|
// site, there must be at least one frame reaching via a forward
|
122
127
|
// jump.
|
123
128
|
virtual void Bind();
|
124
129
|
virtual void Bind(Result* arg);
|
130
|
+
virtual void Bind(Result* arg0, Result* arg1);
|
125
131
|
|
126
132
|
// Emit a call to a jump target. There must be a current frame at
|
127
133
|
// the call. The frame at the target is the same as the current
|
File without changes
|
@@ -68,7 +68,8 @@ class List {
|
|
68
68
|
// not safe to use after operations that can change the list's
|
69
69
|
// backing store (eg, Add).
|
70
70
|
inline T& operator[](int i) const {
|
71
|
-
ASSERT(0 <= i
|
71
|
+
ASSERT(0 <= i);
|
72
|
+
ASSERT(i < length_);
|
72
73
|
return data_[i];
|
73
74
|
}
|
74
75
|
inline T& at(int i) const { return operator[](i); }
|
@@ -0,0 +1,944 @@
|
|
1
|
+
// Copyright 2010 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
|
+
// LiveEdit feature implementation. The script should be executed after
|
29
|
+
// debug-debugger.js.
|
30
|
+
|
31
|
+
// A LiveEdit namespace. It contains functions that modifies JavaScript code
|
32
|
+
// according to changes of script source (if possible).
|
33
|
+
//
|
34
|
+
// When new script source is put in, the difference is calculated textually,
|
35
|
+
// in form of list of delete/add/change chunks. The functions that include
|
36
|
+
// change chunk(s) get recompiled, or their enclosing functions are
|
37
|
+
// recompiled instead.
|
38
|
+
// If the function may not be recompiled (e.g. it was completely erased in new
|
39
|
+
// version of the script) it remains unchanged, but the code that could
|
40
|
+
// create a new instance of this function goes away. An old version of script
|
41
|
+
// is created to back up this obsolete function.
|
42
|
+
// All unchanged functions have their positions updated accordingly.
|
43
|
+
//
|
44
|
+
// LiveEdit namespace is declared inside a single function constructor.
|
45
|
+
Debug.LiveEdit = new function() {
|
46
|
+
|
47
|
+
// Forward declaration for minifier.
|
48
|
+
var FunctionStatus;
|
49
|
+
|
50
|
+
|
51
|
+
// Applies the change to the script.
|
52
|
+
// The change is in form of list of chunks encoded in a single array as
|
53
|
+
// a series of triplets (pos1_start, pos1_end, pos2_end)
|
54
|
+
function ApplyPatchMultiChunk(script, diff_array, new_source, change_log) {
|
55
|
+
|
56
|
+
var old_source = script.source;
|
57
|
+
|
58
|
+
// Gather compile information about old version of script.
|
59
|
+
var old_compile_info = GatherCompileInfo(old_source, script);
|
60
|
+
|
61
|
+
// Build tree structures for old and new versions of the script.
|
62
|
+
var root_old_node = BuildCodeInfoTree(old_compile_info);
|
63
|
+
|
64
|
+
var pos_translator = new PosTranslator(diff_array);
|
65
|
+
|
66
|
+
// Analyze changes.
|
67
|
+
MarkChangedFunctions(root_old_node, pos_translator.GetChunks());
|
68
|
+
|
69
|
+
// Find all SharedFunctionInfo's that were compiled from this script.
|
70
|
+
FindLiveSharedInfos(root_old_node, script);
|
71
|
+
|
72
|
+
// Gather compile information about new version of script.
|
73
|
+
var new_compile_info;
|
74
|
+
try {
|
75
|
+
new_compile_info = GatherCompileInfo(new_source, script);
|
76
|
+
} catch (e) {
|
77
|
+
throw new Failure("Failed to compile new version of script: " + e);
|
78
|
+
}
|
79
|
+
var root_new_node = BuildCodeInfoTree(new_compile_info);
|
80
|
+
|
81
|
+
// Link recompiled script data with other data.
|
82
|
+
FindCorrespondingFunctions(root_old_node, root_new_node);
|
83
|
+
|
84
|
+
// Prepare to-do lists.
|
85
|
+
var replace_code_list = new Array();
|
86
|
+
var link_to_old_script_list = new Array();
|
87
|
+
var link_to_original_script_list = new Array();
|
88
|
+
var update_positions_list = new Array();
|
89
|
+
|
90
|
+
function HarvestTodo(old_node) {
|
91
|
+
function CollectDamaged(node) {
|
92
|
+
link_to_old_script_list.push(node);
|
93
|
+
for (var i = 0; i < node.children.length; i++) {
|
94
|
+
CollectDamaged(node.children[i]);
|
95
|
+
}
|
96
|
+
}
|
97
|
+
|
98
|
+
// Recursively collects all newly compiled functions that are going into
|
99
|
+
// business and should be have link to the actual script updated.
|
100
|
+
function CollectNew(node_list) {
|
101
|
+
for (var i = 0; i < node_list.length; i++) {
|
102
|
+
link_to_original_script_list.push(node_list[i]);
|
103
|
+
CollectNew(node_list[i].children);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
if (old_node.status == FunctionStatus.DAMAGED) {
|
108
|
+
CollectDamaged(old_node);
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
if (old_node.status == FunctionStatus.UNCHANGED) {
|
112
|
+
update_positions_list.push(old_node);
|
113
|
+
} else if (old_node.status == FunctionStatus.SOURCE_CHANGED) {
|
114
|
+
update_positions_list.push(old_node);
|
115
|
+
} else if (old_node.status == FunctionStatus.CHANGED) {
|
116
|
+
replace_code_list.push(old_node);
|
117
|
+
CollectNew(old_node.unmatched_new_nodes);
|
118
|
+
}
|
119
|
+
for (var i = 0; i < old_node.children.length; i++) {
|
120
|
+
HarvestTodo(old_node.children[i]);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
HarvestTodo(root_old_node);
|
125
|
+
|
126
|
+
// Collect shared infos for functions whose code need to be patched.
|
127
|
+
var replaced_function_infos = new Array();
|
128
|
+
for (var i = 0; i < replace_code_list.length; i++) {
|
129
|
+
var info_wrapper = replace_code_list[i].live_shared_info_wrapper;
|
130
|
+
if (info_wrapper) {
|
131
|
+
replaced_function_infos.push(info_wrapper);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
// Check that function being patched is not currently on stack.
|
136
|
+
CheckStackActivations(replaced_function_infos, change_log);
|
137
|
+
|
138
|
+
|
139
|
+
// We haven't changed anything before this line yet.
|
140
|
+
// Committing all changes.
|
141
|
+
|
142
|
+
// Start with breakpoints. Convert their line/column positions and
|
143
|
+
// temporary remove.
|
144
|
+
var break_points_restorer = TemporaryRemoveBreakPoints(script, change_log);
|
145
|
+
|
146
|
+
var old_script;
|
147
|
+
|
148
|
+
// Create an old script only if there are function that should be linked
|
149
|
+
// to old version.
|
150
|
+
if (link_to_old_script_list.length == 0) {
|
151
|
+
%LiveEditReplaceScript(script, new_source, null);
|
152
|
+
old_script = void 0;
|
153
|
+
} else {
|
154
|
+
var old_script_name = CreateNameForOldScript(script);
|
155
|
+
|
156
|
+
// Update the script text and create a new script representing an old
|
157
|
+
// version of the script.
|
158
|
+
old_script = %LiveEditReplaceScript(script, new_source,
|
159
|
+
old_script_name);
|
160
|
+
|
161
|
+
var link_to_old_script_report = new Array();
|
162
|
+
change_log.push( { linked_to_old_script: link_to_old_script_report } );
|
163
|
+
|
164
|
+
// We need to link to old script all former nested functions.
|
165
|
+
for (var i = 0; i < link_to_old_script_list.length; i++) {
|
166
|
+
LinkToOldScript(link_to_old_script_list[i], old_script,
|
167
|
+
link_to_old_script_report);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
// Link to an actual script all the functions that we are going to use.
|
172
|
+
for (var i = 0; i < link_to_original_script_list.length; i++) {
|
173
|
+
%LiveEditFunctionSetScript(
|
174
|
+
link_to_original_script_list[i].info.shared_function_info, script);
|
175
|
+
}
|
176
|
+
|
177
|
+
for (var i = 0; i < replace_code_list.length; i++) {
|
178
|
+
PatchFunctionCode(replace_code_list[i], change_log);
|
179
|
+
}
|
180
|
+
|
181
|
+
var position_patch_report = new Array();
|
182
|
+
change_log.push( {position_patched: position_patch_report} );
|
183
|
+
|
184
|
+
for (var i = 0; i < update_positions_list.length; i++) {
|
185
|
+
// TODO(LiveEdit): take into account wether it's source_changed or
|
186
|
+
// unchanged and whether positions changed at all.
|
187
|
+
PatchPositions(update_positions_list[i], diff_array,
|
188
|
+
position_patch_report);
|
189
|
+
}
|
190
|
+
|
191
|
+
break_points_restorer(pos_translator, old_script);
|
192
|
+
}
|
193
|
+
// Function is public.
|
194
|
+
this.ApplyPatchMultiChunk = ApplyPatchMultiChunk;
|
195
|
+
|
196
|
+
|
197
|
+
// Fully compiles source string as a script. Returns Array of
|
198
|
+
// FunctionCompileInfo -- a descriptions of all functions of the script.
|
199
|
+
// Elements of array are ordered by start positions of functions (from top
|
200
|
+
// to bottom) in the source. Fields outer_index and next_sibling_index help
|
201
|
+
// to navigate the nesting structure of functions.
|
202
|
+
//
|
203
|
+
// All functions get compiled linked to script provided as parameter script.
|
204
|
+
// TODO(LiveEdit): consider not using actual scripts as script, because
|
205
|
+
// we have to manually erase all links right after compile.
|
206
|
+
function GatherCompileInfo(source, script) {
|
207
|
+
// Get function info, elements are partially sorted (it is a tree of
|
208
|
+
// nested functions serialized as parent followed by serialized children.
|
209
|
+
var raw_compile_info = %LiveEditGatherCompileInfo(script, source);
|
210
|
+
|
211
|
+
// Sort function infos by start position field.
|
212
|
+
var compile_info = new Array();
|
213
|
+
var old_index_map = new Array();
|
214
|
+
for (var i = 0; i < raw_compile_info.length; i++) {
|
215
|
+
var info = new FunctionCompileInfo(raw_compile_info[i]);
|
216
|
+
// Remove all links to the actual script. Breakpoints system and
|
217
|
+
// LiveEdit itself believe that any function in heap that points to a
|
218
|
+
// particular script is a regular function.
|
219
|
+
// For some functions we will restore this link later.
|
220
|
+
%LiveEditFunctionSetScript(info.shared_function_info, void 0);
|
221
|
+
compile_info.push(info);
|
222
|
+
old_index_map.push(i);
|
223
|
+
}
|
224
|
+
|
225
|
+
for (var i = 0; i < compile_info.length; i++) {
|
226
|
+
var k = i;
|
227
|
+
for (var j = i + 1; j < compile_info.length; j++) {
|
228
|
+
if (compile_info[k].start_position > compile_info[j].start_position) {
|
229
|
+
k = j;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
if (k != i) {
|
233
|
+
var temp_info = compile_info[k];
|
234
|
+
var temp_index = old_index_map[k];
|
235
|
+
compile_info[k] = compile_info[i];
|
236
|
+
old_index_map[k] = old_index_map[i];
|
237
|
+
compile_info[i] = temp_info;
|
238
|
+
old_index_map[i] = temp_index;
|
239
|
+
}
|
240
|
+
}
|
241
|
+
|
242
|
+
// After sorting update outer_inder field using old_index_map. Also
|
243
|
+
// set next_sibling_index field.
|
244
|
+
var current_index = 0;
|
245
|
+
|
246
|
+
// The recursive function, that goes over all children of a particular
|
247
|
+
// node (i.e. function info).
|
248
|
+
function ResetIndexes(new_parent_index, old_parent_index) {
|
249
|
+
var previous_sibling = -1;
|
250
|
+
while (current_index < compile_info.length &&
|
251
|
+
compile_info[current_index].outer_index == old_parent_index) {
|
252
|
+
var saved_index = current_index;
|
253
|
+
compile_info[saved_index].outer_index = new_parent_index;
|
254
|
+
if (previous_sibling != -1) {
|
255
|
+
compile_info[previous_sibling].next_sibling_index = saved_index;
|
256
|
+
}
|
257
|
+
previous_sibling = saved_index;
|
258
|
+
current_index++;
|
259
|
+
ResetIndexes(saved_index, old_index_map[saved_index]);
|
260
|
+
}
|
261
|
+
if (previous_sibling != -1) {
|
262
|
+
compile_info[previous_sibling].next_sibling_index = -1;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
|
266
|
+
ResetIndexes(-1, -1);
|
267
|
+
Assert(current_index == compile_info.length);
|
268
|
+
|
269
|
+
return compile_info;
|
270
|
+
}
|
271
|
+
|
272
|
+
|
273
|
+
// Replaces function's Code.
|
274
|
+
function PatchFunctionCode(old_node, change_log) {
|
275
|
+
var new_info = old_node.corresponding_node.info;
|
276
|
+
var shared_info_wrapper = old_node.live_shared_info_wrapper;
|
277
|
+
if (shared_info_wrapper) {
|
278
|
+
%LiveEditReplaceFunctionCode(new_info.raw_array,
|
279
|
+
shared_info_wrapper.raw_array);
|
280
|
+
|
281
|
+
// The function got a new code. However, this new code brings all new
|
282
|
+
// instances of SharedFunctionInfo for nested functions. However,
|
283
|
+
// we want the original instances to be used wherever possible.
|
284
|
+
// (This is because old instances and new instances will be both
|
285
|
+
// linked to a script and breakpoints subsystem does not really
|
286
|
+
// expects this; neither does LiveEdit subsystem on next call).
|
287
|
+
for (var i = 0; i < old_node.children.length; i++) {
|
288
|
+
if (old_node.children[i].corresponding_node) {
|
289
|
+
var corresponding_child = old_node.children[i].corresponding_node;
|
290
|
+
var child_shared_info_wrapper =
|
291
|
+
old_node.children[i].live_shared_info_wrapper;
|
292
|
+
if (child_shared_info_wrapper) {
|
293
|
+
%LiveEditReplaceRefToNestedFunction(shared_info_wrapper.info,
|
294
|
+
corresponding_child.info.shared_function_info,
|
295
|
+
child_shared_info_wrapper.info);
|
296
|
+
}
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
change_log.push( {function_patched: new_info.function_name} );
|
301
|
+
} else {
|
302
|
+
change_log.push( {function_patched: new_info.function_name,
|
303
|
+
function_info_not_found: true} );
|
304
|
+
}
|
305
|
+
}
|
306
|
+
|
307
|
+
|
308
|
+
// Makes a function associated with another instance of a script (the
|
309
|
+
// one representing its old version). This way the function still
|
310
|
+
// may access its own text.
|
311
|
+
function LinkToOldScript(old_info_node, old_script, report_array) {
|
312
|
+
var shared_info = old_info_node.live_shared_info_wrapper;
|
313
|
+
if (shared_info) {
|
314
|
+
%LiveEditFunctionSetScript(shared_info.info, old_script);
|
315
|
+
report_array.push( { name: shared_info.function_name } );
|
316
|
+
} else {
|
317
|
+
report_array.push(
|
318
|
+
{ name: old_info_node.info.function_name, not_found: true } );
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
322
|
+
|
323
|
+
// Returns function that restores breakpoints.
|
324
|
+
function TemporaryRemoveBreakPoints(original_script, change_log) {
|
325
|
+
var script_break_points = GetScriptBreakPoints(original_script);
|
326
|
+
|
327
|
+
var break_points_update_report = [];
|
328
|
+
change_log.push( { break_points_update: break_points_update_report } );
|
329
|
+
|
330
|
+
var break_point_old_positions = [];
|
331
|
+
for (var i = 0; i < script_break_points.length; i++) {
|
332
|
+
var break_point = script_break_points[i];
|
333
|
+
|
334
|
+
break_point.clear();
|
335
|
+
|
336
|
+
// TODO(LiveEdit): be careful with resource offset here.
|
337
|
+
var break_point_position = Debug.findScriptSourcePosition(original_script,
|
338
|
+
break_point.line(), break_point.column());
|
339
|
+
|
340
|
+
var old_position_description = {
|
341
|
+
position: break_point_position,
|
342
|
+
line: break_point.line(),
|
343
|
+
column: break_point.column()
|
344
|
+
}
|
345
|
+
break_point_old_positions.push(old_position_description);
|
346
|
+
}
|
347
|
+
|
348
|
+
|
349
|
+
// Restores breakpoints and creates their copies in the "old" copy of
|
350
|
+
// the script.
|
351
|
+
return function (pos_translator, old_script_copy_opt) {
|
352
|
+
// Update breakpoints (change positions and restore them in old version
|
353
|
+
// of script.
|
354
|
+
for (var i = 0; i < script_break_points.length; i++) {
|
355
|
+
var break_point = script_break_points[i];
|
356
|
+
if (old_script_copy_opt) {
|
357
|
+
var clone = break_point.cloneForOtherScript(old_script_copy_opt);
|
358
|
+
clone.set(old_script_copy_opt);
|
359
|
+
|
360
|
+
break_points_update_report.push( {
|
361
|
+
type: "copied_to_old",
|
362
|
+
id: break_point.number(),
|
363
|
+
new_id: clone.number(),
|
364
|
+
positions: break_point_old_positions[i]
|
365
|
+
} );
|
366
|
+
}
|
367
|
+
|
368
|
+
var updated_position = pos_translator.Translate(
|
369
|
+
break_point_old_positions[i].position,
|
370
|
+
PosTranslator.ShiftWithTopInsideChunkHandler);
|
371
|
+
|
372
|
+
var new_location =
|
373
|
+
original_script.locationFromPosition(updated_position, false);
|
374
|
+
|
375
|
+
break_point.update_positions(new_location.line, new_location.column);
|
376
|
+
|
377
|
+
var new_position_description = {
|
378
|
+
position: updated_position,
|
379
|
+
line: new_location.line,
|
380
|
+
column: new_location.column
|
381
|
+
}
|
382
|
+
|
383
|
+
break_point.set(original_script);
|
384
|
+
|
385
|
+
break_points_update_report.push( { type: "position_changed",
|
386
|
+
id: break_point.number(),
|
387
|
+
old_positions: break_point_old_positions[i],
|
388
|
+
new_positions: new_position_description
|
389
|
+
} );
|
390
|
+
}
|
391
|
+
}
|
392
|
+
}
|
393
|
+
|
394
|
+
|
395
|
+
function Assert(condition, message) {
|
396
|
+
if (!condition) {
|
397
|
+
if (message) {
|
398
|
+
throw "Assert " + message;
|
399
|
+
} else {
|
400
|
+
throw "Assert";
|
401
|
+
}
|
402
|
+
}
|
403
|
+
}
|
404
|
+
|
405
|
+
function DiffChunk(pos1, pos2, len1, len2) {
|
406
|
+
this.pos1 = pos1;
|
407
|
+
this.pos2 = pos2;
|
408
|
+
this.len1 = len1;
|
409
|
+
this.len2 = len2;
|
410
|
+
}
|
411
|
+
|
412
|
+
function PosTranslator(diff_array) {
|
413
|
+
var chunks = new Array();
|
414
|
+
var current_diff = 0;
|
415
|
+
for (var i = 0; i < diff_array.length; i += 3) {
|
416
|
+
var pos1_begin = diff_array[i];
|
417
|
+
var pos2_begin = pos1_begin + current_diff;
|
418
|
+
var pos1_end = diff_array[i + 1];
|
419
|
+
var pos2_end = diff_array[i + 2];
|
420
|
+
chunks.push(new DiffChunk(pos1_begin, pos2_begin, pos1_end - pos1_begin,
|
421
|
+
pos2_end - pos2_begin));
|
422
|
+
current_diff = pos2_end - pos1_end;
|
423
|
+
}
|
424
|
+
this.chunks = chunks;
|
425
|
+
}
|
426
|
+
PosTranslator.prototype.GetChunks = function() {
|
427
|
+
return this.chunks;
|
428
|
+
}
|
429
|
+
|
430
|
+
PosTranslator.prototype.Translate = function(pos, inside_chunk_handler) {
|
431
|
+
var array = this.chunks;
|
432
|
+
if (array.length == 0 || pos < array[0].pos1) {
|
433
|
+
return pos;
|
434
|
+
}
|
435
|
+
var chunk_index1 = 0;
|
436
|
+
var chunk_index2 = array.length - 1;
|
437
|
+
|
438
|
+
while (chunk_index1 < chunk_index2) {
|
439
|
+
var middle_index = Math.floor((chunk_index1 + chunk_index2) / 2);
|
440
|
+
if (pos < array[middle_index + 1].pos1) {
|
441
|
+
chunk_index2 = middle_index;
|
442
|
+
} else {
|
443
|
+
chunk_index1 = middle_index + 1;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
var chunk = array[chunk_index1];
|
447
|
+
if (pos >= chunk.pos1 + chunk.len1) {
|
448
|
+
return pos + chunk.pos2 + chunk.len2 - chunk.pos1 - chunk.len1;
|
449
|
+
}
|
450
|
+
|
451
|
+
if (!inside_chunk_handler) {
|
452
|
+
inside_chunk_handler = PosTranslator.DefaultInsideChunkHandler;
|
453
|
+
}
|
454
|
+
return inside_chunk_handler(pos, chunk);
|
455
|
+
}
|
456
|
+
|
457
|
+
PosTranslator.DefaultInsideChunkHandler = function(pos, diff_chunk) {
|
458
|
+
Assert(false, "Cannot translate position in changed area");
|
459
|
+
}
|
460
|
+
|
461
|
+
PosTranslator.ShiftWithTopInsideChunkHandler =
|
462
|
+
function(pos, diff_chunk) {
|
463
|
+
// We carelessly do not check whether we stay inside the chunk after
|
464
|
+
// translation.
|
465
|
+
return pos - diff_chunk.pos1 + diff_chunk.pos2;
|
466
|
+
}
|
467
|
+
|
468
|
+
var FunctionStatus = {
|
469
|
+
// No change to function or its inner functions; however its positions
|
470
|
+
// in script may have been shifted.
|
471
|
+
UNCHANGED: "unchanged",
|
472
|
+
// The code of a function remains unchanged, but something happened inside
|
473
|
+
// some inner functions.
|
474
|
+
SOURCE_CHANGED: "source changed",
|
475
|
+
// The code of a function is changed or some nested function cannot be
|
476
|
+
// properly patched so this function must be recompiled.
|
477
|
+
CHANGED: "changed",
|
478
|
+
// Function is changed but cannot be patched.
|
479
|
+
DAMAGED: "damaged"
|
480
|
+
}
|
481
|
+
|
482
|
+
function CodeInfoTreeNode(code_info, children, array_index) {
|
483
|
+
this.info = code_info;
|
484
|
+
this.children = children;
|
485
|
+
// an index in array of compile_info
|
486
|
+
this.array_index = array_index;
|
487
|
+
this.parent = void 0;
|
488
|
+
|
489
|
+
this.status = FunctionStatus.UNCHANGED;
|
490
|
+
// Status explanation is used for debugging purposes and will be shown
|
491
|
+
// in user UI if some explanations are needed.
|
492
|
+
this.status_explanation = void 0;
|
493
|
+
this.new_start_pos = void 0;
|
494
|
+
this.new_end_pos = void 0;
|
495
|
+
this.corresponding_node = void 0;
|
496
|
+
this.unmatched_new_nodes = void 0;
|
497
|
+
this.live_shared_info_wrapper = void 0;
|
498
|
+
}
|
499
|
+
|
500
|
+
// From array of function infos that is implicitly a tree creates
|
501
|
+
// an actual tree of functions in script.
|
502
|
+
function BuildCodeInfoTree(code_info_array) {
|
503
|
+
// Throughtout all function we iterate over input array.
|
504
|
+
var index = 0;
|
505
|
+
|
506
|
+
// Recursive function that builds a branch of tree.
|
507
|
+
function BuildNode() {
|
508
|
+
var my_index = index;
|
509
|
+
index++;
|
510
|
+
var child_array = new Array();
|
511
|
+
while (index < code_info_array.length &&
|
512
|
+
code_info_array[index].outer_index == my_index) {
|
513
|
+
child_array.push(BuildNode());
|
514
|
+
}
|
515
|
+
var node = new CodeInfoTreeNode(code_info_array[my_index], child_array,
|
516
|
+
my_index);
|
517
|
+
for (var i = 0; i < child_array.length; i++) {
|
518
|
+
child_array[i].parent = node;
|
519
|
+
}
|
520
|
+
return node;
|
521
|
+
}
|
522
|
+
|
523
|
+
var root = BuildNode();
|
524
|
+
Assert(index == code_info_array.length);
|
525
|
+
return root;
|
526
|
+
}
|
527
|
+
|
528
|
+
// Applies a list of the textual diff chunks onto the tree of functions.
|
529
|
+
// Determines status of each function (from unchanged to damaged). However
|
530
|
+
// children of unchanged functions are ignored.
|
531
|
+
function MarkChangedFunctions(code_info_tree, chunks) {
|
532
|
+
|
533
|
+
// A convenient interator over diff chunks that also translates
|
534
|
+
// positions from old to new in a current non-changed part of script.
|
535
|
+
var chunk_it = new function() {
|
536
|
+
var chunk_index = 0;
|
537
|
+
var pos_diff = 0;
|
538
|
+
this.current = function() { return chunks[chunk_index]; }
|
539
|
+
this.next = function() {
|
540
|
+
var chunk = chunks[chunk_index];
|
541
|
+
pos_diff = chunk.pos2 + chunk.len2 - (chunk.pos1 + chunk.len1);
|
542
|
+
chunk_index++;
|
543
|
+
}
|
544
|
+
this.done = function() { return chunk_index >= chunks.length; }
|
545
|
+
this.TranslatePos = function(pos) { return pos + pos_diff; }
|
546
|
+
};
|
547
|
+
|
548
|
+
// A recursive function that processes internals of a function and all its
|
549
|
+
// inner functions. Iterator chunk_it initially points to a chunk that is
|
550
|
+
// below function start.
|
551
|
+
function ProcessInternals(info_node) {
|
552
|
+
info_node.new_start_pos = chunk_it.TranslatePos(
|
553
|
+
info_node.info.start_position);
|
554
|
+
var child_index = 0;
|
555
|
+
var code_changed = false;
|
556
|
+
var source_changed = false;
|
557
|
+
// Simultaneously iterates over child functions and over chunks.
|
558
|
+
while (!chunk_it.done() &&
|
559
|
+
chunk_it.current().pos1 < info_node.info.end_position) {
|
560
|
+
if (child_index < info_node.children.length) {
|
561
|
+
var child = info_node.children[child_index];
|
562
|
+
|
563
|
+
if (child.info.end_position <= chunk_it.current().pos1) {
|
564
|
+
ProcessUnchangedChild(child);
|
565
|
+
child_index++;
|
566
|
+
continue;
|
567
|
+
} else if (child.info.start_position >=
|
568
|
+
chunk_it.current().pos1 + chunk_it.current().len1) {
|
569
|
+
code_changed = true;
|
570
|
+
chunk_it.next();
|
571
|
+
continue;
|
572
|
+
} else if (child.info.start_position <= chunk_it.current().pos1 &&
|
573
|
+
child.info.end_position >= chunk_it.current().pos1 +
|
574
|
+
chunk_it.current().len1) {
|
575
|
+
ProcessInternals(child);
|
576
|
+
source_changed = source_changed ||
|
577
|
+
( child.status != FunctionStatus.UNCHANGED );
|
578
|
+
code_changed = code_changed ||
|
579
|
+
( child.status == FunctionStatus.DAMAGED );
|
580
|
+
child_index++;
|
581
|
+
continue;
|
582
|
+
} else {
|
583
|
+
code_changed = true;
|
584
|
+
child.status = FunctionStatus.DAMAGED;
|
585
|
+
child.status_explanation =
|
586
|
+
"Text diff overlaps with function boundary";
|
587
|
+
child_index++;
|
588
|
+
continue;
|
589
|
+
}
|
590
|
+
} else {
|
591
|
+
if (chunk_it.current().pos1 + chunk_it.current().len1 <=
|
592
|
+
info_node.info.end_position) {
|
593
|
+
info_node.status = FunctionStatus.CHANGED;
|
594
|
+
chunk_it.next();
|
595
|
+
continue;
|
596
|
+
} else {
|
597
|
+
info_node.status = FunctionStatus.DAMAGED;
|
598
|
+
info_node.status_explanation =
|
599
|
+
"Text diff overlaps with function boundary";
|
600
|
+
return;
|
601
|
+
}
|
602
|
+
}
|
603
|
+
Assert("Unreachable", false);
|
604
|
+
}
|
605
|
+
while (child_index < info_node.children.length) {
|
606
|
+
var child = info_node.children[child_index];
|
607
|
+
ProcessUnchangedChild(child);
|
608
|
+
child_index++;
|
609
|
+
}
|
610
|
+
if (code_changed) {
|
611
|
+
info_node.status = FunctionStatus.CHANGED;
|
612
|
+
} else if (source_changed) {
|
613
|
+
info_node.status = FunctionStatus.SOURCE_CHANGED;
|
614
|
+
}
|
615
|
+
info_node.new_end_pos =
|
616
|
+
chunk_it.TranslatePos(info_node.info.end_position);
|
617
|
+
}
|
618
|
+
|
619
|
+
function ProcessUnchangedChild(node) {
|
620
|
+
node.new_start_pos = chunk_it.TranslatePos(node.info.start_position);
|
621
|
+
node.new_end_pos = chunk_it.TranslatePos(node.info.end_position);
|
622
|
+
}
|
623
|
+
|
624
|
+
ProcessInternals(code_info_tree);
|
625
|
+
}
|
626
|
+
|
627
|
+
// For ecah old function (if it is not damaged) tries to find a corresponding
|
628
|
+
// function in new script. Typically it should succeed (non-damaged functions
|
629
|
+
// by definition may only have changes inside their bodies). However there are
|
630
|
+
// reasons for corresponence not to be found; function with unmodified text
|
631
|
+
// in new script may become enclosed into other function; the innocent change
|
632
|
+
// inside function body may in fact be something like "} function B() {" that
|
633
|
+
// splits a function into 2 functions.
|
634
|
+
function FindCorrespondingFunctions(old_code_tree, new_code_tree) {
|
635
|
+
|
636
|
+
// A recursive function that tries to find a correspondence for all
|
637
|
+
// child functions and for their inner functions.
|
638
|
+
function ProcessChildren(old_node, new_node) {
|
639
|
+
var old_children = old_node.children;
|
640
|
+
var new_children = new_node.children;
|
641
|
+
|
642
|
+
var unmatched_new_nodes_list = [];
|
643
|
+
|
644
|
+
var old_index = 0;
|
645
|
+
var new_index = 0;
|
646
|
+
while (old_index < old_children.length) {
|
647
|
+
if (old_children[old_index].status == FunctionStatus.DAMAGED) {
|
648
|
+
old_index++;
|
649
|
+
} else if (new_index < new_children.length) {
|
650
|
+
if (new_children[new_index].info.start_position <
|
651
|
+
old_children[old_index].new_start_pos) {
|
652
|
+
unmatched_new_nodes_list.push(new_children[new_index]);
|
653
|
+
new_index++;
|
654
|
+
} else if (new_children[new_index].info.start_position ==
|
655
|
+
old_children[old_index].new_start_pos) {
|
656
|
+
if (new_children[new_index].info.end_position ==
|
657
|
+
old_children[old_index].new_end_pos) {
|
658
|
+
old_children[old_index].corresponding_node =
|
659
|
+
new_children[new_index];
|
660
|
+
if (old_children[old_index].status != FunctionStatus.UNCHANGED) {
|
661
|
+
ProcessChildren(old_children[old_index],
|
662
|
+
new_children[new_index]);
|
663
|
+
if (old_children[old_index].status == FunctionStatus.DAMAGED) {
|
664
|
+
unmatched_new_nodes_list.push(
|
665
|
+
old_children[old_index].corresponding_node);
|
666
|
+
old_children[old_index].corresponding_node = void 0;
|
667
|
+
old_node.status = FunctionStatus.CHANGED;
|
668
|
+
}
|
669
|
+
}
|
670
|
+
} else {
|
671
|
+
old_children[old_index].status = FunctionStatus.DAMAGED;
|
672
|
+
old_children[old_index].status_explanation =
|
673
|
+
"No corresponding function in new script found";
|
674
|
+
old_node.status = FunctionStatus.CHANGED;
|
675
|
+
unmatched_new_nodes_list.push(new_children[new_index]);
|
676
|
+
}
|
677
|
+
new_index++;
|
678
|
+
old_index++;
|
679
|
+
} else {
|
680
|
+
old_children[old_index].status = FunctionStatus.DAMAGED;
|
681
|
+
old_children[old_index].status_explanation =
|
682
|
+
"No corresponding function in new script found";
|
683
|
+
old_node.status = FunctionStatus.CHANGED;
|
684
|
+
old_index++;
|
685
|
+
}
|
686
|
+
} else {
|
687
|
+
old_children[old_index].status = FunctionStatus.DAMAGED;
|
688
|
+
old_children[old_index].status_explanation =
|
689
|
+
"No corresponding function in new script found";
|
690
|
+
old_node.status = FunctionStatus.CHANGED;
|
691
|
+
old_index++;
|
692
|
+
}
|
693
|
+
}
|
694
|
+
|
695
|
+
while (new_index < new_children.length) {
|
696
|
+
unmatched_new_nodes_list.push(new_children[new_index]);
|
697
|
+
new_index++;
|
698
|
+
}
|
699
|
+
|
700
|
+
if (old_node.status == FunctionStatus.CHANGED) {
|
701
|
+
if (!CompareFunctionExpectations(old_node.info, new_node.info)) {
|
702
|
+
old_node.status = FunctionStatus.DAMAGED;
|
703
|
+
old_node.status_explanation = "Changed code expectations";
|
704
|
+
}
|
705
|
+
}
|
706
|
+
old_node.unmatched_new_nodes = unmatched_new_nodes_list;
|
707
|
+
}
|
708
|
+
|
709
|
+
ProcessChildren(old_code_tree, new_code_tree);
|
710
|
+
|
711
|
+
old_code_tree.corresponding_node = new_code_tree;
|
712
|
+
Assert(old_code_tree.status != FunctionStatus.DAMAGED,
|
713
|
+
"Script became damaged");
|
714
|
+
}
|
715
|
+
|
716
|
+
function FindLiveSharedInfos(old_code_tree, script) {
|
717
|
+
var shared_raw_list = %LiveEditFindSharedFunctionInfosForScript(script);
|
718
|
+
|
719
|
+
var shared_infos = new Array();
|
720
|
+
|
721
|
+
for (var i = 0; i < shared_raw_list.length; i++) {
|
722
|
+
shared_infos.push(new SharedInfoWrapper(shared_raw_list[i]));
|
723
|
+
}
|
724
|
+
|
725
|
+
// Finds SharedFunctionInfo that corresponds compile info with index
|
726
|
+
// in old version of the script.
|
727
|
+
function FindFunctionInfo(compile_info) {
|
728
|
+
for (var i = 0; i < shared_infos.length; i++) {
|
729
|
+
var wrapper = shared_infos[i];
|
730
|
+
if (wrapper.start_position == compile_info.start_position &&
|
731
|
+
wrapper.end_position == compile_info.end_position) {
|
732
|
+
return wrapper;
|
733
|
+
}
|
734
|
+
}
|
735
|
+
}
|
736
|
+
|
737
|
+
function TraverseTree(node) {
|
738
|
+
var info_wrapper = FindFunctionInfo(node.info);
|
739
|
+
if (info_wrapper) {
|
740
|
+
node.live_shared_info_wrapper = info_wrapper;
|
741
|
+
}
|
742
|
+
for (var i = 0; i < node.children.length; i++) {
|
743
|
+
TraverseTree(node.children[i]);
|
744
|
+
}
|
745
|
+
}
|
746
|
+
|
747
|
+
TraverseTree(old_code_tree);
|
748
|
+
}
|
749
|
+
|
750
|
+
|
751
|
+
// An object describing function compilation details. Its index fields
|
752
|
+
// apply to indexes inside array that stores these objects.
|
753
|
+
function FunctionCompileInfo(raw_array) {
|
754
|
+
this.function_name = raw_array[0];
|
755
|
+
this.start_position = raw_array[1];
|
756
|
+
this.end_position = raw_array[2];
|
757
|
+
this.param_num = raw_array[3];
|
758
|
+
this.code = raw_array[4];
|
759
|
+
this.scope_info = raw_array[5];
|
760
|
+
this.outer_index = raw_array[6];
|
761
|
+
this.shared_function_info = raw_array[7];
|
762
|
+
this.next_sibling_index = null;
|
763
|
+
this.raw_array = raw_array;
|
764
|
+
}
|
765
|
+
|
766
|
+
function SharedInfoWrapper(raw_array) {
|
767
|
+
this.function_name = raw_array[0];
|
768
|
+
this.start_position = raw_array[1];
|
769
|
+
this.end_position = raw_array[2];
|
770
|
+
this.info = raw_array[3];
|
771
|
+
this.raw_array = raw_array;
|
772
|
+
}
|
773
|
+
|
774
|
+
// Changes positions (including all statments) in function.
|
775
|
+
function PatchPositions(old_info_node, diff_array, report_array) {
|
776
|
+
var shared_info_wrapper = old_info_node.live_shared_info_wrapper;
|
777
|
+
if (!shared_info_wrapper) {
|
778
|
+
// TODO(LiveEdit): function is not compiled yet or is already collected.
|
779
|
+
report_array.push(
|
780
|
+
{ name: old_info_node.info.function_name, info_not_found: true } );
|
781
|
+
return;
|
782
|
+
}
|
783
|
+
%LiveEditPatchFunctionPositions(shared_info_wrapper.raw_array,
|
784
|
+
diff_array);
|
785
|
+
report_array.push( { name: old_info_node.info.function_name } );
|
786
|
+
}
|
787
|
+
|
788
|
+
// Adds a suffix to script name to mark that it is old version.
|
789
|
+
function CreateNameForOldScript(script) {
|
790
|
+
// TODO(635): try better than this; support several changes.
|
791
|
+
return script.name + " (old)";
|
792
|
+
}
|
793
|
+
|
794
|
+
// Compares a function interface old and new version, whether it
|
795
|
+
// changed or not.
|
796
|
+
function CompareFunctionExpectations(function_info1, function_info2) {
|
797
|
+
// Check that function has the same number of parameters (there may exist
|
798
|
+
// an adapter, that won't survive function parameter number change).
|
799
|
+
if (function_info1.param_num != function_info2.param_num) {
|
800
|
+
return false;
|
801
|
+
}
|
802
|
+
var scope_info1 = function_info1.scope_info;
|
803
|
+
var scope_info2 = function_info2.scope_info;
|
804
|
+
|
805
|
+
if (!scope_info1) {
|
806
|
+
return !scope_info2;
|
807
|
+
}
|
808
|
+
|
809
|
+
if (scope_info1.length != scope_info2.length) {
|
810
|
+
return false;
|
811
|
+
}
|
812
|
+
|
813
|
+
// Check that outer scope structure is not changed. Otherwise the function
|
814
|
+
// will not properly work with existing scopes.
|
815
|
+
return scope_info1.toString() == scope_info2.toString();
|
816
|
+
}
|
817
|
+
|
818
|
+
// Minifier forward declaration.
|
819
|
+
var FunctionPatchabilityStatus;
|
820
|
+
|
821
|
+
// For array of wrapped shared function infos checks that none of them
|
822
|
+
// have activations on stack (of any thread). Throws a Failure exception
|
823
|
+
// if this proves to be false.
|
824
|
+
function CheckStackActivations(shared_wrapper_list, change_log) {
|
825
|
+
var shared_list = new Array();
|
826
|
+
for (var i = 0; i < shared_wrapper_list.length; i++) {
|
827
|
+
shared_list[i] = shared_wrapper_list[i].info;
|
828
|
+
}
|
829
|
+
var result = %LiveEditCheckAndDropActivations(shared_list, true);
|
830
|
+
if (result[shared_list.length]) {
|
831
|
+
// Extra array element may contain error message.
|
832
|
+
throw new Failure(result[shared_list.length]);
|
833
|
+
}
|
834
|
+
|
835
|
+
var problems = new Array();
|
836
|
+
var dropped = new Array();
|
837
|
+
for (var i = 0; i < shared_list.length; i++) {
|
838
|
+
var shared = shared_wrapper_list[i];
|
839
|
+
if (result[i] == FunctionPatchabilityStatus.REPLACED_ON_ACTIVE_STACK) {
|
840
|
+
dropped.push({ name: shared.function_name } );
|
841
|
+
} else if (result[i] != FunctionPatchabilityStatus.AVAILABLE_FOR_PATCH) {
|
842
|
+
var description = {
|
843
|
+
name: shared.function_name,
|
844
|
+
start_pos: shared.start_position,
|
845
|
+
end_pos: shared.end_position,
|
846
|
+
replace_problem:
|
847
|
+
FunctionPatchabilityStatus.SymbolName(result[i])
|
848
|
+
};
|
849
|
+
problems.push(description);
|
850
|
+
}
|
851
|
+
}
|
852
|
+
if (dropped.length > 0) {
|
853
|
+
change_log.push({ dropped_from_stack: dropped });
|
854
|
+
}
|
855
|
+
if (problems.length > 0) {
|
856
|
+
change_log.push( { functions_on_stack: problems } );
|
857
|
+
throw new Failure("Blocked by functions on stack");
|
858
|
+
}
|
859
|
+
}
|
860
|
+
|
861
|
+
// A copy of the FunctionPatchabilityStatus enum from liveedit.h
|
862
|
+
var FunctionPatchabilityStatus = {
|
863
|
+
AVAILABLE_FOR_PATCH: 1,
|
864
|
+
BLOCKED_ON_ACTIVE_STACK: 2,
|
865
|
+
BLOCKED_ON_OTHER_STACK: 3,
|
866
|
+
BLOCKED_UNDER_NATIVE_CODE: 4,
|
867
|
+
REPLACED_ON_ACTIVE_STACK: 5
|
868
|
+
}
|
869
|
+
|
870
|
+
FunctionPatchabilityStatus.SymbolName = function(code) {
|
871
|
+
var enum = FunctionPatchabilityStatus;
|
872
|
+
for (name in enum) {
|
873
|
+
if (enum[name] == code) {
|
874
|
+
return name;
|
875
|
+
}
|
876
|
+
}
|
877
|
+
}
|
878
|
+
|
879
|
+
|
880
|
+
// A logical failure in liveedit process. This means that change_log
|
881
|
+
// is valid and consistent description of what happened.
|
882
|
+
function Failure(message) {
|
883
|
+
this.message = message;
|
884
|
+
}
|
885
|
+
// Function (constructor) is public.
|
886
|
+
this.Failure = Failure;
|
887
|
+
|
888
|
+
Failure.prototype.toString = function() {
|
889
|
+
return "LiveEdit Failure: " + this.message;
|
890
|
+
}
|
891
|
+
|
892
|
+
// A testing entry.
|
893
|
+
function GetPcFromSourcePos(func, source_pos) {
|
894
|
+
return %GetFunctionCodePositionFromSource(func, source_pos);
|
895
|
+
}
|
896
|
+
// Function is public.
|
897
|
+
this.GetPcFromSourcePos = GetPcFromSourcePos;
|
898
|
+
|
899
|
+
// LiveEdit main entry point: changes a script text to a new string.
|
900
|
+
function SetScriptSource(script, new_source, change_log) {
|
901
|
+
var old_source = script.source;
|
902
|
+
var diff = CompareStringsLinewise(old_source, new_source);
|
903
|
+
if (diff.length == 0) {
|
904
|
+
change_log.push( { empty_diff: true } );
|
905
|
+
return;
|
906
|
+
}
|
907
|
+
ApplyPatchMultiChunk(script, diff, new_source, change_log);
|
908
|
+
}
|
909
|
+
// Function is public.
|
910
|
+
this.SetScriptSource = SetScriptSource;
|
911
|
+
|
912
|
+
function CompareStringsLinewise(s1, s2) {
|
913
|
+
return %LiveEditCompareStringsLinewise(s1, s2);
|
914
|
+
}
|
915
|
+
|
916
|
+
// Applies the change to the script.
|
917
|
+
// The change is always a substring (change_pos, change_pos + change_len)
|
918
|
+
// being replaced with a completely different string new_str.
|
919
|
+
// This API is a legacy and is obsolete.
|
920
|
+
//
|
921
|
+
// @param {Script} script that is being changed
|
922
|
+
// @param {Array} change_log a list that collects engineer-readable
|
923
|
+
// description of what happened.
|
924
|
+
function ApplySingleChunkPatch(script, change_pos, change_len, new_str,
|
925
|
+
change_log) {
|
926
|
+
var old_source = script.source;
|
927
|
+
|
928
|
+
// Prepare new source string.
|
929
|
+
var new_source = old_source.substring(0, change_pos) +
|
930
|
+
new_str + old_source.substring(change_pos + change_len);
|
931
|
+
|
932
|
+
return ApplyPatchMultiChunk(script,
|
933
|
+
[ change_pos, change_pos + change_len, change_pos + new_str.length],
|
934
|
+
new_source, change_log);
|
935
|
+
}
|
936
|
+
|
937
|
+
|
938
|
+
// Functions are public for tests.
|
939
|
+
this.TestApi = {
|
940
|
+
PosTranslator: PosTranslator,
|
941
|
+
CompareStringsLinewise: CompareStringsLinewise,
|
942
|
+
ApplySingleChunkPatch: ApplySingleChunkPatch
|
943
|
+
}
|
944
|
+
}
|