JavaScript internals
V8's two-tier JIT, the event loop in detail, generational garbage collection, hidden classes and inline caches, prototypes, promise internals, libuv, streams, module resolution, JIT deoptimisation. Ten mechanisms that decide how JavaScript programs actually behave at runtime.
10 sub-pages planned. Each is a long-form walkthrough with source links and references.
The mechanisms
V8 — Ignition + TurboFan
Hidden classes, inline caches, the optimising compiler. Why predictable object shapes matter and what your code actually costs in JIT-land.
The event loop (deep)
Microtasks vs macrotasks, browser tasks vs Node phases, libuv internals. Why a flood of promises can starve I/O and what to do about it.
Garbage collection (V8)
Generational GC, the Scavenger and Mark-Compact, Orinoco. Concurrent marking, incremental marking, and what causes stop-the-world pauses you can measure.
Still in flight
Each will be a long-form sub-page with code, runtime / engine source links, and references.
- 04Hidden classes & inline cachesHow V8 represents objects internally, why constructor field order matters, and how property access is patched at runtime via inline caches.hidden class · transition tree · monomorphic IC · polymorphic IC · megamorphic
- 05Promise queue internalsPromiseReactionJob, the microtask queue, host-defined queue draining rules. The exact order of resolution and why .then chains behave like they do.microtask queue · PromiseReactionJob · job · resolve · host hook
- 06libuv — Node event loopPhases, the thread pool, the polling step, signal handlers. Where Node's I/O concurrency actually comes from.phases · thread pool · pollio · check phase · epoll
- 07Streams & backpressureWeb Streams (WHATWG) vs Node streams. How backpressure propagates, why pipe is correct and pipeline is canonical.ReadableStream · WritableStream · backpressure · pipe · pipeline
- 08Module resolutionNode require algorithm, ESM resolution, the exports map, dual-package hazards. Where bundlers diverge from the runtime.require algorithm · exports map · conditional exports · dual-package · subpath
- 09Prototypes — the object modelObject [[Prototype]] vs Object.prototype, the [[Get]] / [[Set]] internal slots, class as sugar. Why monkey-patching is dangerous and predictable shapes are fast.[[Prototype]] · [[Get]] · [[Set]] · class · inheritance
- 10JIT deoptimisationWhat makes V8 bail out — type feedback violations, unsupported operations, megamorphic call sites. How to read --trace-deopt and avoid the common traps.deopt · type feedback · %TraceOpt · megamorphism · eager deopt