Closed Bug 856533 Opened 9 years ago Closed 5 years ago

IonMonkey: Implement escape analysis.


(Core :: JavaScript Engine: JIT, defect)

Not set





(Reporter: nbp, Assigned: nbp)


(Blocks 2 open bugs)


(Whiteboard: [js:p2])

Escape analysis is blocking many optimizations, some of them are still to be done, such as stack allocation, store & load aliasing, or hoisting store at the end of loops.  The last 2 optimizations would likely impact pdfjs.js:16933 (octane benchmark) in 2 locations, one being the scope chain which only need to be synced when we call into getToken (which captures the loop variable, and also block Bug 856178 in the same function), the second one (unlikely a perf issue) being the content of the program object which is constantly read.

The escape analysis implies being able to link a declaration to the instruction which is escaping it. The way I am thinking for designing this technique is to add 2 MUse flags. One flag indicates that a use “isEscaped”, and the other that a use “mightBeTransitivelyEscaped” for stores.

The fact of adding a flag on the MUse makes it easier than using the MInstructions flags, but implies that such flags need to be either updated during replaceOperand or maintained with a separate phase (which might be more costly).

On the other hand, using MUse flags gives the ability to implement a MEscapeIterator which follow the MUses' flag (“isEcaped”) to iterate over all escaping instructions, which might not be obvious to discover once instructions are boxed & unboxed for whatever reasons.

Note: Bug 661374 suggests adding escape analysis to the bytecode.
Depends on: 897606
Depends on: 927548
Component: JavaScript Engine → JavaScript Engine: JIT
Whiteboard: [js:p2]
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1069307
You need to log in before you can comment on or make changes to this bug.