Add instructions for viewing asm with v8
If you don't care about byte code then there's simpler way - just run node --print-opt-code test.js >output.txt and it will produce x64 asm in plain text file. No websites needed to view it.
Text file for this square function will contain these lines:
00007FF5DC94E91F 5f c5fb104107 vmovsd xmm0,[rcx+0x7]
00007FF5DC94E924 64 c5fb59c0 vmulsd xmm0,xmm0,xmm0
address, offset, x64 instruction bytes, and text x64 assembly.
Yes this is how I have added it to compiler explorer. But that output really isn't very friendly when I want to understand what is going on. The turbolizer output is much more understandable at my current level. The way I read that is,
- Look at the blocks marked in the bytecode as (B1, B2, etc)
- Look for those same blocks in the assembly code
Its much easier to spot which line of javascript generated which bytecodes than to spot which lines of js generated which lines of asm directly. I don't fully understand the blocks yet, but they have something to do with the sea of nodes method v8 uses to compile the bytecode to asm. I can't say I really get the things that go on in there, but I am trying. And Im hoping that by the end of this course I will have a much better understanding of how exactly v8 compiles/optimizes the bytecode.