liveBook · Manning

JavaScript engine

As explained in JavaScript in Depth

A JavaScript engine is software that parses, compiles, interprets, and executes JavaScript code.

A JavaScript engine turns source text into executable instructions by parsing, compiling, interpreting, and running it. It handles the language’s complex execution details, while engine implementations may differ in parsing strategies and optimizations. section 1.3

An engine does not operate alone: a host runtime embeds and controls it, handling networking, files, timers, event scheduling, and available resources. The ECMAScript specification forms a third layer, defining language behavior separately from engine and host behavior. section 1.3 section 1.3.3

Table 1.2 Examples of host runtimes and JavaScript engines
Runtime
Engine (Developer)
Node.js
V8 (Google)
Deno
V8 (Google)
Bun
JavaScript Core (Apple)
Cloudflare Workers
V8 (Google)
Chromium-based Web Browsers (chrome, edge)
V8 (Google)
Firefox
SpiderMonkey (Mozilla)
Safari
JavaScript Core (Apple)

Compare host runtimes with their engines to avoid treating runtime behavior as interchangeable. section 1.3

Use these distinctions when explaining surprising behavior or performance:

  • Treat language-defined behavior as consistent across runtimes, implementation-defined behavior as roughly shared by runtimes using the same engine, and host-defined behavior as runtime-specific. section 1.3.3
  • Expect engines to optimize behind the specification’s observable requirements; V8 uses multiple internal string representations and chooses among them according to content, size, and usage. section 2.2
  • Analyze function performance through the engine’s pipeline: functions may be parsed, compiled, optimized, and de-optimized according to how they are called. section 6.6

How JavaScript in Depth covers it

How deep it goes
Defines the execution pipeline and boundaries, then examines V8 string and function strategies without surveying engine source code.
Examples
Uses runtime-engine pairings, V8 string representations, and function execution pipelines to expose implementation differences and performance effects.
What you can do after
Diagnose behavior and performance by separating specification rules, engine implementation choices, and host-runtime facilities.
How it connects
Connects JavaScript engines with ECMAScript, host runtimes, V8, strings, functions, optimization, and de-optimization.

Also explained in

Compare how 2 books explain JavaScript engine →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of JavaScript in Depth. The section links point to the parts of the book it draws on.