Fix early exit condition for LowMemoryNotification.

When computing next_gc_likely_to_collect_more do not take into account already
free nodes in PostGarbageCollectionProcessing.

This reduces the number of full GC in LowMemoryNotification from 7 to ~2.

R=mstarzinger@chromium.org

Review URL: https://chromiumcodereview.appspot.com/18834002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15550 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
ulan@chromium.org 2013-07-08 11:51:34 +00:00
parent 8f72d99ab1
commit 7ab931ee62

View File

@ -634,6 +634,11 @@ bool GlobalHandles::PostGarbageCollectionProcessing(
for (int i = 0; i < new_space_nodes_.length(); ++i) { for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i]; Node* node = new_space_nodes_[i];
ASSERT(node->is_in_new_space_list()); ASSERT(node->is_in_new_space_list());
if (!node->IsRetainer()) {
// Free nodes do not have weak callbacks. Do not use them to compute
// the next_gc_likely_to_collect_more.
continue;
}
// Skip dependent handles. Their weak callbacks might expect to be // Skip dependent handles. Their weak callbacks might expect to be
// called between two global garbage collection callbacks which // called between two global garbage collection callbacks which
// are not called for minor collections. // are not called for minor collections.
@ -656,6 +661,11 @@ bool GlobalHandles::PostGarbageCollectionProcessing(
} }
} else { } else {
for (NodeIterator it(this); !it.done(); it.Advance()) { for (NodeIterator it(this); !it.done(); it.Advance()) {
if (!it.node()->IsRetainer()) {
// Free nodes do not have weak callbacks. Do not use them to compute
// the next_gc_likely_to_collect_more.
continue;
}
it.node()->clear_partially_dependent(); it.node()->clear_partially_dependent();
if (it.node()->PostGarbageCollectionProcessing(isolate_)) { if (it.node()->PostGarbageCollectionProcessing(isolate_)) {
if (initial_post_gc_processing_count != post_gc_processing_count_) { if (initial_post_gc_processing_count != post_gc_processing_count_) {