Index: src/heap/incremental-marking.cc |
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc |
index d72423a60aa81619516404c2995ebc26df4e60a2..c3f60f4bc66950f6ffbdc533b2a6b56bd5a953c6 100644 |
--- a/src/heap/incremental-marking.cc |
+++ b/src/heap/incremental-marking.cc |
@@ -27,6 +27,7 @@ IncrementalMarking::IncrementalMarking(Heap* heap) |
should_hurry_(false), |
marking_speed_(0), |
allocated_(0), |
+ idle_marking_delay_counter_(0), |
no_marking_scope_depth_(0), |
unscanned_bytes_of_large_object_(0) {} |
@@ -893,7 +894,7 @@ void IncrementalMarking::SpeedUp() { |
void IncrementalMarking::Step(intptr_t allocated_bytes, CompletionAction action, |
- bool force_marking) { |
+ bool force_marking, bool force_completion) { |
if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking || |
!FLAG_incremental_marking_steps || |
(state_ != SWEEPING && state_ != MARKING)) { |
@@ -943,7 +944,11 @@ void IncrementalMarking::Step(intptr_t allocated_bytes, CompletionAction action, |
} |
} else if (state_ == MARKING) { |
bytes_processed = ProcessMarkingDeque(bytes_to_process); |
- if (marking_deque_.IsEmpty()) MarkingComplete(action); |
+ IncrementIdleMarkingDelayCounter(); |
Erik Corry Chromium.org
2014/10/06 14:56:47
If we increment this every time we do a step, then
Hannes Payer (out of office)
2014/10/07 13:41:11
Uff, good catch. We should just increment the coun
|
+ if (marking_deque_.IsEmpty() && |
+ (force_completion || IsIdleMarkingDelayCounterLimitReached())) { |
+ MarkingComplete(action); |
+ } |
} |
steps_count_++; |
@@ -978,5 +983,20 @@ void IncrementalMarking::ResetStepCounters() { |
int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
} |
+ |
+ |
+bool IncrementalMarking::IsIdleMarkingDelayCounterLimitReached() { |
+ return idle_marking_delay_counter_ >= kMaxIdleMarkingDelayCounter; |
+} |
+ |
+ |
+void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
+ idle_marking_delay_counter_++; |
+} |
+ |
+ |
+void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
+ idle_marking_delay_counter_ = 0; |
+} |
} |
} // namespace v8::internal |