Commit 53a527f6 authored by Seth Brenith's avatar Seth Brenith Committed by V8 LUCI CQ

Avoid reporting incorrect retaining paths in heap snapshots

The heap snapshot view in the dev tools reports a lot of incorrect
retaining paths involving weak references from FeedbackVectors. To fix,
when IndexedReferencesExtractor encounters a weak reference, it should
record a weak reference rather than a hidden reference. This way, the
forward reference is still visible when exploring in the summary view,
but weak references aren't reported as retainers.

Bug: v8:12112
Change-Id: Ib3bafc49482fb4f515877a90bae8707483d0a7a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3101266Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#76364}
parent e7f4c2a1
......@@ -774,8 +774,13 @@ class IndexedReferencesExtractor : public ObjectVisitor {
generator_->visited_fields_[field_index] = false;
} else {
HeapObject heap_object;
if (slot.load(cage_base).GetHeapObject(&heap_object)) {
auto loaded_value = slot.load(cage_base);
if (loaded_value.GetHeapObjectIfStrong(&heap_object)) {
VisitHeapObjectImpl(heap_object, field_index);
} else if (loaded_value.GetHeapObjectIfWeak(&heap_object)) {
generator_->SetWeakReference(parent_, next_index_++, heap_object,
field_index * kTaggedSize);
generator_->visited_fields_[field_index] = false;
}
}
}
......
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