IRHydra2

This is a tool that can display intermediate representations used by V8 and Dart VM optimizing compilers.

If it's you first time trying IRHydra consider watching the following screencast showcasing its main features:

Demos

Try clicking on the links below to explore features that IRHydra provides. Each link loads compilation artifacts collected from a single V8 or Dart VM run on a given source file.

Compilation Artifacts Cheatsheet

If you already have some artifacts collected go ahead and explore them with  otherwise here is how you can collect some.

V8

You need V8 version >= 3.24.39 to use IRHydra2. You can check about:version to see if your browser comes with the suitable version.

You need to pass the following flags to V8 to collect IR and deoptimization artifacts and be able to use source level view:

--trace-hydrogen
--trace-phase=Z
--trace-deopt
--code-comments
--hydrogen-track-positions
--redirect-code-traces
--redirect-code-traces-to=code.asm

Additionally you can pass the following flags to enable disassembly view. This requires building V8 with v8_enable_disassembler=1 GYP flag.

--print-opt-code

When run with this flags V8 will produce two files hydrogen.cfg and code.asm both of which should be loaded into IRHydra.

When running in Chromium use --js-flags="..." to pass V8 flags and --no-sandbox to allow V8 to write hydrogen-<pid>-<id>.cfg and code-<pid>-<id>.asm.

--no-sandbox                           \
--js-flags="--trace-hydrogen           \
            --trace-phase=Z            \
            --trace-deopt              \
            --code-comments            \
            --hydrogen-track-positions \
            --redirect-code-traces"

Notice that there is no need to pass --redirect-code-traces-to=code.asm flag, this guarantees that in the presence of multiple renderer processes compilation artifacts are correctly split between separate files.

Dart VM

You need to pass the following flags to Dart VM to collect IR and disassemble artifacts:

--print-flow-graph-optimized
--disassemble-optimized
--code-comments

All data is dumped into standard output.

When running in Dartium use DART_FLAGS environment variable to pass flags.

Deoptimization matching and source level view is not currently available for Dart VM.