mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-22 03:25:48 +00:00
Only freeze once the cached JS values of templates
CParamNodes can be quite large, thus we usually cache the JS::Value when
converting them. The AIInterface makes heavy use of it as detected in #7404.
However, the cached values are re-frozen everytime, which is a
significant waste of time on a large number of templates.
(cherry picked from commit e48b9ea106)
Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2024 Wildfire Games.
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -69,11 +69,6 @@ template<> void Script::ToJSVal<IComponent*>(const ScriptRequest& rq, JS::Mutab
|
||||
template<> void Script::ToJSVal<CParamNode>(const ScriptRequest& rq, JS::MutableHandleValue ret, CParamNode const& val)
|
||||
{
|
||||
val.ToJSVal(rq, true, ret);
|
||||
|
||||
// Prevent modifications to the object, so that it's safe to share between
|
||||
// components and to reconstruct on deserialization
|
||||
if (ret.isObject())
|
||||
Script::DeepFreezeObject(rq, ret);
|
||||
}
|
||||
|
||||
template<> void Script::ToJSVal<const CParamNode*>(const ScriptRequest& rq, JS::MutableHandleValue ret, const CParamNode* const& val)
|
||||
|
||||
Reference in New Issue
Block a user