01Chapter 1: From Source Text to Bytecode: The Engine PipelineBefore a JavaScript engine can optimize anything, it has to turn your source text into something it can execute. This chapter follows that path in V8, the engine in Chrome and Node.js, from raw characters to bytecode. Later chapters cover what happens after bytecode exists.3 min read
02Chapter 2: Running Bytecode in an InterpreterThis chapter assumes you can write JavaScript functions and run scripts with Node.js. It also assumes you have read the previous chapter, which described how V8 parses source into an abstract syntax tree (AST) and turns that tree into bytecode. Here we look at what happens to that bytecode next: V8'3 min read
03Chapter 3: What Just-in-Time Compilation MeansThis chapter assumes you can write JavaScript functions and run scripts with Node.js, and that you know the basic difference between compiling a program ahead of time and interpreting it. The previous chapter showed how V8's Ignition interpreter runs bytecode. Here you will see why engines don't sto2 min read
04Chapter 4: Tiered Compilation: Trading Startup Time for Peak SpeedThis chapter assumes you know what bytecode is and how V8's Ignition interpreter runs it, and that you understand the basic idea of just-in-time (JIT) compilation from the previous chapters. You should also be able to run Node.js with command-line flags.3 min read
05Chapter 5: Hidden Classes: Giving Dynamic Objects a Fixed LayoutThis chapter assumes you can write JavaScript constructors and object literals, run scripts with Node.js, and remember that the interpreter executes bytecode. Earlier chapters covered how engines parse, interpret, and compile code. This chapter covers how they store objects.2 min read
06Chapter 6: Shape Transitions and Why Property Order MattersThis chapter assumes you know what a hidden class (V8 calls it a map) is from the previous chapter. You should also be able to run Node.js with command-line flags. Here you will see how V8 builds hidden classes step by step, and why two objects with the same keys can end up with different layouts.3 min read
07Chapter 7: Dictionary Mode: When Objects Fall Off the Fast PathThis chapter assumes you know how hidden classes describe an object's layout and how adding properties creates shape transitions. You should also be able to run Node.js with extra flags from the command line.2 min read
08Chapter 8: Inline Caches: Remembering Where Properties LiveThis chapter assumes you know how V8 turns source into bytecode and runs it in Ignition. It also assumes you know that hidden classes, which V8 calls maps, describe an object's layout. Here you will see how the engine uses that layout to skip repeated property lookups.2 min read
09Chapter 9: Monomorphic, Polymorphic, and Megamorphic Call SitesThis chapter assumes you have read the earlier chapters on hidden classes, shape transitions, and inline caches. You should already know that an inline cache (IC) stores the hidden class it saw at a property access, along with where that property lives. Here we look at what happens when one access s2 min read
10Chapter 10: Type Feedback: How the Engine Learns From Running CodeThis chapter assumes you have read the earlier chapters on bytecode interpreters, hidden classes, and inline caches. You should also be comfortable with JavaScript's dynamic typing. An inline cache records the shapes it sees at one property access. Type feedback is the general version of that idea. 2 min read
11Chapter 11: Speculative Optimization: Betting on Past BehaviorThis chapter assumes you already know how Ignition runs bytecode, how the tiers above it (Sparkplug, Maglev, TurboFan) are arranged, and how feedback vectors record the types and hidden classes each operation has seen. Here you will see what the optimizing compilers do with that feedback.2 min read
12Chapter 12: Deoptimization: When the Bet FailsThis chapter assumes you have read the earlier chapters on type feedback and speculative optimization. You should know that V8's optimizing tiers (Maglev and TurboFan) compile a function using assumptions taken from its feedback vector. You should also be comfortable running Node.js with command-lin2 min read
13Chapter 13: Array Elements Kinds and Fast ArraysThis chapter assumes you have read the earlier chapters on hidden classes and type feedback. You should also be able to run Node.js with flags. A JavaScript array can hold any mix of values and can have gaps in it. Most arrays in real programs do neither, and V8 makes those common arrays faster by r2 min read
14Chapter 14: Inside the Optimizing Compiler: Inlining and Escape AnalysisThis chapter assumes you have read the chapters on type feedback, speculative optimization, and deoptimization. You should also be able to run Node.js scripts with V8 flags. Here we look at two things TurboFan, V8's top-tier optimizing compiler, does with the feedback it collects: inlining and escap2 min read
15Chapter 15: Watching the Engine Work With V8 Flags and Native SyntaxThis chapter assumes you can run scripts with Node.js from the command line. It also assumes you know the ideas from earlier chapters: hidden classes (V8 calls them maps), inline caches, tiered compilation, and deoptimization. Here you will check those ideas against a real engine instead of taking t2 min read
16Chapter 16: Writing Engine-Friendly JavaScript Without Micro-OptimizingThis chapter assumes you already know the earlier ideas in the tutorial: hidden classes, inline cache states, type feedback, deoptimization, and elements kinds. It also assumes you can run Node.js with V8 flags. The goal here is to turn those ideas into a few habits. Most of them also make code easi2 min read
17Chapter 17: Beyond V8: SpiderMonkey and JavaScriptCoreThis chapter assumes you have read the earlier chapters on tiered compilation, hidden classes, and inline caches. You should be comfortable with V8's tiers (Ignition, Sparkplug, Maglev, TurboFan) and with the idea that objects have shapes. Everything so far has used V8. Firefox runs on SpiderMonkey 2 min read