Bug 174322

Summary: Introduce a method to write tests for DFG IR that would be hard to generate from just writing JS programs
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: NEW ---    
Severity: Normal CC: benjamin, fpizlo, ggaren, gskachkov, jfbastien, keith_miller, mark.lam, msaboff, ticaiolima, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Saam Barati 2017-07-10 14:48:52 PDT
Something that'd be easy to do would be an API like:
```test(" js text program here ", Phase, lambda(Graph&))```
where `test` will run the program, and call lambda right before executing Phase.

This proposal could have the downside that the lambda assumes that the graph is in a particular state. At a later time, we could change how the DFG modifies the IR for the program text, and then we'll end up in a state where the lambda crashes or silently fails. Maybe this is an OK tradeoff.

There are other, perhaps more comprehensive, ways of writing such tests, but they might be harder to implement. Perhaps we should also do them at some point. One idea would be to introduce a bytecode writer, and have a way of executing particular bytecode we write ourselves.