Revert "Tune snapshot taking progress indicator."

This reverts commit 630437a0239ce4de029ea367083cb12a8099506c.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10825 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 482325ec
...@@ -3166,7 +3166,7 @@ bool HeapSnapshotGenerator::GenerateSnapshot() { ...@@ -3166,7 +3166,7 @@ bool HeapSnapshotGenerator::GenerateSnapshot() {
debug_heap->Verify(); debug_heap->Verify();
#endif #endif
SetProgressTotal(2); // 2 passes. SetProgressTotal(4); // 2 passes + dominators + sizes.
#ifdef DEBUG #ifdef DEBUG
debug_heap->Verify(); debug_heap->Verify();
...@@ -3303,9 +3303,10 @@ bool HeapSnapshotGenerator::BuildDominatorTree( ...@@ -3303,9 +3303,10 @@ bool HeapSnapshotGenerator::BuildDominatorTree(
affected[children[i].to()->ordered_index()] = true; affected[children[i].to()->ordered_index()] = true;
} }
bool changed = true; int changed = 1;
while (changed) { const int base_progress_counter = progress_counter_;
changed = false; while (changed != 0) {
changed = 0;
for (int i = root_index - 1; i >= 0; --i) { for (int i = root_index - 1; i >= 0; --i) {
// If dominator of the entry has already been set to root, // If dominator of the entry has already been set to root,
// then it can't propagate any further. // then it can't propagate any further.
...@@ -3329,13 +3330,17 @@ bool HeapSnapshotGenerator::BuildDominatorTree( ...@@ -3329,13 +3330,17 @@ bool HeapSnapshotGenerator::BuildDominatorTree(
if (new_idom_index != kNoDominator if (new_idom_index != kNoDominator
&& dominators->at(i) != new_idom_index) { && dominators->at(i) != new_idom_index) {
(*dominators)[i] = new_idom_index; (*dominators)[i] = new_idom_index;
changed = true; ++changed;
Vector<HeapGraphEdge> children = entries[i]->children(); Vector<HeapGraphEdge> children = entries[i]->children();
for (int j = 0; j < children.length(); ++j) { for (int j = 0; j < children.length(); ++j) {
affected[children[j].to()->ordered_index()] = true; affected[children[j].to()->ordered_index()] = true;
} }
} }
} }
int remaining = entries_length - changed;
ASSERT(remaining >= 0);
progress_counter_ = base_progress_counter + remaining;
if (!ProgressReport(true)) return false;
} }
return true; return true;
} }
...@@ -3359,19 +3364,21 @@ bool HeapSnapshotGenerator::ApproximateRetainedSizes() { ...@@ -3359,19 +3364,21 @@ bool HeapSnapshotGenerator::ApproximateRetainedSizes() {
// As for the dominators tree we only know parent nodes, not // As for the dominators tree we only know parent nodes, not
// children, to sum up total sizes we "bubble" node's self size // children, to sum up total sizes we "bubble" node's self size
// adding it to all of its parents. // adding it to all of its parents.
List<HeapEntry*>& entries = *snapshot_->entries(); for (int i = 0; i < snapshot_->entries()->length(); ++i) {
for (int i = 0; i < entries.length(); ++i) { HeapEntry* entry = snapshot_->entries()->at(i);
HeapEntry* entry = entries[i];
entry->set_retained_size(entry->self_size()); entry->set_retained_size(entry->self_size());
} }
for (int i = 0; i < entries.length(); ++i) { for (int i = 0;
HeapEntry* entry = entries[i]; i < snapshot_->entries()->length();
++i, ProgressStep()) {
HeapEntry* entry = snapshot_->entries()->at(i);
int entry_size = entry->self_size(); int entry_size = entry->self_size();
for (HeapEntry* dominator = entry->dominator(); for (HeapEntry* dominator = entry->dominator();
dominator != entry; dominator != entry;
entry = dominator, dominator = entry->dominator()) { entry = dominator, dominator = entry->dominator()) {
dominator->add_retained_size(entry_size); dominator->add_retained_size(entry_size);
} }
if (!ProgressReport()) return false;
} }
return true; return true;
} }
......
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