SpiderMonkey 17

  • Revision slug: SpiderMonkey/17
  • Revision title: 17
  • Revision id: 361719
  • Created:
  • Creator: darkxst
  • Is current revision? No
  • Comment

Revision Content

{{ draft() }}

{{ jsapi_minversion_header("17") }}

These release notes are an incomplete draft and were initially seeded from the (now-defunct) 1.8.8 release notes, which were themselves seeded from the 1.8.5 release notes, so lots of the information here isn't actually new to SpiderMonkey 17.

The Mozilla JavaScript team is pleased to announce the release of SpiderMonkey 17. You can download full source code here: INSERT-ACTUAL-LINK-WHEN-THE-RELEASE-HAPPENS (MD5 checksum: INSERT-ACTUAL-HASH-HERE).

SpiderMonkey 17 is the JavaScript engine that shipped in Firefox 17. It continues to improve performance over previous SpiderMonkey releases, with ongoing JIT compilation work and with the introduction of type inference to enable faster JITted code.  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.

—INSERT-ACTUAL-RELEASE-DATE-HERE

Platform support

SpiderMonkey 17 is supported on all the platforms where Firefox 17 runs.

SpiderMonkey 17 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 17

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

SpiderMonkey 17 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.

  • A significant number of typedefs of built-in types, or of types which are now standardized, have been removed.

These and other changes are explained in detail below.

New JavaScript language features

JavaScript 17 includes significant updates to language features, yo.

typedef Changes

Many types have been removed from the JSAPI and replaced with simpler alternatives.  Including jsapi.h provides all these types, but more-specific headers also provide these types if you wish to use them in other code.

Obsolete typedef Replacement type Provided by

uint8, int8, uint16, int16, uint32, int32, uint64, int64

uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t mozilla/StdInt.h
uintN, intN unsigned (also known as unsigned int), int

N/A

jsdouble double N/A
JSUintn, JSIntn unsigned (also known as unsigned int), int N/A
JSPackedBool N/A N/A
jsrefcount N/A N/A


The fixed-size integer types are defined in one of the following ways:

  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

  • ...list and link to new APIs here...

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.

  • ...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...

JSClass Prototype has changed

A number of optional members have been removed from the JSCLass Prototype.

JSClass Callback changes

Many of the JSClass callbacks such as JSResolveOP, JSEnumerateOp and JSPropertyOp, have a type change on their arguments to JSHandleObject, JSHandleId, JSHandleMutableObject etc. Atleast for the C API this wraps an extra pointer around these objects, so you would cast the argument to JSObject**, in the callback function.

Removal of JSContext* parameters to many methods

The JS_GetClass method now takes only a JSObject*, where previously it also required a JSContext* in threadsafe builds.  (The JS_GET_CLASS macro abstracting away this difference has accordingly been removed.)

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

INCLUDE-FOLLOWUP-ON-EXPERIMENTAL-LIBRARY-VERSIONING-SCHEME-HERE

SpiderMonkey embedders should also 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.  :-)

Revision Source

<p>{{ draft() }}</p>
<p>{{ jsapi_minversion_header("17") }}</p>
<div class="note" style="color: black;">
  <p><strong>These release notes are an incomplete draft and were initially seeded from the (now-defunct) 1.8.8 release notes, which were themselves seeded from the 1.8.5 release notes, so lots of the information here isn't actually new to SpiderMonkey 17.</strong></p>
  <p>The Mozilla JavaScript team is pleased to announce the release of <strong>SpiderMonkey 17</strong>. You can download full source code here: INSERT-ACTUAL-LINK-WHEN-THE-RELEASE-HAPPENS (MD5 checksum: <code>INSERT-ACTUAL-HASH-HERE</code>).</p>
  <p>SpiderMonkey 17 is the JavaScript engine that shipped in Firefox 17. It continues to improve performance over previous SpiderMonkey releases, with ongoing JIT compilation work and with the introduction of type inference to enable faster JITted code.&nbsp; It also contains new language and API features described in detail below.</p>
  <p>Please let us know about your experiences with this release by posting in the <a class="link-news" href="news://news.mozilla.org/mozilla.dev.tech.js-engine">mozilla.dev.tech.js-engine newsgroup</a>. Or file bugs at <a class="link-https" href="https://bugzilla.mozilla.org/">bugzilla.mozilla.org</a> under Product: Core, Component:&nbsp;JavaScript engine.</p>
  <p>—INSERT-ACTUAL-RELEASE-DATE-HERE</p>
</div>
<h2 id="Platform_support">Platform support</h2>
<p>SpiderMonkey 17 is supported on all the platforms where Firefox 17 runs.</p>
<p>SpiderMonkey 17 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&nbsp;architectures. On some other platforms (SPARC, MIPS), the JIT&nbsp;is provided but not supported.&nbsp; 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.</p>
<h2 id="Migrating_to_SpiderMonkey_17">Migrating to SpiderMonkey 17</h2>
<p>The following features in earlier versions of SpiderMonkey have been dropped.</p>
<ul>
  <li>The <code>JSRESOLVE_CLASSNAME</code> and <code>JSRESOLVE_WITH</code> resolve flags (passed to <a href="/en/SpiderMonkey/JSAPI_Reference/JSClass.resolve" title="en/SpiderMonkey/JSAPI_Reference/JSClass.resolve">JSClass.resolve</a> when <code>JSClass.flags</code> contains <a href="/en/SpiderMonkey/JSAPI_Reference/JSClass.flags" title="https://developer.mozilla.org/en/SpiderMonkey/JSAPI_Reference/JSClass.flags">JSCLASS_NEW_RESOLVE</a>) have been removed.</li>
</ul>
<p>SpiderMonkey 17 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++&nbsp;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.</p>
<ul>
  <li>A significant number of <code>typedef</code>s of built-in types, or of types which are now standardized, have been removed.</li>
</ul>
<p>These and other changes are explained in detail below.</p>
<h2 id="New_JavaScript_language_features">New JavaScript language features</h2>
<p>JavaScript 17 includes significant updates to language features, yo.</p>
<h2 id="typedef_Changes"><code>typedef</code> Changes</h2>
<p>Many types have been removed from the JSAPI and replaced with simpler alternatives.&nbsp; Including <code>jsapi.h</code> provides all these types, but more-specific headers also provide these types if you wish to use them in other code.</p>
<table align="left" border="1" cellpadding="1" cellspacing="1" style="width: 100%;">
  <thead>
    <tr>
      <th scope="col">Obsolete <code>typedef</code></th>
      <th scope="col">Replacement type</th>
      <th scope="col">Provided by</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <p><code>uint8</code>, <code>int8</code>, <code>uint16</code>, <code>int16</code>, <code>uint32</code>, <code>int32</code>, <code>uint64</code>, <code>int64</code></p>
      </td>
      <td><code>uint8_t</code>, <code>int8_t</code>, <code>uint16_t</code>, <code>int16_t</code>, <code>uint32_t</code>, <code>int32_t</code>, <code>uint64_t</code>, <code>int64_t</code></td>
      <td>mozilla/StdInt.h</td>
    </tr>
    <tr>
      <td><code>uintN</code>, <code>intN</code></td>
      <td><code>unsigned</code> (also known as <code>unsigned int</code>), <code>int</code></td>
      <td>
        <p>N/A</p>
      </td>
    </tr>
    <tr>
      <td><code>jsdouble</code></td>
      <td><code>double</code></td>
      <td>N/A</td>
    </tr>
    <tr>
      <td><code>JSUintn</code>, <code>JSIntn</code></td>
      <td><code>unsigned</code> (also known as <code>unsigned int</code>), <code>int</code></td>
      <td>N/A</td>
    </tr>
    <tr>
      <td><code>JSPackedBool</code></td>
      <td>N/A</td>
      <td>N/A</td>
    </tr>
    <tr>
      <td><code>jsrefcount</code></td>
      <td>N/A</td>
      <td>N/A</td>
    </tr>
  </tbody>
</table>
<p><br />
  The fixed-size integer types are defined in one of the following ways:</p>
<ol>
  <li>If the environment variable <code>MOZ_CUSTOM_STDINT_H</code> is set, that file will be included to provide definitions for these types.&nbsp; The file must conform to the standard C99 <code>&lt;stdint.h&gt;</code> header interface in all respects, providing all that header's types and macro definitions.&nbsp; (The <a class="external" href="http://code.google.com/p/msinttypes/" title="http://code.google.com/p/msinttypes/">msstdint project</a> includes <a class="external" href="http://msinttypes.googlecode.com/svn/trunk/stdint.h" title="http://msinttypes.googlecode.com/svn/trunk/stdint.h">an implementation of this header </a>for Microsoft Visual Studio which demonstrates what the C99 interface looks like.)</li>
  <li>Otherwise, if the compiler doesn't provide a usable <code>&lt;stdint.h&gt;</code> header, a custom implementation shipped with the SpiderMonkey source is used.&nbsp; 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.</li>
  <li>Otherwise <code>&lt;stdint.h&gt;</code> is used.</li>
</ol>
<p>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.&nbsp; In the long run we anticipate removing the environment variable-based overriding when we drop support for versions of Visual Studio prior to 2010.&nbsp; In the meantime <code>MOZ_CUSTOM_STDINT_H</code> is intended to function as a bridge to always using the standard header.</p>
<p>For more information on the fixed-size integer types changes, see <a class="external" href="http://whereswalden.com/2011/12/08/party-like-its-1999-stdint-h-comes-to-mozilla/" title="http://whereswalden.com/2011/12/08/party-like-its-1999-stdint-h-comes-to-mozilla/">this blog post</a>.</p>
<h2 id="New_C_APIs" style="position: static; z-index: auto; ">New C APIs</h2>
<ul style="-moz-column-count:3;">
  <li><code>...list and link to new APIs here...</code></li>
</ul>
<h2 id="New_C.2B.2B_helpers">New C++ helpers</h2>
<p>While JSAPI&nbsp;remains a C&nbsp;API, the engine is now implemented in C++. Some C++&nbsp;helpers have been introduced into the API, to help embedders writing C++&nbsp;projects.&nbsp; Please note that SpiderMonkey reserves the JS::&nbsp;namespace for itself.</p>
<ul>
  <li><code>...list new C++ helpers here...</code></li>
</ul>
<h2 id="Obsolete_APIs">Obsolete APIs</h2>
<ul>
  <li><code>...list obsolete methods/structs/APIs here...</code></li>
</ul>
<h2 id="Deleted_APIs">Deleted APIs</h2>
<ul>
  <li><a href="/en/SpiderMonkey/JSAPI_Reference/JS_GET_CLASS" title="JS GetClass">JS_GET_CLASS</a> (use <code><a href="/en/SpiderMonkey/JSAPI_Reference/JS_GetClass" title="JS GetClass">JS_GetClass</a></code> instead)</li>
  <li><a href="/en/SpiderMonkey/JSAPI_Reference/JS_ConstructObject" title="en/SpiderMonkey/JSAPI_Reference/JS_ConstructObject"><code>JS_ConstructObject</code> and <code>JS_ConstructObjectWithArguments</code></a> (preferably use <a href="/en/SpiderMonkey/JSAPI_Reference/JS_New" title="en/SpiderMonkey/JSAPI_Reference/JS_New"><code>JS_New</code></a> instead, or use <a class="link-https" href="https://groups.google.com/d/msg/mozilla.dev.tech.js-engine/5xqxa2IAOoQ/0vCzgTi9GIAJ" title="https://groups.google.com/d/msg/mozilla.dev.tech.js-engine/5xqxa2IAOoQ/0vCzgTi9GIAJ">this reimplementation</a> as a short-term fix)</li>
  <li><a href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_NewCompartmentAndGlobalObject" title="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_NewCompartmentAndGlobalObject">JS_NewCompartmentAndGlobalObject</a> (Use <a class="new" href="https://developer.mozilla.org/en/docs/SpiderMonkey/JSAPI_Reference/JS_NewGlobalObject" title="http://en/docs/SpiderMonkey/JSAPI_Reference/JS_NewGlobalObject">JS_NewGlobalObject</a> instead.)</li>
  <li>JSPD_ARGUMENT</li>
  <li><a href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JSVAL_IS_OBJECT" title="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JSVAL_IS_OBJECT">JSVAL_IS_OBJECT() </a>(use !JSVAL_IS_PRIMITIVE(v) to detect objects and JSVAL_IS_NULL(v) to detect null).</li>
  <li>JS_IsScriptFrame</li>
  <li><a href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JSClass.flags" title="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JSClass.flags">JSCLASS_NEW_RESOLVE_GETS_START</a> flag</li>
  <li><a href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_NumberValue" title="https://developer.mozilla.org/en-US/docs/SpiderMonkey/JSAPI_Reference/JS_NumberValue">JS_NewNumberValue</a></li>
  <li>JS_FinalizeStub</li>
  <li>JS_ClearNewbornRoots</li>
  <li>JSCLASS_MARK_IS_TRACE flag</li>
  <li>JS_SetScriptStackQuota</li>
</ul>
<h2 id="API_changes">API changes</h2>
<p>Break out and discuss all API changes here...</p>
<h4 id="JSClass_Prototype_has_changed"><code>JSClass</code> Prototype has changed</h4>
<p>A number of optional members have been removed from the JSCLass Prototype.</p>
<h4 id="JSClass_Callback_changes"><code>JSClass</code> Callback changes</h4>
<p>Many of the JSClass callbacks such as <code>JSResolveOP</code>, <code>JSEnumerateOp</code> and <code>JSPropertyOp</code>, have a type change on their arguments to <code>JSHandleObject</code>, <code>JSHandleId</code>, <code>JSHandleMutableObject </code>etc. Atleast for the C API this wraps an extra pointer around these objects, so you would cast the argument to <code>JSObject**</code>, in the callback function.</p>
<h4 id="Removal_of_JSContext*_parameters_to_many_methods">Removal of <code>JSContext*</code> parameters to many methods</h4>
<p>The <a href="/en/SpiderMonkey/JSAPI_Reference/JS_GetClass" title="JS_GET_CLASS"><code>JS_GetClass</code></a> method now takes only a <code>JSObject*</code>, where previously it also required a <code>JSContext*</code> in threadsafe builds.&nbsp; (The <a href="/en/SpiderMonkey/JSAPI_Reference/JS_GET_CLASS" title="JS GetClass">JS_GET_CLASS</a> macro abstracting away this difference has accordingly been removed.)</p>
<p><strong>Garbage Collection functions now take runtime argument</strong></p>
<p>Most garbage collection functions now take a runtime argument instead of a context. The one exception to this is <code>JS_MaybeGC </code>which still takes a context as argument.</p>
<h2 id="JavaScript_shell_changes">JavaScript shell changes</h2>
<p>Detail added/removed methods here...</p>
<h2 id="Known_Issues">Known Issues</h2>
<p>Detail any known issues here...</p>
<h2 id="Future_Direction">Future Direction</h2>
<p>INCLUDE-FOLLOWUP-ON-EXPERIMENTAL-LIBRARY-VERSIONING-SCHEME-HERE</p>
<p>SpiderMonkey embedders should also be aware that</p>
<ul>
  <li>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.</li>
  <li>The team is considering the removal of TinyIDs</li>
  <li>JS_THREADSAFE is going away, with future versions supporting only thread-safe builds</li>
  <li>A new debugging API is on the way to replace JSD.</li>
</ul>
<h2 id="Release_Notes_Errata">Release Notes Errata</h2>
<p>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!</p>
<ul>
  <li>Don't add anything here -- this is for after the release notes are completed.&nbsp; :-)</li>
</ul>
Revert to this revision