From 89ba65fd4970130eea02b675e448a8219ae3d0dd Mon Sep 17 00:00:00 2001 From: ulan Date: Wed, 25 Mar 2015 08:59:28 -0700 Subject: [PATCH] Reland "Allow compaction when incremental marking is on." BUG=chromium:450824 LOG=NO Review URL: https://codereview.chromium.org/1038663002 Cr-Commit-Position: refs/heads/master@{#27451} --- src/heap/incremental-marking.cc | 14 ++++++-------- src/heap/incremental-marking.h | 6 ++---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc index 749fa5ef54..b3609e4adc 100644 --- a/src/heap/incremental-marking.cc +++ b/src/heap/incremental-marking.cc @@ -468,7 +468,7 @@ static void PatchIncrementalMarkingRecordWriteStubs( } -void IncrementalMarking::Start(CompactionFlag flag) { +void IncrementalMarking::Start() { if (FLAG_trace_incremental_marking) { PrintF("[IncrementalMarking] Start\n"); } @@ -483,7 +483,7 @@ void IncrementalMarking::Start(CompactionFlag flag) { was_activated_ = true; if (!heap_->mark_compact_collector()->sweeping_in_progress()) { - StartMarking(flag); + StartMarking(); } else { if (FLAG_trace_incremental_marking) { PrintF("[IncrementalMarking] Start sweeping.\n"); @@ -495,12 +495,12 @@ void IncrementalMarking::Start(CompactionFlag flag) { } -void IncrementalMarking::StartMarking(CompactionFlag flag) { +void IncrementalMarking::StartMarking() { if (FLAG_trace_incremental_marking) { PrintF("[IncrementalMarking] Start marking\n"); } - is_compacting_ = !FLAG_never_compact && (flag == ALLOW_COMPACTION) && + is_compacting_ = !FLAG_never_compact && heap_->mark_compact_collector()->StartCompaction( MarkCompactCollector::INCREMENTAL_COMPACTION); @@ -834,9 +834,7 @@ void IncrementalMarking::Epilogue() { void IncrementalMarking::OldSpaceStep(intptr_t allocated) { if (IsStopped() && ShouldActivate()) { - // TODO(hpayer): Let's play safe for now, but compaction should be - // in principle possible. - Start(PREVENT_COMPACTION); + Start(); } else { Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); } @@ -965,7 +963,7 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, } if (!heap_->mark_compact_collector()->sweeping_in_progress()) { bytes_scanned_ = 0; - StartMarking(PREVENT_COMPACTION); + StartMarking(); } } else if (state_ == MARKING) { bytes_processed = ProcessMarkingDeque(bytes_to_process); diff --git a/src/heap/incremental-marking.h b/src/heap/incremental-marking.h index 7d41cfef41..6a6f8c4abb 100644 --- a/src/heap/incremental-marking.h +++ b/src/heap/incremental-marking.h @@ -67,9 +67,7 @@ class IncrementalMarking { bool WasActivated(); - enum CompactionFlag { ALLOW_COMPACTION, PREVENT_COMPACTION }; - - void Start(CompactionFlag flag = ALLOW_COMPACTION); + void Start(); void Stop(); @@ -208,7 +206,7 @@ class IncrementalMarking { void ResetStepCounters(); - void StartMarking(CompactionFlag flag); + void StartMarking(); void ActivateIncrementalWriteBarrier(PagedSpace* space); static void ActivateIncrementalWriteBarrier(NewSpace* space);