Commit a48e236e authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

devtools: Fix distances when no user roots have been found

In the case that user roots are not provided, distances should start
at 0. This is the case when full heap snapshots are provided with
the gn flag
  v8_enable_full_heap_snapshots

For production builds this flag is always false.

V8 CL: https://crrev.com/c/1528994

Bug: 936797
Change-Id: Ifd247a082a4336b59d05f444ba54d281f9eae805
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1529096Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Reviewed-by: default avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642413}
parent 4ebde227
...@@ -1305,7 +1305,7 @@ HeapSnapshotWorker.HeapSnapshot = class { ...@@ -1305,7 +1305,7 @@ HeapSnapshotWorker.HeapSnapshot = class {
this._bfs(nodesToVisit, nodesToVisitLength, distances, filter); this._bfs(nodesToVisit, nodesToVisitLength, distances, filter);
// BFS for objects not reached from user roots. // BFS for objects not reached from user roots.
distances[this.rootNode().ordinal()] = HeapSnapshotModel.baseSystemDistance; distances[this.rootNode().ordinal()] = nodesToVisitLength > 0 ? HeapSnapshotModel.baseSystemDistance : 0;
nodesToVisit[0] = this.rootNode().nodeIndex; nodesToVisit[0] = this.rootNode().nodeIndex;
nodesToVisitLength = 1; nodesToVisitLength = 1;
this._bfs(nodesToVisit, nodesToVisitLength, distances, filter); this._bfs(nodesToVisit, nodesToVisitLength, distances, filter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment