Jump to content

SpiderMonkey

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Jan Hofmann (talk | contribs) at 06:35, 5 December 2010 (→‎JägerMonkey). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

SpiderMonkey
Developer(s)Mozilla Foundation / Mozilla Corporation
Repository
Written inC
Operating systemCross-platform
TypeJavaScript engine
LicenseMPL/GPL/LGPL tri-license
Websitedeveloper.mozilla.org/en/SpiderMonkey
www.mozilla.org/js/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:

Several large organizations have been known to use SpiderMonkey for managing their JavaScript for front-end applications.

See also

References

  1. ^ https://bugzilla.mozilla.org/show_bug.cgi?id=es5
  2. ^ http://arstechnica.com/news.ars/post/20080822-firefox-to-get-massive-javascript-performance-boost.html
  3. ^ http://www.bailopan.net/blog/?p=683
  4. ^ a b http://arstechnica.com/open-source/news/2010/03/mozilla-borrows-from-webkit-to-build-fast-new-js-engine.ars
  5. ^ https://wiki.mozilla.org/JaegerMonkey
  6. ^ Bolso, Erik Inge (8 March 2005). "2005 Text Mode Browser Roundup". Linux Journal. Retrieved 5 August 2010.
  7. ^ wine-cvs mailing list, September 16, 2008: “jscript: Added regular expression compiler based on Mozilla regexp implementation”