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 82 and 83 Nightly release cycles.
If you like these newsletters, you may also enjoy Yulia’s Compiler Compiler live stream.
🏆 New contributors
- Yozaam optimized part of our private fields implementation.
👷🏽♀️ New features
Firefox 82-83
In progress
- Tom implemented the .item proposal, but this feature had to be backed out after a few days because it caused various web compatibility issues.
- Yulia is making progress implementing Top-level await.
- Jessica from Igalia started implementing the Wasm type reflection proposal.
- Ryan started implementing the Wasm function-references proposal.
- Ryan implemented the Wasm eqref type.
🚀 WarpBuilder
WarpBuilder is the JIT project to replace the frontend of our optimizing JIT (IonBuilder) and the engine’s Type Inference mechanism with a new MIR builder based on compiling CacheIR to MIR. WarpBuilder will let us improve security, performance, memory usage and maintainability of the whole engine.
We have enabled WarpBuilder by default for Firefox 83 🎉 This resulted in improved responsiveness, page load performance and memory usage. Feedback from Nightly users has been very positive.
A few of the other Warp changes that landed the past months:
- Iain landed many improvements for (trial) inlining.
- Jan added getter/setter calls and optimized Wasm calls to the transpiler.
- Tom ported optimizations for DOM getters, setters, methods and certain proxies.
- Caroline made changes to improve the CacheIR analysis tool.
- André added CacheIR optimizations for function.name, arguments[Symbol.iterator], Object.prototype.isPrototypeOf.
- Tom added CacheIR optimizations for
toString
andvalueOf
on numbers and strings. - André implemented more CacheIR instructions in the transpiler.
🧹 Garbage Collection
- Jon added a header to dynamic object slots to store the object slot span and capacity.
- Jon refactored the tracing interface and simplified how slots and elements are stored on the mark stack. These changes will help us experiment with concurrent marking.
- Jon optimized the GC barrier code.
❇️ 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.
- Kannan landed the ParserAtom conversion. The frontend no longer depends on the GC to allocate atoms.
- Ted landed various follow-up optimizations for ParserAtoms.
- Arai added a browser pref that switches off-thread parsing to use the Stencil format instead of off-thread GC allocations.
- Kannan added support for serializing the Stencil format to XDR.
- Arai added support for incremental XDR-encoding.
- Denis added telemetry probes for JS parsing and execution.
- Arai updated the Stencil data structures to support moving between threads.
- Arai cleaned up the interaction of Stencil with delazification.
- Matthew simplified handling of BigInt properties in the frontend.
- Ted updated Debugger to compile less when inserting breakpoints.
⚡ WebAssembly
- Benjamin enabled Cranelift by default for ARM64 hardware in Nightly builds.
- Lars added support for SIMD instructions on ARM64 to the baseline compiler.
- Dmitry from Igalia landed more call ABI changes for speeding up indirect calls.
📚 Miscellaneous changes
- Jason optimized lexical variables in generators and async functions.
- Tom Ritter added a
disnative
shell function for disassembling JIT/Wasm code. - Nicolas changed the
callWithABI
interface. This lets us generate ABI tests for each signature. - Steve made jsapi-tests faster by letting tests reuse a JS context/global.
- Iain added a
jitsrc
command for rr to help debug JIT code. - Jeff started splitting up jsfriendapi.h into smaller headers.
- Jon and André cleaned up many headers, removing a lot of unnecessary #includes.
- Arai added documentation explaining how async functions and async generators are implemented.
- Jan and Ryan removed a lot of code for TypedObject. This feature has been non-standard and Nightly-only for years, but the underlying code is now being reused for Wasm GC support.
- Jon simplified locking for helper thread tasks.
- Iain cleaned up the bailout code in the Ion backend.
- Denis made canceling off-thread parse tasks more robust.