Chromium Code Reviews| Index: src/heap/incremental-marking.cc |
| diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc |
| index 3e5e6c0697cd505bf49880d407891ef8f938458a..f0b409d81b0f0ac21f26bccc3bc60ccaa1ceb91d 100644 |
| --- a/src/heap/incremental-marking.cc |
| +++ b/src/heap/incremental-marking.cc |
| @@ -42,8 +42,8 @@ IncrementalMarking::IncrementalMarking(Heap* heap) |
| no_marking_scope_depth_(0), |
| unscanned_bytes_of_large_object_(0), |
| was_activated_(false), |
| - weak_closure_was_overapproximated_(false), |
| - weak_closure_approximation_rounds_(0), |
| + finalize_marking_completed_(false), |
| + incremental_marking_finalization_rounds_(0), |
| request_type_(COMPLETE_MARKING) {} |
| @@ -623,33 +623,53 @@ void IncrementalMarking::StartMarking() { |
| } |
| -void IncrementalMarking::MarkObjectGroups() { |
| - DCHECK(FLAG_overapproximate_weak_closure); |
| - DCHECK(!weak_closure_was_overapproximated_); |
| +void IncrementalMarking::MarkRoots() { |
| + DCHECK(FLAG_finalize_marking_incrementally); |
| + DCHECK(!finalize_marking_completed_); |
| DCHECK(IsMarking()); |
| - int old_marking_deque_top = |
| - heap_->mark_compact_collector()->marking_deque()->top(); |
| + IncrementalMarkingRootMarkingVisitor visitor(this); |
| + heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
| +} |
| - heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); |
| + |
| +void IncrementalMarking::MarkObjectGroups() { |
| + DCHECK(FLAG_finalize_marking_incrementally); |
| + DCHECK(!finalize_marking_completed_); |
| + DCHECK(IsMarking()); |
| IncrementalMarkingRootMarkingVisitor visitor(this); |
| + heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); |
| heap_->isolate()->global_handles()->IterateObjectGroups( |
| &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); |
| + heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); |
| + heap_->isolate()->global_handles()->RemoveObjectGroups(); |
| +} |
| + |
| + |
| +void IncrementalMarking::FinalizeIncrementally() { |
|
ulan
2015/10/28 10:36:19
We are not tracking this pause in any of the histo
Hannes Payer (out of office)
2015/10/28 11:42:54
Good point! I will do that in a separate CL.
|
| + DCHECK(FLAG_finalize_marking_incrementally); |
| + DCHECK(!finalize_marking_completed_); |
| + DCHECK(IsMarking()); |
| + |
| + int old_marking_deque_top = |
| + heap_->mark_compact_collector()->marking_deque()->top(); |
| + |
| + MarkRoots(); |
| + MarkObjectGroups(); |
| int marking_progress = |
| abs(old_marking_deque_top - |
| - heap_->mark_compact_collector()->marking_deque()->top()); |
| - |
| - ++weak_closure_approximation_rounds_; |
| - if ((weak_closure_approximation_rounds_ >= |
| - FLAG_max_object_groups_marking_rounds) || |
| - (marking_progress < FLAG_min_progress_during_object_groups_marking)) { |
| - weak_closure_was_overapproximated_ = true; |
| + heap_->mark_compact_collector()->marking_deque()->top()) / |
| + kPointerSize; |
| + |
| + ++incremental_marking_finalization_rounds_; |
| + if ((incremental_marking_finalization_rounds_ >= |
| + FLAG_max_incremental_marking_finalization_rounds) || |
| + (marking_progress < |
| + FLAG_min_progress_during_incremental_marking_finalization)) { |
| + finalize_marking_completed_ = true; |
| } |
| - |
| - heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); |
| - heap_->isolate()->global_handles()->RemoveObjectGroups(); |
| } |
| @@ -860,13 +880,15 @@ void IncrementalMarking::Finalize() { |
| } |
| -void IncrementalMarking::OverApproximateWeakClosure(CompletionAction action) { |
| - DCHECK(FLAG_overapproximate_weak_closure); |
| - DCHECK(!weak_closure_was_overapproximated_); |
| +void IncrementalMarking::FinalizeMarking(CompletionAction action) { |
| + DCHECK(FLAG_finalize_marking_incrementally); |
| + DCHECK(!finalize_marking_completed_); |
| if (FLAG_trace_incremental_marking) { |
| - PrintF("[IncrementalMarking] requesting weak closure overapproximation.\n"); |
| + PrintF( |
| + "[IncrementalMarking] requesting finalization of incremental " |
| + "marking.\n"); |
| } |
| - request_type_ = OVERAPPROXIMATION; |
| + request_type_ = FINALIZATION; |
| if (action == GC_VIA_STACK_GUARD) { |
| heap_->isolate()->stack_guard()->RequestGC(); |
| } |
| @@ -893,8 +915,8 @@ void IncrementalMarking::MarkingComplete(CompletionAction action) { |
| void IncrementalMarking::Epilogue() { |
| was_activated_ = false; |
| - weak_closure_was_overapproximated_ = false; |
| - weak_closure_approximation_rounds_ = 0; |
| + finalize_marking_completed_ = false; |
| + incremental_marking_finalization_rounds_ = 0; |
| } |
| @@ -1072,9 +1094,9 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes, |
| if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) { |
| if (completion == FORCE_COMPLETION || |
| IsIdleMarkingDelayCounterLimitReached()) { |
| - if (FLAG_overapproximate_weak_closure && |
| - !weak_closure_was_overapproximated_) { |
| - OverApproximateWeakClosure(action); |
| + if (FLAG_finalize_marking_incrementally && |
| + !finalize_marking_completed_) { |
| + FinalizeMarking(action); |
| } else { |
| MarkingComplete(action); |
| } |