Created
January 6, 2016 18:07
-
-
Save mraleph/6a547573f05de35f2a6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Raw source --- | |
() { | |
var sum = 0; | |
for (var i = 0; i < 1000; i++) { | |
sum += i; | |
} | |
} | |
--- Optimized code --- | |
optimization_id = 0 | |
source_position = 11 | |
kind = OPTIMIZED_FUNCTION | |
name = f | |
stack_slots = 2 | |
compiler = crankshaft | |
Instructions (size = 148) | |
0x3e8336c0 0 55 push ebp | |
0x3e8336c1 1 89e5 mov ebp,esp | |
0x3e8336c3 3 56 push esi | |
0x3e8336c4 4 57 push edi | |
0x3e8336c5 5 83ec08 sub esp,0x8 | |
;;; Store dynamic frame alignment tag for spilled doubles | |
0x3e8336c8 8 c745f400000000 mov [ebp-0xc],0x0 | |
;;; <@0,#0> -------------------- B0 -------------------- | |
;;; <@4,#3> prologue | |
;;; Prologue begin | |
;;; Prologue end | |
;;; <@6,#3> lazy-bailout | |
;;; <@10,#5> -------------------- B1 -------------------- | |
;;; <@12,#6> context | |
0x3e8336cf 15 8b45fc mov eax,[ebp-0x4] | |
;;; <@13,#6> gap | |
0x3e8336d2 18 8945f0 mov [ebp-0x10],eax | |
;;; <@16,#10> -------------------- B2 -------------------- | |
;;; <@17,#10> gap | |
0x3e8336d5 21 89c6 mov esi,eax | |
;;; <@18,#12> stack-check | |
0x3e8336d7 23 3b25545ac608 cmp esp,[0x8c65a54] | |
0x3e8336dd 29 7305 jnc 36 (0x3e8336e4) | |
0x3e8336df 31 e89cc6ffff call StackCheck (0x3e82fd80) ;; code: BUILTIN | |
;;; <@20,#12> lazy-bailout | |
;;; <@22,#22> gap | |
0x3e8336e4 36 33c9 xor ecx,ecx | |
0x3e8336e6 38 33c0 xor eax,eax | |
;;; <@24,#23> -------------------- B3 (loop header) -------------------- | |
;;; <@27,#27> compare-numeric-and-branch | |
0x3e8336e8 40 3dd0070000 cmp eax,0x7d0 ;; debug: position 51 | |
0x3e8336ed 45 0f8d1d000000 jnl 80 (0x3e833710) | |
;;; <@28,#28> -------------------- B4 (unreachable/replaced) -------------------- | |
;;; <@32,#34> -------------------- B5 -------------------- | |
;;; <@34,#36> stack-check | |
0x3e8336f3 51 3b25545ac608 cmp esp,[0x8c65a54] | |
0x3e8336f9 57 0f821c000000 jc 91 (0x3e83371b) | |
;;; <@35,#36> gap | |
0x3e8336ff 63 89ca mov edx,ecx | |
;;; <@36,#39> add-i | |
0x3e833701 65 03d0 add edx,eax ;; debug: position 75 | |
0x3e833703 67 0f8025000000 jo 110 (0x3e83372e) | |
;;; <@38,#44> add-i | |
0x3e833709 73 83c002 add eax,0x2 ;; debug: position 60 | |
;;; <@40,#47> gap | |
0x3e83370c 76 89d1 mov ecx,edx | |
;;; <@41,#47> goto | |
0x3e83370e 78 ebd8 jmp 40 (0x3e8336e8) | |
;;; <@42,#31> -------------------- B6 (unreachable/replaced) -------------------- | |
;;; <@46,#48> -------------------- B7 -------------------- | |
;;; <@48,#2> constant-t | |
0x3e833710 80 b8c980f046 mov eax,0x46f080c9 ;; object: 0x46f080c9 <undefined> | |
;;; <@50,#50> return | |
0x3e833715 85 89ec mov esp,ebp | |
0x3e833717 87 5d pop ebp | |
0x3e833718 88 c20400 ret 0x4 | |
;;; <@34,#36> -------------------- Deferred stack-check -------------------- | |
0x3e83371b 91 60 pushad ;; debug: position 51 | |
0x3e83371c 92 8b75fc mov esi,[ebp-0x4] | |
0x3e83371f 95 33c0 xor eax,eax | |
0x3e833721 97 bbe0664f08 mov ebx,0x84f66e0 | |
0x3e833726 102 e8b56afdff call 0x3e80a1e0 ;; code: STUB, CEntryStub, minor: 1 | |
0x3e83372b 107 61 popad | |
0x3e83372c 108 ebd1 jmp 63 (0x3e8336ff) | |
;;; -------------------- Jump table -------------------- | |
0x3e83372e 110 e8eb685d09 call 0x47e0a01e ;; deoptimization bailout 3 | |
0x3e833733 115 90 nop | |
0x3e833734 116 90 nop | |
0x3e833735 117 90 nop | |
0x3e833736 118 90 nop | |
0x3e833737 119 90 nop | |
;;; Safepoint table. | |
Inlined functions (count = 0) | |
Deoptimization Input Data (deopt points = 4) | |
index ast id argc pc | |
0 2 0 15 | |
1 4 0 36 | |
2 28 0 63 | |
3 28 0 -1 | |
Safepoints (size = 28) | |
0x3e8336e4 36 10 (sp -> fp) 1 | |
0x3e83372b 107 10 (sp -> fp) 2 | |
RelocInfo (size = 203) | |
0x3e8336c8 comment (;;; Store dynamic frame alignment tag for spilled doubles) | |
0x3e8336cf comment (;;; <@0,#0> -------------------- B0 --------------------) | |
0x3e8336cf comment (;;; <@4,#3> prologue) | |
0x3e8336cf comment (;;; Prologue begin) | |
0x3e8336cf comment (;;; Prologue end) | |
0x3e8336cf comment (;;; <@6,#3> lazy-bailout) | |
0x3e8336cf comment (;;; <@10,#5> -------------------- B1 --------------------) | |
0x3e8336cf comment (;;; <@12,#6> context) | |
0x3e8336d2 comment (;;; <@13,#6> gap) | |
0x3e8336d5 comment (;;; <@16,#10> -------------------- B2 --------------------) | |
0x3e8336d5 comment (;;; <@17,#10> gap) | |
0x3e8336d7 comment (;;; <@18,#12> stack-check) | |
0x3e8336e0 code target (BUILTIN) (0x3e82fd80) | |
0x3e8336e4 comment (;;; <@20,#12> lazy-bailout) | |
0x3e8336e4 comment (;;; <@22,#22> gap) | |
0x3e8336e8 position (51) | |
0x3e8336e8 comment (;;; <@24,#23> -------------------- B3 (loop header) --------------------) | |
0x3e8336e8 comment (;;; <@27,#27> compare-numeric-and-branch) | |
0x3e8336f3 comment (;;; <@28,#28> -------------------- B4 (unreachable/replaced) --------------------) | |
0x3e8336f3 comment (;;; <@32,#34> -------------------- B5 --------------------) | |
0x3e8336f3 comment (;;; <@34,#36> stack-check) | |
0x3e8336ff comment (;;; <@35,#36> gap) | |
0x3e833701 comment (;;; <@36,#39> add-i) | |
0x3e833701 position (75) | |
0x3e833709 comment (;;; <@38,#44> add-i) | |
0x3e833709 position (60) | |
0x3e83370c comment (;;; <@40,#47> gap) | |
0x3e83370e comment (;;; <@41,#47> goto) | |
0x3e833710 comment (;;; <@42,#31> -------------------- B6 (unreachable/replaced) --------------------) | |
0x3e833710 comment (;;; <@46,#48> -------------------- B7 --------------------) | |
0x3e833710 comment (;;; <@48,#2> constant-t) | |
0x3e833711 embedded object (0x46f080c9 <undefined>) | |
0x3e833715 comment (;;; <@50,#50> return) | |
0x3e83371b position (51) | |
0x3e83371b comment (;;; <@34,#36> -------------------- Deferred stack-check --------------------) | |
0x3e833727 code target (STUB) (0x3e80a1e0) | |
0x3e83372e comment (;;; -------------------- Jump table --------------------) | |
0x3e83372f runtime entry (deoptimization bailout 3) | |
0x3e833738 comment (;;; Safepoint table.) | |
--- End code --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- TRACE 1 start test0.lua:3 | |
0006 ADDVV 0 0 4 | |
0007 FORL 1 => 0006 | |
---- TRACE 1 IR | |
0001 int SLOAD #2 CI | |
0002 > num SLOAD #1 T | |
0003 num CONV 0001 num.int | |
0004 + num ADD 0003 0002 | |
0005 + int ADD 0001 +1 | |
0006 > int LE 0005 +1000 | |
0007 ------ LOOP ------------ | |
0008 num CONV 0005 num.int | |
0009 + num ADD 0008 0004 | |
0010 + int ADD 0005 +1 | |
0011 > int LE 0010 +1000 | |
0012 int PHI 0005 0010 | |
0013 num PHI 0004 0009 | |
---- TRACE 1 mcode 82 | |
0bcaffa9 mov dword [0x410ea410], 0x1 | |
0bcaffb4 cvttsd2si ebp, [rdx+0x8] | |
0bcaffb9 cmp dword [rdx+0x4], 0xfffeffff | |
0bcaffc0 jnb 0x0bca0010 ->0 | |
0bcaffc6 xorps xmm7, xmm7 | |
0bcaffc9 cvtsi2sd xmm7, ebp | |
0bcaffcd addsd xmm7, [rdx] | |
0bcaffd1 add ebp, +0x01 | |
0bcaffd4 cmp ebp, 0x3e8 | |
0bcaffda jg 0x0bca0014 ->1 | |
->LOOP: | |
0bcaffe0 xorps xmm6, xmm6 | |
0bcaffe3 cvtsi2sd xmm6, ebp | |
0bcaffe7 addsd xmm7, xmm6 | |
0bcaffeb add ebp, +0x01 | |
0bcaffee cmp ebp, 0x3e8 | |
0bcafff4 jle 0x0bcaffe0 ->LOOP | |
0bcafff6 jmp 0x0bca001c ->3 | |
---- TRACE 1 stop -> loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function f() { | |
var sum = 0; | |
for (var i = 0; i < 1000; i++) { | |
sum += i; | |
} | |
} | |
// V8 does not start optimizing as early as LuaJIT. | |
for (var i = 0; i < 100; i++) f(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local sum = 0 | |
for i = 1, 1000 do | |
sum = sum + i | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment