SpiderMonkey
SpiderMonkey is the code name for the first-ever JavaScript engine, written by Brendan Eich at Netscape Communications, later released as open source and now maintained by the Mozilla Foundation.
Standards
SpiderMonkey implements ECMA-262 edition 3 (ECMAScript), along with several additional features. Work is underway to implement ECMAScript 5[1].
SpiderMonkey and its sister engine Rhino have implemented support for the ECMAScript for XML (E4X) standard.
Even though SpiderMonkey is used in Firefox, it does not itself provide host environments such as Document Object Model (DOM).
Internals
SpiderMonkey is written in C and contains a compiler, interpreter, decompiler, garbage collector, and standard classes.
TraceMonkey
Mozilla has added optimization using "Trace Trees" to SpiderMonkey. Released June 30, 2009, Firefox 3.5 includes this new optimization technique which offers "performance improvements ranging between 20 and 40 times faster in some cases" (compared to Firefox 3).[2]
JägerMonkey
JägerMonkey is an additional optimization to the engine planned to ship in Firefox 4. It improves speed in cases where TraceMonkey optimizations fail to improve performance.[3][4]
The most publicized optimization in JägerMonkey is "method-based JIT" (that compiles code one method at a time) using inline threading (see [1]) and implements PICs, but there were multiple other optimizations implemented for Firefox 4[5]. To implement method JIT, Mozilla reused the assembler from Nitro, WebKit's JavaScript engine.[4]
The difference between TraceMonkey and JägerMonkey JIT techniques and the need for both was explained in a hacks.mozilla.org article. A more in-depth explanation of the technical details was provided by Chris Leary, one of SpiderMonkey developers, in a blog post. More technical information can be found in other developer's blogs: dvander, dmandelin.
Usage
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
- Adobe Acrobat and Adobe Reader.
- Yahoo! Widgets (formerly known as "Konfabulator")
- UOX3, an Ultima Online server emulator.
- Sphere suite of applications primarily intended to aid in the design of role-playing games.
- The Methabot web crawler uses SpiderMonkey in a multi-threaded environment for running user-provided filetype and URL parsers.
- It is also used in CouchDB database system written in Erlang - JavaScript is used for defining maps, filters, reduce functions and viewing data for example in HTML format.
- FreeSWITCH, open-source telephony engine, uses SpiderMonkey to provide users with ability to write call management scripts in JavaScript.
- ELinks, a text-based web browser, is using SpiderMonkey to support JavaScript.[6]
- Parts of SpiderMonkey are used in the Wine project's Jscript (re-)implementation.[7]
- SpiderMonkey is also used in a number of other open-source projects, see https://developer.mozilla.org/en/SpiderMonkey/FOSS
Several large organizations have been known to use SpiderMonkey for managing their JavaScript for front-end applications.
See also
- Rhino
- List of JavaScript engines
- JavaScript OSA, a SpiderMonkey inter-process communication language for the Macintosh computer
- Synchronet, a BBS, E-Mail, Web and application server using the SpiderMonkey engine.
References
- ^ https://bugzilla.mozilla.org/show_bug.cgi?id=es5
- ^ http://arstechnica.com/news.ars/post/20080822-firefox-to-get-massive-javascript-performance-boost.html
- ^ http://www.bailopan.net/blog/?p=683
- ^ a b http://arstechnica.com/open-source/news/2010/03/mozilla-borrows-from-webkit-to-build-fast-new-js-engine.ars
- ^ https://wiki.mozilla.org/JaegerMonkey
- ^ Bolso, Erik Inge (8 March 2005). "2005 Text Mode Browser Roundup". Linux Journal. Retrieved 5 August 2010.
- ^ wine-cvs mailing list, September 16, 2008: “jscript: Added regular expression compiler based on Mozilla regexp implementation”