Skip to content

V8 Architecture

V8 is Google’s open-source JavaScript engine used in Chrome, Node.js, Deno, and Electron. It compiles JavaScript to machine code.

flowchart LR
A["JavaScript Source"] --> B["Parser"]
B --> C["AST"]
C --> D["Ignition Interpreter"]
D --> E["Bytecode"]
E --> F["TurboFan Compiler"]
F --> G["Optimized Machine Code"]
E --> H["Execute"]
G --> H
H -->|"Deoptimize"| E
  • Parser: Creates AST (Abstract Syntax Tree)
  • Ignition: Fast interpreter that produces bytecode
  • TurboFan: Optimizing JIT compiler
  • Orinoco: Garbage collector
  • Memory Manager: Heap and stack management
  1. Source code → Parser → AST
  2. AST → Ignition → Bytecode
  3. Bytecode execution starts immediately
  4. Hot (frequently executed) functions → TurboFan → Optimized machine code
  5. If assumptions fail → Deoptimize → Back to bytecode
  • V8 uses a multi-tier architecture
  • Starts fast with Ignition interpreter
  • Optimizes hot code with TurboFan
  • Can deoptimize when assumptions change