| Index: src/heap/incremental-marking.cc
|
| diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
|
| index c82fc83ff7fc361eb730dd09f14620578027f35f..e87f1a96337ab81e36511778ef82441b7d6a2e06 100644
|
| --- a/src/heap/incremental-marking.cc
|
| +++ b/src/heap/incremental-marking.cc
|
| @@ -568,7 +568,7 @@ void IncrementalMarking::StartMarking() {
|
| IncrementalMarkingRootMarkingVisitor visitor(this);
|
| heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG);
|
|
|
| - if (FLAG_black_allocation) {
|
| + if (FLAG_black_allocation && !heap()->ShouldReduceMemory()) {
|
| StartBlackAllocation();
|
| }
|
|
|
| @@ -591,9 +591,11 @@ void IncrementalMarking::StartBlackAllocation() {
|
| }
|
|
|
| void IncrementalMarking::FinishBlackAllocation() {
|
| - black_allocation_ = false;
|
| - if (FLAG_trace_incremental_marking) {
|
| - PrintF("[IncrementalMarking] Black allocation finished\n");
|
| + if (black_allocation_) {
|
| + black_allocation_ = false;
|
| + if (FLAG_trace_incremental_marking) {
|
| + PrintF("[IncrementalMarking] Black allocation finished\n");
|
| + }
|
| }
|
| }
|
|
|
| @@ -767,6 +769,12 @@ void IncrementalMarking::FinalizeIncrementally() {
|
| (marking_progress <
|
| FLAG_min_progress_during_incremental_marking_finalization)) {
|
| finalize_marking_completed_ = true;
|
| +
|
| + // If black allocation was not enabled earlier, start black allocation
|
| + // here.
|
| + if (FLAG_black_allocation && !black_allocation_) {
|
| + StartBlackAllocation();
|
| + }
|
| }
|
| }
|
|
|
|
|