mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-22 18:06:14 +00:00
Delete unused SpiderMonkey GarbageCollection ScriptFunctions ForceGC in the AI and GUI context (e9e05f4efc) and MaybeGC in the random mapgen context (942a45372c).
Optimizing the memory footprint requires likely different functions following the new SM versions and a lot of testing, so having these doesn't lower the effort to achieve optimization while confusing the reader. Differential Revision: https://code.wildfiregames.com/D1073 Reviewed By: Yves This was SVN commit r20572.
This commit is contained in:
@@ -104,7 +104,6 @@ bool CMapGeneratorWorker::Run()
|
|||||||
m_ScriptInterface->RegisterFunction<bool, std::wstring, CMapGeneratorWorker::LoadLibrary>("LoadLibrary");
|
m_ScriptInterface->RegisterFunction<bool, std::wstring, CMapGeneratorWorker::LoadLibrary>("LoadLibrary");
|
||||||
m_ScriptInterface->RegisterFunction<void, JS::HandleValue, CMapGeneratorWorker::ExportMap>("ExportMap");
|
m_ScriptInterface->RegisterFunction<void, JS::HandleValue, CMapGeneratorWorker::ExportMap>("ExportMap");
|
||||||
m_ScriptInterface->RegisterFunction<void, int, CMapGeneratorWorker::SetProgress>("SetProgress");
|
m_ScriptInterface->RegisterFunction<void, int, CMapGeneratorWorker::SetProgress>("SetProgress");
|
||||||
m_ScriptInterface->RegisterFunction<void, CMapGeneratorWorker::MaybeGC>("MaybeGC");
|
|
||||||
m_ScriptInterface->RegisterFunction<CParamNode, std::string, CMapGeneratorWorker::GetTemplate>("GetTemplate");
|
m_ScriptInterface->RegisterFunction<CParamNode, std::string, CMapGeneratorWorker::GetTemplate>("GetTemplate");
|
||||||
m_ScriptInterface->RegisterFunction<bool, std::string, CMapGeneratorWorker::TemplateExists>("TemplateExists");
|
m_ScriptInterface->RegisterFunction<bool, std::string, CMapGeneratorWorker::TemplateExists>("TemplateExists");
|
||||||
m_ScriptInterface->RegisterFunction<std::vector<std::string>, std::string, bool, CMapGeneratorWorker::FindTemplates>("FindTemplates");
|
m_ScriptInterface->RegisterFunction<std::vector<std::string>, std::string, bool, CMapGeneratorWorker::FindTemplates>("FindTemplates");
|
||||||
@@ -190,12 +189,6 @@ void CMapGeneratorWorker::SetProgress(ScriptInterface::CxPrivate* pCxPrivate, in
|
|||||||
self->m_Progress = progress;
|
self->m_Progress = progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMapGeneratorWorker::MaybeGC(ScriptInterface::CxPrivate* pCxPrivate)
|
|
||||||
{
|
|
||||||
CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(pCxPrivate->pCBData);
|
|
||||||
self->m_ScriptInterface->MaybeGC();
|
|
||||||
}
|
|
||||||
|
|
||||||
CParamNode CMapGeneratorWorker::GetTemplate(ScriptInterface::CxPrivate* pCxPrivate, const std::string& templateName)
|
CParamNode CMapGeneratorWorker::GetTemplate(ScriptInterface::CxPrivate* pCxPrivate, const std::string& templateName)
|
||||||
{
|
{
|
||||||
CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(pCxPrivate->pCBData);
|
CMapGeneratorWorker* self = static_cast<CMapGeneratorWorker*>(pCxPrivate->pCBData);
|
||||||
|
|||||||
@@ -124,7 +124,6 @@ private:
|
|||||||
static bool LoadLibrary(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& name);
|
static bool LoadLibrary(ScriptInterface::CxPrivate* pCxPrivate, const std::wstring& name);
|
||||||
static void ExportMap(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue data);
|
static void ExportMap(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue data);
|
||||||
static void SetProgress(ScriptInterface::CxPrivate* pCxPrivate, int progress);
|
static void SetProgress(ScriptInterface::CxPrivate* pCxPrivate, int progress);
|
||||||
static void MaybeGC(ScriptInterface::CxPrivate* pCxPrivate);
|
|
||||||
static CParamNode GetTemplate(ScriptInterface::CxPrivate* pCxPrivate, const std::string& templateName);
|
static CParamNode GetTemplate(ScriptInterface::CxPrivate* pCxPrivate, const std::string& templateName);
|
||||||
static bool TemplateExists(ScriptInterface::CxPrivate* pCxPrivate, const std::string& templateName);
|
static bool TemplateExists(ScriptInterface::CxPrivate* pCxPrivate, const std::string& templateName);
|
||||||
static std::vector<std::string> FindTemplates(ScriptInterface::CxPrivate* pCxPrivate, const std::string& path, bool includeSubdirectories);
|
static std::vector<std::string> FindTemplates(ScriptInterface::CxPrivate* pCxPrivate, const std::string& path, bool includeSubdirectories);
|
||||||
|
|||||||
@@ -121,16 +121,6 @@ std::wstring JSI_Debug::GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCx
|
|||||||
return wstring_from_utf8(buf);
|
return wstring_from_utf8(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force a JS garbage collection cycle to take place immediately.
|
|
||||||
// Writes an indication of how long this took to the console.
|
|
||||||
void JSI_Debug::ForceGC(ScriptInterface::CxPrivate* pCxPrivate)
|
|
||||||
{
|
|
||||||
double time = timer_Time();
|
|
||||||
JS_GC(pCxPrivate->pScriptInterface->GetJSRuntime());
|
|
||||||
time = timer_Time() - time;
|
|
||||||
g_Console->InsertMessage(fmt::sprintf("Garbage collection completed in: %f", time));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool JSI_Debug::IsUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
bool JSI_Debug::IsUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||||
{
|
{
|
||||||
return g_UserReporter.IsReportingEnabled();
|
return g_UserReporter.IsReportingEnabled();
|
||||||
@@ -159,7 +149,6 @@ void JSI_Debug::RegisterScriptFunctions(const ScriptInterface& scriptInterface)
|
|||||||
scriptInterface.RegisterFunction<void, std::wstring, &DisplayErrorDialog>("DisplayErrorDialog");
|
scriptInterface.RegisterFunction<void, std::wstring, &DisplayErrorDialog>("DisplayErrorDialog");
|
||||||
scriptInterface.RegisterFunction<JS::Value, &GetProfilerState>("GetProfilerState");
|
scriptInterface.RegisterFunction<JS::Value, &GetProfilerState>("GetProfilerState");
|
||||||
scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp");
|
scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp");
|
||||||
scriptInterface.RegisterFunction<void, &ForceGC>("ForceGC");
|
|
||||||
|
|
||||||
// User report functions
|
// User report functions
|
||||||
scriptInterface.RegisterFunction<bool, &IsUserReportEnabled>("IsUserReportEnabled");
|
scriptInterface.RegisterFunction<bool, &IsUserReportEnabled>("IsUserReportEnabled");
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ namespace JSI_Debug
|
|||||||
void SubmitUserReport(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& type, int version, const std::wstring& data);
|
void SubmitUserReport(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& type, int version, const std::wstring& data);
|
||||||
std::wstring GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int mode);
|
std::wstring GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int mode);
|
||||||
double GetMicroseconds(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
double GetMicroseconds(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));
|
||||||
void ForceGC(ScriptInterface::CxPrivate* pCxPrivate);
|
|
||||||
|
|
||||||
void RegisterScriptFunctions(const ScriptInterface& ScriptInterface);
|
void RegisterScriptFunctions(const ScriptInterface& ScriptInterface);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1103,17 +1103,6 @@ void* ScriptInterface::GetPrivate(JS::HandleObject obj)
|
|||||||
return JS_GetPrivate(obj);
|
return JS_GetPrivate(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptInterface::MaybeGC()
|
|
||||||
{
|
|
||||||
JS_MaybeGC(m->m_cx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ScriptInterface::ForceGC()
|
|
||||||
{
|
|
||||||
PROFILE2("JS_GC");
|
|
||||||
JS_GC(this->GetJSRuntime());
|
|
||||||
}
|
|
||||||
|
|
||||||
JS::Value ScriptInterface::CloneValueFromOtherContext(const ScriptInterface& otherContext, JS::HandleValue val) const
|
JS::Value ScriptInterface::CloneValueFromOtherContext(const ScriptInterface& otherContext, JS::HandleValue val) const
|
||||||
{
|
{
|
||||||
PROFILE("CloneValueFromOtherContext");
|
PROFILE("CloneValueFromOtherContext");
|
||||||
|
|||||||
@@ -228,7 +228,6 @@ public:
|
|||||||
|
|
||||||
m_ScriptInterface->RegisterFunction<void, int, JS::HandleValue, CAIWorker::PostCommand>("PostCommand");
|
m_ScriptInterface->RegisterFunction<void, int, JS::HandleValue, CAIWorker::PostCommand>("PostCommand");
|
||||||
m_ScriptInterface->RegisterFunction<void, std::wstring, CAIWorker::IncludeModule>("IncludeModule");
|
m_ScriptInterface->RegisterFunction<void, std::wstring, CAIWorker::IncludeModule>("IncludeModule");
|
||||||
m_ScriptInterface->RegisterFunction<void, CAIWorker::ForceGC>("ForceGC");
|
|
||||||
m_ScriptInterface->RegisterFunction<void, CAIWorker::ExitProgram>("Exit");
|
m_ScriptInterface->RegisterFunction<void, CAIWorker::ExitProgram>("Exit");
|
||||||
|
|
||||||
m_ScriptInterface->RegisterFunction<JS::Value, JS::HandleValue, JS::HandleValue, pass_class_t, CAIWorker::ComputePath>("ComputePath");
|
m_ScriptInterface->RegisterFunction<JS::Value, JS::HandleValue, JS::HandleValue, pass_class_t, CAIWorker::ComputePath>("ComputePath");
|
||||||
@@ -347,12 +346,6 @@ public:
|
|||||||
return m_TemplateLoader.GetTemplateFileData(name).GetChild("Entity");
|
return m_TemplateLoader.GetTemplateFileData(name).GetChild("Entity");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ForceGC(ScriptInterface::CxPrivate* pCxPrivate)
|
|
||||||
{
|
|
||||||
PROFILE3("AI compute GC");
|
|
||||||
JS_GC(pCxPrivate->pScriptInterface->GetJSRuntime());
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ExitProgram(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
static void ExitProgram(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||||
{
|
{
|
||||||
kill_mainloop();
|
kill_mainloop();
|
||||||
|
|||||||
Reference in New Issue
Block a user