Draft
This page is not complete.
These release notes are an incomplete draft and will remain so until SpiderMonkey 38 is released.
The Mozilla JavaScript team is pleased to announce the release of SpiderMonkey 38. You can download full source code here: https://people.mozilla.org/~sstangl/mozjs-38.2.1.rc0.tar.bz2
SpiderMonkey 38 is the JavaScript engine that shipped in Firefox 38. It continues to improve performance over previous SpiderMonkey releases, with XXX blah blah blah. 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.
— Sep 17, 2015
Platform support
SpiderMonkey 38 is supported on all the platforms where Firefox 38 runs. Compiling it requires a C++ compiler, and the JSAPI can only be used from C++ code. If you are compiling with Microsoft's Visual Studio, note that the minimum supported version is MSVC10/2010.
SpiderMonkey 38 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 38
....
XXX will need updating for actual new GC stuff at time! A major change to SpiderMonkey in 38 is that its APIs support a moving garbage collector. This entailed changing the vast majority of the JSAPI from raw types, such as JS::Value or
JS::Value
*
, to JS::Handle
and JS::MutableHandle
template types that encapsulate access to the provided value/string/object or its location. The JS::Handle<JS::Value>
and JS::MutableHandle<JS::Value>
classes have been specialized to implement the same interface as JS::Value
, for simplicity and to ease migration pain. Changes to introduce handles to the JSAPI are not individually documented, because of the breadth of the changes involved.
The following features in earlier versions of SpiderMonkey have been dropped.
- XXX list removed features here
SpiderMonkey 38 is not binary-compatible with previous releases, nor is it source-code compatible. Many JSAPI types, functions, and callback signatures have changed, though most functions that have changed still have the same names and implement essentially unchanged functionality. 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:
- ....
These and other changes are explained in detail below.
New JavaScript language features
JavaScript 38 includes significant updates to language features, yo.
New C++ APIs
JSAPI is now a C++-only API. Please note that SpiderMonkey reserves the JS::
namespace for itself (and the js::
namespace for internal use).
- JS::CloneFunctionObject (bug 1088228)
- INTERNED_STRING_TO_JSID (bug 1045900)
- JS::Construct (bug 1017109)
- JS::CreateError (bug 984048)
- JS::FalseHandleValue (bug 959787)
- JS::HandleSymbol (bug 645416)
- JS::IdentifyStandardConstructor (bug 976148)
- JS::IsCallable (bug 1065811)
- JS::IsConstructor (bug 1065811)
- JS::MutableHandleSymbol (bug 645416)
- JS::OrdinaryToPrimitive (bug 1103152)
- JS::PropertySpecNameEqualsId (bug 1082672)
- JS::PropertySpecNameIsSymbol (bug 1082672)
- JS::PropertySpecNameToPermanentId (bug 1082672)
- JS::ProtoKeyToId (bug 987669)
- JS::RootedSymbol (bug 645416)
- JS::TrueHandleValue (bug 959787)
- JSConstIntegerSpec (bug 1066020)
- JSID_IS_SYMBOL (bug 645416)
- JSID_TO_SYMBOL (bug 645416)
- JSPROP_DEFINE_LATE (bug 825199)
- JSPROP_IGNORE_ENUMERATE (bug 1037770)
- JSPROP_IGNORE_PERMANENT (bug 1037770)
- JSPROP_IGNORE_READONLY (bug 1037770)
- JSPROP_IGNORE_VALUE (bug 1037770)
- JSPROP_PROPOP_ACCESSORS (bug 1088002)
- JSPROP_REDEFINE_NONCONFIGURABLE (bug 1101123)
- JS_AddFinalizeCallback (bug 996785)
- JS_DefineConstIntegers (bug 1066020)
- JS_GetFlatStringCharAt (bug 1034627)
- JS_GetFunctionScript (bug 1069694)
- JS_GetLatin1FlatStringChars (bug 1037869)
- JS_GetLatin1InternedStringChars (bug 1037869)
- JS_GetLatin1StringCharsAndLength (bug 1032726)
- JS_GetStringCharAt (bug 1034627)
- JS_GetTwoByteExternalStringChars (bug 1034627)
- JS_GetTwoByteFlatStringChars (bug 1037869)
- JS_GetTwoByteInternedStringChars (bug 1037869)
- JS_GetTwoByteStringCharsAndLength (bug 1032726)
- JS_NewPlainObject (bug 1125356)
- JS_RemoveFinalizeCallback (bug 996785)
- JS_SELF_HOSTED_SYM_FN (bug 1082672)
- JS_SYM_FN (bug 1082672)
- JS_SYM_FNSPEC (bug 1082672)
- JS_StringHasLatin1Chars (bug 1032726)
- JS_StringIsFlat (bug 1037869)
- JS_StringToId (bug 959787)
- PropertyDefinitionBehavior (bug 825199)
- SYMBOL_TO_JSID (bug 645416)
Obsolete APIs
- ...
Deleted APIs
- JS::AddNamedObjectRoot (bug 1107639)
- JS::AddNamedScriptRoot (bug 1107639)
- JS::AddNamedStringRoot (bug 1107639)
- JS::AddNamedValueRoot (bug 1107639)
- JS::AddNamedValueRootRT (bug 1107639)
- JS::AddObjectRoot (bug 1107639)
- JS::AddStringRoot (bug 1107639)
- JS::AddValueRoot (bug 1107639)
- JS::RemoveObjectRoot (bug 1107639)
- JS::RemoveObjectRootRT (bug 1107639)
- JS::RemoveScriptRoot (bug 1107639)
- JS::RemoveScriptRootRT (bug 1107639)
- JS::RemoveStringRoot (bug 1107639)
- JS::RemoveStringRootRT (bug 1107639)
- JS::RemoveValueRoot (bug 1107639)
- JS::RemoveValueRootRT (bug 1107639)
- JSCLASS_NEW_ENUMERATE (bug 1097267)
- JSCLASS_NEW_RESOLVE (bug 993026)
- JSID_IS_OBJECT (bug 915482)
- JSNewResolveOp (bug 993026)
- JSVAL_IS_BOOLEAN (bug 952650)
- JSVAL_IS_DOUBLE (bug 952650)
- JSVAL_IS_GCTHING (bug 952650)
- JSVAL_IS_INT (bug 952650)
- JSVAL_IS_NULL (bug 952650)
- JSVAL_IS_NUMBER (bug 952650)
- JSVAL_IS_PRIMITIVE (bug 952650)
- JSVAL_IS_STRING (bug 952650)
- JSVAL_IS_VOID (bug 952650)
- JSVAL_TO_BOOLEAN (bug 952650)
- JSVAL_TO_DOUBLE (bug 952650)
- JSVAL_TO_GCTHING (bug 952650)
- JSVAL_TO_INT (bug 952650)
- JSVAL_TO_OBJECT (bug 952650)
- JSVAL_TO_PRIVATE (bug 952650)
- JSVAL_TO_STRING (bug 952650)
- JS_ClearNonGlobalObject (bug 1043281)
- JS_CloneFunctionObject (bug 1089026)
- JS_CompileFunction (bug 1089026)
- JS_CompileUCFunction (bug 1089026)
- JS_ConvertArguments (bug 1125784)
- JS_ConvertArgumentsVA (bug 1125784)
- JS_ConvertStub (bug 1103152)
- JS_DefineOwnProperty (bug 1017323)
- JS_DeletePropertyStub (bug 1103152)
- JS_DoubleToInt32 (bug 1112774)
- JS_DoubleToUint32 (bug 1112774)
- JS_EnumerateStub (bug 1103152)
- JS_EvaluateScript (bug 1100579)
- JS_EvaluateUCScript (bug 1100579)
- JS_ExecuteScriptVersion (bug 1095660)
- JS_GetFlatStringChars (bug 1037869)
- JS_GetFunctionCallback (bug 1103269)
- JS_GetInternedStringChars (bug 1037869)
- JS_GetInternedStringCharsAndLength (bug 1037869)
- JS_GetStringCharsAndLength (bug 1037869)
- JS_GetStringCharsZ (bug 1037869)
- JS_GetStringCharsZAndLength (bug 1037869)
- JS_GetTypeName (bug 1037718)
- JS_IsAboutToBeFinalized (bug 650161)
- JS_LookupElement (bug 1094176)
- JS_LookupProperty (bug 1094176)
- JS_LookupPropertyById (bug 1094176)
- JS_LookupUCProperty (bug 1094176)
- JS_NewPropertyIterator (bug 1081660)
- JS_NextProperty (bug 1081660)
- JS_ResolveStub (bug 1103152)
- JS_SetFinalizeCallback (bug 996785)
- JS_SetFunctionCallback (bug 1103269)
- jschar (bug 1063962)
API changes
jschar
, a typedef for the standard C++ type char16_t
, has been removed. JSAPI functions that used jschar
now use char16_t
directly. Embedder code should use char16_t
, too. (See bug 1063962.)
JS_PreventExtensions
now indicates its success or failure in two ways: via return value (as with most JSAPI methods), and via outparam (indicating whether the attempt took effect or not, independent of JSAPI failure). This change better aligns with ECMAScript's [[PreventExtensions]] hook, which generally returns true or false to indicate whether subsequent attempts to add a new property will fail, yet also itself may throw in some cases.
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.
- 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. :-)