Closed Bug 927548 Opened 7 years ago Closed 4 years ago

consider implementing scalar replacement for iterators


(Core :: JavaScript Engine: JIT, defect, P3)






(Reporter: bkelly, Unassigned)



(Keywords: perf)

Consider implementing scalar replacement in our JavaScript engine.  As discussed in bug 907077 it would be very useful in order to avoid object allocations on each iteration of the new es6 for-of loops.
Component: JavaScript Engine → JavaScript Engine: JIT
I am already working on this on my spare time as part of the rewrite of the Alias Analysis (Bug 897606) before implementing Escape Analysis (Bug 856533).

One of the problem of Scalar Replacement is that we need to add annotation into the resume points to recover the state of the iterator.  Recover instructions (Bug 878503) introduces a generic way to solve this problem for any MIR instructions which has an equivalent recover instructions.
Blocks: 856533
Depends on: 897606
Side note, we now have a form of scalar replacement in IonMonkey (see Bug 992845 and Bug 1040027).
Still, I do think that the current implementation of our scalar replacement need some improvement such as Bug 897606, on which I will work in the next few weeks.
Summary: consider implementing scalar replacement optimization → consider implementing scalar replacement for iterators
This issue got fixed with the landing of Scalar Replacement.  Still I will note that even if the next function can be inlined as well as the object returned by the next function, the iterator object is not inlined if we OSR in the loop, but it would be if we enter the loop frequently.
Closed: 4 years ago
Priority: -- → P3
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.