Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(716)

Unified Diff: src/profiler/heap-snapshot-generator.cc

Issue 2189643004: Fix performance regression of heap snapshot generator that was (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/profiler/heap-snapshot-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/heap-snapshot-generator.cc
diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc
index 8862ad9257a96351ff88341c92f1ebc491467e93..0f5bcdf8b280de9edcde44ad60d49a78da6af388 100644
--- a/src/profiler/heap-snapshot-generator.cc
+++ b/src/profiler/heap-snapshot-generator.cc
@@ -986,8 +986,7 @@ class IndexedReferencesExtractor : public ObjectVisitor {
}
void VisitPointers(Object** start, Object** end) override {
for (Object** p = start; p < end; p++) {
- intptr_t index =
- static_cast<intptr_t>(p - HeapObject::RawField(parent_obj_, 0));
+ int index = static_cast<int>(p - HeapObject::RawField(parent_obj_, 0));
++next_index_;
// |p| could be outside of the object, e.g., while visiting RelocInfo of
// code objects.
@@ -995,7 +994,8 @@ class IndexedReferencesExtractor : public ObjectVisitor {
generator_->marks_[index] = false;
continue;
}
- generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p);
+ generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p,
+ index * kPointerSize);
}
}
@@ -1835,6 +1835,16 @@ bool V8HeapExplorer::IsEssentialObject(Object* object) {
object != heap_->two_pointer_filler_map();
}
+bool V8HeapExplorer::IsEssentialHiddenReference(Object* parent,
+ int field_offset) {
+ if (parent->IsAllocationSite() &&
+ field_offset == AllocationSite::kWeakNextOffset)
+ return false;
+ // TODO(ulan): JSFunction, Code, and Context also have next weak link, which
+ // is non-essential. Currently they are handled as normal weak links.
+ // Move them here.
+ return true;
+}
void V8HeapExplorer::SetContextReference(HeapObject* parent_obj,
int parent_entry,
@@ -1926,14 +1936,13 @@ void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
MarkVisitedField(parent_obj, field_offset);
}
-
void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj,
- int parent_entry,
- int index,
- Object* child_obj) {
+ int parent_entry, int index,
+ Object* child_obj, int field_offset) {
DCHECK(parent_entry == GetEntry(parent_obj)->index());
HeapEntry* child_entry = GetEntry(child_obj);
- if (child_entry != NULL && IsEssentialObject(child_obj)) {
+ if (child_entry != NULL && IsEssentialObject(child_obj) &&
+ IsEssentialHiddenReference(parent_obj, field_offset)) {
filler_->SetIndexedReference(HeapGraphEdge::kHidden,
parent_entry,
index,
« no previous file with comments | « src/profiler/heap-snapshot-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698