0ad/source/scriptinterface
wraitii dad2857538 Use Symbols to store JS object references when serialising and delete ObjectIDCache
When serialising JS objects, we keep track of any encountered object,
and serialize it only once. Any further serialisation instead stores an
ID referring to the original object (essentially an opaque pointer).
The trouble of course is to have a unique, persistent identifier for
such an object.
svn uses an ObjectIDCache, essentially a "JS Object -> ID" map (which
internally is essentially a "JS heap pointer -> ID" map).

JS, since ES15, includes a "Symbol" primitive type, which is a unique,
immutable identifier. They are also not iterable by for..in or
GetOwnPropertyName or related.
This means they can be used to store the tag directly on the object
(since it's impossible overwrite a user property).
Thanks to this, we can forgo ObjectIDCache in the serializers, and since
following D2897 it becomes unused, we can delete it, along with the
Finalization code it used.


Part of SM52 migration, stage: SM45-compatible changes.

Patch by: Itms
Tested By: Freagarach
Refs #4893

Differential Revision: https://code.wildfiregames.com/D3085
This was SVN commit r24167.
2020-11-12 06:40:19 +00:00
..
tests Use Symbols to store JS object references when serialising and delete ObjectIDCache 2020-11-12 06:40:19 +00:00
NativeWrapperDecls.h Replace deprecated jsval with JS::Value. 2017-08-28 10:27:36 +00:00
NativeWrapperDefns.h Officially drop support for Visual Studio 2013, which stopped working after 3a839517ce, fixes #5379. 2020-01-12 20:04:22 +00:00
ScriptConversions.cpp Fix conversion of UTF8 strings between the scripts and the engine. 2020-06-30 10:46:06 +00:00
ScriptConversions.h Stop failing if mod is broken and display invalid mods in downloader [Mod Io] 2020-07-12 09:25:03 +00:00
ScriptEngine.h Upgrade SpiderMonkey to version 45.0.2, refs #4893. 2019-08-07 22:37:43 +00:00
ScriptExtraHeaders.h SpiderMonkey 38 upgrade: 09/35 2016-09-02 16:23:44 +00:00
ScriptInterface.cpp Rework ScriptInterface EnumeratePropertyNames to support non-enumerable properties. 2020-06-14 09:49:32 +00:00
ScriptInterface.h Stop failing if mod is broken and display invalid mods in downloader [Mod Io] 2020-07-12 09:25:03 +00:00
ScriptRuntime.cpp Use Symbols to store JS object references when serialising and delete ObjectIDCache 2020-11-12 06:40:19 +00:00
ScriptRuntime.h Use Symbols to store JS object references when serialising and delete ObjectIDCache 2020-11-12 06:40:19 +00:00
ScriptStats.cpp Use in-place construction. 2015-07-29 23:44:17 +00:00
ScriptStats.h Add JS memory usage to profiler. 2010-08-02 19:23:58 +00:00
ScriptTypes.h Upgrade SpiderMonkey to version 45.0.2, refs #4893. 2019-08-07 22:37:43 +00:00
ScriptVal.h Officially drop support for Visual Studio 2013, which stopped working after 3a839517ce, fixes #5379. 2020-01-12 20:04:22 +00:00