Reputation: 7278
Can node.js (or some other v8 interface or wrapper around v8) output the generated assembly from the v8 JIT?
I'd like to see what the generated assembly looks like for various snippets.
Upvotes: 13
Views: 4822
Reputation: 10492
You need to ensure that node.js is built with V8 disassembler enabled. Debug builds will have it enabled by default. For release builds (in recent enough node that uses GYP build) you can enable it by doing:
GYP_DEFINES="v8_enable_disassembler=1 v8_object_print=1" ./configure
and rebuilding node.
When disassembler is enabled you can use flags like --print-code
, --print-code-stubs
, --print-opt-code
and --code-comments
to check out the code generated by V8.
If you would like to investigate IR used by optimizing compiler use --trace-hydrogen
and look at hydrogen.cfg
(it can be viewed with C1 Visualizer).
Upvotes: 25