Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Unified Diff: src/heap/scavenge-job.cc

Issue 1841043002: Represent speed in GCTracer functions as double instead of int. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/scavenge-job.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/heap/scavenge-job.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698