javascript - Does nodejs/V8 store compiled machine code anywhere on disk? -
edit: @dystroy notes below, node uses machine code directly, not bytecode.
i lot of python coding, , there's bytecode lying around in .pyc files.
i wondering if node stores machine code in similar files, eg make sense keep machine code representation around on disk , re-use if file's source unchanged.
if so, node/v8 store machine code?
edit 2: @dystroy mentions below dupe of how can see machine code generated v8?
v8 introduced bytecode interpreter, ignition, in 2016. can print bytecode --print-bytecode
(node 8.3 , newer).
$ node --print-bytecode incrementx.js -e 'function incrementx(obj) {return 1 + obj.x;} incrementx({x: 42});` ... [generating bytecode function: incrementx] parameter count 2 frame size 8 12 e> 0x2ddf8802cf6e @ stackcheck 19 s> 0x2ddf8802cf6f @ ldasmi [1] 0x2ddf8802cf71 @ star r0 34 e> 0x2ddf8802cf73 @ ldanamedproperty a0, [0], [4] 28 e> 0x2ddf8802cf77 @ add r0, [6] 36 s> 0x2ddf8802cf7a @ return constant pool (size = 1) 0x2ddf8802cf21: [fixedarray] in oldspace - map = 0x2ddfb2d02309 <map(holey_elements)> - length: 1 0: 0x2ddf8db91611 <string[1]: x> handler table (size = 16)
see understanding v8's bytecode.
to see machine code, use --print-opt-code --code-comments
.
Comments
Post a Comment