Perform smaller marking steps incrementally in idle notification.

BUG=

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

Cr-Commit-Position: refs/heads/master@{#25607}
This commit is contained in:
hpayer 2014-12-02 03:24:58 -08:00 committed by Commit bot
parent 49859dc3bb
commit ee798e203f
3 changed files with 18 additions and 8 deletions

View File

@ -27,7 +27,8 @@ void GCIdleTimeAction::Print() {
PrintF("no action");
break;
case DO_INCREMENTAL_MARKING:
PrintF("incremental marking with step %" V8_PTR_PREFIX "d", parameter);
PrintF("incremental marking with step %" V8_PTR_PREFIX "d / ms",
parameter);
break;
case DO_SCAVENGE:
PrintF("scavenge");
@ -250,7 +251,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
return GCIdleTimeAction::Nothing();
}
size_t step_size = EstimateMarkingStepSize(
static_cast<size_t>(idle_time_in_ms),
static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
heap_state.incremental_marking_speed_in_bytes_per_ms);
return GCIdleTimeAction::IncrementalMarking(step_size);
}

View File

@ -125,6 +125,9 @@ class GCIdleTimeHandler {
// If contexts are disposed at a higher rate a full gc is triggered.
static const double kHighContextDisposalRate;
// Incremental marking step time.
static const size_t kIncrementalMarkingStepTimeInMs = 1;
class HeapState {
public:
void Print();

View File

@ -4489,12 +4489,18 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
if (incremental_marking()->IsStopped()) {
incremental_marking()->Start();
}
incremental_marking()->Step(action.parameter,
IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_MARKING,
IncrementalMarking::DO_NOT_FORCE_COMPLETION);
double remaining_idle_time_in_ms =
deadline_in_ms - MonotonicallyIncreasingTimeInMs();
double remaining_idle_time_in_ms = 0.0;
do {
incremental_marking()->Step(
action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
IncrementalMarking::FORCE_MARKING,
IncrementalMarking::DO_NOT_FORCE_COMPLETION);
remaining_idle_time_in_ms =
deadline_in_ms - MonotonicallyIncreasingTimeInMs();
} while (remaining_idle_time_in_ms >=
2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
!incremental_marking()->IsComplete() &&
!mark_compact_collector_.marking_deque()->IsEmpty());
if (remaining_idle_time_in_ms > 0.0) {
TryFinalizeIdleIncrementalMarking(
remaining_idle_time_in_ms, heap_state.size_of_objects,