[heap] Respect idle deadline in AdvanceIncrementalMarking more carefully.

Review URL: https://codereview.chromium.org/1855943002

Cr-Commit-Position: refs/heads/master@{#35288}
This commit is contained in:
hpayer 2016-04-06 02:06:04 -07:00 committed by Commit bot
parent 6c2bb8389d
commit 0eb53167f4
2 changed files with 11 additions and 10 deletions

View File

@ -113,6 +113,10 @@ class GCIdleTimeHandler {
// Incremental marking step time.
static const size_t kIncrementalMarkingStepTimeInMs = 1;
// Minimum incremental marking step time.
static const size_t kMinIncrementalMarkingStepTimeInMs =
kIncrementalMarkingStepTimeInMs + 1;
static const size_t kMinTimeForOverApproximatingWeakClosureInMs;
// Number of times we will return a Nothing action in the current mode

View File

@ -1024,20 +1024,17 @@ double IncrementalMarking::AdvanceIncrementalMarking(
heap()
->tracer()
->FinalIncrementalMarkCompactSpeedInBytesPerMillisecond());
double remaining_time_in_ms = 0.0;
intptr_t bytes_processed = 0;
do {
bytes_processed =
double remaining_time_in_ms =
deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs();
while (remaining_time_in_ms >=
GCIdleTimeHandler::kMinIncrementalMarkingStepTimeInMs) {
intptr_t bytes_processed =
Step(step_size_in_bytes, step_actions.completion_action,
step_actions.force_marking, step_actions.force_completion);
remaining_time_in_ms =
deadline_in_ms - heap()->MonotonicallyIncreasingTimeInMs();
} while (bytes_processed > 0 &&
remaining_time_in_ms >=
2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
!IsComplete() &&
!heap()->mark_compact_collector()->marking_deque()->IsEmpty());
if (bytes_processed == 0) break;
}
return remaining_time_in_ms;
}