SpiderMonkey 24

These release notes are an incomplete draft and were initially seeded from the SpiderMonkey 17 release notes, so they're not necessarily complete or fully accurate.

The Mozilla JavaScript team is pleased to announce the release of SpiderMonkey 24. You can download full source code here: https://ftp.mozilla.org/pub/mozilla.org/js/mozjs-24.2.0.tar.bz2 (SHA1: ce779081cc11bd0c871c6f303fc4a0091cf4fe66)

SpiderMonkey 24 is the JavaScript engine that shipped in Firefox 24. It continues to improve performance over previous SpiderMonkey releases, with a significantly improved garbage collector, a new JIT compilation mode, and other features.  It also contains new language and API features described in detail below.

Please let us know about your experiences with this release by posting in the mozilla.dev.tech.js-engine newsgroup. Or file bugs at bugzilla.mozilla.org under Product: Core, Component: JavaScript engine.

— Dec 16, 2013

The download url still available, but SpiderMonkey not RELEASE alone! Get it here mozilla-esr24 if the download url is outdate

You will find it in "Firefox Extended Support Release 24" package on hg release

Platform support

SpiderMonkey 24 is supported on all the platforms where Firefox 24 runs.  Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code.  (This change was motivated by garbage collector improvements, which lean quite heavily on C++'s support for RAII through constructors and destructors.)  If you are compiling with Microsoft's Visual Studio, note that the minimum supported version is MSVC10/2010: MSVC8/9 support has been dropped.

SpiderMonkey 24 includes a just-in-time compiler (JIT) that compiles JavaScript to machine code, for a significant speed increase. It is supported on x86, x86_64, and ARM architectures. On some other platforms (SPARC, MIPS), the JIT is provided but not supported.  On all other platforms the JIT is simply disabled; JavaScript code runs in an interpreter, as in previous versions. It's the same language, just not as fast.

Migrating to SpiderMonkey 24

SpiderMonkey now provides a fully C++ interface, so embedders relying on embeddability in C projects will have to convert to C++, or implement their own adapter code.

The following features in earlier versions of SpiderMonkey have been dropped.

  • E4X, an extension to ECMAScript adding XML support, has been removed.  The extension eventually became an evolutionary dead end, as TC39 chose not to incorporate it into ECMAScript proper.  It is recommended that you embed a separate XML parser, or include an XML parsing implementation written in JavaScript, as an alternative.
  • JaegerMonkey has been removed and replaced by IonMonkey

SpiderMonkey 24 is not binary-compatible with previous releases, nor is it source-code compatible. Many JSAPI types, functions, and callback signatures have changed, though most of them still have the same names and do the same things. Applications will need significant changes, but most of those changes will be detected by the C/C++ compiler, so they are easy to detect and updating the code is a fairly straightforward job. Here is a list of the most significant changes.

  • Many of the garbage collector changes require type signature changes to JSAPI methods: specifically introducing JS::Rooted, JS::Handle, and JS::MutableHandle types.  These types, with the appropriate parametrizations, can roughly be substituted for plain types of GC things (values, string/object pointers, etc.).

These and other changes are explained in detail below.

New JavaScript language features

JavaScript 24 includes significant updates to language features, yo.

typedef Changes

The fixed-size integer types introduced in SpiderMonkey 17 are defined in one of the following ways (XXX update for MSVC<10 deprecation):

  1. If the environment variable MOZ_CUSTOM_STDINT_H is set, that file will be included to provide definitions for these types.  The file must conform to the standard C99 <stdint.h> header interface in all respects, providing all that header's types and macro definitions.  (The msstdint project includes an implementation of this header for Microsoft Visual Studio which demonstrates what the C99 interface looks like.)
  2. Otherwise, if the compiler doesn't provide a usable <stdint.h> header, a custom implementation shipped with the SpiderMonkey source is used.  Currently only versions of Visual Studio prior to 2010 (also known as version 10) are known to be deficient in this manner, so the custom implementation (which is compatible with the one shipped in Visual Studio 2010 and later) is only invoked for those compilers.
  3. Otherwise <stdint.h> is used.

The environment variable is provided as a solution for embedders whose code requires particular definitions of those types, and those particular definitions are incompatible with the standard definitions or the custom implementation needed for older versions of Visual Studio.  In the long run we anticipate removing the environment variable-based overriding when we drop support for versions of Visual Studio prior to 2010.  In the meantime MOZ_CUSTOM_STDINT_H is intended to function as a bridge to always using the standard header.

For more information on the fixed-size integer types changes, see this blog post.

New C APIs

New C++ helpers

While JSAPI remains a C API, the engine is now implemented in C++. Some C++ helpers have been introduced into the API, to help embedders writing C++ projects.  Please note that SpiderMonkey reserves the JS:: namespace for itself (and the js:: namespace for internal use).

  • ...list new C++ helpers here...

Obsolete APIs

  • ...list obsolete methods/structs/APIs here...

Deleted APIs

API changes

Break out and discuss all API changes here...


JS_SetVersion has been removed, JS Version is now set on the compartment instead of context.

JS_GetPrototype, takes context as first argument

JS_EncodeStringToBuffer takes add context as first argument,

JS_NewRuntime adds a JS_[USE|NO]_HELPER_THREADS flag

Delete property in JSClass definitions now use JS_DeletePropertyStub

Garbage Collection functions now take runtime argument


Most garbage collection functions now take a runtime argument instead of a context. The one exception to this is JS_MaybeGC which still takes a context as argument.

JavaScript shell changes

Detail added/removed methods here...

Known Issues

Detail any known issues here...

Future Direction

...insert details on future plans...

SpiderMonkey embedders should be aware that

  • Mozilla has no plans to keep the JSAPI, nor the JSDBGAPI stable for embedders. We have chosen to concentrate on performance and correctness as primary concerns instead.
  • The team is considering the removal of TinyIDs
  • JS_THREADSAFE is going away, with future versions supporting only thread-safe builds
  • A new debugging API is on the way to replace JSD.

Release Notes Errata

This is a list of changes which need to be made to the release notes ASAP. Feel free to fix any problems you spot -- this is a Wiki!

  • Don't add anything here -- this is for after the release notes are completed.  :-)

Document Tags and Contributors

 Contributors to this page: irelance, fscholz, tschneidereit, evilpie, darkxst, Waldo, terrence, Gutworth
 Last updated by: irelance,