From 6d5c966e6803850f8a6e8ed62c05ba352759c7be Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Wed, 26 Oct 2022 16:02:50 +0000 Subject: [PATCH] [observatory] Don't repeat storage of identity hashes in loaded heap snapshots. TEST=ci Change-Id: I4696f0e943f4b0dd5716ece285650aed85056c37 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265521 Reviewed-by: Ben Konyi Commit-Queue: Ryan Macnak --- runtime/observatory/lib/object_graph.dart | 5 ++--- runtime/observatory_2/lib/object_graph.dart | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart index 18e0fae9298..e39f2cb7c9e 100644 --- a/runtime/observatory/lib/object_graph.dart +++ b/runtime/observatory/lib/object_graph.dart @@ -260,12 +260,10 @@ abstract class SnapshotObject { class _SnapshotObject implements SnapshotObject { final int _id; - final int identityHashCode; final _SnapshotGraph _graph; final String label; - _SnapshotObject._new(this._id, this._graph, this.label) - : identityHashCode = _graph._identityHashes![_id]; + _SnapshotObject._new(this._id, this._graph, this.label); bool operator ==(Object other) { if (other is _SnapshotObject) { @@ -275,6 +273,7 @@ class _SnapshotObject implements SnapshotObject { } int get hashCode => _id ^ _graph.hashCode; + int get identityHashCode => _graph._identityHashes![_id]; int get shallowSize => internalSize + externalSize; int get internalSize => _graph._internalSizes![_id]; diff --git a/runtime/observatory_2/lib/object_graph.dart b/runtime/observatory_2/lib/object_graph.dart index 21b426a0897..41b0bd39c69 100644 --- a/runtime/observatory_2/lib/object_graph.dart +++ b/runtime/observatory_2/lib/object_graph.dart @@ -260,12 +260,10 @@ abstract class SnapshotObject { class _SnapshotObject implements SnapshotObject { final int _id; - final int identityHashCode; final _SnapshotGraph _graph; final String label; - _SnapshotObject._new(this._id, this._graph, this.label) - : identityHashCode = _graph._identityHashes[_id]; + _SnapshotObject._new(this._id, this._graph, this.label); bool operator ==(Object other) { if (other is _SnapshotObject) { @@ -275,6 +273,7 @@ class _SnapshotObject implements SnapshotObject { } int get hashCode => _id ^ _graph.hashCode; + int get identityHashCode => _graph._identityHashes[_id]; int get shallowSize => internalSize + externalSize; int get internalSize => _graph._internalSizes[_id];