Ignition (JavaScript interpreter)
ID: ignition-javascript-interpreter
Ignition is the register-based interpreter used within V8. It executes an internal representation of JavaScript computations rather than being a separate programming language with different source-level results.[ref]
Ignition in the V8 documentation. Opening description, low-level register-based interpreter
A small abstract bytecode example explains the role of such a representation. To compute a function returning
x + 2, imagine instructions load_arg r0; const r1, 2; add r2, r0, r1; return r2. For argument 5, the represented values are r0 = 5, r1 = 2 and r2 = 7, so the result is 7. An interpreter selects and performs the operation named by each instruction.This instruction spelling is invented for explanation; it is not an Ignition disassembly or a promise about a particular V8 release. The example separates source syntax, an intermediate instruction representation and execution. A register machine supplies a related abstract way to reason about stored intermediate values and operations, without identifying its formal instruction set with a production engine's bytecode.
Actual JavaScript operations require more than an arithmetic mnemonic. The expression
x + 2 can produce numerical addition or string concatenation depending on the value of x. Supplying "5" yields "52" rather than 7. Whatever internal instructions implement it must preserve the applicable ECMAScript behavior.[ref]ECMAScript Language Specification by Ecma International. Addition Operator, string concatenation and numeric addition
Understanding Ignition is therefore useful for studying execution and implementation costs, while the language specification remains the reference for observable program meaning.
New to topics? Read the docs here!