| Index: src/heap/incremental-marking.cc
|
| diff --git a/src/heap/incremental-marking.cc b/src/heap/incremental-marking.cc
|
| index a85d4a8489326ec84afcd2ca4191d45ebdda18fe..91f14160578e6af956ab72df64a7667adcaec769 100644
|
| --- a/src/heap/incremental-marking.cc
|
| +++ b/src/heap/incremental-marking.cc
|
| @@ -28,7 +28,9 @@ IncrementalMarking::IncrementalMarking(Heap* heap)
|
| idle_marking_delay_counter_(0),
|
| no_marking_scope_depth_(0),
|
| unscanned_bytes_of_large_object_(0),
|
| - was_activated_(false) {}
|
| + was_activated_(false),
|
| + weak_closure_was_overapproximated_(false),
|
| + request_type_(COMPLETE_MARKING) {}
|
|
|
|
|
| void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot,
|
| @@ -771,6 +773,18 @@ void IncrementalMarking::Finalize() {
|
| }
|
|
|
|
|
| +void IncrementalMarking::OverApproximateWeakClosure() {
|
| + DCHECK(FLAG_overapproximate_weak_closure);
|
| + DCHECK(!weak_closure_was_overapproximated_);
|
| + if (FLAG_trace_incremental_marking) {
|
| + PrintF("[IncrementalMarking] requesting weak closure overapproximation.\n");
|
| + }
|
| + set_should_hurry(true);
|
| + request_type_ = OVERAPPROXIMATION;
|
| + heap_->isolate()->stack_guard()->RequestGC();
|
| +}
|
| +
|
| +
|
| void IncrementalMarking::MarkingComplete(CompletionAction action) {
|
| state_ = COMPLETE;
|
| // We will set the stack guard to request a GC now. This will mean the rest
|
| @@ -783,12 +797,16 @@ void IncrementalMarking::MarkingComplete(CompletionAction action) {
|
| PrintF("[IncrementalMarking] Complete (normal).\n");
|
| }
|
| if (action == GC_VIA_STACK_GUARD) {
|
| + request_type_ = COMPLETE_MARKING;
|
| heap_->isolate()->stack_guard()->RequestGC();
|
| }
|
| }
|
|
|
|
|
| -void IncrementalMarking::Epilogue() { was_activated_ = false; }
|
| +void IncrementalMarking::Epilogue() {
|
| + was_activated_ = false;
|
| + weak_closure_was_overapproximated_ = false;
|
| +}
|
|
|
|
|
| void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
|
| @@ -931,7 +949,13 @@ intptr_t IncrementalMarking::Step(intptr_t allocated_bytes,
|
| if (heap_->mark_compact_collector()->marking_deque()->IsEmpty()) {
|
| if (completion == FORCE_COMPLETION ||
|
| IsIdleMarkingDelayCounterLimitReached()) {
|
| - MarkingComplete(action);
|
| + if (FLAG_overapproximate_weak_closure &&
|
| + !weak_closure_was_overapproximated_ &&
|
| + action == GC_VIA_STACK_GUARD) {
|
| + OverApproximateWeakClosure();
|
| + } else {
|
| + MarkingComplete(action);
|
| + }
|
| } else {
|
| IncrementIdleMarkingDelayCounter();
|
| }
|
|
|