Today an IonScript has at most one OSR entry, and it lives inside the script's normal compile. That causes two things:
- Recompiles. When a different loop gets hot, we sit in Baseline for up to 6000 "OSR pc mismatch" checks, then invalidate and recompile the whole script.
- Complexity and worse steady-state code. Entering the graph at an inner loop makes the CFG irreducible: a second graph root, fake loop predecessors, GVN OSR fixups,
canOsrspecial cases, and no LICM or contiguity for the loops enclosing the OSR loop. Worse, when OSR fires first, that compile also becomes the function's entry code for every later call.
- No OSR entry in normal IonScripts. Every normal compile has a single root and none of the OSR special cases apply.
- OSR code is its own IonScript per loop head. These are stored in a small side table on the JitScript, are only entered from Baseline at their loop head, and ar