Parent: #459 Depends on: #467, #471
Goal
Add sound JavaScript call specialization, inlining, escape analysis, and scalar replacement so hot application call graphs and short-lived allocations do not pay canonical runtime cost.
Current boundary
Optimizer call links can jump directly to a current callee artifact, but bodies are not inlined and short-lived closures/objects/arrays/arguments remain material allocations.
Scope
- Build monomorphic and bounded-polymorphic call-site profiles with versioned callee/shape/realm assumptions.
- Inline ordinary, method, constructor, closure, and small builtin bodies with exact
this,new.target, arguments/rest, exceptions, tail calls, and debugger-visible frames. - Perform interprocedural effect summaries, escape analysis, scalar replacement, allocation sinking, and closure/environment stack allocation where identity cannot escape.
- Materialize eliminated objects/environments/arguments exactly on deopt, debugger inspection, exception escape, weak observation, or host boundary.
- Budget code growth and compilation latency; retain non-inlined direct-call links when inlining is not profitable.
No-workaround rules
- Do not assume a function/property remains unchanged without a guarded version; do not erase observable allocation identity, WeakRef/finalizer behavior, prototype/accessor calls, stack traces, or OOM timing where specified.
- No hardcoded benchmark callees or always-inline policy.
Acceptance
- Forced-on/off differentials cover polymorphism, rebinding, recursion, construct/new.target, exceptions/finally, eval, debugger stacks, GC/WeakRef/finalization, and no-GIL invalidation.
- Deopt materialization is failure-safe and precisely rooted.
- Profiles prove fewer runtime call entries and allocations on call/closure/application rows.
- Compilation time and executable-byte budgets are measured and bounded.
- Every retained speedup passes exact-parent wall/CPU/RSS evidence with no #44 regression.
Foundation
Direct call links and epoch retirement landed under #433/#439; current call-link contract is documented in docs/optimizing-jit.md.