[SM78 2/2] Update to Spidermonkey 78 APIs

This ugprades 0 A.D. to the latest ESR at the moment of writing.

Mostly straighforward API changes (see meta-Bug 1633145)
- js::Class is merged with JSClass
- JSNewArrayObject becomes JS::NewArrayObject
- ArrayObject-functions are moved to a new public header Array.h
- JSMSG error messages have again been changed, requiring some tweaks.
- AutoValueArray becomes RootedBalueArray (Bug 1634435)
- 'uneval' is behind a Realm flag (Bug 1565170), but no removal is
planned in the short-term future.
- Some minor GC API changes (Bugs 1569564 and 1633405)
- Error reporting has had some tweaks, and error flags have been removed
(Bug 1620583)
- StructuredClone are now always thread-safe, simplifying an API change
introduced in SM52 (Bug 1607791)

Tested by: Stan, Freagarach, mammadori
Closes #5861

Differential Revision: https://code.wildfiregames.com/D3168
This was SVN commit r24333.
This commit is contained in:
wraitii
2020-12-06 14:03:02 +00:00
parent 6da64bf354
commit d92a2118b0
30 changed files with 91 additions and 100 deletions
+3 -11
View File
@@ -89,20 +89,15 @@ ScriptContext::ScriptContext(int contextSize, int heapGrowthBytesGCTrigger):
{
ENSURE(ScriptEngine::IsInitialised() && "The ScriptEngine must be initialized before constructing any ScriptContexts!");
m_cx = JS_NewContext(contextSize, JS::DefaultNurseryBytes, nullptr);
m_cx = JS_NewContext(contextSize);
ENSURE(m_cx); // TODO: error handling
ENSURE(JS::InitSelfHostedCode(m_cx));
JS::SetGCSliceCallback(m_cx, GCSliceCallbackHook);
JS_SetGCParameter(m_cx, JSGC_MAX_MALLOC_BYTES, m_ContextSize);
JS_SetGCParameter(m_cx, JSGC_MAX_BYTES, m_ContextSize);
JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_INCREMENTAL);
// The whole heap-growth mechanism seems to work only for non-incremental GCs.
// We disable it to make it more clear if full GCs happen triggered by this JSAPI internal mechanism.
JS_SetGCParameter(m_cx, JSGC_DYNAMIC_HEAP_GROWTH, false);
JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_ZONE_INCREMENTAL);
JS_SetOffthreadIonCompilationEnabled(m_cx, true);
@@ -114,10 +109,7 @@ ScriptContext::ScriptContext(int contextSize, int heapGrowthBytesGCTrigger):
JS_SetGlobalJitCompilerOption(m_cx, JSJITCOMPILER_ION_ENABLE, 1);
JS_SetGlobalJitCompilerOption(m_cx, JSJITCOMPILER_BASELINE_ENABLE, 1);
JS::ContextOptionsRef(m_cx)
.setExtraWarnings(true)
.setWerror(false)
.setStrictMode(true);
JS::ContextOptionsRef(m_cx).setStrictMode(true);
ScriptEngine::GetSingleton().RegisterContext(m_cx);
}