Index: src/heap/scavenge-job.cc |
diff --git a/src/heap/scavenge-job.cc b/src/heap/scavenge-job.cc |
index 52ba97a9c7bab9f64769f031e328903d95a271f0..d89c9453c50bb19da5aca78cda23a544ce4ce139 100644 |
--- a/src/heap/scavenge-job.cc |
+++ b/src/heap/scavenge-job.cc |
@@ -23,8 +23,8 @@ void ScavengeJob::IdleTask::RunInternal(double deadline_in_seconds) { |
static_cast<double>(base::Time::kMillisecondsPerSecond); |
double start_ms = heap->MonotonicallyIncreasingTimeInMs(); |
double idle_time_in_ms = deadline_in_ms - start_ms; |
- size_t scavenge_speed_in_bytes_per_ms = |
- static_cast<size_t>(heap->tracer()->ScavengeSpeedInBytesPerMillisecond()); |
+ double scavenge_speed_in_bytes_per_ms = |
+ heap->tracer()->ScavengeSpeedInBytesPerMillisecond(); |
size_t new_space_size = heap->new_space()->Size(); |
size_t new_space_capacity = heap->new_space()->Capacity(); |
@@ -42,9 +42,8 @@ void ScavengeJob::IdleTask::RunInternal(double deadline_in_seconds) { |
} |
} |
- |
bool ScavengeJob::ReachedIdleAllocationLimit( |
- size_t scavenge_speed_in_bytes_per_ms, size_t new_space_size, |
+ double scavenge_speed_in_bytes_per_ms, size_t new_space_size, |
size_t new_space_capacity) { |
if (scavenge_speed_in_bytes_per_ms == 0) { |
scavenge_speed_in_bytes_per_ms = kInitialScavengeSpeedInBytesPerMs; |
@@ -52,27 +51,24 @@ bool ScavengeJob::ReachedIdleAllocationLimit( |
// Set the allocation limit to the number of bytes we can scavenge in an |
// average idle task. |
- size_t allocation_limit = kAverageIdleTimeMs * scavenge_speed_in_bytes_per_ms; |
+ double allocation_limit = kAverageIdleTimeMs * scavenge_speed_in_bytes_per_ms; |
// Keep the limit smaller than the new space capacity. |
allocation_limit = |
- Min(allocation_limit, |
- static_cast<size_t>(new_space_capacity * |
- kMaxAllocationLimitAsFractionOfNewSpace)); |
+ Min<double>(allocation_limit, |
+ new_space_capacity * kMaxAllocationLimitAsFractionOfNewSpace); |
// Adjust the limit to take into account bytes that will be allocated until |
- // the next check. |
- allocation_limit = allocation_limit < kBytesAllocatedBeforeNextIdleTask |
- ? 0 |
- : allocation_limit - kBytesAllocatedBeforeNextIdleTask; |
- // Keep the limit large enough to avoid scavenges in tiny new space. |
- allocation_limit = Max(allocation_limit, kMinAllocationLimit); |
+ // the next check and keep the limit large enough to avoid scavenges in tiny |
+ // new space. |
+ allocation_limit = |
+ Max<double>(allocation_limit - kBytesAllocatedBeforeNextIdleTask, |
+ kMinAllocationLimit); |
return allocation_limit <= new_space_size; |
} |
- |
bool ScavengeJob::EnoughIdleTimeForScavenge( |
- double idle_time_in_ms, size_t scavenge_speed_in_bytes_per_ms, |
+ double idle_time_in_ms, double scavenge_speed_in_bytes_per_ms, |
size_t new_space_size) { |
if (scavenge_speed_in_bytes_per_ms == 0) { |
scavenge_speed_in_bytes_per_ms = kInitialScavengeSpeedInBytesPerMs; |