What is a V8 Engine?
The V8 engine is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others.
The V8 engine processing workflow
The V8 engine processing workflow is the sequence of steps that V8 takes to convert JavaScript code into executable machine code, allowing for the efficient execution of JavaScript.
The V8 JavaScript Engine Processing Workflow Diagram

A general overview of the V8 Engine Processing Workflow
- Source code: This is the JavaScript code that you write, which is then fed into the V8 engine for execution.
- Parser: The parser takes the source code and turns it into an Abstract Syntax Tree (AST), which represents the structure of the code in a tree-like format.
- Abstract Syntax Tree: This is the output of the parser. It breaks down the code into a format that can be easily processed by the next stages of the engine.
- Bytecode Generator (Ignition): The AST is then compiled into bytecode.
- Bytecode: This is a concise intermediate representation of JavaScript source code, which is not directly executable by the CPU but is optimized for reduced memory usage and faster execution. It streamlines the V8 engine’s compiler pipeline by serving as the foundational layer for both optimizing and deoptimizing code, thus reducing parsing overhead and simplifying the execution process.
- Interpreter (Ignition): The Ignition interpreter processes bytecode by interpreting each opcode one at a time. During this step, the interpreter carries out a direct translation of bytecode instructions into machine code, ensuring that the code can be executed by the CPU as it is being read, without the need for prior compilation. This method allows for the execution of JavaScript with minimal delay, as each instruction is handled in sequence at the moment it is encountered.
- JIT Compiler (TurboFan): Some sequences of bytecode that are executed frequently (referred to as “hot code”) are sent to the JIT (Just-In-Time) compiler, TurboFan, to be optimized into machine code.
- Optimized Machine Code: This is the highly optimized code that the CPU can execute directly, leading to better performance for frequently executed code.
- Machine Code: This is the machine-level code generated by the interpreter from individual bytecode instructions. It is crafted to be directly executed by the CPU.
Machine code deoptimization
A process known as “Deoptimization” refers to the reversal of an optimization phase within a JavaScript engine. During the execution of optimized machine code, if the engine encounters a situation that deviates from its initial assumptions—such as receiving data types that were not anticipated or a change in the execution path that was not predicted during optimization—the engine can revert the code back to its intermediate bytecode form. This bytecode is less efficient but more general-purpose, allowing the engine to handle the new scenario correctly. The deoptimization ensures that the execution continues accurately, albeit at a potentially reduced performance level, until such time as the code may be re-optimized with the new information taken into account.