mraleph / irhydra

Tool for displaying IR used by V8 and Dart VM optimizing compilers
Apache License 2.0
433 stars 32 forks source link

unrecognized flags when running in node #34

Closed vkz closed 9 years ago

vkz commented 9 years ago

Getting these:

Error: unrecognized flag --redirect-code-traces-to=code.asm
Error: unrecognized flag --redirect-code-traces
Error: unrecognized flag --emit-opt-code-positions

Is my built missing some GYP flags? Node was built in the environment: GYP_DEFINES="v8_enable_disassembler=1 v8_object_print=1"

Running with

alias nodeir='node --redirect-code-traces --redirect-code-traces-to=code.asm --trace-deopt --trace-hydrogen --trace-phase=Z --print-opt-code --code-comments --emit-opt-code-positions'

Versions

bash-3.2$ node -v
v0.10.33
bash-3.2$ node -e "console.log(process.versions.v8)"
3.14.5.9

I suspect the last error can be fixed by applying https://github.com/mraleph/irhydra/blob/master/patches/v8.r18822.patch to node/deps/v8. Unfortunately most hunks fail to apply to the version of v8 shipped with node.

mraleph commented 9 years ago

Sorry, 3.14.5.9 is simply way too old. For all IRHydra2 features to work properly you need at least 2.24.39 (that was the first version where all necessary things were implemented).

If you limit yourself to --trace-hydrogen --print-opt-code --code-comments --trace-deopt you should be able to get subset of features working (though you will have to manually redirect stdout to code.asm to capture disassembly and deoptimizations). Though even that is not guaranteed as I ripped out various pieces of code that were trying to cope with lack of information by parsing various parts of disassembled code. Probably only old IRHydra (deployed at http://mrale.ph/irhydra/1/) would be able to map deoptimizations to IR instructions for such an old version. And there'll be no way of getting source-to-IR mapping.

I am not sure I can do anything here, to be honest. Node.js is simply way behind with their V8.

I think you might have a better chance with v0.12.*

mraleph commented 9 years ago

Apparently IRHydra2 at least does successfully map deoptimizations when used with node v0.10.x, because I have a sample from WebRebel's talk included that was generated with node v0.10.x and deoptimization mapping works there.

All features should work with node master (even though V8 is still quite old there):

$ node -v
v0.13.0-pre
$ node -e "console.log(process.versions.v8)"
3.26.33

Additionally it should be --hydrogen-track-positions for recent V8, not --emit-opt-code-positions. That's how the flag used to be called.

The http://mraleph/irhydra/2/ page lists all up-to-date flags, so please use them.

vkz commented 9 years ago

yay! Works with node --HEAD v0.12

mraleph commented 9 years ago

Great. Don't hesitate to contact me with any other issues.