Chromium Code Reviews| 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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 IncrementalMarkingRootMarkingVisitor visitor(this); | 552 IncrementalMarkingRootMarkingVisitor visitor(this); |
| 553 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); | 553 heap_->IterateStrongRoots(&visitor, VISIT_ONLY_STRONG); |
| 554 | 554 |
| 555 // Ready to start incremental marking. | 555 // Ready to start incremental marking. |
| 556 if (FLAG_trace_incremental_marking) { | 556 if (FLAG_trace_incremental_marking) { |
| 557 PrintF("[IncrementalMarking] Running\n"); | 557 PrintF("[IncrementalMarking] Running\n"); |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 | 560 |
| 561 | 561 |
| 562 void IncrementalMarking::MarkObjectGroups() { | |
| 563 DCHECK(FLAG_overapproximate_weak_closure); | |
| 564 DCHECK(!weak_closure_was_overapproximated_); | |
| 565 | |
| 566 GCTracer::Scope gc_scope(heap_->tracer(), | |
| 567 GCTracer::Scope::MC_INCREMENTAL_WEAKCLOSURE); | |
| 568 | |
| 569 heap_->mark_compact_collector()->MarkImplicitRefGroups(); | |
|
jochen (gone - plz use gerrit)
2015/03/13 09:59:27
this might be wrong too, as it just marks the obje
| |
| 570 | |
| 571 IncrementalMarkingRootMarkingVisitor visitor(this); | |
| 572 heap_->isolate()->global_handles()->IterateObjectGroups( | |
| 573 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); | |
| 574 | |
| 575 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); | |
| 576 heap_->isolate()->global_handles()->RemoveObjectGroups(); | |
| 577 | |
| 578 weak_closure_was_overapproximated_ = true; | |
| 579 } | |
| 580 | |
| 581 | |
| 562 void IncrementalMarking::PrepareForScavenge() { | 582 void IncrementalMarking::PrepareForScavenge() { |
| 563 if (!IsMarking()) return; | 583 if (!IsMarking()) return; |
| 564 NewSpacePageIterator it(heap_->new_space()->FromSpaceStart(), | 584 NewSpacePageIterator it(heap_->new_space()->FromSpaceStart(), |
| 565 heap_->new_space()->FromSpaceEnd()); | 585 heap_->new_space()->FromSpaceEnd()); |
| 566 while (it.has_next()) { | 586 while (it.has_next()) { |
| 567 Bitmap::Clear(it.next()); | 587 Bitmap::Clear(it.next()); |
| 568 } | 588 } |
| 569 } | 589 } |
| 570 | 590 |
| 571 | 591 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 heap_->isolate()->stack_guard()->ClearGC(); | 790 heap_->isolate()->stack_guard()->ClearGC(); |
| 771 } | 791 } |
| 772 | 792 |
| 773 | 793 |
| 774 void IncrementalMarking::OverApproximateWeakClosure() { | 794 void IncrementalMarking::OverApproximateWeakClosure() { |
| 775 DCHECK(FLAG_overapproximate_weak_closure); | 795 DCHECK(FLAG_overapproximate_weak_closure); |
| 776 DCHECK(!weak_closure_was_overapproximated_); | 796 DCHECK(!weak_closure_was_overapproximated_); |
| 777 if (FLAG_trace_incremental_marking) { | 797 if (FLAG_trace_incremental_marking) { |
| 778 PrintF("[IncrementalMarking] requesting weak closure overapproximation.\n"); | 798 PrintF("[IncrementalMarking] requesting weak closure overapproximation.\n"); |
| 779 } | 799 } |
| 780 set_should_hurry(true); | |
| 781 request_type_ = OVERAPPROXIMATION; | 800 request_type_ = OVERAPPROXIMATION; |
| 782 heap_->isolate()->stack_guard()->RequestGC(); | 801 heap_->isolate()->stack_guard()->RequestGC(); |
| 783 } | 802 } |
| 784 | 803 |
| 785 | 804 |
| 786 void IncrementalMarking::MarkingComplete(CompletionAction action) { | 805 void IncrementalMarking::MarkingComplete(CompletionAction action) { |
| 787 state_ = COMPLETE; | 806 state_ = COMPLETE; |
| 788 // We will set the stack guard to request a GC now. This will mean the rest | 807 // We will set the stack guard to request a GC now. This will mean the rest |
| 789 // of the GC gets performed as soon as possible (we can't do a GC here in a | 808 // of the GC gets performed as soon as possible (we can't do a GC here in a |
| 790 // record-write context). If a few things get allocated between now and then | 809 // record-write context). If a few things get allocated between now and then |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1003 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1022 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1004 idle_marking_delay_counter_++; | 1023 idle_marking_delay_counter_++; |
| 1005 } | 1024 } |
| 1006 | 1025 |
| 1007 | 1026 |
| 1008 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1027 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1009 idle_marking_delay_counter_ = 0; | 1028 idle_marking_delay_counter_ = 0; |
| 1010 } | 1029 } |
| 1011 } | 1030 } |
| 1012 } // namespace v8::internal | 1031 } // namespace v8::internal |
| OLD | NEW |