Commit 97f74843 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Experimental change to idle notifications: Try to limit the

interactions between idle notifications for background tabs
and the context disposal GCs even further.
Review URL: http://codereview.chromium.org/698003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4062 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 800b6df2
...@@ -3076,14 +3076,7 @@ bool Heap::IdleNotification() { ...@@ -3076,14 +3076,7 @@ bool Heap::IdleNotification() {
static int number_idle_notifications = 0; static int number_idle_notifications = 0;
static int last_gc_count = gc_count_; static int last_gc_count = gc_count_;
if (!FLAG_expose_gc && (contexts_disposed_ > 0)) { bool uncommit = true;
HistogramTimerScope scope(&Counters::gc_context);
CollectAllGarbage(false);
ASSERT(contexts_disposed_ == 0);
last_gc_count = gc_count_;
return false;
}
bool finished = false; bool finished = false;
if (last_gc_count == gc_count_) { if (last_gc_count == gc_count_) {
...@@ -3094,7 +3087,12 @@ bool Heap::IdleNotification() { ...@@ -3094,7 +3087,12 @@ bool Heap::IdleNotification() {
} }
if (number_idle_notifications == kIdlesBeforeScavenge) { if (number_idle_notifications == kIdlesBeforeScavenge) {
if (contexts_disposed_ > 0) {
HistogramTimerScope scope(&Counters::gc_context);
CollectAllGarbage(false);
} else {
CollectGarbage(0, NEW_SPACE); CollectGarbage(0, NEW_SPACE);
}
new_space_.Shrink(); new_space_.Shrink();
last_gc_count = gc_count_; last_gc_count = gc_count_;
...@@ -3114,10 +3112,29 @@ bool Heap::IdleNotification() { ...@@ -3114,10 +3112,29 @@ bool Heap::IdleNotification() {
last_gc_count = gc_count_; last_gc_count = gc_count_;
number_idle_notifications = 0; number_idle_notifications = 0;
finished = true; finished = true;
} else if (contexts_disposed_ > 0) {
if (FLAG_expose_gc) {
contexts_disposed_ = 0;
} else {
HistogramTimerScope scope(&Counters::gc_context);
CollectAllGarbage(false);
last_gc_count = gc_count_;
}
// If this is the first idle notification, we reset the
// notification count to avoid letting idle notifications for
// context disposal garbage collections start a potentially too
// aggressive idle GC cycle.
if (number_idle_notifications <= 1) {
number_idle_notifications = 0;
uncommit = false;
}
} }
// Uncommit unused memory in new space. // Make sure that we have no pending context disposals and
Heap::UncommitFromSpace(); // conditionally uncommit from space.
ASSERT(contexts_disposed_ == 0);
if (uncommit) Heap::UncommitFromSpace();
return finished; return finished;
} }
......
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