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 100 and 101 Nightly release cycles.
👷🏽♀️ New features
WritableStream
andpipeTo
are now enabled by default (Firefox 100)- Wasm exception handling has been enabled by default (Firefox 100)
⚙️ Modernizing JS modules
We’re working on improving our implementation of modules. This includes supporting modules in Workers, adding support for Import Maps, and ESM-ification (replacing the JSM module system for Firefox internal JS code with standard ECMAScript modules).
- We added support for caching module scripts in the bytecode cache.
- We landed support for caching modules in the StartupCache.
- We’ve landed many changes to improve the browser’s module loader code.
- We’ve added a common base class to work towards supporting modules in Workers.
- We’ve landed a cleanup for the Worker Script Loader.
🚀 JS Performance
- We’ve added support for functions with simple try-finally blocks to the optimizing JIT, fixing a very old performance cliff. Support for more complicated cases will be added in a later release.
- We’ve improved
instanceof
performance by removing the non-standardJSClass
hook, proxy trap, and by optimizing polymorphic cases better in the JITs. - We changed how
function.call
andfunction.apply
are optimized. This is more robust and fixes some performance cliffs. - We added support for optimizing builtin functions in CacheIR when called through
function.call
. - We used this to optimize the common
slice.call(arguments)
pattern in the JITs. - We optimized certain calls into C++ from optimized JIT code by removing (unnecessary) dynamic stack alignment.
- We improved CacheIR support for property-init operations.
- We reimplemented
new.target
as a real binding. - We added support for scalar replacement of array iterator objects.
🏎️ WebAssembly Performance
- We moved trap instructions out-of-line to improve branch prediction.
- We merged
wasm::Instance
andTlsData
. This eliminates some memory loads. - We improved Baseline code performance by pinning the Instance/TLS register on most platforms.
- We fixed some DevTools performance issues: opening the web console no longer results in using slower debugging code for Wasm modules and we fixed debugging support to not clone Wasm code.
- We optimized a common instruction sequence with SIMD instructions.
- We added AVX support for all binary SIMD operations.
- We enabled support for AVX instructions for Wasm SIMD on Nightly.
- We optimized
table.get/set
for anyref tables. - We optimized
memory.copy/fill
for Memory64.
📚 Miscellaneous
- We fixed a number of compiler errors when compiling in C++20 mode.
- We’ve updated ICU to version 71.
- We landed a workaround for a glibc pthreads bug that was causing intermittent hangs in CI for JS shell tests on Linux.
- We stopped using extended functions for most class methods, to reduce memory usage.