Chromium Code Reviews| Index: src/heap/heap.cc |
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
| index e9379ac5658c9653cb21023f180d567a2364c068..a4611d91a2f17c9103e657cb6a17725532e94bb9 100644 |
| --- a/src/heap/heap.cc |
| +++ b/src/heap/heap.cc |
| @@ -4504,17 +4504,8 @@ void Heap::MakeHeapIterable() { |
| } |
| -void Heap::IdleMarkCompact(const char* message) { |
| - bool uncommit = false; |
| - if (gc_count_at_last_idle_gc_ == gc_count_) { |
| - // No GC since the last full GC, the mutator is probably not active. |
| - isolate_->compilation_cache()->Clear(); |
| - uncommit = true; |
| - } |
| - CollectAllGarbage(kReduceMemoryFootprintMask, message); |
| - gc_idle_time_handler_.NotifyIdleMarkCompact(); |
| - gc_count_at_last_idle_gc_ = gc_count_; |
| - if (uncommit) { |
| +void Heap::ReduceNewSpaceSize(bool long_idle_time) { |
|
rmcilroy
2015/04/28 11:19:09
nit - would be clearer as is_long_idle_notificatio
Hannes Payer (out of office)
2015/04/28 11:27:47
Done.
|
| + if (long_idle_time) { |
| new_space_.Shrink(); |
| UncommitFromSpace(); |
| } |
| @@ -4522,7 +4513,7 @@ void Heap::IdleMarkCompact(const char* message) { |
| bool Heap::TryFinalizeIdleIncrementalMarking( |
| - double idle_time_in_ms, size_t size_of_objects, |
| + bool long_idle_time, double idle_time_in_ms, size_t size_of_objects, |
|
rmcilroy
2015/04/28 11:19:08
ditto
Hannes Payer (out of office)
2015/04/28 11:27:46
Done.
|
| size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
| if (FLAG_overapproximate_weak_closure && |
| (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
| @@ -4539,6 +4530,7 @@ bool Heap::TryFinalizeIdleIncrementalMarking( |
| static_cast<size_t>(idle_time_in_ms), size_of_objects, |
| final_incremental_mark_compact_speed_in_bytes_per_ms))) { |
| CollectAllGarbage(kNoGCFlags, "idle notification: finalize incremental"); |
| + ReduceNewSpaceSize(long_idle_time); |
| return true; |
| } |
| return false; |
| @@ -4567,6 +4559,8 @@ bool Heap::IdleNotification(double deadline_in_seconds) { |
| HistogramTimerScope idle_notification_scope( |
| isolate_->counters()->gc_idle_notification()); |
| double idle_time_in_ms = deadline_in_ms - MonotonicallyIncreasingTimeInMs(); |
| + bool long_idle_time = static_cast<size_t>(idle_time_in_ms) > |
|
rmcilroy
2015/04/28 11:19:08
nit - would be clearer as is_long_idle_notificatio
Hannes Payer (out of office)
2015/04/28 11:27:46
Done.
|
| + GCIdleTimeHandler::kMaxFrameRenderingIdleTime; |
| GCIdleTimeHandler::HeapState heap_state; |
| heap_state.contexts_disposed = contexts_disposed_; |
| @@ -4576,8 +4570,7 @@ bool Heap::IdleNotification(double deadline_in_seconds) { |
| heap_state.incremental_marking_stopped = incremental_marking()->IsStopped(); |
| // TODO(ulan): Start incremental marking only for large heaps. |
| intptr_t limit = old_generation_allocation_limit_; |
| - if (static_cast<size_t>(idle_time_in_ms) > |
| - GCIdleTimeHandler::kMaxFrameRenderingIdleTime) { |
| + if (long_idle_time) { |
| limit = idle_old_generation_allocation_limit_; |
| } |
| @@ -4632,24 +4625,31 @@ bool Heap::IdleNotification(double deadline_in_seconds) { |
| !mark_compact_collector_.marking_deque()->IsEmpty()); |
| if (remaining_idle_time_in_ms > 0.0) { |
| action.additional_work = TryFinalizeIdleIncrementalMarking( |
| - remaining_idle_time_in_ms, heap_state.size_of_objects, |
| + long_idle_time, remaining_idle_time_in_ms, |
| + heap_state.size_of_objects, |
| heap_state.final_incremental_mark_compact_speed_in_bytes_per_ms); |
| } |
| break; |
| } |
| case DO_FULL_GC: { |
| + if (long_idle_time && gc_count_at_last_idle_gc_ == gc_count) { |
| + isolate_->compilation_cache()->Clear(); |
| + } |
| if (contexts_disposed_) { |
| HistogramTimerScope scope(isolate_->counters()->gc_context()); |
| CollectAllGarbage(kNoGCFlags, "idle notification: contexts disposed"); |
| - gc_idle_time_handler_.NotifyIdleMarkCompact(); |
| - gc_count_at_last_idle_gc_ = gc_count_; |
| } else { |
| - IdleMarkCompact("idle notification: finalize idle round"); |
| + CollectAllGarbage(kReduceMemoryFootprintMask, |
| + "idle notification: finalize idle round"); |
| } |
| + gc_count_at_last_idle_gc_ = gc_count_; |
| + ReduceNewSpaceSize(long_idle_time); |
| + gc_idle_time_handler_.NotifyIdleMarkCompact(); |
| break; |
| } |
| case DO_SCAVENGE: |
| CollectGarbage(NEW_SPACE, "idle notification: scavenge"); |
| + ReduceNewSpaceSize(idle_time_in_ms); |
|
rmcilroy
2015/04/28 11:19:08
You are passing idle_time_in_ms to this ReduceNewS
Hannes Payer (out of office)
2015/04/28 11:27:46
long_idle_time should be there. thanks, done
|
| break; |
| case DO_FINALIZE_SWEEPING: |
| mark_compact_collector()->EnsureSweepingCompleted(); |