Commit 57049242 authored by hpayer's avatar hpayer Committed by Commit bot

[heap] Make sure that we transition to MARKING when we are finalize SWEEPING.

BUG=chromium:601204
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#35336}
parent 40290edf
......@@ -71,14 +71,12 @@ void IncrementalMarkingJob::ScheduleDelayedTask(Heap* heap) {
IncrementalMarkingJob::IdleTask::Progress IncrementalMarkingJob::IdleTask::Step(
Heap* heap, double deadline_in_ms) {
IncrementalMarking* incremental_marking = heap->incremental_marking();
MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector();
if (incremental_marking->IsStopped()) {
return kDone;
}
if (mark_compact_collector->sweeping_in_progress()) {
if (mark_compact_collector->IsSweepingCompleted()) {
mark_compact_collector->EnsureSweepingCompleted();
}
if (incremental_marking->IsSweeping()) {
incremental_marking->FinalizeSweeping();
// TODO(hpayer): We can continue here if enough idle time is left.
return kMoreWork;
}
const double remaining_idle_time_in_ms =
......
......@@ -1107,6 +1107,18 @@ void IncrementalMarking::SpeedUp() {
}
}
void IncrementalMarking::FinalizeSweeping() {
DCHECK(state_ == SWEEPING);
if (heap_->mark_compact_collector()->sweeping_in_progress() &&
(heap_->mark_compact_collector()->IsSweepingCompleted() ||
!FLAG_concurrent_sweeping)) {
heap_->mark_compact_collector()->EnsureSweepingCompleted();
}
if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
bytes_scanned_ = 0;
StartMarking();
}
}
intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
CompletionAction action,
......@@ -1156,17 +1168,11 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
bytes_scanned_ += bytes_to_process;
// TODO(hpayer): Do not account for sweeping finalization while marking.
if (state_ == SWEEPING) {
if (heap_->mark_compact_collector()->sweeping_in_progress() &&
(heap_->mark_compact_collector()->IsSweepingCompleted() ||
!FLAG_concurrent_sweeping)) {
heap_->mark_compact_collector()->EnsureSweepingCompleted();
}
if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
bytes_scanned_ = 0;
StartMarking();
}
FinalizeSweeping();
}
if (state_ == MARKING) {
bytes_processed = ProcessMarkingDeque(bytes_to_process);
if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) {
......
......@@ -68,6 +68,8 @@ class IncrementalMarking {
inline bool IsStopped() { return state() == STOPPED; }
inline bool IsSweeping() { return state() == SWEEPING; }
INLINE(bool IsMarking()) { return state() >= MARKING; }
inline bool IsMarkingIncomplete() { return state() == MARKING; }
......@@ -135,6 +137,8 @@ class IncrementalMarking {
// incremental marking to be postponed.
static const size_t kMaxIdleMarkingDelayCounter = 3;
void FinalizeSweeping();
void OldSpaceStep(intptr_t allocated);
intptr_t Step(intptr_t allocated, CompletionAction action,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment