dc88076767
Instead of special-casing the current fields that may have WeakSerializationReferences, handle WSRs appearing as elements or properties of objects more generally. This removes existing special casing and avoids the need for it in case of new future uses of WSRs. For artificial nodes being added for dropped WeakSerializationReference targets, add them as kArtificial nodes (not kSnapshot) that has the original offset (element) or name (property). The replacement is added as a kSnapshot node that has a negative offset with the same magnitude as the artificial node (element) or ":real_<property name>" (property). This simplifies the work done in pkg/vm_snapshot_analysis to use the artificial nodes instead of replacement ones for reassembling hierarchies and the like. This CL also cleans up the old SerializerWritingObjectScope class, both moving it to Serializer::WritingObjectScope and allowing nesting of WritingObjectScopes with the correct semantics. Thanks to this, not only can we recur when under a WritingObjectScope instead of lifting recursion outside of those scopes, but we can also create artificial nodes for non-empty per-code object pools and static call target tables instead of attributing their contents as supposed elements of the Code object being written. TEST=pkg/vm_snapshot_analysis/test/instruction_sizes_test Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-mac-release-try,pkg-win-release-try Change-Id: Ib945c5afcd89b1458b8be3559b6eae24048aba2f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/194243 Commit-Queue: Tess Strickland <sstrickl@google.com> Reviewed-by: Ryan Macnak <rmacnak@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>