Skip to content

Instantly share code, notes, and snippets.

@arturparkhisenko
Last active February 8, 2018 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arturparkhisenko/d339a74ebe35cc6ef655607b7dfc5ebf to your computer and use it in GitHub Desktop.
Save arturparkhisenko/d339a74ebe35cc6ef655607b7dfc5ebf to your computer and use it in GitHub Desktop.
Understanding V8’s Bytecode
// https://medium.com/dailyjs/understanding-v8s-bytecode-317d46c94775
// node --print-bytecode --print-bytecode-filter=ZXC v8-bytecode.js
function ZXC() {
var A = 0;
let B = 0;
const C = 0;
const O = {};
const N = 9;
}
ZXC();
/*
[generating bytecode for function: ZXC]
Parameter count 1
Frame size 48
136 E> 0x3c901c14e20e @ 0 : 91 StackCheck
151 S> 0x3c901c14e20f @ 1 : 02 LdaZero
0x3c901c14e210 @ 2 : 1e fa Star r0
164 S> 0x3c901c14e212 @ 4 : 02 LdaZero
0x3c901c14e213 @ 5 : 1e f9 Star r1
179 S> 0x3c901c14e215 @ 7 : 02 LdaZero
0x3c901c14e216 @ 8 : 1e f8 Star r2
197 S> 0x3c901c14e218 @ 10 : 6d 00 03 29 f5 CreateObjectLiteral [0], [3], #41, r5
0x3c901c14e21d @ 15 : 1f f5 f7 Mov r5, r3
216 S> 0x3c901c14e220 @ 18 : 03 09 LdaSmi [9]
0x3c901c14e222 @ 20 : 1e f6 Star r4
0x3c901c14e224 @ 22 : 04 LdaUndefined
219 S> 0x3c901c14e225 @ 23 : 95 Return
Constant pool (size = 1) // because of object, no matter var/let/const
Handler Table (size = 16)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment