SpiderMonkey Newsletter (Firefox 90-91)

SpiderMonkey is the JavaScript engine used in Mozilla Firefox. This newsletter gives an overview of the JavaScript and WebAssembly work we’ve done as part of the Firefox 90 and 91 Nightly release cycles.

Firefox/SpiderMonkey 91 will become the next ESR branch and will remain supported over the next year.

👷🏽‍♀️ JS features

  • Support for Private Fields has been enabled by default (Firefox 90).
  • The Ergonomic Brand Checks for Private Fields proposal has been implemented (Firefox 90).
  • Support for the .at() proposal has been enabled by default (Firefox 90).
  • Intl.DateTimeFormat.dayPeriod is now available (Firefox 90).
  • The Error Cause proposal has been implemented (Firefox 91). This is also supported in our DevTools.
  • The Object.hasOwn proposal has been implemented (Firefox 91).
  • Intl.DisplayNames v2 has been implemented (Firefox 91).
  • Intl.DateTimeFormat support for formatRange and formatRangeToParts has been enabled by default (Firefox 91).

🌍 Unified Intl implementation

Work is underway to unify the Intl (Internationalization) code in SpiderMonkey and the rest of Gecko as a shared mozilla::intl component. This results in less code duplication and will make it easier to migrate from the ICU library to ICU4X in the future. The features and behaviour of this code continue to follow the ECMA-402 specification.

The past months number formatting, PluralRules and DateTimeFormat have been ported to the new mozilla::intl code module.

⚡ WebAssembly

  • We’ve revendored the SIMD test suite with a new translator.
  • More of the Baseline compiler has been templatized to clean up and simplify the code.
  • The Extended Constant Expressions proposal is now supported.
  • More SIMD operations have been optimized.
  • ARM64 codegen has been optimized more.
  • We fixed a performance cliff caused by the LICM optimization pass hoisting too much code out of very large loops.
  • We changed memory length values from bytes to pages to prepare for 64-bit Wasm memory.

🧪 WASI port

Fastly and Igalia have upstreamed an initial WASI port of SpiderMonkey. We’re very excited about bringing our JS engine to new platforms and exploring the future of this technology.

❇️ Stencil

Stencil is our project to create an explicit interface between the frontend (parser, bytecode emitter) and the rest of the VM, decoupling those components. This lets us improve web-browsing performance, simplify a lot of code and improve bytecode caching.

  • We’re now using shared memory to share stencils and bytecode for our self-hosted JS code (builtins implemented in JS) across content processes. This has resulted in significant memory usage and content process startup improvements.
  • To optimize and shrink self-hosted code more, we’ve started work on simplifying self-hosted bindings and certain intrinsics.
  • We’ve added testing functions for compiling to stencil off the main thread, to improve testing and fuzzing.
  • More code in the browser has been converted to the new stencil-based APIs.

📐 ReShape

ReShape is a project to optimize and simplify our object layout and property representation after removing TI. This will help us fix some long-standing issues related to performance, memory usage and code complexity.

  • We’ve converted ShapeTable (hash table for properties) from a custom hash table implementation to mozilla::HashSet. This has let us remove a lot of complicated code and is also faster.
  • After adding better abstractions for property lookups, we moved property information out of Shapes into a new PropMap (property map) data structure. This fixes some performance issues and has reduced JS memory by 5-6% because it allows sharing more information.


  • We’ve fixed the Baseline IC code for NewObject to be shareable. These unshared IC stubs used to account for more than 65% of all Baseline IC compilations on certain websites.
  • We’ve added Warp transpiler support for NewObject and NewArray IC stubs.
  • These changes made it possible to optimize JitScript allocation by allocating Baseline IC fallback stubs as fixed size array instead of using a bump allocator. We were also able to shrink and simplify various IC-related data structures.
  • We’ve added code generation based on YAML for MIR instructions, to remove C++ boilerplate code.
  • We removed the old arguments analysis code after switching to a much simpler design in Firefox 89.
  • We’ve optimized polymorphic Object.is more to improve React performance.
  • We added a mechanism to reorder type checks for polymorphic TypeOf and ToBool operations in Warp based on Baseline IC feedback.
  • Contributor Garima hardened the JIT back-ends by forcing the use of RAII patterns for scratch registers

🧹Garbage Collection

  • Documentation for the hazard analysis was moved from the wiki to firefox-source-docs.
  • We’ve changed the WeakMap marking algorithm to be much simpler and faster.
  • We’ve added GC counts to performance profiles to help diagnose performance issues.
  • We implemented a new pre-tenuring mechanism for object allocations. We used to have a TI-based implementation, but the new version is a lot more precise and robust.
  • The maximum store buffer size has been increased to avoid triggering nursery GCs too early on websites like Reddit.

📚 Miscellaneous

  • We redesigned our website at https://spidermonkey.dev/ and introduced our new logo.
  • SpiderMonkey can now use an external thread pool for background tasks. This was enabled in Firefox to reduce the number of background threads.
  • PropertyDescriptor (and code using it) has been greatly improved and simplified. It now uses proper encapsulation and enforces important invariants.
  • Storage for private methods has been optimized.
  • We’ve added debugger API support for private fields and methods.
  • We removed the old debugger instrumentation mechanism that was no longer being used.
  • The team did a small sprint to split up the big jsapi.h header file more.
  • We’ve simplified the complicated rope flattening code a lot.
  • We added a new Fuzzilli CI build to help our fuzzing team.
  • We’ve added more embedding APIs for working with BigInt values.
  • We’ve updated irregexp to the latest version.
  • mozilla::Unused is now unused in SpiderMonkey code.
  • Contributor sagu added CI support to the embedding examples repository.