Reputation: 4477
Assume that I am writing a compiler with an asm.js-backend. In order to generate the most efficient code, I'd like to know how the generated asm.js code is translated to machine code. Is there a way to dump the (x86-64 in my case) assembly generated by OdinMonkey with a SpiderMonkey build like here: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Build_Documentation?
Upvotes: 1
Views: 394
Reputation: 4477
I have just learnt that OdinMonkey does not directly generate assembler code (https://github.com/dherman/asm.js/issues/80#issuecomment-31673247) but does generate optimized MIR code for IonMonkey, which is then translated to LIR code and then to machine code.
Thus my question should have been how to dump the assembly that IonMonkey processes and outputs. For the intermediate code one can use a debug build of SpiderMonkey's js shell with IONFLAGS=logs. This gives quite a lot of information in /tmp/ion.cfg. For the assembly code, this site (https://developer.mozilla.org/en-US/docs/SpiderMonkey/Hacking_Tips) suggests to use gdb to disassemble the machine code.
Upvotes: 4