Expand description
Inlines immediately invoked function expressions (IIFEs) to allow more fine-grained memoization of the values they produce.
Example:
const x = (() => {
const x = [];
x.push(foo());
return x;
})();
=>
bb0:
// placeholder for the result, all return statements will assign here
let t0;
// Label allows using a goto (break) to exit out of the body
Label block=bb1 fallthrough=bb2
bb1:
// code within the function expression
const x0 = [];
x0.push(foo());
// return is replaced by assignment to the result variable...
t0 = x0;
// ...and a goto to the code after the function expression invocation
Goto bb2
bb2:
// code after the IIFE call
const x = t0;If the inlined function has only one return, we avoid the labeled block and fully inline the code. The original return is replaced with an assignment to the IIFE’s call expression lvalue.
Analogous to TS Inference/InlineImmediatelyInvokedFunctionExpressions.ts.
Functions§
- inline_
immediately_ invoked_ function_ expressions - Inline immediately invoked function expressions into the enclosing function’s control flow graph.