mraleph / irhydra

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

Source does not display in IR #53

Closed akerfoot closed 7 years ago

akerfoot commented 7 years ago

I'm running into a number of issues using IRHydra2, and I assume most of them stem from not parsing the code.asm file correctly.

I've isolated a small test case that exhibits the problem, and attached the source file, ir-test.js, along with the hydrogen.cfg and code.asm that v8 generated here: irtest.tar.gz.

They were created with the following command:

(v8):irtest alex$d8 --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces --redirect-code-traces-to=code.asm --print-opt-code ir-test.js 
Concurrent recompilation has been disabled for tracing.
sum: 139
accum: 13900000

d8 refers to v8/out/x64.debug/d8 from the master branch of v8, commit: https://github.com/v8/v8/commit/5561c17ac7be810af525cedbf91c8925687ce29d

The problems are as follows:

  1. When I first load hydrogen.cfg and code.asm into IRHydra2, I see console logs confirming they were loaded. However, if I click on ir-test.js:add, I get an error source_annotator.annotate failed: sources not available (code.asm not loaded?)
  2. The "Source" tab doesn't appear for ir-test.js:add, and toggling "Splice source into IR" does nothing.
  3. If I click ir-test.js:, I get an error in the console:
    
    index.html.polymer.bootstrap.dart.js:2945 ERROR: source_annotator.annotate failed.
    There is a mismatch between the source and source positions recorded.
    This can be caused by the presence of CRLF line endings.
    IRHydra assumes LF-only endings. Contact @mraleph for troubleshooting.

index.html.polymer.bootstrap.dart.js:2945 NullError: method not found: 'gi' on null index.html.polymer.bootstrap.dart.js:2945 TypeError: Cannot read property 'gi' of null at Object.J.q (index.html.polymer.bootstrap.dart.js:21311) at Mm.dart.Mm.$1 (index.html.polymer.bootstrap.dart.js:12276) at Object.dart.M5 (index.html.polymer.bootstrap.dart.js:12118) at Object.dart.QB (index.html.polymer.bootstrap.dart.js:11912) at DX.dart.DX.ll (index.html.polymer.bootstrap.dart.js:12381) at kl.dart.k0.FY (index.html.polymer.bootstrap.dart.js:12690) at Object.eval (eval at zy (index.html.polymer.bootstrap.dart.js:2094), :2:33) at Object.fe (index.html.polymer.bootstrap.dart.js:1907) at Bb. (index.html.polymer.bootstrap.dart.js:17036) at FA.dart.FA.$2 (index.html.polymer.bootstrap.dart.js:15419)

4. The Source tab appears, but when clicked it displays the source for `add()`
5. If I toggle the "Splice source into IR" button, it doesn't show the source, but instead toggles the red, vertical line highlight of the hot blocks (B6-B9).
6. If I select "Split Disassembly", I get the following unhandled exception:

index.html.polymer.bootstrap.dart.js:21328 Uncaught TypeError: J.k(...).gcA is not a function



Let me know if any of these should be split out into separate issues.
mraleph commented 7 years ago

V8 people has changed what they are dumping on their side and did not notify me

https://codereview.chromium.org/2451853002

I will try to fix it.

mraleph commented 7 years ago

I have V8 CL out for review that would fix V8 part of the issue.

Commit 50d16dc (on the branch right now) contains IRHydra part of the fix.

I will land it and redeploy IRHydra after V8 part is landed.

mraleph commented 7 years ago

This issue should be now fixed. Please try V8 HEAD.