Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index 3f3d591025ce5522b99ff474f5e6d5561de47c2e..6455ee066cbe0d84de1cf89af33ada3bfe1d31e7 100644 |
| --- a/src/heap/heap.cc |
| +++ b/src/heap/heap.cc |
| @@ -68,9 +68,9 @@ Heap::Heap() |
| survived_since_last_expansion_(0), |
| sweep_generation_(0), |
| always_allocate_scope_depth_(0), |
| - contexts_disposed_(0), |
| global_ic_age_(0), |
| flush_monomorphic_ics_(false), |
| + last_notify_context_disposed_(0.0), |
| scan_on_scavenge_pages_(0), |
| new_space_(this), |
| old_pointer_space_(NULL), |
| @@ -858,14 +858,26 @@ bool Heap::CollectGarbage(GarbageCollector collector, const char* gc_reason, |
| } |
| -int Heap::NotifyContextDisposed() { |
| +void Heap::NotifyContextDisposed() { |
| + double current_notify_context_disposed = base::OS::TimeCurrentMillis(); |
| if (isolate()->concurrent_recompilation_enabled()) { |
| // Flush the queued recompilation tasks. |
| isolate()->optimizing_compiler_thread()->Flush(); |
| } |
| flush_monomorphic_ics_ = true; |
| AgeInlineCaches(); |
| - return ++contexts_disposed_; |
| + if (last_notify_context_disposed_ > 0.0 && |
| + (current_notify_context_disposed - last_notify_context_disposed_ < |
| + static_cast<double>(kNotifyContextDisposedFullGCLimitInMS))) { |
| + CollectAllGarbage(kReduceMemoryFootprintMask, |
| + "notify contexts disposed at high rate"); |
| + } |
| + |
| + // After context disposal there is likely a lot of garbage remaining, reset |
| + // the idle notification counters in order to allow more idle notifcations. |
| + StartIdleRound(); |
| + |
| + last_notify_context_disposed_ = base::OS::TimeCurrentMillis(); |
| } |
| @@ -4302,33 +4314,6 @@ bool Heap::IdleNotification(int hint) { |
| HistogramTimerScope idle_notification_scope( |
| isolate_->counters()->gc_idle_notification()); |
| - if (contexts_disposed_ > 0) { |
| - contexts_disposed_ = 0; |
| - int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
| - if (hint >= mark_sweep_time && !FLAG_expose_gc && |
| - incremental_marking()->IsStopped()) { |
| - HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| - CollectAllGarbage(kReduceMemoryFootprintMask, |
| - "idle notification: contexts disposed"); |
| - } else { |
| - AdvanceIdleIncrementalMarking(step_size); |
| - } |
| - |
| - // After context disposal there is likely a lot of garbage remaining, reset |
| - // the idle notification counters in order to trigger more incremental GCs |
| - // on subsequent idle notifications. |
| - StartIdleRound(); |
| - return false; |
| - } |
| - |
| - // 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. |
| - // An incremental GC progresses as follows: |
| - // 1. many incremental marking steps, |
| - // 2. one old space mark-sweep-compact, |
| - // Use mark-sweep-compact events to count incremental GCs in a round. |
| - |
| if (mark_sweeps_since_idle_round_started_ >= kMaxMarkSweepsInIdleRound) { |
| if (EnoughGarbageSinceLastIdleRound()) { |
| StartIdleRound(); |
| @@ -4337,10 +4322,15 @@ bool Heap::IdleNotification(int hint) { |
| } |
| } |
| - int remaining_mark_sweeps = |
| - kMaxMarkSweepsInIdleRound - mark_sweeps_since_idle_round_started_; |
| - |
| - if (incremental_marking()->IsStopped()) { |
| + int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000); |
| + // Perform a full gc if there is enough idle time. |
| + if (hint >= mark_sweep_time) { |
| + CollectAllGarbage(kReduceMemoryFootprintMask, |
|
jochen (gone - plz use gerrit)
2014/08/07 09:14:51
this is a somewhat new behavior, because previousl
Hannes Payer (out of office)
2014/08/07 10:53:30
Yes, this is different. Note that before we were j
|
| + "idle notification: finalize idle round"); |
| + mark_sweeps_since_idle_round_started_++; |
| + } else if (incremental_marking()->IsStopped()) { |
| + int remaining_mark_sweeps = |
| + kMaxMarkSweepsInIdleRound - mark_sweeps_since_idle_round_started_; |
| // If there are no more than two GCs left in this idle round and we are |
| // allowed to do a full GC, then make those GCs full in order to compact |
| // the code space. |