Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 36995336a47b8caf948227f0a78fed275842720c..63e0ff0340585b32c51b6a34d05d65cdd8919134 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -4254,6 +4254,9 @@ void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) { |
bool Heap::IdleNotification(int hint) { |
+ // If incremental marking is off, we do not perform idle notification. |
+ if (!FLAG_incremental_marking) return true; |
jochen (gone - plz use gerrit)
2014/07/28 13:11:13
why not return false (meaning "no need to call aga
Hannes Payer (out of office)
2014/07/28 13:56:49
Return true means that "we are done".
|
+ |
// Hints greater than this value indicate that |
// the embedder is requesting a lot of GC work. |
const int kMaxHint = 1000; |
@@ -4290,10 +4293,6 @@ bool Heap::IdleNotification(int hint) { |
return false; |
} |
- if (!FLAG_incremental_marking || isolate_->serializer_enabled()) { |
- return IdleGlobalGC(); |
- } |
- |
// By doing small chunks of GC work in each IdleNotification, |
// perform a round of incremental GCs and after that wait until |
// the mutator creates enough garbage to justify a new round. |
@@ -4348,66 +4347,6 @@ bool Heap::IdleNotification(int hint) { |
} |
-bool Heap::IdleGlobalGC() { |
- static const int kIdlesBeforeScavenge = 4; |
- static const int kIdlesBeforeMarkSweep = 7; |
- static const int kIdlesBeforeMarkCompact = 8; |
- static const int kMaxIdleCount = kIdlesBeforeMarkCompact + 1; |
- static const unsigned int kGCsBetweenCleanup = 4; |
- |
- if (!last_idle_notification_gc_count_init_) { |
- last_idle_notification_gc_count_ = gc_count_; |
- last_idle_notification_gc_count_init_ = true; |
- } |
- |
- bool uncommit = true; |
- bool finished = false; |
- |
- // Reset the number of idle notifications received when a number of |
- // GCs have taken place. This allows another round of cleanup based |
- // on idle notifications if enough work has been carried out to |
- // provoke a number of garbage collections. |
- if (gc_count_ - last_idle_notification_gc_count_ < kGCsBetweenCleanup) { |
- number_idle_notifications_ = |
- Min(number_idle_notifications_ + 1, kMaxIdleCount); |
- } else { |
- number_idle_notifications_ = 0; |
- last_idle_notification_gc_count_ = gc_count_; |
- } |
- |
- if (number_idle_notifications_ == kIdlesBeforeScavenge) { |
- CollectGarbage(NEW_SPACE, "idle notification"); |
- new_space_.Shrink(); |
- last_idle_notification_gc_count_ = gc_count_; |
- } else if (number_idle_notifications_ == kIdlesBeforeMarkSweep) { |
- // Before doing the mark-sweep collections we clear the |
- // compilation cache to avoid hanging on to source code and |
- // generated code for cached functions. |
- isolate_->compilation_cache()->Clear(); |
- |
- CollectAllGarbage(kReduceMemoryFootprintMask, "idle notification"); |
- new_space_.Shrink(); |
- last_idle_notification_gc_count_ = gc_count_; |
- |
- } else if (number_idle_notifications_ == kIdlesBeforeMarkCompact) { |
- CollectAllGarbage(kReduceMemoryFootprintMask, "idle notification"); |
- new_space_.Shrink(); |
- last_idle_notification_gc_count_ = gc_count_; |
- number_idle_notifications_ = 0; |
- finished = true; |
- } else if (number_idle_notifications_ > kIdlesBeforeMarkCompact) { |
- // If we have received more than kIdlesBeforeMarkCompact idle |
- // notifications we do not perform any cleanup because we don't |
- // expect to gain much by doing so. |
- finished = true; |
- } |
- |
- if (uncommit) UncommitFromSpace(); |
- |
- return finished; |
-} |
- |
- |
#ifdef DEBUG |
void Heap::Print() { |