Skip to content
This repository has been archived by the owner on Dec 1, 2020. It is now read-only.

Migrating to v25

Ricardo Quesada edited this page Oct 31, 2013 · 13 revisions

Changes needed to migrate to SpiderMonkey v25 from v23

API Changes

JS_Init

JS_Init() needs to be called at the very beginning.

JS_SetProperty

JS_SetProperty no longer works with jsval objects. Instead now receives JS::RootedValue objects.

// Old Way
jsval someJSval = OBJECT_TO_JSVAL(someObject);
JS_SetProperty(cx, object, "cp", &someJSval);

// New Way
JS::RootedValue someJSval(_cx);
someJSval = OBJECT_TO_JSVAL(someObject);
JS_SetProperty(cx, object, "cp", someJSval);

JS_NewGlobalObject

// Old Way
JS_NewGlobalObject(cx, &global_class, NULL);

// New Way
JS_NewGlobalObject(cx, &global_class, NULL, JS::DontFireOnNewGlobalHook /* or JS::FireOnNewGlobalHook */);

JS_SetVersion

// Old Way
JS_SetVersion(_cx, JSVERSION_LATEST);

// New Way
JS_SetVersionForCompartment(js::GetContextCompartment(_cx), JSVERSION_LATEST);

Patched files

build-*

Adds build-ios, build-osx, build-android and build-win32 scripts

configure.in, configure, aclocal.m4, ios.m4

Adds iOS options

Android.mk

Needed to compile Android

methodjit/Logging.h (Not longer needed from v23)

Disables JIT on debug.

  • Logging.h
// old
#if defined(DEBUG) && !defined(JS_METHODJIT_SPEW)
#define JS_METHODJIT_SPEW
#endif

// new
#ifdef JS_METHODJIT_SPEW

vm/NumericConversions.h

Disables ARM assembly optimizations when using clang

jspubtd.h

Disables "DEBUG" class id in order to have ABI compatibility between DEBUG and RELEASE builds

AsmJS.h

Empty implementation of AsmJSMachExceptionHandler for iOS

Disabling init-api since that wasn't supported on Android and iOS.

The icu library will is too large to be included in spidermonkey. For instance, on win32, the size of the dynamic library 'mozjs.dll' will grow to 12M while 3M in v22. https://github.com/ricardoquesada/Spidermonkey/commit/5b9356315a9bffbf3faa4a5e87664b6e0909c6ff

Clone this wiki locally