From 89db44a94e423d8264f14d7178f684c33eb0674d Mon Sep 17 00:00:00 2001 From: "hpayer@chromium.org" Date: Mon, 15 Sep 2014 15:15:23 +0000 Subject: [PATCH] Use an upper bound for marking time estimation in idle notification. BUG= R=ulan@chromium.org Review URL: https://codereview.chromium.org/571913003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23954 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap/gc-idle-time-handler-unittest.cc | 6 +++--- src/heap/gc-idle-time-handler.cc | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/heap/gc-idle-time-handler-unittest.cc b/src/heap/gc-idle-time-handler-unittest.cc index b9989a8..56ff2f3 100644 --- a/src/heap/gc-idle-time-handler-unittest.cc +++ b/src/heap/gc-idle-time-handler-unittest.cc @@ -32,8 +32,8 @@ class GCIdleTimeHandlerTest : public ::testing::Test { } static const size_t kSizeOfObjects = 100 * MB; - static const size_t kMarkCompactSpeed = 100 * KB; - static const size_t kMarkingSpeed = 100 * KB; + static const size_t kMarkCompactSpeed = 200 * KB; + static const size_t kMarkingSpeed = 200 * KB; private: GCIdleTimeHandler handler_; @@ -87,7 +87,7 @@ TEST(GCIdleTimeHandler, EstimateMarkCompactTimeInitial) { TEST(GCIdleTimeHandler, EstimateMarkCompactTimeNonZero) { size_t size = 100 * MB; - size_t speed = 10 * KB; + size_t speed = 1 * MB; size_t time = GCIdleTimeHandler::EstimateMarkCompactTime(size, speed); EXPECT_EQ(size / speed, time); } diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc index bd174c0..cd7efe0 100644 --- a/src/heap/gc-idle-time-handler.cc +++ b/src/heap/gc-idle-time-handler.cc @@ -10,7 +10,7 @@ namespace v8 { namespace internal { const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; -const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000000; +const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; const size_t GCIdleTimeHandler::kMinTimeForFinalizeSweeping = 100; const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7; const int GCIdleTimeHandler::kIdleScavengeThreshold = 5; @@ -78,9 +78,10 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(size_t idle_time_in_ms, } } if (heap_state.incremental_marking_stopped) { - if (idle_time_in_ms >= EstimateMarkCompactTime( - heap_state.size_of_objects, - heap_state.mark_compact_speed_in_bytes_per_ms) || + size_t estimated_time_in_ms = + EstimateMarkCompactTime(heap_state.size_of_objects, + heap_state.mark_compact_speed_in_bytes_per_ms); + if (idle_time_in_ms >= estimated_time_in_ms || (heap_state.size_of_objects < kSmallHeapSize && heap_state.contexts_disposed > 0)) { // If there are no more than two GCs left in this idle round and we are -- 2.7.4