Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 01546a8fc1f013371df7099698a025b0128b6405..a61c829436b56c39c07318074e5757a9135832eb 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -5308,7 +5308,7 @@ void Heap::DampenOldGenerationAllocationLimit(size_t old_gen_size, |
bool Heap::ShouldOptimizeForLoadTime() { |
return isolate()->rail_mode() == PERFORMANCE_LOAD && |
- PromotedTotalSize() < initial_old_generation_size_ && |
+ !AllocationLimitOvershotByLargeMargin() && |
MonotonicallyIncreasingTimeInMs() < |
isolate()->LoadStartTimeMs() + kMaxLoadTimeMs; |
} |
@@ -5360,9 +5360,13 @@ Heap::IncrementalMarkingLimit Heap::IncrementalMarkingLimitReached() { |
if (old_generation_space_available > new_space_->Capacity()) { |
return IncrementalMarkingLimit::kNoLimit; |
} |
- // We are close to the allocation limit. |
- // Choose between the hard and the soft limits. |
- if (old_generation_space_available == 0 || ShouldOptimizeForMemoryUsage()) { |
+ if (ShouldOptimizeForMemoryUsage()) { |
+ return IncrementalMarkingLimit::kHardLimit; |
+ } |
+ if (ShouldOptimizeForLoadTime()) { |
+ return IncrementalMarkingLimit::kNoLimit; |
+ } |
+ if (old_generation_space_available == 0) { |
return IncrementalMarkingLimit::kHardLimit; |
} |
return IncrementalMarkingLimit::kSoftLimit; |