forked from 0ad/0ad
wraitii
dad2857538
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. |
||
---|---|---|
.. | ||
osx | ||
LICENSE.txt |