mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
[SM91] Update to Spidermonkey 91.1.3 APIs
Fixes: #5986 Patch by: @wraitii Comments by: @nwtour, @Stan Differential Revision: https://code.wildfiregames.com/D4428 This was SVN commit r27409.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -107,7 +107,8 @@ ScriptContext::ScriptContext(int contextSize, int heapGrowthBytesGCTrigger):
|
||||
JS::SetGCSliceCallback(m_cx, GCSliceCallbackHook);
|
||||
|
||||
JS_SetGCParameter(m_cx, JSGC_MAX_BYTES, m_ContextSize);
|
||||
JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_INCREMENTAL);
|
||||
JS_SetGCParameter(m_cx, JSGC_INCREMENTAL_GC_ENABLED, true);
|
||||
JS_SetGCParameter(m_cx, JSGC_PER_ZONE_GC_ENABLED, false);
|
||||
|
||||
JS_SetOffthreadIonCompilationEnabled(m_cx, true);
|
||||
|
||||
@@ -143,7 +144,7 @@ void ScriptContext::UnRegisterRealm(JS::Realm* realm)
|
||||
// Schedule the zone for GC, which will destroy the realm.
|
||||
if (JS::IsIncrementalGCInProgress(m_cx))
|
||||
JS::FinishIncrementalGC(m_cx, JS::GCReason::API);
|
||||
JS::PrepareZoneForGC(js::GetRealmZone(realm));
|
||||
JS::PrepareZoneForGC(m_cx, js::GetRealmZone(realm));
|
||||
m_Realms.remove(realm);
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ void ScriptContext::MaybeIncrementalGC(double delay)
|
||||
#endif
|
||||
PrepareZonesForIncrementalGC();
|
||||
if (!JS::IsIncrementalGCInProgress(m_cx))
|
||||
JS::StartIncrementalGC(m_cx, GC_NORMAL, JS::GCReason::API, GCSliceTimeBudget);
|
||||
JS::StartIncrementalGC(m_cx, JS::GCOptions::Normal, JS::GCReason::API, GCSliceTimeBudget);
|
||||
else
|
||||
JS::IncrementalGCSlice(m_cx, JS::GCReason::API, GCSliceTimeBudget);
|
||||
}
|
||||
@@ -252,14 +253,16 @@ void ScriptContext::MaybeIncrementalGC(double delay)
|
||||
|
||||
void ScriptContext::ShrinkingGC()
|
||||
{
|
||||
JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_ZONE);
|
||||
JS_SetGCParameter(m_cx, JSGC_INCREMENTAL_GC_ENABLED, false);
|
||||
JS_SetGCParameter(m_cx, JSGC_PER_ZONE_GC_ENABLED, true);
|
||||
JS::PrepareForFullGC(m_cx);
|
||||
JS::NonIncrementalGC(m_cx, GC_SHRINK, JS::GCReason::API);
|
||||
JS_SetGCParameter(m_cx, JSGC_MODE, JSGC_MODE_INCREMENTAL);
|
||||
JS::NonIncrementalGC(m_cx, JS::GCOptions::Shrink, JS::GCReason::API);
|
||||
JS_SetGCParameter(m_cx, JSGC_INCREMENTAL_GC_ENABLED, true);
|
||||
JS_SetGCParameter(m_cx, JSGC_PER_ZONE_GC_ENABLED, false);
|
||||
}
|
||||
|
||||
void ScriptContext::PrepareZonesForIncrementalGC() const
|
||||
{
|
||||
for (JS::Realm* const& realm : m_Realms)
|
||||
JS::PrepareZoneForGC(js::GetRealmZone(realm));
|
||||
JS::PrepareZoneForGC(m_cx, js::GetRealmZone(realm));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -105,7 +105,7 @@ template<> bool Script::FromJSVal<std::wstring>(const ScriptRequest& rq, JS::Ha
|
||||
if (!str)
|
||||
FAIL("Argument must be convertible to a string");
|
||||
|
||||
if (JS_StringHasLatin1Chars(str))
|
||||
if (JS::StringHasLatin1Chars(str))
|
||||
{
|
||||
size_t length;
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -60,6 +60,10 @@
|
||||
#include "js/Proxy.h"
|
||||
#include "js/Warnings.h"
|
||||
|
||||
#include "js/experimental/TypedData.h"
|
||||
|
||||
#include "js/friend/ErrorMessages.h"
|
||||
|
||||
#undef signbit
|
||||
|
||||
#if MSC_VERSION
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -533,11 +533,11 @@ bool ScriptInterface::SetGlobal_(const char* name, JS::HandleValue value, bool r
|
||||
return false;
|
||||
if (found)
|
||||
{
|
||||
JS::Rooted<JS::PropertyDescriptor> desc(rq.cx);
|
||||
if (!JS_GetOwnPropertyDescriptor(rq.cx, global, name, &desc))
|
||||
JS::Rooted<mozilla::Maybe<JS::PropertyDescriptor>> desc(rq.cx);
|
||||
if (!JS_GetOwnPropertyDescriptor(rq.cx, global, name, &desc) || !desc.isSome())
|
||||
return false;
|
||||
|
||||
if (!desc.writable())
|
||||
if (!desc->writable())
|
||||
{
|
||||
if (!replace)
|
||||
{
|
||||
@@ -547,7 +547,7 @@ bool ScriptInterface::SetGlobal_(const char* name, JS::HandleValue value, bool r
|
||||
|
||||
// This is not supposed to happen, unless the user has called SetProperty with constant = true on the global object
|
||||
// instead of using SetGlobal.
|
||||
if (!desc.configurable())
|
||||
if (!desc->configurable())
|
||||
{
|
||||
ScriptException::Raise(rq, "The global \"%s\" is permanent and cannot be hotloaded", name);
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -73,7 +73,7 @@
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if MOZJS_MAJOR_VERSION != 78
|
||||
#if MOZJS_MAJOR_VERSION != 91
|
||||
#error Your compiler is trying to use an incorrect major version of the \
|
||||
SpiderMonkey library. The only version that works is the one in the \
|
||||
libraries/spidermonkey/ directory, and it will not work with a typical \
|
||||
@@ -81,7 +81,7 @@ system-installed version. Make sure you have got all the right files and \
|
||||
include paths.
|
||||
#endif
|
||||
|
||||
#if MOZJS_MINOR_VERSION != 6
|
||||
#if MOZJS_MINOR_VERSION != 13
|
||||
#error Your compiler is trying to use an untested minor version of the \
|
||||
SpiderMonkey library. If you are a package maintainer, please make sure \
|
||||
to check very carefully that this version does not change the behaviour \
|
||||
|
||||
Reference in New Issue
Block a user