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

