Recover Instructions

Recover Instructions

IonMonkey poster

Let's Implement some Crazy Optimizations

This Presentation

  1. Optimizing JIT principles & Bailouts.
  2. Current Optimizations.
  3. Improving Bailouts with Recover Instructions.
  4. Overview of Possible Optimizations.

Control Flow Graph

Control Flow Graph

Optimizing with Guards

Optimizing with Assumptions

Optimizing with Assumptions

Bailouts

Resume Points

Resume Points

Resume Points

Snapshots

Building Snapshots

UCE

        if (predicate() /* proved false */)
          /* remove code */
        
      

Unreachable Code Elimination, remove unused branches.

Inlining

        var failed = function (i) {
          if (i > 9997)
            failed = function (i) { return true; } 
          return false; 
        }
      
          if (failed(i) || failed(i))
            /* Inlining → Removed by UCE */
      

Cause invalidation on scripts inlining this function.

Range Analysis

        function ra(i) {
          var x = (-1 >> 1) + 308641 * i;
          //  ^ Computed with int32s.
          failed(i); failed(i);
          
          print(x | 0);
        }
      

UCE → Range Analysis Failure

        function ra(i) {
          var x = (-1 >> 1) + 308641 * i;
          //  ^ Computed with doubles.
          if (failed(i) || failed(i))
            return; /* print(x); */
          print(x | 0);
        }
      

UCE prevents Range Analysis optimizations.

Limited by Bailouts

Recover Idea

Recover Instructions

Recover Instructions Build

Optim: Removing Writes

Removing writes is just about adding write instructions to the list of recover instructions.

→ Implies precise alias analysis.

→ Needed Escape analysis.