Draft
This page is not complete.
These release notes are an incomplete draft and will remain so well after SpiderMonkey 45 is released.
The Mozilla JavaScript team is pleased to announce the release of SpiderMonkey 45. You can download full source code here: https://people.mozilla.org/~sfink/mozjs-45.0.2.tar.bz2
SpiderMonkey 45 is the JavaScript engine that shipped in Firefox 45. It continues to improve performance over previous SpiderMonkey releases. 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. You may wish to make the bugs block bug 837921 (aliased as "sm.embedding").
— Apr 14, 2016
Platform support
SpiderMonkey 45 is supported on all platforms able to run Firefox 45. 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 the minimum supported version is MSVC 2013.
SpiderMonkey 45 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 several other platforms (SPARC, MIPS), the JIT is provided but not supported. On remaining platforms the JIT is disabled; JavaScript code runs in an interpreter, as it has in previous versions. It's the same language, just not as fast.
Migrating to SpiderMonkey 45
SpiderMonkey 45 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 retain their previous name, providing relatively unchanged functionality. Applications will require significant changes, but most changes will be automatically detected by the C/C++ compiler, making them easy to detect and updating the code a relatively straightforward job. Here is a list of the most significant changes:
- JS::NullPtr is obselete. You should now use nullptr instead. (Supporting decltype(nullptr)).
New JavaScript language features
JavaScript 45 includes significant updates to its language features, yo.
New C++ APIs
JSAPI is a C++ exclusive API. Please note that SpiderMonkey reserves the JS::
namespace for itself (and subsequently the js::
namespace for internal use).
- JS_SetCurrentEmbedderTimeFunction (bug 1159507)
- JS_GetCurrentEmbedderTime (bug 1159507)
- JS_MayResolveStandardClass (bug 1155946)
- JS_GetIteratorPrototype (bug 1225392)
- JS_GlobalLexicalScope (bug 1202902)
- JS_HasExtensibleLexicalScope (bug 1202902)
- JS_ExtensibleLexicalScope (bug 1202902)
- JS_InitReflectParse (bug 987514)
- JS::ToPrimitive (bug 1206168)
- JS::GetFirstArgumentAsTypeHint (bug 1054756)
- JS::ObjectToCompletePropertyDescriptor (bug 1144366)
- JS_SetImmutablePrototype (bug 1211607)
- JS_GetOwnUCPropertyDescriptor (bug 1211607)
- JS_HasOwnPropertyById (bug 1211607)
- JS_HasOwnProperty (bug 1211607)
- JS_DeleteUCProperty (bug 1211607)
- JS::NewFunctionFromSpec (bug 1054756)
- JS::CompileForNonSyntacticScope (bug 1165486)
- JS_CheckForInterrupt (bug 1058695)
- JS::MapDelete (bug 1159469)
- JS::MapForEach (bug 1159469)
- JS::NewSetObject (bug 1159469)
- JS::SetSize (bug 1159469)
- JS::SetHas (bug 1159469)
- JS::SetDelete (bug 1159469)
- JS::SetAdd (bug 1159469)
- JS::SetClear (bug 1159469)
- JS::SetKeys (bug 1159469)
- JS::SetValues (bug 1159469)
- JS::SetEntries (bug 1159469)
- JS::SetForEach (bug 1159469)
- JS::ExceptionStackOrNull (bug 814497)
- JS::CopyAsyncStack (bug 1160307)
- JS::GetSavedFrameSource (bug 1216819)
- JS::GetSavedFrameLine (bug 1216819)
- JS::GetSavedFrameColumn (bug 1216819)
- JS::GetSavedFrameFunctionDisplayName (bug 1216819)
- JS::GetSavedFrameAsyncCause (bug 1216819)
- JS::GetSavedFrameAsyncParent (bug 1216819)
- JS::GetSavedFrameParent (bug 1216819)
- JS::BuildStackString (bug 1133191)
- JS::FlushPerformanceMonitoring (bug 1181175)
- JS::ResetPerformanceMonitoring (bug 1181175)
- JS::DisposePerformanceMonitoring (bug 1208747)
- JS::SetStopwatchIsMonitoringCPOW (bug 1156264)
- JS::GetStopwatchIsMonitoringCPOW (bug 1156264)
- JS::SetStopwatchIsMonitoringJank (bug 1156264)
- JS::GetStopwatchIsMonitoringJank (bug 1156264)
- JS::IsStopwatchActive (bug 674779)
- JS::GetPerfMonitoringTestCpuRescheduling (bug 1181175)
- JS::AddCPOWPerformanceDelta (bug 1181175)
- JS::SetStopwatchStartCallback (bug 1208747)
- JS::SetStopwatchCommitCallback (bug 1208747)
- JS::SetGetPerformanceGroupsCallback (bug 1208747)
- JS_StringHasBeenInterned renamed to JS_StringHasBeenPinned (bug 1178581)
- JS_InternJSString renamed to JS_AtomizeAndPinJSString (bug 1178581)
- JS_InternStringN renamed to JS_AtomizeAndPinStringN (bug 1178581)
- JS_InternString renamed to JS_AtomizeAndPinString (bug 1178581)
- JS_InternUCStringN renamed to JS_AtomizeAndPinUCStringN (bug 1178581)
- JS_InternUCString renamed to JS_AtomizeAndPinUCString (bug 1178581)
Deleted APIs
- JS_GetCompartmentStats
- JS_SetICUMemoryFunctions
- JS_IsGCMarkingTracer
- JS_IsMarkingGray
- JS_IdArrayLength
- JS_IdArrayGet
- JS_DestroyIdArray
- JS_DefaultValue
- JS_GetParent
- JS_SetParent
- JS::ParsePropertyDescriptorObject
- JS_DeleteProperty2
- JS_DeletePropertyById2
- JS_DeleteUCProperty2
- JS_DeleteElement2
- JS_NewFunctionById
- JS_BindCallable
- JS_DecompileFunctionBody
- JS_GetLatin1InternedStringChars
- JS_GetTwoByteInternedStringChars
- JS_NewDateObjectMsec
- JS_ClearDateCaches
Changed APIs
- JS_Init has moved from jsapi.h to js/Initialization.h
- JS_ShutDown has moved from jsapi.h to js/Initialization.h
- JS_InitReflect is now implicit
- JS_AddWeakPointerCallback is replaced with JS_AddWeakPointerZoneGroupCallback and JS_AddWeakPointerCompartmentCallback
- JS_RemoveWeakPointerCallback is replaced with JS_RemoveWeakPointerZoneGroupCallback and JS_RemoveWeakPointerCompartmentCallback
API changes
JavaScript shell changes
Detail added/removed methods here...
Known Issues
Detail any known issues here...
Future Direction
JSContext and JSRuntime are merging. (JSContext will be the only thing visible from within the API, there will be just one per runtime, and inheriting from JSRuntime.)
SpiderMonkey embedders should be aware that
- Mozilla has no plans to keep the JSAPI stable for embedders. We have instead chosen to concentrate on overall performance and accuracy as our primary concerns.
Release Notes Errata
Feel free to fix any problems you spot, directly in the text above -- this is a Wiki!