Welcome to the V8 codebase architecture documentation. These guides are designed for both human engineers onboarding to V8 (providing a clear conceptual model at the top of each document) and experienced V8 developers and AI coding agents (providing exact C++ class names, bitfield layouts, cross-tier invariants, and sharp edges verified against src/).
(Note: The top-level .md files directly inside docs/ are legacy copies of historical v8.dev/docs articles. The structured subsystem and cross-component documentation lives in the subdirectories indexed below.)
docs/parsing/)How JavaScript source text is scanned, parsed into an AST, analyzed for variable allocation, and checked for Temporal Dead Zone (TDZ) invariants across tiers:
Scanner (1-character c0_ lookahead + 4-token TokenDesc ring buffer), off-heap AstRawString / AstConsString deduplication in AstValueFactory (internalized in Parser::PostProcessParseResult), ParserBase<Impl> CRTP, single-pass ambiguity resolution via ExpressionScope, vtable-free AstNode bit-packing, DeclarationScope::Analyze, and Rewriter::Rewrite (.result).PreParser, and PreparseData: Eager vs lazy compilation heuristics (IIFE/PIFE detection), ParserTypes<PreParser> (PreParserExpression 32-bit bitfields), why PreParser tracks outer variable references (VariableProxy), and how ProducedPreparseData / ConsumedPreparseData avoid re-preparsing nested functions.tdz_hole_value (TdzHole) and eliminates redundant checks across three compiler stages:UpdateNeedsHoleCheck (src/ast/scopes.cc), ScopeInfo::kMaxVariablePositionDistance, module import & kDynamic/kDynamicLocal edge cases, and eliding LdaTdzHole via ForceHoleInitializationFlag.Variable::HoleCheckBitmap (tracking up to 63 variables per function in bits 1..63), HoleCheckElisionScope, and branch intersection via HoleCheckElisionMergeScope.ValueNode::IsTdzHole(), ThrowReferenceErrorIfTdzHole, KnownNodeAspects) and TurboFan / Turboshaft (TdzHoleConstant, RootEqual) hole check elimination, including how Maglev prevents LoadContextSlotNoCells (loaded_context_constants_) in the “Inverted Generator” pattern from poisoning catch block merges before ThrowReferenceErrorIfTdzHole.docs/objects/)How JavaScript values, strings, hidden classes (Maps), properties, elements, and internal sentinels are laid out in the V8 heap:
ReadOnlyRoots holes (TheHole strictly for array/dictionary elements, TdzHole for lexical TDZ & derived this, PropertyCellHole, HashTableHole, PromiseHole, UninitializedHole, ExceptionHole, TerminationException, OptimizedOut, etc.), --unmap-holes 64 KB hardware guard pages (Hole::kPayloadSize), kHoleNanInt64 vs user NaN canonicalization (DOUBLE_LITERAL vs HOLEY_DOUBLE_LITERAL), and two-phase literal boilerplate initialization (JSDataObjectBuilder / FoldedMutableHeapNumberAllocation / gc-observable stores).InstanceType low 7-bit string encoding (kStringRepresentationMask, kIsIndirectStringMask, kStringEncodingMask, kUncachedExternalStringMask, Bit 5 kSharedStringMask, and Bit 6 kIsNotInternalizedMask), SeqString, ConsString in-place flattening and GC shortcutting, SlicedString, ExternalString / UncachedExternalString, ThinString, and Name::raw_hash_field_ (kHash, kIntegerIndex, kForwardingIndex in StringForwardingTable, kEmpty).DescriptorArray header (number_of_all_descriptors, number_of_descriptors, slack descriptors, concurrent marking raw_gc_state, EnumCache), 3-slot entry layout, FieldType encoding (None, Any, Weak<Map>), DescriptorPointer binary search, TransitionsAccessor::Encoding (6 inline/out-of-line states), TransitionArray, and SideStepTransition (kCloneObject, kObjectAssign).PropertyArray, why Representation::Double() fields box values in mutable HeapNumbers under pointer compression, SwissNameDictionary (SIMD SSE2/NEON H2 probing + insertion-order meta_table), ElementsKind transition sequence (kFastElementsKindSequence vs enum order warning), and MapUpdater generalization.LookupIterator: Property Resolution State Machine: receiver_ vs lookup_start_object_ (super.prop), holder_, the LookupIterator::State machine (ACCESS_CHECK, INTERCEPTOR, JSPROXY, TYPED_ARRAY_INDEX_NOT_FOUND, DATA, ACCESSOR, TRANSITION), two-pass masking vs non-masking InterceptorState, and write transitions (PrepareForDataProperty, PrepareTransitionToDataProperty).docs/runtime/)How V8 executes functions, caches property accesses, walks the call stack, unwinds exceptions, tiers up across compilers, and deoptimizes back to bytecode:
JSFunction, SharedFunctionInfo, Context, FeedbackVector): Separation of per-definition SharedFunctionInfo (dual trusted_function_data_ and untrusted_function_data_ slots) from per-closure JSFunction (context() invariant pointing to the creation scope's Context), JSDispatchTable dispatch (dispatch_handle_), and the three-stage FeedbackCell lifecycle (Undefined -> ClosureFeedbackCellArray -> FeedbackVector).ScopeInfo, and ContextCell: Compile-time Scope analysis vs persistent ScopeInfo bit-packing, runtime Context chains, and ContextCell state specialization (kConst, kSmi, unboxed kInt32, unboxed kFloat64, and kDetached with DependentCode deoptimization).UNINITIALIZED -> MONOMORPHIC -> POLYMORPHIC -> MEGAMORPHIC), LoadHandler and StoreHandler Smi bitfields, variable-length DataHandler (smi_handler_, validity_cell_, data1..data5), prototype validity cells, and the three per-Isolate StubCaches (load_stub_cache_, store_stub_cache_, define_own_stub_cache_ with primary_ and secondary_ tables).DescriptorArray prefixes, branching TransitionArrays, and PropertyConstness::kConst constant folding (DependentCode::kFieldConstGroup).TieringManager: How FeedbackCell::interrupt_budget_ drives TieringManager::OnInterruptTick, feedback allocation + Sparkplug batch compilation on the 1st interrupt tick, IC stabilization (NotifyICChanged), JSDispatchTable::SetTieringRequest (TieringBuiltin), and On-Stack Replacement (FeedbackVector::osr_urgency, JumpLoop loop_depth, and Maglev-to-TurboFan deopt-to-OSR).DeoptimizeKind::kEager vs kLazy, trusted-space DeoptimizationData (DeoptimizationLiteralArray vs ProtectedDeoptimizationLiteralArray), DeoptimizationFrameTranslation opcodes (INTERPRETED_FRAME_WITH_RETURN vs WITHOUT_RETURN, DOUBLE_LITERAL vs HOLEY_DOUBLE_LITERAL, CAPTURED_OBJECT), and two-phase no-GC stack rewriting followed by GC-allowed heap materialization.Isolate::pending_exception vs scheduled_exception, TerminationException, HandlerTable encodings (kRangeBasedEncoding with CatchPrediction + HandlerWasUsed vs kReturnAddressBasedEncoding), kNoHandlerFound = -1 vs kLazyDeopt = HandlerOffsetField::kMax, how Sparkplug handles exceptions directly via BytecodeArray's HandlerTable without deoptimizing, and finally token re-dispatch.fp) chains, explicit StackFrame::Type markers (shared JAVASCRIPT marker for INTERPRETED, BASELINE, MAGLEV, and TURBOFAN_JS, plus ENTRY, EXIT, BUILTIN_CONTINUATION, WASM), c_entry_fp bridging, StackFrameIterator vs signal-safe StackFrameIteratorForProfiler (and why it must never be V8_EXPORT_PRIVATE), and Conservative Stack Scanning (CSS) with SafepointTables.docs/interpreter/):docs/compiler/):HeapBrokerdocs/codegen/):docs/builtins/, docs/torque/):docs/heap/):Smi, HeapObject, MaybeObject)PtrComprCageBase)DirectHandle, IndirectHandle, LocalHandles, TracedHandles)ReadOnlyRoots, RootsTable, Static Roots)Zone, AccountingAllocator)docs/sandbox/, docs/snapshot/):docs/wasm/, docs/regexp/, docs/security/):