Bug 174322 - Introduce a method to write tests for DFG IR that would be hard to generate from just writing JS programs
Summary: Introduce a method to write tests for DFG IR that would be hard to generate f...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-10 14:48 PDT by Saam Barati
Modified: 2017-07-10 14:48 PDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.