V8 Reference
V8 Glossary
The shared vocabulary for this track. Terms are added as lessons introduce
them — once a term is here, every lesson uses it the same way. L1
marks terms introduced in Lesson 1.
Execution pipeline
- Pipeline / Tiers L1
- V8's staged path from source to machine code: Parser → Ignition (bytecode) →
Sparkplug → Maglev → TurboFan. Later tiers are faster but more expensive to produce,
so V8 only promotes "hot" code to them.
- Parser / AST L1
- The parser turns source text into an Abstract Syntax Tree (AST) — a structured
tree of the program. Bytecode is generated from the AST. See
--print-ast.
- Ignition L1
- V8's bytecode interpreter. Compiles each function to compact bytecode and executes
it. Most code only ever runs here.
Docs.
- Bytecode L1
- The compact instruction format Ignition runs. A register machine design centered on
the accumulator. Inspect with
--print-bytecode.
- Accumulator L1
- A single implicit register that most bytecode instructions read from and write to.
Keeps bytecode small (instructions don't need to name a destination).
Ldar loads
it; Star stores from it.
- Feedback slot / Feedback vector L1
- Per-function storage where Ignition records the runtime types it observes (the
[0] in Add a0, [0]). The optimizing compilers read this to
generate type-specialized machine code.
- Sparkplug · Maglev · TurboFan L2
- The three compilers that turn bytecode into machine code. Sparkplug: fast baseline,
no optimization (1:1 bytecode→machine code). Maglev: mid-tier optimizer. TurboFan:
top-tier, most aggressive, compiles concurrently. A function climbs these only as it proves "hot".
Sparkplug ·
Maglev.
- Speculative optimization L2
- V8's central strategy: run cheaply, observe the types that actually occur, then compile
machine code that bets those types continue. The bet is what makes the code fast — and
what can break (→ deoptimization).
- Tier-up L2
- Promoting a function to a higher compiler tier because it became "hot and stable"
(called often, consistent types). Watch with
--trace-opt.
- Deoptimization (bailout) L2
- When optimized machine code's assumptions break at runtime, V8 bails back to bytecode
(the interpreter) and resumes there. Common reason:
wrong map (object shape changed).
Eager deopt happens at the breaking instruction; lazy deopt is deferred. See --trace-deopt.
- OSR — On-Stack Replacement L2
- Swapping a currently-running function's code (e.g. a long loop) for freshly-compiled
optimized code, mid-execution, without waiting for it to return.
- Concurrent compilation L2
- Optimizing compilers run on background threads (
ConcurrencyMode::kConcurrent)
so your JavaScript keeps executing while V8 compiles a faster version.
Object model & runtime
- Receiver L1
- The hidden first parameter of every function call — the value of
this. Why
add(a,b) reports "Parameter count 3".
- SharedFunctionInfo (SFI) L1
- V8's internal record describing a function's code (name, source position, bytecode)
shared across all closures of that function. Appears in
--print-bytecode headers.
- Source position (S / E)
- Markers in bytecode mapping instructions back to source offsets — Statement and
Expression positions. Power stack traces and debugging.
- Hidden Class / Map / Shape L7
- V8's internal descriptor of an object's layout — which properties it has and at what
fixed offset. Objects built the same way (same properties, same order) share a Map,
so property access compiles to "check the Map, read offset N." "Map" (V8), "hidden class", and
"shape" all mean the same thing. Inspect with
%HaveSameMap(a,b) / %DebugPrint(o).
Maps doc.
- Transition L7
- Adding a property doesn't mutate a Map — it transitions to a new Map and records the
link, forming a transition tree. Objects that add properties in the same order share Maps at
every step. Property order matters:
{x,y} ≠ {y,x}.
- Inline Cache (IC) L7
- A per-site cache at each property access recording "for Map M, property p is at offset N", so
repeat accesses skip the full lookup. This is the type feedback the optimizers consume.
- Monomorphic · Polymorphic · Megamorphic L7
- How many shapes an IC has seen. Monomorphic (1) = fastest. Polymorphic (2–4) =
small Map list, slower. Megamorphic (many) = V8 stops caching → generic lookup → perf cliff.
- FastProperties vs dictionary mode L7
- FastProperties = the hidden-class fast path (offsets). If an object's shape gets too
chaotic (or you
delete properties), V8 drops it to dictionary mode — a real
hash table, the slow path. Visible in %DebugPrint output.
Garbage collection — Orinoco
- Generational GC · Young / Old generation L8
- Based on "most objects die young." New objects are born in the small young generation
(nursery); survivors are promoted to the large old generation. Each is collected by
a different algorithm.
- Scavenge (Minor GC) L8
- Young-gen collector. Copies live objects between two semi-spaces; never visits dead ones.
Fast and frequent. Docs.
- Mark-Compact (Major GC) L8
- Old-gen collector. Marks reachable objects from roots, then compacts survivors
together to fight fragmentation. Rarer, costlier — and it moves objects.
- Orinoco L8
- V8's GC project that hides pauses via parallel (many GC threads), incremental
(small interleaved chunks), and concurrent (GC runs while JS runs) techniques.
Trash talk.
- Mutator · mutator utilization (mu) L8
- The mutator is your JavaScript (it mutates the heap). mu = fraction of time given
to the mutator;
mu=1.0 means GC stole ~none, lower means GC pressure. Seen in --trace-gc.
- Write barrier L8
- A tiny check on every property write that re-flags objects for the GC, so concurrent/incremental
marking can't miss a newly-created reference. The tax that makes pauseless GC correct.
Build toolchain
- depot_tools · fetch · gclient L3
- Google's build toolchain wrapper.
fetch v8 = one-time checkout (V8 + all deps);
gclient sync = update deps later. Never git clone the GitHub
mirror to build — it has no deps. Docs.
- GN · ninja · gm L3
- GN generates build config from args (
gn gen); ninja compiles
(ninja -C out/… target); gm (tools/dev/gm.py arm64.release) wraps
both. Docs.
- Monolith (libv8_monolith.a) L3
- V8 built as one static library for embedding. Produced by the
.sample GN config
(v8_monolithic=true is_component_build=false …). Link target for your own host.
- d8 L3
- V8's standalone developer shell — a minimal embedder you get when you build V8. Runs JS files,
has a REPL, and exposes all the inspection flags from Lessons 1–2 & 7–8.
Embedding API
- Platform L4
- Supplies V8's threading/task primitives (
NewDefaultPlatform()). Must be created and
registered before V8::Initialize(); disposed after V8::Dispose().
- Isolate L4
- "A VM instance with its own heap." One running thread at a time; objects can't cross isolates.
Entered via
v8::Isolate::Scope.
- Context L4
- "An execution environment that allows separate, unrelated JavaScript code to run in a single
instance of V8" — its own globals/built-ins. Many contexts can share one isolate. Entered via
v8::Context::Scope.
- Local<T> · HandleScope L4 · L5
- A Local is a GC-safe handle whose lifetime = the enclosing HandleScope (a
stack-only container released in bulk). The default handle for per-call work. Handles exist
because the moving GC rewrites them when it relocates objects.
- Global<T> / Persistent<T> L5
- A handle that outlives any scope — for keeping a JS object alive across calls. You own it: must
Reset() or it leaks. Global is move-only (modern default);
Persistent can be copyable.
- EscapableHandleScope L5
- A HandleScope that lets one handle
Escape() into the enclosing scope — how a
function returns a freshly-created Local without it dying.
- MaybeLocal · ToLocalChecked L4
- Operations that can fail (compile, run — JS throws) return
MaybeLocal<T>.
.ToLocalChecked() asserts success (crashes if empty); real code checks and reads the
exception instead.
- FunctionTemplate · ObjectTemplate L6
- Blueprints. A FunctionTemplate binds a C++ callback to a JS function; an
ObjectTemplate shapes an object (often the global). V8 instantiates templates into
live objects when a Context is created. Guide.
- FunctionCallbackInfo& args L6
- The single parameter to every exposed callback. Inputs:
args[i],
args.Length(), args.GetIsolate(). Output:
args.GetReturnValue().Set(v) — not a C++ return.