Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 344441dfdb4bd3cc7287bc0ba5f384af7833cff1..e77ab6b58d3b550363fe4ed094a6821db7e4f194 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -264,6 +264,10 @@ GarbageCollector Heap::SelectGarbageCollector(AllocationSpace space, |
return MARK_COMPACTOR; |
} |
+ if (incremental_marking()->NeedsFinalization()) { |
+ return MARK_COMPACTOR; |
+ } |
+ |
// Is there enough space left in OLD to guarantee that a scavenge can |
// succeed? |
// |
@@ -5297,12 +5301,16 @@ void Heap::DampenOldGenerationAllocationLimit(size_t old_gen_size, |
// major GC. It happens when the old generation allocation limit is reached and |
// - either we need to optimize for memory usage, |
// - or the incremental marking is not in progress and we cannot start it. |
-bool Heap::ShouldExpandOldGenerationOnAllocationFailure() { |
+bool Heap::ShouldExpandOldGenerationOnSlowAllocation() { |
if (always_allocate() || OldGenerationSpaceAvailable() > 0) return true; |
// We reached the old generation allocation limit. |
if (ShouldOptimizeForMemoryUsage()) return false; |
+ if (incremental_marking()->NeedsFinalization()) { |
+ return false; |
+ } |
+ |
if (incremental_marking()->IsStopped() && |
IncrementalMarkingLimitReached() == IncrementalMarkingLimit::kNoLimit) { |
// We cannot start incremental marking. |