forked from mirrors/0ad
SpiderMonkey 31 upgrade
This upgrade also introduces exact stack rooting (see to the wiki: JSRootingGuide) and fixes problems with moving GC. This allows us to enable generational garbage collection (GGC). Measurements a few months ago have shown a performance improvement of a non-visual replay of around 13.5%. This probably varies quite a bit, but it should be somewhere between 5-20%. Memory usage has also been improved. Check the forum thread for details. Thanks to everyone from the team who helped with this directly or indirectly (review, finding and fixing issues, the required C++11 upgrade, the new autobuilder etc.)! Also thanks to the SpiderMonkey developers who helped on the #jsapi channel or elsewhere! Fixes #2462, #2415, #2428, #2684, #1374 Refs #2973, #2669 This was SVN commit r16214.
This commit is contained in:
@@ -43,12 +43,12 @@ extern void restart_engine();
|
||||
* @return JS object with available mods as the keys of the modname.json
|
||||
* properties.
|
||||
*/
|
||||
CScriptVal JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
JS::Value JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
{
|
||||
ScriptInterface* scriptInterface = pCxPrivate->pScriptInterface;
|
||||
JSContext* cx = scriptInterface->GetContext();
|
||||
JSAutoRequest rq(cx);
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, NULL, NULL, NULL));
|
||||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||
|
||||
const Paths paths(g_args);
|
||||
|
||||
@@ -80,7 +80,7 @@ CScriptVal JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
continue;
|
||||
|
||||
// Valid mod, add it to our structure
|
||||
JS_SetProperty(cx, obj, utf8_from_wstring(iter->string()).c_str(), json.address());
|
||||
JS_SetProperty(cx, obj, utf8_from_wstring(iter->string()).c_str(), json);
|
||||
}
|
||||
|
||||
GetDirectoryEntries(modUserPath, NULL, &modDirsUser);
|
||||
@@ -106,7 +106,7 @@ CScriptVal JSI_Mod::GetAvailableMods(ScriptInterface::CxPrivate* pCxPrivate)
|
||||
continue;
|
||||
|
||||
// Valid mod, add it to our structure
|
||||
JS_SetProperty(cx, obj, utf8_from_wstring(iter->string()).c_str(), json.address());
|
||||
JS_SetProperty(cx, obj, utf8_from_wstring(iter->string()).c_str(), json);
|
||||
}
|
||||
|
||||
return JS::ObjectValue(*obj);
|
||||
@@ -124,7 +124,7 @@ void JSI_Mod::SetMods(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::vecto
|
||||
|
||||
void JSI_Mod::RegisterScriptFunctions(ScriptInterface& scriptInterface)
|
||||
{
|
||||
scriptInterface.RegisterFunction<CScriptVal, &JSI_Mod::GetAvailableMods>("GetAvailableMods");
|
||||
scriptInterface.RegisterFunction<JS::Value, &JSI_Mod::GetAvailableMods>("GetAvailableMods");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Mod::RestartEngine>("RestartEngine");
|
||||
scriptInterface.RegisterFunction<void, std::vector<CStr>, &JSI_Mod::SetMods>("SetMods");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user