Deoptimization Is Harder Than Optimization: How JIT Escape Hatches Keep Dynamic Languages Fast

lauriewired · x · 2026-09-23

Security researcher LaurieWired explains deoptimization: JITs like V8, HotSpot, and WebKit make "dirty" speculative optimizations based on what's been true so far, betting the next call is "Dog" like the last 3 million. The safety net: when an assumption breaks, the deoptimizer must reconstruct correct program state at any escape hatch — rebuilding destroyed stack frames and never-allocated objects from limited metadata — before jumping to the slow path. Her metaphor: we drive fast because we have brakes. A great primer on why dynamic languages can fly close to the sun.

Original post →

More from Research

Research channel →