Index: src/heap/incremental-marking.cc |
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc |
index 2fe52906255592175fe1afd020f2b15fa2577e21..d3e4b99981d16c60ebee697f22d0834f39e340f6 100644 |
--- a/src/heap/incremental-marking.cc |
+++ b/src/heap/incremental-marking.cc |
@@ -1069,6 +1069,13 @@ size_t IncrementalMarking::StepSizeToMakeProgress() { |
// target step count are chosen based on benchmarks. |
const int kRampUpIntervalMs = 300; |
const size_t kTargetStepCount = 128; |
+ const size_t kTargetStepCountAtOOM = 16; |
+ size_t oom_slack = heap()->new_space()->Capacity() + 64 * MB; |
+ |
+ if (heap()->IsCloseToOutOfMemory(oom_slack)) { |
+ return heap()->PromotedSpaceSizeOfObjects() / kTargetStepCountAtOOM; |
+ } |
+ |
size_t step_size = Max(initial_old_generation_size_ / kTargetStepCount, |
IncrementalMarking::kAllocatedThreshold); |
double time_passed_ms = |