Closed Bug 677415 Opened 13 years ago Closed 10 years ago

IonMonkey: constant folding in GVN is a bit ugly

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1004363

People

(Reporter: rpearl, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [ion:t])

Follow up for Bug 669789

Constant folding in GVN asks nodes to fold themselves, but has to deal with cleaning up the graph itself if a new node is created. This isn't done very cleanly.

There is also a parameter to the foldsTo function, to decide whether to use congruency checking, or just identity checking (that is, id() vs valueNumber() for determining if two instructions are the same). If possible, this should be factored out, so that folding a node doesn't take some strange bool parameter.
In the new GVN implementation (bug 1004363), nodes still fold themselves and don't clean up after themselves, but the GVN code has general-purpose cleanup code that also handles cleaning up after removing redundant expressions.

The new implementation also eliminates the distinction between id() and valueNumber(), the extra parameter to the foldsTo function, and a bunch of associated complexity. This does favor a pessimistic GVN over an optimistic GVN, but the simplicity and speed possible with a pessimistic GVN are worth the loss of theoretical power here, which in practice is fairly small.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.