1
0
forked from mirrors/0ad

SpiderMonkey 38 upgrade: 30/35

Upstream added a compartment option to preserve JIT code during
non-shrinking GCs, so use it. Patch by leper.
Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1068697

This was SVN commit r18684.
This commit is contained in:
Itms
2016-09-02 16:48:41 +00:00
parent 27c434e2bd
commit f06eb5536b
+2 -8
View File
@@ -360,6 +360,8 @@ ScriptInterface_impl::ScriptInterface_impl(const char* nativeScopeName, const sh
JS::CompartmentOptions opt;
opt.setVersion(JSVERSION_LATEST);
// Keep JIT code during non-shrinking GCs. This brings a quite big performance improvement.
opt.setPreserveJitCode(true);
JSAutoRequest rq(m_cx);
JS::RootedObject globalRootedVal(m_cx, JS_NewGlobalObject(m_cx, &global_class, NULL, JS::OnNewGlobalHookOption::FireOnNewGlobalHook, opt));
@@ -368,14 +370,6 @@ ScriptInterface_impl::ScriptInterface_impl(const char* nativeScopeName, const sh
ENSURE(ok);
m_glob = globalRootedVal.get();
// Use the testing functions to globally enable gcPreserveCode. This brings quite a
// big performance improvement. In future SpiderMonkey versions, we should probably
// use the functions implemented here: https://bugzilla.mozilla.org/show_bug.cgi?id=1068697
JS::RootedObject testingFunctionsObj(m_cx, js::GetTestingFunctions(m_cx));
ENSURE(testingFunctionsObj);
JS::RootedValue ret(m_cx);
JS_CallFunctionName(m_cx, testingFunctionsObj, "gcPreserveCode", JS::HandleValueArray::empty(), &ret);
JS_DefineProperty(m_cx, m_glob, "global", globalRootedVal, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
m_nativeScope = JS_DefineObject(m_cx, m_glob, nativeScopeName, nullptr, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);