{{Short description|JavaScript and WebAssembly engine}} {{about|the software|the primate|Spider monkey|other uses|Spider monkey (disambiguation)}} {{Use dmy dates|date=December 2017}} {{Infobox software | name = SpiderMonkey | logo = Spidermonkey-logo-2021.svg | caption = | developer = {{Unbulleted list|Mozilla Foundation|Mozilla Corporation}} | released = {{start date and age|September 1995|df=y}} | latest release version = | latest release date = | operating system = Cross-platform | genre = JavaScript and WebAssembly engine | programming language = C, C++ | platform = IA-32, x86-64, ARM, MIPS, SPARC,<ref>{{cite web |url=https://developer.mozilla.org/en-US/docs/SpiderMonkey/1.8.8#Platform_support |title=1.8.8 – SpiderMonkey &#124; MDN |publisher=Developer.mozilla.org |date=10 January 2013 |access-date=21 March 2013 |archive-url=https://web.archive.org/web/20130502115508/https://developer.mozilla.org/en-US/docs/SpiderMonkey/1.8.8#Platform_support |archive-date=2 May 2013 |url-status=live |df=dmy-all }}</ref> RISC-V<ref>{{cite web |date=2023-02-16|title=SpiderMonkey Newsletter (Firefox 110-111) |url=https://spidermonkey.dev/blog/2023/02/16/newsletter-firefox-110-111.html |website=spidermonkey.dev |access-date=27 December 2023}}</ref> | license = MPL 2.0<ref>{{citation |url=https://www.mozilla.org/foundation/licensing.html |title=Mozilla Licensing Policies |publisher=mozilla.org |access-date=26 March 2013 |archive-url=https://web.archive.org/web/20130402181908/http://www.mozilla.org/foundation/licensing.html |archive-date=2 April 2013 |url-status=live |df=dmy-all }}</ref> | website = {{URL|spidermonkey.dev}} | repo = {{URL|github.com/mozilla-firefox/firefox/tree/main/js/src}}, {{URL|github.com/mozilla-spidermonkey}} }}

'''SpiderMonkey''' is an open-source JavaScript and WebAssembly engine by the Mozilla Foundation.<ref>{{Cite web|title=Home|url=https://spidermonkey.dev|access-date=2023-04-24|website=SpiderMonkey JavaScript/WebAssembly Engine|language=en-US}}</ref> The engine powers the Firefox Web browser and has used multiple generations of JavaScript just-in-time (JIT) compilers, including TraceMonkey, JägerMonkey, IonMonkey, and the current WarpMonkey.

It is the first JavaScript engine, written by Brendan Eich at Netscape Communications, and later released as open source and currently maintained by the Mozilla Foundation. Its design allows it to be embedded in applications beyond Web browsers, with implementations including MongoDB database system, Adobe Acrobat, and the GNOME desktop environment.

== History == Eich "wrote JavaScript in ten days" in 1995,<ref name=BE201106> {{cite web | first= Brendan | last= Eich | author-link= Brendan Eich | title= New JavaScript Engine Module Owner | date= 21 June 2011 | publisher= BrendanEich.com | url= http://brendaneich.com/2011/06/new-javascript-engine-module-owner/ | access-date= 1 July 2011 | archive-url= https://web.archive.org/web/20110714191057/http://brendaneich.com/2011/06/new-javascript-engine-module-owner/ | archive-date= 14 July 2011 | url-status= live | df= dmy-all }} </ref> having been "recruited to Netscape with the promise of 'doing Scheme' in the browser".<ref name=BE200804> {{cite web |title = Popularity |date = 3 April 2008 |first = Brendan |last = Eich |author-link = Brendan Eich |publisher = BrendanEich.com |url = http://brendaneich.com/2008/04/popularity/ |access-date = 1 July 2011 |archive-url = https://web.archive.org/web/20110703020955/http://brendaneich.com/2008/04/popularity/ |archive-date = 3 July 2011 |url-status = live |df = dmy-all }} </ref> (The idea of using Scheme was abandoned when "engineering management [decided] that the language must 'look like Java{{'"}}.)<ref name=BE200804/> In late 1996, Eich, needing to "pay off [the] substantial technical debt" left from the first year, "stayed home for two weeks to rewrite Mocha as the codebase that became known as SpiderMonkey".<ref name=BE201106/> (Mocha was the original working name for the language.)<ref name="BE200804" /><ref name=BE201108> {{cite web |title = Mapping the Monkeysphere |first = Brendan |last = Eich |date = 19 August 2011 |author-link = Brendan Eich |url = http://blog.cdleary.com/2011/06/mapping-the-monkeysphere/#comment-222163115 |access-date = 19 August 2011 |archive-url = https://web.archive.org/web/20130113222435/http://blog.cdleary.com/2011/06/mapping-the-monkeysphere/#comment-222163115 |archive-date = 13 January 2013 |url-status = live |df = dmy-all }} </ref> In 2011, Eich transferred management of the SpiderMonkey code to Dave Mandelin.<ref name=BE201106/>

===Versions=== {{see also|ECMAScript version history}} {| class="wikitable" style="text-align:center;" |+SpiderMonkey version history |- !scope="col" |Version !scope="col" |Release date !scope="col" | ECMAScript version !scope="col" | Browser version !scope="col" | Added functionality<ref name="js20">{{Cite journal |last1=Wirfs-Brock |first1=Allen |last2=Eich |first2=Brendan |title=JavaScript: the first 20 years |journal=Proceedings of the ACM on Programming Languages |volume=4 |issue=HOPL |year=2020 |doi=10.1145/3386327 |url=https://dl.acm.org/doi/pdf/10.1145/3386327|doi-access=free }}</ref><ref>{{cite web |url=https://web.archive.org/web/20040802225238/http://developer.netscape.com/docs/manuals/js/core/jsref/index.htm |title=Core JavaScript Reference v1.4 - New Features in this Release |publisher=Netscape Communications Corporation |year=1998}}</ref><ref>https://web.archive.org/web/20140829071706/https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.5</ref><ref>http://www.jsdb.org/jsguide/intro.html#1023167</ref><ref>{{cite web|last=|first=|date=|title=New in JavaScript 1.6|url=https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.6|url-status=dead|archive-url=https://web.archive.org/web/20150905053952/https://developer.mozilla.org/en-US/docs/Web/JavaScript/New_in_JavaScript/1.6|archive-date=5 September 2015|access-date=28 July 2015|website=|df=dmy-all}}</ref> |- !scope="row" {{Version |o |1.0}}<br>(Mocha) | September 1995<ref name="js20" /> || || Netscape Navigator 2.0b1<ref>{{cite web |url=http://www25.netscape.com:80/eng/mozilla/2.0/relnotes/windows-2.0b1.html |title=Netscape Navigator 2.0b1 for Windows |archive-url=https://web.archive.org/web/19970419160510/http://www25.netscape.com:80/eng/mozilla/2.0/relnotes/windows-2.0b1.html |archive-date=April 19, 1997 |url-status=dead}} (The first beta version with JavaScript support, marketed as LiveScript at that point.)</ref> || * Basic syntax mostly from C, <code>>>></code> (unsigned shift) from Java, <code>for-in</code> statement and <code>function</code> declaration from AWK.<ref name="js20" /> * <code>var</code>, <code>with</code>, <code>this</code>, <code>obj.prop</code> and <code>obj[prop]</code> syntax, automatic semicolon insertion, <code>&lt;!--</code> comments. * number, string, boolean, object and function types; undefined and null * <code>Object</code>, <code>String</code>, <code>Date</code> classes and methods, <code>Math</code> object, <code>eval()</code>, <code>parseInt()</code>, <code>parseFloat()</code>, <code>isNaN()</code> * Function's <code>arguments</code> property (quirk: merely an alias for the function object) |- !scope="row" {{Version |o |1.1}}<br>(Mocha) | August 1996 || Basis for ES1 || Netscape Navigator 3.0 || * Finished originally envisioned language design that was cut short due to Netscape Navigator 2.0's feature freeze.<ref name="js20" /> * prototype-based inheritance (from Self) via function's <code>prototype</code> property. * <code>typeof</code>, <code>void</code> and <code>delete var</code> operators. * <code>Array</code>, <code>Boolean</code>, <code>Function</code>, <code>Number</code>, <code>String</code> classes. * Automatic type coercions. Wrapper objects when accessing a primitive's property. |- !scope="row" {{Version |o |1.2}} | June 1997 || Basis for ES3 || Netscape Navigator 4.0-4.05 || * New engine codenamed "SpiderMonkey", replacing the original Mocha. * Regular expressions, function expressions, nested functions. * <code>do-while</code>, <code>switch</code>, statement labels, <code>break</code>/<code>continue</code> with label, <code>delete obj.prop</code>, <code>__proto__</code> pseudo-property. * Array (<code>[...]</code>), Object (<code>{prop: ...}</code>) and RegExp (<code>/.../</code>) literals. * Array methods: push, pop, shift, splice, unshift, concat, slice * String methods: charCodeAt, fromCharCode, match, replace, search, substr * Function and <code>arguments</code> are distinct objects, <code>arguments.callee</code>, function's <code>arity</code> property. * Non-standard: removed automatic coercions for <code>==</code> (restored in 1.3), <code>watch()</code>/<code>unwatch()</code>, <code>import</code>/<code>export</code> statements and signed scripts. |- !scope="row" {{Version |o |1.3}} | October 1998 || ES1 + ES2<br>(compliant with the standard) || Netscape Navigator 4.06-4.7x || * Full ECMAScript compliance, Unicode support, <code>===</code> and <code>!==</code>.<ref>{{cite web |title=Client-Side JavaScript Guide |version=Version 1.3 |publisher=Netscape Communications Corporation |year=1999 |url=https://docs.oracle.com/cd/E19957-01/816-6409-10/816-6409-10.pdf |format=PDF |access-date=2025-09-23}}</ref> * Type coercion for <code>==</code> reverted to JS1.1 semantics. * <code>if(x=y)</code> no longer converts to <code>if(x==y)</code>. * Non-nullish objects are truthy in conditionals, even a <code>Boolean</code> object that wraps <code>false</code>. * Global <code>undefined</code> binding (idiom before: <code>void(0)</code>)<ref name="js20" /><ref>https://github.com/Historic-Spidermonkey-Source-Code/JavaScript-1.4.2/blob/main/src/jsconfig.h#L212</ref> |- !scope="row" {{Version |o |1.4}} | || || Netscape Server || * <code>try-catch-finally</code> statement, <code>in</code> and <code>instanceof</code> operators. * No indirect <code>eval()</code> (later reverted), removed <code>Object.prototype.eval()</code>. * Function's <code>arguments</code> property is now a variable. <code>arity</code> property deprecated in favor of <code>length</code>. |- !scope="row" {{Version |o |1.5}} | November 2000 || ES3 || Netscape Navigator 6, Firefox 1.0 || * ES3 features: runtime errors reported as exceptions, regex enhancements (non-greedy quantifiers, non-capturing groups, lookahead assertions, m flag), Number formatting methods (toExponential, toFixed, toPrecision) * Getters and setters. * Multiple <code>catch</code> clauses in <code>try-catch</code>. * Functions can be declared inside an expression and <code>if</code> clause. * <code>const</code> declaration (not part of ES3, adopted in ES6) |- !scope="row" {{Version |o |1.6}} | November 2005 || E4X || Firefox 1.5 || * Array methods: indexOf, lastIndexOf, every, filter, forEach, map, some * Array and String generics * E4X and <code>for each...in</code> statement |- !scope="row" {{Version |o |1.7}} | October 2006 || || Firefox 2.0 || * Iterators and generators, <code>for...of</code>, <code>yield</code>, <code>let</code> statement, destructuring assignment. * Non-standard: array comprehensions. |- !scope="row" {{Version |o |1.8}} | June 2008 || || Firefox 3.0 || * Array methods: reduce, reduceRight * Non-standard: expression closures and generator comprehensions. |- !scope="row" {{Version |o |1.8.1}} | June 2009 || || Firefox 3.5<ref>{{cite web |url=https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/3.5 |title=Firefox 3.5 for developers |website=MDN Web Docs |publisher=Mozilla |date=2009-06-30 |access-date=2025-09-23}}</ref> || * TraceMonkey: tracing JIT<ref name="tracemonkey" /> * JSON support, Object.getPrototypeOf(), String methods: trim, trimLeft, trimRight, startsWith. * Switched to C++ from plain C for building the engine. |- !scope="row" {{Version |o |1.8.5}} | March 2011 || ES5 || Firefox 4.0<ref>{{cite web |url=https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/4 |title=Firefox 4 for developers |website=MDN Web Docs |publisher=Mozilla |date=2011-03-22 |access-date=2025-09-23}}</ref> || * JägerMonkey: method JIT * Object manipulation and protection methods, Array.isArray(), Date.prototype.toJSON(), Function.prototype.bind() * Strict mode * Trailing comma not accepted by <code>JSON.parse()</code> * Proxy class and typed arrays (not part of ES5, adopted in ES6) |- !scope="row" {{Version |o |1.8.8}} | January 2012 || || Firefox 10.0 || * Regular expressions object no longer callable, Function.prototype.isGenerator() method (in 5.0). * ES6 WeakMap (in 6.0) * Function.arity removed (in 7.0) * E4X deprecated (in 10.0) |- !scope="row" {{Version |o |17}} | November 2012 || || Firefox 17.0 || * ArrayBuffer.prototype.slice() (in 12.0) * ES6 for...of and Map/Set (in 13.0) * ES6 default and rest parameters, new Number methods, DataView interface (in 15.0) * ES6 spread operator for array initializers (in 16.0) * String methods: startsWith, endsWith, contains. Iterator improvements. E4X disabled for web (in 17.0) |- !scope="row" {{Version |o |24}} | September 2013 || || Firefox 24.0 || * IonMonkey: optimizing JIT compiler (in 18.0)<ref name="ff18" /> * ES6 Proxy, String.prototype.contains() method (in 18.0), * <code>for each...in</code> deprecated, Math.imul() (in 20.0) * Map/Set methods: keys, values, entries (in 20.0/24.0) * E4X removed, parseInt no longer treats strings with leading "0" as octal (in 21.0) * ES6 arrow functions, Object.is() (in 22.0) * OdinMonkey: asm.js optimization module (in 22.0) |- !scope="row" {{Version |o |31}} | July 2014 || || Firefox 31.0 || |- !scope="row" {{Version |o |38}} | May 2015 || || Firefox 38.0 || |- !scope="row" {{Version |o |45}} | March 2016 || || Firefox 45.0 || |- !scope="row" {{Version |o |52}} | March 2017 || ES6 || Firefox 52.0 || * Nearly complete ES6 compliance by 52.0-53.0. Proper Tail Calls the only remaining long-standing issue.<ref>https://web.archive.org/web/20170430175540/http://kangax.github.io/compat-table/es6/</ref> |- !scope="row" {{Version |o |60}} | May 2018 || || Firefox 60.0 || |- !scope="row" {{Version |o |68}} | July 2019 || || Firefox 68.0 || |- !scope="row" {{Version |o |78}} | June 2020 || || Firefox 78.0 || * Switched regex engine from YARR to V8's Irregexp.<ref>https://hacks.mozilla.org/2020/06/a-new-regexp-engine-in-spidermonkey/</ref> |- !scope="row" {{Version |o |91}} | August 2021 || || Firefox 91.0 || * WarpMonkey JIT replaced IonMonkey in 83.0.<ref name="ff83" /> |- !scope="row" {{Version |o |102}} | June 2022 || || Firefox 102.0 || |- !scope="row" {{Version |o |103}} | July 2022 || || Firefox 103.0 || |- !scope="row" {{Version |o |131}} | September 2024<ref>{{Cite web |title=Directory Listing: /pub/firefox/releases/131.0/source/ |url=https://archive.mozilla.org/pub/firefox/releases/131.0/source |archive-url=https://web.archive.org/web/20241007125843/https://archive.mozilla.org/pub/firefox/releases/131.0/source/ |archive-date=2024-10-07 |access-date=2025-03-20 |website=archive.mozilla.org}}</ref>|| || Firefox 131.0 || |- !scope="row" {{Version |c |140 (ESR)}} | June 2025 || ES16 || Firefox 140 (ESR) || |- !scope="row" {{Version |c |150}} | April 2026 || || Firefox 150 || |- | colspan="5" | {{Version|l|show=111111}} |}

==Standards== SpiderMonkey implements the ECMA-262 specification (ECMAScript). ECMA-357 (ECMAScript for XML (E4X)) was dropped in early 2013.<ref>{{cite web |url=https://bugzilla.mozilla.org/show_bug.cgi?id=759422#c0 |title=759422 &ndash; Remove use of e4x in account creation |access-date=5 February 2013}}</ref>

==Internals== SpiderMonkey is written in C/C++ and contains an interpreter, the WarpMonkey JIT compiler, and a garbage collector.

===TraceMonkey=== TraceMonkey<ref name="tracemonkey">{{cite web |url=https://wiki.mozilla.org/JavaScript:TraceMonkey |title=JavaScript:TraceMonkey, MozillaWiki |access-date=2020-07-22}}</ref> was the first JIT compiler written for the JavaScript language. Initially introduced as an option in a beta release and introduced in Brendan Eich's blog on August 23, 2008,<ref>{{cite web |url=https://brendaneich.com/2008/08/tracemonkey-javascript-lightspeed/ |title=TraceMonkey: JavaScript Lightspeed, Brendan Eich's Blog |access-date=2020-07-22}}</ref> the compiler became part of the mainline release as part of SpiderMonkey in Firefox 3.5, providing "performance improvements ranging between 20 and 40 times faster" than the baseline interpreter in Firefox 3.<ref>{{cite web |url=https://arstechnica.com/news.ars/post/20080822-firefox-to-get-massive-javascript-performance-boost.html |title=Firefox to get massive JavaScript performance boost |last=Paul |first=Ryan |date=22 August 2008 |publisher=Ars Technica |access-date=21 March 2013 |archive-url=https://web.archive.org/web/20120506204854/http://arstechnica.com/open-source/news/2008/08/firefox-to-get-massive-javascript-performance-boost.ars |archive-date=6 May 2012 |url-status=live |df=dmy-all}}</ref>

Instead of compiling whole functions, TraceMonkey was a tracing JIT, which operates by recording control flow and data types during interpreter execution. This data then informed the construction of trace trees, highly specialized paths of native code.

Improvements to JägerMonkey eventually made TraceMonkey obsolete, especially with the development of the SpiderMonkey type inference engine. TraceMonkey is absent from SpiderMonkey from Firefox 11 onward.<ref>{{cite web |url=http://blog.mozilla.com/nnethercote/2011/11/01/spidermonkey-is-on-a-diet/ |title=SpiderMonkey is on a diet &#124; Nicholas Nethercote |last=Nethercote |first=Nicholas |date=1 November 2011 |publisher=Blog.mozilla.com |access-date=21 March 2013 |archive-url=https://web.archive.org/web/20120328124431/http://blog.mozilla.com/nnethercote/2011/11/01/spidermonkey-is-on-a-diet/ |archive-date=28 March 2012 |url-status=live |df=dmy-all}}</ref>

===JägerMonkey=== JägerMonkey, internally named MethodJIT, was a whole-method JIT compiler designed to improve performance in cases where TraceMonkey could not generate stable native code.<ref>{{cite web|url=http://www.bailopan.net/blog/?p=683|title=JaegerMonkey – Fast JavaScript, Always! » Mystery Bail Theater|date=26 February 2010|publisher=Bailopan.net|access-date=21 March 2013|archive-url=https://web.archive.org/web/20130324172746/http://www.bailopan.net/blog/?p=683|archive-date=24 March 2013|url-status=live|df=dmy-all}}</ref><ref name="hunted">{{cite web|url=https://arstechnica.com/open-source/news/2010/03/mozilla-borrows-from-webkit-to-build-fast-new-js-engine.ars|title=Mozilla borrows from WebKit to build fast new JS engine|last=Paul|first=Ryan|date=9 March 2010|publisher=Ars Technica|access-date=21 March 2013|archive-url=https://web.archive.org/web/20120416171903/http://arstechnica.com/open-source/news/2010/03/mozilla-borrows-from-webkit-to-build-fast-new-js-engine.ars|archive-date=16 April 2012|url-status=live|df=dmy-all}}</ref> It was first released in Firefox 4 and eventually entirely supplanted TraceMonkey. It has itself been replaced by IonMonkey.

JägerMonkey operated very differently from other compilers in its class: While typical compilers worked by constructing and optimizing a control-flow graph representing the function, JägerMonkey instead operated by iterating linearly forward through SpiderMonkey bytecode, the internal function representation. Although this prohibits optimizations that require instruction reordering, JägerMonkey compiling has the advantage of being very fast, which is useful for JavaScript since recompiling due to changing variable types is frequent.

Mozilla implemented a number of critical optimizations in JägerMonkey, most importantly polymorphic inline caches and type inference.<ref>{{cite web|url=https://wiki.mozilla.org/JaegerMonkey|title=JaegerMonkey - MozillaWiki|publisher=Wiki.mozilla.org|access-date=21 March 2013|archive-url=https://web.archive.org/web/20130823045214/https://wiki.mozilla.org/JaegerMonkey|archive-date=23 August 2013|url-status=live|df=dmy-all}}</ref>

The difference between TraceMonkey and JägerMonkey JIT techniques and the need for both was explained in [https://hacks.mozilla.org/2010/03/improving-javascript-performance-with-jagermonkey/ a hacks.mozilla.org article]. A more in-depth explanation of the technical details was provided by Chris Leary, one of SpiderMonkey's developers, [http://blog.cdleary.com/2010/09/picing-on-javascript-for-fun-and-profit/ in a blog post] {{Webarchive|url=https://archive.today/20121209102341/http://blog.cdleary.com/2010/09/picing-on-javascript-for-fun-and-profit/ |date=9 December 2012 }}. More technical information can be found in other developer's blogs: [http://www.bailopan.net/blog/ dvander], [https://web.archive.org/web/20101211124954/http://blog.mozilla.com/dmandelin/ dmandelin].

===IonMonkey=== IonMonkey was a JavaScript JIT compiler of Mozilla, which was aimed to enable many new optimizations that were impossible with the prior JägerMonkey architecture.<ref name="mozilla1">{{cite web |url=https://wiki.mozilla.org/Platform/Features/IonMonkey |title=Platform/Features/IonMonkey - MozillaWiki |publisher=Wiki.mozilla.org |date=11 February 2013 |access-date=21 March 2013 |archive-url=https://web.archive.org/web/20130308142525/https://wiki.mozilla.org/Platform/Features/IonMonkey |archive-date=8 March 2013 |url-status=live |df=dmy-all }}</ref>

IonMonkey was a more traditional compiler: it translated SpiderMonkey bytecode into a control-flow graph, using static single assignment form (SSA) for the intermediate representation. This architecture enabled well-known optimizations from other programming languages to be used for JavaScript, including type specialization, function inlining, linear-scan register allocation, dead code elimination, and loop-invariant code motion.<ref>{{cite web |url=http://www.infoq.com/news/2011/05/ionmonkey |title=IonMonkey: Mozilla's new JavaScript JIT compiler |publisher=Infoq.com |access-date=21 March 2013 |archive-url=https://web.archive.org/web/20121208010755/http://www.infoq.com/news/2011/05/ionmonkey |archive-date=8 December 2012 |url-status=live |df=dmy-all }}</ref>

The compiler can emit fast native code translations of JavaScript functions on the ARM, x86, and x86-64 platforms. It has been the default engine since Firefox 18.<ref name="ff18">{{cite web |url=https://website-archive.mozilla.org/www.mozilla.org/firefox_releasenotes/en-US/firefox/18.0/releasenotes/ |title=Firefox Notes - Desktop |publisher=Mozilla.org |date=8 January 2013 |access-date=21 March 2013 |archive-url=https://web.archive.org/web/20140902235153/http://website-archive.mozilla.org/www.mozilla.org/firefox_releasenotes/en-US/firefox/18.0/releasenotes/ |archive-date=2 September 2014 |url-status=live |df=dmy-all }}</ref>

===OdinMonkey=== OdinMonkey is the name of Mozilla's new optimization module for asm.js, an easily compilable subset of JavaScript. OdinMonkey itself is not a JIT compiler, it uses the current JIT compiler. It's included with Firefox from release 22.<ref name="ff22">{{cite web |url=https://website-archive.mozilla.org/www.mozilla.org/firefox_releasenotes/en-US/firefox/22.0/releasenotes/ |title=Firefox Notes - Desktop |archive-url=https://web.archive.org/web/20140903224816/http://website-archive.mozilla.org/www.mozilla.org/firefox_releasenotes/en-US/firefox/22.0/releasenotes/ |archive-date=3 September 2014}}</ref> OdinMonkey is disabled by default since Firefox 148 released in February 2026.<ref>{{Cite web |last=Hunt |first=Ryan |date=2026-05-20 |title=Saying goodbye to asm.js |url=https://spidermonkey.dev/blog/2026/05/20/saying-goodbye-to-asmjs.html |access-date=2026-05-20 |website=SpiderMonkey JavaScript/WebAssembly Engine |language=en-US}}</ref>

===WarpMonkey=== The WarpMonkey JIT replaces the former IonMonkey engine from version 83.<ref name="ff83">{{Cite web|title=Warp: Improved JS performance in Firefox 83 – Mozilla Hacks - the Web developer blog|url=https://hacks.mozilla.org/2020/11/warp-improved-js-performance-in-firefox-83|date=13 November 2020|access-date=2021-08-28|website=Mozilla Hacks – the Web developer blog|language=en-US}}</ref> It is able to inline other scripts and specialize code based on the data and arguments being processed. It translates the bytecode and Inline Cache data into a Mid-level Intermediate Representation (Ion MIR). This graph is transformed and optimized before being lowered to a Low-level Intermediate Representation (Ion LIR). This LIR performs register allocation and then generates native machine code in a process called Code Generation. The optimizations here assume that a script continues to see data similar what has been seen before. The Baseline JITs are essential to success here because they generate ICs that match observed data. If after a script is compiled with Warp, it encounters data that it is not prepared to handle it performs a bailout. The bailout mechanism reconstructs the native machine stack frame to match the layout used by the Baseline Interpreter and then branches to that interpreter as though we were running it all along. Building this stack frame may use special side-table saved by Warp to reconstruct values that are not otherwise available.<ref>{{Cite web|title=SpiderMonkey — Firefox Source Docs documentation|url=https://firefox-source-docs.mozilla.org/js/index.html|access-date=2021-08-28|website=firefox-source-docs.mozilla.org}}</ref>

==Use== <!-- Is this still in use? -->SpiderMonkey is intended to be embedded in other applications that provide host environments for JavaScript. An incomplete list follows: * Mozilla Firefox, Thunderbird, SeaMonkey, and other applications that use the Mozilla application framework **Forks of Firefox including the Pale Moon, Basilisk and Waterfox web browsers. *Data storage applications: **MongoDB moved from V8 to SpiderMonkey in version 3.2<ref>{{Cite web |url=https://docs.mongodb.com/manual/release-notes/3.2-javascript |title=JavaScript Changes in MongoDB 3.2 — MongoDB Manual 3.4 |access-date=23 November 2016 |archive-url=https://web.archive.org/web/20170606170929/https://docs.mongodb.com/manual/release-notes/3.2-javascript/ |archive-date=6 June 2017 |url-status=live |df=dmy-all }}</ref> **Riak uses SpiderMonkey as the runtime for JavaScript MapReduce operations<ref>{{cite web|url=http://basho.com/blog/technical/2010/02/03/the-release-riak-0.8-and-javascript-mapreduce/|title=The Release Riak 0.8 and JavaScript Map/Reduce|archive-url=https://web.archive.org/web/20111103222007/http://basho.com/blog/technical/2010/02/03/the-release-riak-0.8-and-javascript-mapreduce/|archive-date=3 November 2011|url-status=live|access-date=24 April 2011|df=dmy-all}}</ref> **CouchDB database system (written in Erlang). JavaScript is used for defining maps, filters, reduce functions and viewing data, for example in HTML format. *Adobe Acrobat and Adobe Reader, Adobe Flash Professional, and Adobe Dreamweaver. Adobe Acrobat DC uses Spidermonkey 24.2 with ECMA-357 support forward ported.<ref>{{Cite web|url=https://helpx.adobe.com/in/acrobat/using/whats-new-dc-2015.html|title=Acrobat DC SDK Documentation|website=helpx.adobe.com|access-date=5 November 2021}}</ref> * GNOME desktop environment, version 3 and later * Cinnamon desktop environment, version 1.0 and later * Yahoo! Widgets, formerly named Konfabulator * FreeSWITCH, open-source telephony engine, uses SpiderMonkey to allow users to write call management scripts in JavaScript * PythonMonkey uses SpiderMonkey to allow users to write programs where JavaScript and Python functions, types, and events interoperate and (where possible) share memory storage.<ref>{{cite web | title=Distributive-Network/PythonMonkey: A Mozilla SpiderMonkey JavaScript engine embedded into the Python VM, using the Python engine to provide the JS host environment. | website=GitHub | date=2023-07-07 | url=https://github.com/Distributive-Network/PythonMonkey | ref={{SfnRef | GitHub | 2023}} | access-date=2023-07-10}}</ref> * The text-based web browser ELinks uses SpiderMonkey to support JavaScript<ref name="linuxjournal">{{cite web|last=Bolso|first=Erik Inge|title=2005 Text Mode Browser Roundup|url=http://www.linuxjournal.com/article/8148?page=0,1|publisher=Linux Journal|access-date=5 August 2010|date=8 March 2005|archive-url=https://web.archive.org/web/20100315132917/http://www.linuxjournal.com/article/8148?page=0,1|archive-date=15 March 2010|url-status=live|df=dmy-all}}</ref> * Parts of SpiderMonkey are used in the Wine project's JScript (re-)implementation<ref>[http://www.winehq.org/pipermail/wine-cvs/2008-September/047548.html wine-cvs mailing list] {{Webarchive|url=https://web.archive.org/web/20090207115516/http://winehq.org/pipermail/wine-cvs/2008-September/047548.html |date=7 February 2009 }}, 16 September 2008: "jscript: Added regular expression compiler based on Mozilla regexp implementation"</ref> * Synchronet, a BBS, e-mail, Web, and application server using the SpiderMonkey engine * JavaScript OSA, a SpiderMonkey inter-process communication language for the Mac computer * ''0 A.D.'', a real-time strategy game * Wasmer has incorporated SpiderMonkey into their WinterJS open-source project; a JavaScript runtime environment. * SpiderMonkey is also used in many other open-source projects; an external list is maintained at Mozilla's developer site.<ref>{{Cite web|url=https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/FOSS|title=SpiderMonkey > FOSS|website=MDN Web Docs|language=en|access-date=2019-04-02}}</ref>

SpiderMonkey includes a JavaScript Shell for interactive JavaScript development and for command-line invocation of JavaScript program files.<ref>{{cite web |url = https://developer.mozilla.org/En/SpiderMonkey/Introduction_to_the_JavaScript_shell |title = Introduction to the JavaScript shell |date = 29 September 2010 |work = MDN |publisher = Mozilla Developer Network |access-date = 14 December 2010 |quote = The JavaScript shell is a command-line program included in the SpiderMonkey source distribution. [...] You can use it as an interactive shell [...] You can also pass in, on the command line, a JavaScript program file to run [...] |archive-url = https://web.archive.org/web/20110629134447/https://developer.mozilla.org/En/SpiderMonkey/Introduction_to_the_JavaScript_shell |archive-date = 29 June 2011 |url-status = dead |df = dmy-all }}</ref>

==See also== {{Portal|Free and open-source software}}

* Rhino (JavaScript engine) * List of ECMAScript engines

==References== {{Reflist|30em}}

==External links== * {{official website}}, SpiderMonkey (JavaScript-C) engine * [https://wiki.mozilla.org/Release_Management/Calendar Firefox (and Spidermonkey) Release Calendar]

{{Mozilla}} {{ECMAScript}}

{{DEFAULTSORT:Spidermonkey (JavaScript engine)}} Category:Cross-platform software Category:JavaScript engines Category:Mozilla Category:Software using the Mozilla Public License