Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: src/heap/incremental-marking.cc

Issue 629903003: Check if there is still time before finalizing an incremental collection. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/incremental-marking.cc
diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
index d72423a60aa81619516404c2995ebc26df4e60a2..b38d85906ac426f9463a5593827851ba85ff39dc 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) {}
@@ -892,24 +893,27 @@ void IncrementalMarking::SpeedUp() {
}
-void IncrementalMarking::Step(intptr_t allocated_bytes, CompletionAction action,
- bool force_marking) {
+intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
+ CompletionAction action,
+ ForceMarkingAction marking,
+ ForceCompletionAction completion) {
if (heap_->gc_state() != Heap::NOT_IN_GC || !FLAG_incremental_marking ||
!FLAG_incremental_marking_steps ||
(state_ != SWEEPING && state_ != MARKING)) {
- return;
+ return 0;
}
allocated_ += allocated_bytes;
- if (!force_marking && allocated_ < kAllocatedThreshold &&
+ if (marking == DO_NOT_FORCE_MARKING && allocated_ < kAllocatedThreshold &&
write_barriers_invoked_since_last_step_ <
kWriteBarriersInvokedThreshold) {
- return;
+ return 0;
}
- if (state_ == MARKING && no_marking_scope_depth_ > 0) return;
+ if (state_ == MARKING && no_marking_scope_depth_ > 0) return 0;
+ intptr_t bytes_processed = 0;
{
HistogramTimerScope incremental_marking_scope(
heap_->isolate()->counters()->gc_incremental_marking());
@@ -930,7 +934,6 @@ void IncrementalMarking::Step(intptr_t allocated_bytes, CompletionAction action,
write_barriers_invoked_since_last_step_ = 0;
bytes_scanned_ += bytes_to_process;
- intptr_t bytes_processed = 0;
if (state_ == SWEEPING) {
if (heap_->mark_compact_collector()->sweeping_in_progress() &&
@@ -943,7 +946,14 @@ 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);
+ if (marking_deque_.IsEmpty()) {
+ if (completion == FORCE_COMPLETION ||
+ IsIdleMarkingDelayCounterLimitReached()) {
+ MarkingComplete(action);
+ } else {
+ IncrementIdleMarkingDelayCounter();
+ }
+ }
}
steps_count_++;
@@ -959,6 +969,7 @@ void IncrementalMarking::Step(intptr_t allocated_bytes, CompletionAction action,
// process the marking deque.
heap_->tracer()->AddIncrementalMarkingStep(duration, bytes_processed);
}
+ return bytes_processed;
}
@@ -978,5 +989,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
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/mark-compact.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698