From 953bf90bcbce3b5e8780ea306f3f2cc7dcc7ddf3 Mon Sep 17 00:00:00 2001 From: hpayer Date: Fri, 22 May 2015 06:10:18 -0700 Subject: [PATCH] Idle old generation limit is used when allocation rate is low. BUG= Review URL: https://codereview.chromium.org/1153763003 Cr-Commit-Position: refs/heads/master@{#28593} --- src/heap/heap.cc | 26 +++++++++++--------------- src/heap/heap.h | 2 +- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 74f4ac1..09f4cc7 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -4602,23 +4602,13 @@ bool Heap::TryFinalizeIdleIncrementalMarking( } -GCIdleTimeHandler::HeapState Heap::ComputeHeapState(bool reduce_memory) { +GCIdleTimeHandler::HeapState Heap::ComputeHeapState() { GCIdleTimeHandler::HeapState heap_state; heap_state.contexts_disposed = contexts_disposed_; heap_state.contexts_disposal_rate = tracer()->ContextDisposalRateInMilliseconds(); heap_state.size_of_objects = static_cast(SizeOfObjects()); 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 (reduce_memory) { - limit = idle_old_generation_allocation_limit_; - } - - heap_state.can_start_incremental_marking = - incremental_marking()->CanBeActivated() && - HeapIsFullEnoughToStartIncrementalMarking(limit) && - !mark_compact_collector()->sweeping_in_progress(); heap_state.sweeping_in_progress = mark_compact_collector()->sweeping_in_progress(); heap_state.sweeping_completed = @@ -4638,6 +4628,15 @@ GCIdleTimeHandler::HeapState Heap::ComputeHeapState(bool reduce_memory) { tracer()->NewSpaceAllocationThroughputInBytesPerMillisecond(); heap_state.current_new_space_allocation_throughput_in_bytes_per_ms = tracer()->CurrentNewSpaceAllocationThroughputInBytesPerMillisecond(); + intptr_t limit = old_generation_allocation_limit_; + if (HasLowAllocationRate( + heap_state.current_new_space_allocation_throughput_in_bytes_per_ms)) { + limit = idle_old_generation_allocation_limit_; + } + heap_state.can_start_incremental_marking = + incremental_marking()->CanBeActivated() && + HeapIsFullEnoughToStartIncrementalMarking(limit) && + !mark_compact_collector()->sweeping_in_progress(); return heap_state; } @@ -4773,7 +4772,6 @@ bool Heap::IdleNotification(int idle_time_in_ms) { bool Heap::IdleNotification(double deadline_in_seconds) { CHECK(HasBeenSetUp()); - static const double kLastGCTimeTreshold = 1000; double deadline_in_ms = deadline_in_seconds * static_cast(base::Time::kMillisecondsPerSecond); @@ -4784,14 +4782,12 @@ bool Heap::IdleNotification(double deadline_in_seconds) { bool is_long_idle_notification = static_cast(idle_time_in_ms) > GCIdleTimeHandler::kMaxFrameRenderingIdleTime; - bool has_low_gc_activity = (start_ms - last_gc_time_) > kLastGCTimeTreshold; if (is_long_idle_notification) { tracer()->SampleNewSpaceAllocation(start_ms, NewSpaceAllocationCounter()); } - GCIdleTimeHandler::HeapState heap_state = - ComputeHeapState(is_long_idle_notification && has_low_gc_activity); + GCIdleTimeHandler::HeapState heap_state = ComputeHeapState(); GCIdleTimeAction action = gc_idle_time_handler_.Compute(idle_time_in_ms, heap_state); diff --git a/src/heap/heap.h b/src/heap/heap.h index 742aa4b..d398599 100644 --- a/src/heap/heap.h +++ b/src/heap/heap.h @@ -2135,7 +2135,7 @@ class Heap { double idle_time_in_ms, size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms); - GCIdleTimeHandler::HeapState ComputeHeapState(bool reduce_memory); + GCIdleTimeHandler::HeapState ComputeHeapState(); bool PerformIdleTimeAction(GCIdleTimeAction action, GCIdleTimeHandler::HeapState heap_state, -- 2.7.4