Skip to content

Instantly share code, notes, and snippets.

@Twipped
Last active August 29, 2015 14:08
Show Gist options
  • Save Twipped/f51b8e8fd6005095dbf1 to your computer and use it in GitHub Desktop.
Save Twipped/f51b8e8fd6005095dbf1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env node --trace_opt --trace_deopt --allow-natives-syntax
var optimized = require('optimized');
function test () {
var ai = 0, al = arguments.length, args = al && new Array(al) || [];
if (al) for(; ai < al; ai++) args[ai] = arguments[ai];
return args;
}
optimized(test, [1,2]); // is optimized
optimized(test, [{}, {}]); // is optimized
[deoptimize context: 1a18aac414b1]
[optimizing: test / 208cd4f7bf89 - took 0.161, 0.276, 0.000 ms]
Function test(1, 2) is optimized
**** DEOPT: test at bailout #10, address 0x0, frame size 24
[deoptimizing: begin 0x208cd4f7bf89 test @10]
translating test => node=59, height=32
0x7fff5fbff4c0: [top + 64] <- 0x1a18aac573a1 ; [sp + 56] 0x1a18aac573a1 <JS Global Object>
0x7fff5fbff4b8: [top + 56] <- 0x2cc39540a96e ; caller's pc
0x7fff5fbff4b0: [top + 48] <- 0x7fff5fbff4e0 ; caller's fp
0x7fff5fbff4a8: [top + 40] <- 0x1a18aac414b1; context
0x7fff5fbff4a0: [top + 32] <- 0x208cd4f7bf89; function
0x7fff5fbff498: [top + 24] <- 0x1a18aac041c1 <Odd Oddball> ; arguments object
0x7fff5fbff490: [top + 16] <- 0 ; rdi (smi)
0x7fff5fbff488: [top + 8] <- 2 ; rbx (smi)
0x7fff5fbff480: [top + 0] <- 0x208cd4fd76b9 ; rax 0x208cd4fd76b9 <JS Array[2]>
[deoptimizing: end 0x208cd4f7bf89 test => node=59, pc=0x2cc39546f665, state=NO_REGISTERS, alignment=no padding, took 0.044 ms]
Materializing (adapted) arguments object for 0x7fff5fbff498: 0x208cd4fd76f9 <an Arguments>
[removing optimized code for: test]
[optimizing: test / 208cd4f7bf89 - took 0.047, 0.124, 0.000 ms]
Function test({}, {}) is optimized
#!/usr/bin/env node --trace_opt --trace_deopt --allow-natives-syntax
var optimized = require('optimized');
function test () {
var ai = 0, al = arguments.length, args = al && new Array(al) || [];
if (al) for(; ai < al; ai++) args[ai] = arguments[ai];
return args;
}
optimized(test, [{}, {}]); // is NOT optimized
optimized(test, [1,2]); // is optimized
[deoptimize context: 1c4c335414b1]
[optimizing: test / 58556f7bf89 - took 0.155, 0.277, 0.000 ms]
**** DEOPT: test at bailout #5, address 0x0, frame size 24
[deoptimizing: begin 0x58556f7bf89 test @5]
translating test => node=55, height=32
0x7fff5fbff4c0: [top + 64] <- 0x1c4c335573a1 ; [sp + 56] 0x1c4c335573a1 <JS Global Object>
0x7fff5fbff4b8: [top + 56] <- 0x34d33920a96e ; caller's pc
0x7fff5fbff4b0: [top + 48] <- 0x7fff5fbff4e0 ; caller's fp
0x7fff5fbff4a8: [top + 40] <- 0x1c4c335414b1; context
0x7fff5fbff4a0: [top + 32] <- 0x58556f7bf89; function
0x7fff5fbff498: [top + 24] <- 0x1c4c335041c1 <Odd Oddball> ; arguments object
0x7fff5fbff490: [top + 16] <- 0 ; literal
0x7fff5fbff488: [top + 8] <- 2 ; rbx (smi)
0x7fff5fbff480: [top + 0] <- 0x58556fb0a19 ; rax 0x58556fb0a19 <JS Array[2]>
[deoptimizing: end 0x58556f7bf89 test => node=55, pc=0x34d33926f575, state=NO_REGISTERS, alignment=no padding, took 0.032 ms]
Materializing (adapted) arguments object for 0x7fff5fbff498: 0x58556fb0a59 <an Arguments>
[removing optimized code for: test]
Function test({}, {}) is not optimized
[optimizing: test / 58556f7bf89 - took 0.059, 0.127, 0.000 ms]
Function test(1, 2) is optimized
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment