| 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/heap/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
| 9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
| 10 #include "src/heap/gc-tracer.h" | 10 #include "src/heap/gc-tracer.h" |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 480 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
| 481 StartMarking(); | 481 StartMarking(); |
| 482 } else { | 482 } else { |
| 483 if (FLAG_trace_incremental_marking) { | 483 if (FLAG_trace_incremental_marking) { |
| 484 PrintF("[IncrementalMarking] Start sweeping.\n"); | 484 PrintF("[IncrementalMarking] Start sweeping.\n"); |
| 485 } | 485 } |
| 486 state_ = SWEEPING; | 486 state_ = SWEEPING; |
| 487 } | 487 } |
| 488 | 488 |
| 489 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); | 489 heap_->LowerInlineAllocationLimit(kAllocatedThreshold); |
| 490 incremental_marking_job()->Start(heap_); | 490 incremental_marking_job()->Start(heap_); |
| 491 } | 491 } |
| 492 | 492 |
| 493 | 493 |
| 494 void IncrementalMarking::StartMarking() { | 494 void IncrementalMarking::StartMarking() { |
| 495 if (FLAG_trace_incremental_marking) { | 495 if (FLAG_trace_incremental_marking) { |
| 496 PrintF("[IncrementalMarking] Start marking\n"); | 496 PrintF("[IncrementalMarking] Start marking\n"); |
| 497 } | 497 } |
| 498 | 498 |
| 499 is_compacting_ = !FLAG_never_compact && | 499 is_compacting_ = !FLAG_never_compact && |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); | 731 context = Context::cast(context)->get(Context::NEXT_CONTEXT_LINK); |
| 732 } | 732 } |
| 733 } | 733 } |
| 734 | 734 |
| 735 | 735 |
| 736 void IncrementalMarking::Stop() { | 736 void IncrementalMarking::Stop() { |
| 737 if (IsStopped()) return; | 737 if (IsStopped()) return; |
| 738 if (FLAG_trace_incremental_marking) { | 738 if (FLAG_trace_incremental_marking) { |
| 739 PrintF("[IncrementalMarking] Stopping.\n"); | 739 PrintF("[IncrementalMarking] Stopping.\n"); |
| 740 } | 740 } |
| 741 heap_->new_space()->LowerInlineAllocationLimit(0); | 741 heap_->ResetInlineAllocationLimit(); |
| 742 IncrementalMarking::set_should_hurry(false); | 742 IncrementalMarking::set_should_hurry(false); |
| 743 ResetStepCounters(); | 743 ResetStepCounters(); |
| 744 if (IsMarking()) { | 744 if (IsMarking()) { |
| 745 PatchIncrementalMarkingRecordWriteStubs(heap_, | 745 PatchIncrementalMarkingRecordWriteStubs(heap_, |
| 746 RecordWriteStub::STORE_BUFFER_ONLY); | 746 RecordWriteStub::STORE_BUFFER_ONLY); |
| 747 DeactivateIncrementalWriteBarrier(); | 747 DeactivateIncrementalWriteBarrier(); |
| 748 | 748 |
| 749 if (is_compacting_) { | 749 if (is_compacting_) { |
| 750 LargeObjectIterator it(heap_->lo_space()); | 750 LargeObjectIterator it(heap_->lo_space()); |
| 751 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 751 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
| 752 Page* p = Page::FromAddress(obj->address()); | 752 Page* p = Page::FromAddress(obj->address()); |
| 753 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 753 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| 754 p->ClearFlag(Page::RESCAN_ON_EVACUATION); | 754 p->ClearFlag(Page::RESCAN_ON_EVACUATION); |
| 755 } | 755 } |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 heap_->isolate()->stack_guard()->ClearGC(); | 759 heap_->isolate()->stack_guard()->ClearGC(); |
| 760 state_ = STOPPED; | 760 state_ = STOPPED; |
| 761 is_compacting_ = false; | 761 is_compacting_ = false; |
| 762 } | 762 } |
| 763 | 763 |
| 764 | 764 |
| 765 void IncrementalMarking::Finalize() { | 765 void IncrementalMarking::Finalize() { |
| 766 Hurry(); | 766 Hurry(); |
| 767 state_ = STOPPED; | 767 state_ = STOPPED; |
| 768 is_compacting_ = false; | 768 is_compacting_ = false; |
| 769 heap_->new_space()->LowerInlineAllocationLimit(0); | 769 heap_->ResetInlineAllocationLimit(); |
| 770 IncrementalMarking::set_should_hurry(false); | 770 IncrementalMarking::set_should_hurry(false); |
| 771 ResetStepCounters(); | 771 ResetStepCounters(); |
| 772 PatchIncrementalMarkingRecordWriteStubs(heap_, | 772 PatchIncrementalMarkingRecordWriteStubs(heap_, |
| 773 RecordWriteStub::STORE_BUFFER_ONLY); | 773 RecordWriteStub::STORE_BUFFER_ONLY); |
| 774 DeactivateIncrementalWriteBarrier(); | 774 DeactivateIncrementalWriteBarrier(); |
| 775 DCHECK(heap_->mark_compact_collector()->marking_deque()->IsEmpty()); | 775 DCHECK(heap_->mark_compact_collector()->marking_deque()->IsEmpty()); |
| 776 heap_->isolate()->stack_guard()->ClearGC(); | 776 heap_->isolate()->stack_guard()->ClearGC(); |
| 777 } | 777 } |
| 778 | 778 |
| 779 | 779 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 1016 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
| 1017 idle_marking_delay_counter_++; | 1017 idle_marking_delay_counter_++; |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 | 1020 |
| 1021 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1021 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
| 1022 idle_marking_delay_counter_ = 0; | 1022 idle_marking_delay_counter_ = 0; |
| 1023 } | 1023 } |
| 1024 } // namespace internal | 1024 } // namespace internal |
| 1025 } // namespace v8 | 1025 } // namespace v8 |
| OLD | NEW |