OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/heap/incremental-marking.h" | 7 #include "src/heap/incremental-marking.h" |
8 | 8 |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 IncrementalMarkingRootMarkingVisitor visitor(this); | 538 IncrementalMarkingRootMarkingVisitor visitor(this); |
539 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 539 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
540 | 540 |
541 // Ready to start incremental marking. | 541 // Ready to start incremental marking. |
542 if (FLAG_trace_incremental_marking) { | 542 if (FLAG_trace_incremental_marking) { |
543 PrintF("[IncrementalMarking] Running\n"); | 543 PrintF("[IncrementalMarking] Running\n"); |
544 } | 544 } |
545 } | 545 } |
546 | 546 |
547 | 547 |
548 void IncrementalMarking::MarkObjectGroups() { | 548 void IncrementalMarking::MarkObjectGroups() { |
Hannes Payer (out of office)
2015/03/16 12:09:24
Should we have an upper bound on of how often this
| |
549 DCHECK(FLAG_overapproximate_weak_closure); | 549 DCHECK(FLAG_overapproximate_weak_closure); |
550 DCHECK(!weak_closure_was_overapproximated_); | 550 DCHECK(!weak_closure_was_overapproximated_); |
551 | 551 |
552 GCTracer::Scope gc_scope(heap_->tracer(), | 552 int old_marking_deque_top = |
553 GCTracer::Scope::MC_INCREMENTAL_WEAKCLOSURE); | 553 heap_->mark_compact_collector()->marking_deque()->top(); |
554 | 554 |
555 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); | 555 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); |
556 | 556 |
557 IncrementalMarkingRootMarkingVisitor visitor(this); | 557 IncrementalMarkingRootMarkingVisitor visitor(this); |
558 heap_->isolate()->global_handles()->IterateObjectGroups( | 558 heap_->isolate()->global_handles()->IterateObjectGroups( |
559 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); | 559 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); |
560 | 560 |
561 int marking_progress = | |
562 abs(old_marking_deque_top - | |
563 heap_->mark_compact_collector()->marking_deque()->top()); | |
564 | |
565 if (marking_progress < FLAG_min_progress_during_object_groups_marking) { | |
566 weak_closure_was_overapproximated_ = true; | |
567 } | |
568 | |
561 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); | 569 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); |
562 heap_->isolate()->global_handles()->RemoveObjectGroups(); | 570 heap_->isolate()->global_handles()->RemoveObjectGroups(); |
563 | |
564 weak_closure_was_overapproximated_ = true; | |
565 } | 571 } |
566 | 572 |
567 | 573 |
568 void IncrementalMarking::PrepareForScavenge() { | 574 void IncrementalMarking::PrepareForScavenge() { |
569 if (!IsMarking()) return; | 575 if (!IsMarking()) return; |
570 NewSpacePageIterator it(heap_->new_space()->FromSpaceStart(), | 576 NewSpacePageIterator it(heap_->new_space()->FromSpaceStart(), |
571 heap_->new_space()->FromSpaceEnd()); | 577 heap_->new_space()->FromSpaceEnd()); |
572 while (it.has_next()) { | 578 while (it.has_next()) { |
573 Bitmap::Clear(it.next()); | 579 Bitmap::Clear(it.next()); |
574 } | 580 } |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1024 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
1019 idle_marking_delay_counter_++; | 1025 idle_marking_delay_counter_++; |
1020 } | 1026 } |
1021 | 1027 |
1022 | 1028 |
1023 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1029 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1024 idle_marking_delay_counter_ = 0; | 1030 idle_marking_delay_counter_ = 0; |
1025 } | 1031 } |
1026 } | 1032 } |
1027 } // namespace v8::internal | 1033 } // namespace v8::internal |
OLD | NEW |