DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
← From Beginner to Expert in Fundamentals of Frontend
  • How the Web Works
  • Browsers: The Engines
  • Networking & Latency
  • HTTPS & TLS Handshake
  • CDNs & Edge Computing
  • WebSockets & WebRTC
  • RESTful Architecture
  • GraphQL Architecture
  • CORS (Cross-Origin Resource Sharing)
  • Load Balancing
  • Critical Rendering Path Deep Dive
  • DOM vs. CSSOM Construction
  • The Rendering Engine: Layout, Paint, Compositing
  • JavaScript Engine: V8 Internals
  • The Event Loop: Macro vs. Micro Tasks
  • Garbage Collection
  • Browser Storage Architecture
  • Service Workers & PWAs
  • Web Workers: Multi-Threading
← From Beginner to Expert in Fundamentals of Frontend

JavaScript Engine: V8 Internals

22 min read
V8JIT CompilationCall StackHeapIgnitionTurboFanHidden Classes

Inside the V8 JavaScript Engine

The Execution Pipeline

  1. Parser: Parses source code into an Abstract Syntax Tree (AST)
  2. Ignition (Interpreter): Converts AST to bytecode, starts executing immediately
  3. TurboFan (Optimizing Compiler): Compiles hot functions to optimized machine code
  4. Deoptimization: If assumptions violated (type changes), reverts to bytecode

Call Stack and Heap

  • Call Stack: LIFO structure tracking function execution. Stack Overflow occurs at ~10,000 frames.
  • Heap: Unstructured memory where objects and closures live. Managed by garbage collector.

Hidden Classes (Shapes)

V8 creates internal hidden classes for objects with the same structure, enabling fast property lookups. Objects created in different orders get different hidden classes.

Writing V8-Friendly Code

  • Always pass the same types to a function (monomorphic)
  • Initialize all properties in constructors
  • Use undefined instead of delete (delete changes hidden class)
  • Use TypedArrays for number-heavy work

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.