talira

JavaScriptCore

WebKit's built-in JavaScript engine

open sourceBSD-2-Clause AND LGPL-2.0-or-laterself-hostablefree

JavaScriptCore is the JavaScript engine built into WebKit, implementing ECMAScript as defined in ECMA-262; it's the engine behind Safari, where Apple has marketed it as Nitro, and it has also been called SquirrelFish. It's an optimizing virtual machine with four tiers: a hand-written lexer and parser produce bytecode that the Low Level Interpreter (LLInt) runs with no start-up cost, functions that run often move to the Baseline JIT, and hot code goes to the low-latency DFG optimizing JIT and then the high-throughput FTL JIT, with on-stack replacement and inline caching between tiers. It lives in the WebKit source tree under Source/JavaScriptCore and can be embedded in applications; Bun uses it as its engine. Apple maintains the macOS and iOS ports, Igalia the Linux ports (WebKitGTK and WPE), and a JSCOnly port builds it without the rest of WebKit. WebKit's code is under the two-clause BSD licence, with older code inherited from KHTML under the LGPL.

Problems it solves

  • embed a JavaScript engine in my macOS or iOS app
  • understand why my code behaves differently in Safari's JavaScript engine
  • a fast JavaScript engine with a low start-up cost to embed in a runtime
  • run JavaScript inside a native application without bundling Chromium

Features

  • ECMAScript (ECMA-262) implementation
  • LLInt bytecode interpreter
  • Baseline JIT
  • DFG low-latency optimizing JIT
  • FTL high-throughput optimizing JIT
  • on-stack replacement and inline caching
  • embeddable in applications

Alternatives

The same job

These do what JavaScriptCore does.

  1. QuickJS Small, embeddable JavaScript engine with almost complete ES2025 support
  2. SpiderMonkey Mozilla's JavaScript and WebAssembly engine
  3. V8 Google's open source high-performance JavaScript and WebAssembly engine

Compare JavaScriptCore with the top 3