The Engine Driving the Modern Web
An interactive guide to Google's V8, the high-performance JavaScript and WebAssembly engine powering Chrome and Node.js.
A Timeline of Innovation
V8's architecture has constantly evolved to meet the web's growing demands. Click on an era to learn more.
The Modern Execution Pipeline
V8 uses a multi-tiered system to balance fast startup and peak performance. Click each stage to see its role.
Select a Stage
Click on a component in the diagram to the left to learn about its function within the V8 execution pipeline.
Compiler Architecture Evolution
The trade-offs between compilation tiers have changed significantly over V8's lifetime.
Core Optimization Principles
V8 uses clever techniques to make dynamic JavaScript run incredibly fast.
1. Hidden Classes (Shapes)
To avoid slow property lookups, V8 creates hidden classes (or Shapes) that describe an object's structure. Objects with the same structure share the same hidden class, allowing for rapid property access.
2. Inline Caching (IC)
V8 caches the results of operations. An IC for `obj.x` assumes future objects will have the same hidden class, skipping the lookup. The IC state changes based on how many hidden classes it sees.
Click to simulate property access.
3. Escape Analysis
The optimizing compiler (TurboFan) analyzes if an object "escapes" its creation function. If not, V8 can perform allocation folding: storing the object's contents in CPU registers instead of allocating it on the heap, which is much faster.
Orinoco: The Garbage Collector
V8's GC automatically reclaims memory, using a generational approach to minimize application pauses ("jank").
Visualizing the Young Generation Scavenge
New objects are born in the "Young Generation". When this space fills up, a fast "Scavenge" copies live objects to a new space and promotes survivors to the "Old Generation". This animation shows the process.
From Space (Nursery)
To Space / Old Gen
V8 & WebAssembly
V8 is a dual-language VM, also providing high-performance execution for WebAssembly (Wasm).
Liftoff
The baseline compiler for Wasm. Liftoff prioritizes compilation speed, performing a single, fast pass over Wasm bytecode to generate machine code, ensuring modules start almost instantly.
WasmGC
A major advancement allowing languages with their own garbage collectors (like Java or Dart) to compile to Wasm and have their memory managed by V8's highly-optimized Orinoco GC.
JS Promise Integration
An API that allows Wasm code to seamlessly integrate with JavaScript's async ecosystem, enabling Wasm to call async Web APIs and suspend/resume without blocking the main thread.