From Sea of Nodes to Turboshaft: How V8 Reengineered Its Compiler IR

Introduction

V8's optimizing compiler Turbofan was one of the few production compilers using the Sea of Nodes (SoN) intermediate representation (IR). For nearly three years, the V8 team has been systematically replacing Sea of Nodes with a more traditional control-flow graph (CFG) based IR called Turboshaft. Today, the entire JavaScript backend of Turbofan and the complete WebAssembly pipeline use Turboshaft. Only the builtin pipeline (slowly being replaced) and the JavaScript frontend (being replaced by Maglev) still retain some Sea of Nodes components. This guide walks through the step-by-step journey of that transition, explaining why V8 moved away from Sea of Nodes and how you can understand the process.

From Sea of Nodes to Turboshaft: How V8 Reengineered Its Compiler IR
Source: v8.dev

What You Need


Step 1: Recognize the Limitations of the Sea of Nodes

Before the transition could begin, the V8 team had to acknowledge that the Sea of Nodes IR, despite its theoretical elegance, caused practical problems. Key issues included:

Step 2: Evaluate the Need for a New IR

With the problems identified, the team determined that patching Sea of Nodes was insufficient. They needed an IR that:

This led to the conceptual design of Turboshaft, a CFG-based IR that retained the best parts of Sea of Nodes while addressing its weaknesses.

Step 3: Design Turboshaft – A Hybrid CFG IR

Turboshaft was built as a control-flow graph but with a sophisticated node-based representation for data dependencies, similar to Sea of Nodes. The design goals were:

Step 4: Pilot the Transition in the JavaScript Backend

The team started by replacing the Sea of Nodes backend of the JavaScript pipeline with Turboshaft. This meant rewriting:

This phase took several months and produced significant performance wins without regression.

Step 5: Extend Turboshaft to WebAssembly

After the JavaScript backend was stable, the team tackled WebAssembly (wasm). Wasm had its own pipeline built on Sea of Nodes. The transition for wasm was simpler because wasm’s language semantics aligned well with CFG. The entire wasm pipeline now uses Turboshaft, yielding faster compilation and better code quality.

Step 6: Gradually Migrate Remaining Components

Two parts still rely on Sea of Nodes: the builtin pipeline (for internal V8 functions) and the JavaScript frontend (graph building from JavaScript bytecode). The team is methodically replacing these:

Step 7: Monitor and Iterate

With the major components migrated, V8 continues to:


Tips for Understanding This Transition

Recommended

Discover More

Bank of America Predicts GTA 6 Could Set a New $80 Standard for Video GamesBuilding a Smarter Advertising System: A Multi-Agent Architecture Guide6 Key Kubernetes v1.36 Updates for Controller Health and ObservabilityRevolutionary 3D-Printed Pinhole Camera Captures Wigglegrams: Two Cameras in OneMastering AI in Software Development: Insights from Chris Parsons' Updated Guide