Index: src/heap/gc-idle-time-handler.cc |
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc |
index 83e95acc0526f5c46740b1e8ddc4f32619577a14..5ff4017c233f071b742974b9fcf242609de03de3 100644 |
--- a/src/heap/gc-idle-time-handler.cc |
+++ b/src/heap/gc-idle-time-handler.cc |
@@ -1,9 +1,6 @@ |
// Copyright 2014 the V8 project authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include <climits> |
- |
-#include "src/v8.h" |
#include "src/heap/gc-idle-time-handler.h" |
@@ -14,8 +11,8 @@ namespace internal { |
const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; |
-intptr_t GCIdleTimeHandler::EstimateMarkingStepSize( |
- int idle_time_in_ms, intptr_t marking_speed_in_bytes_per_ms) { |
+size_t GCIdleTimeHandler::EstimateMarkingStepSize( |
+ size_t idle_time_in_ms, size_t marking_speed_in_bytes_per_ms) { |
DCHECK(idle_time_in_ms > 0); |
if (marking_speed_in_bytes_per_ms == 0) { |
@@ -23,15 +20,17 @@ intptr_t GCIdleTimeHandler::EstimateMarkingStepSize( |
GCIdleTimeHandler::kInitialConservativeMarkingSpeed; |
} |
- intptr_t marking_step_size = marking_speed_in_bytes_per_ms * idle_time_in_ms; |
- if (static_cast<intptr_t>(marking_step_size / idle_time_in_ms) != |
- marking_speed_in_bytes_per_ms) { |
+ size_t marking_step_size = marking_speed_in_bytes_per_ms * idle_time_in_ms; |
+ if (marking_step_size / marking_speed_in_bytes_per_ms != idle_time_in_ms) { |
// In the case of an overflow we return maximum marking step size. |
- return INT_MAX; |
+ return GCIdleTimeHandler::kMaximumMarkingStepSize; |
} |
- return static_cast<intptr_t>(marking_step_size * |
- GCIdleTimeHandler::kConservativeTimeRatio); |
+ if (marking_step_size > kMaximumMarkingStepSize) |
+ return kMaximumMarkingStepSize; |
+ |
+ return static_cast<size_t>(marking_step_size * |
+ GCIdleTimeHandler::kConservativeTimeRatio); |
} |
} |
} |