V8: From CFG to Sea of Nodes and back again
a year ago
- #JavaScript
- #Compiler Optimization
- #V8
- V8's Turbofan compiler is moving from Sea of Nodes (SoN) to a Control-Flow Graph (CFG) IR named Turboshaft.
- Sea of Nodes was initially chosen for its flexibility in representing dependencies but proved problematic for JavaScript and WebAssembly.
- Key issues with SoN include complexity in managing effect and control chains, difficulty in visual inspection, and inefficiency in compilation.
- The transition to Turboshaft aims to simplify the compiler's architecture, improve performance, and make the code easier to maintain and debug.
- Turboshaft has already shown benefits, such as faster compile times and better cache locality, compared to the SoN-based approach.