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

Unified Diff: src/heap/gc-idle-time-handler.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/gc-idle-time-handler.h ('k') | src/heap/gc-tracer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f09ca1bc3023b32821775d59a38e4547214a1324..972dfa6e5cf9ef12165f1b685c63a02e0d321d18 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -12,7 +12,6 @@ namespace v8 {
namespace internal {
const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9;
-const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000;
const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000;
const double GCIdleTimeHandler::kHighContextDisposalRate = 100;
const size_t GCIdleTimeHandler::kMinTimeForOverApproximatingWeakClosureInMs = 1;
@@ -47,82 +46,50 @@ void GCIdleTimeHeapState::Print() {
PrintF("incremental_marking_stopped=%d ", incremental_marking_stopped);
}
-
size_t GCIdleTimeHandler::EstimateMarkingStepSize(
- size_t idle_time_in_ms, size_t marking_speed_in_bytes_per_ms) {
+ double idle_time_in_ms, double marking_speed_in_bytes_per_ms) {
DCHECK(idle_time_in_ms > 0);
if (marking_speed_in_bytes_per_ms == 0) {
marking_speed_in_bytes_per_ms = kInitialConservativeMarkingSpeed;
}
- 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.
+ double marking_step_size = marking_speed_in_bytes_per_ms * idle_time_in_ms;
+ if (marking_step_size >= kMaximumMarkingStepSize) {
return kMaximumMarkingStepSize;
}
-
- if (marking_step_size > kMaximumMarkingStepSize)
- return kMaximumMarkingStepSize;
-
return static_cast<size_t>(marking_step_size * kConservativeTimeRatio);
}
-
-size_t GCIdleTimeHandler::EstimateMarkCompactTime(
- size_t size_of_objects, size_t mark_compact_speed_in_bytes_per_ms) {
- // TODO(hpayer): Be more precise about the type of mark-compact event. It
- // makes a huge difference if compaction is happening.
- if (mark_compact_speed_in_bytes_per_ms == 0) {
- mark_compact_speed_in_bytes_per_ms = kInitialConservativeMarkCompactSpeed;
- }
- size_t result = size_of_objects / mark_compact_speed_in_bytes_per_ms;
- return Min(result, kMaxMarkCompactTimeInMs);
-}
-
-
-size_t GCIdleTimeHandler::EstimateFinalIncrementalMarkCompactTime(
+double GCIdleTimeHandler::EstimateFinalIncrementalMarkCompactTime(
size_t size_of_objects,
- size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
+ double final_incremental_mark_compact_speed_in_bytes_per_ms) {
if (final_incremental_mark_compact_speed_in_bytes_per_ms == 0) {
final_incremental_mark_compact_speed_in_bytes_per_ms =
kInitialConservativeFinalIncrementalMarkCompactSpeed;
}
- size_t result =
+ double result =
size_of_objects / final_incremental_mark_compact_speed_in_bytes_per_ms;
- return Min(result, kMaxFinalIncrementalMarkCompactTimeInMs);
-}
-
-
-bool GCIdleTimeHandler::ShouldDoMarkCompact(
- size_t idle_time_in_ms, size_t size_of_objects,
- size_t mark_compact_speed_in_bytes_per_ms) {
- return idle_time_in_ms >= kMaxScheduledIdleTime &&
- idle_time_in_ms >=
- EstimateMarkCompactTime(size_of_objects,
- mark_compact_speed_in_bytes_per_ms);
+ return Min<double>(result, kMaxFinalIncrementalMarkCompactTimeInMs);
}
-
bool GCIdleTimeHandler::ShouldDoContextDisposalMarkCompact(
int contexts_disposed, double contexts_disposal_rate) {
return contexts_disposed > 0 && contexts_disposal_rate > 0 &&
contexts_disposal_rate < kHighContextDisposalRate;
}
-
bool GCIdleTimeHandler::ShouldDoFinalIncrementalMarkCompact(
- size_t idle_time_in_ms, size_t size_of_objects,
- size_t final_incremental_mark_compact_speed_in_bytes_per_ms) {
+ double idle_time_in_ms, size_t size_of_objects,
+ double final_incremental_mark_compact_speed_in_bytes_per_ms) {
return idle_time_in_ms >=
EstimateFinalIncrementalMarkCompactTime(
size_of_objects,
final_incremental_mark_compact_speed_in_bytes_per_ms);
}
-
bool GCIdleTimeHandler::ShouldDoOverApproximateWeakClosure(
- size_t idle_time_in_ms) {
+ double idle_time_in_ms) {
// TODO(jochen): Estimate the time it will take to build the object groups.
return idle_time_in_ms >= kMinTimeForOverApproximatingWeakClosureInMs;
}
« no previous file with comments | « src/heap/gc-idle-time-handler.h ('k') | src/heap/gc-tracer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698