Index: src/profile-generator.cc |
diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
index e0b63f950ceebd604386914d2f16a2e1dbb923ed..33e352707c587bbf5d366e4d3c5fc99c521fb51a 100644 |
--- a/src/profile-generator.cc |
+++ b/src/profile-generator.cc |
@@ -1462,6 +1462,14 @@ void HeapSnapshot::BuildDominatorTree(const Vector<HeapEntry*>& entries, |
} |
+void HeapSnapshot::SetDominatorsToSelf() { |
+ for (int i = 0; i < entries_.length(); ++i) { |
+ HeapEntry* entry = entries_[i]; |
+ if (entry->dominator() == NULL) entry->set_dominator(entry); |
+ } |
+} |
+ |
+ |
void HeapSnapshot::SetEntriesDominators() { |
// This array is used for maintaining reverse postorder of nodes. |
ScopedVector<HeapEntry*> ordered_entries(entries_.length()); |
@@ -1473,10 +1481,7 @@ void HeapSnapshot::SetEntriesDominators() { |
ordered_entries[i]->set_dominator(dominators[i]); |
} |
// For nodes unreachable from root, set dominator to itself. |
- for (int i = 0; i < entries_.length(); ++i) { |
- HeapEntry* entry = entries_[i]; |
- if (entry->dominator() == NULL) entry->set_dominator(entry); |
- } |
+ SetDominatorsToSelf(); |
} |