| 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 "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #include "incremental-marking.h" | 7 #include "incremental-marking.h" |
| 8 | 8 |
| 9 #include "code-stubs.h" | 9 #include "code-stubs.h" |
| 10 #include "compilation-cache.h" | 10 #include "compilation-cache.h" |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 if (is_compacting_) { | 790 if (is_compacting_) { |
| 791 LargeObjectIterator it(heap_->lo_space()); | 791 LargeObjectIterator it(heap_->lo_space()); |
| 792 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { | 792 for (HeapObject* obj = it.Next(); obj != NULL; obj = it.Next()) { |
| 793 Page* p = Page::FromAddress(obj->address()); | 793 Page* p = Page::FromAddress(obj->address()); |
| 794 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 794 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| 795 p->ClearFlag(Page::RESCAN_ON_EVACUATION); | 795 p->ClearFlag(Page::RESCAN_ON_EVACUATION); |
| 796 } | 796 } |
| 797 } | 797 } |
| 798 } | 798 } |
| 799 } | 799 } |
| 800 heap_->isolate()->stack_guard()->Continue(GC_REQUEST); | 800 heap_->isolate()->stack_guard()->ClearGC(); |
| 801 state_ = STOPPED; | 801 state_ = STOPPED; |
| 802 is_compacting_ = false; | 802 is_compacting_ = false; |
| 803 } | 803 } |
| 804 | 804 |
| 805 | 805 |
| 806 void IncrementalMarking::Finalize() { | 806 void IncrementalMarking::Finalize() { |
| 807 Hurry(); | 807 Hurry(); |
| 808 state_ = STOPPED; | 808 state_ = STOPPED; |
| 809 is_compacting_ = false; | 809 is_compacting_ = false; |
| 810 heap_->new_space()->LowerInlineAllocationLimit(0); | 810 heap_->new_space()->LowerInlineAllocationLimit(0); |
| 811 IncrementalMarking::set_should_hurry(false); | 811 IncrementalMarking::set_should_hurry(false); |
| 812 ResetStepCounters(); | 812 ResetStepCounters(); |
| 813 PatchIncrementalMarkingRecordWriteStubs(heap_, | 813 PatchIncrementalMarkingRecordWriteStubs(heap_, |
| 814 RecordWriteStub::STORE_BUFFER_ONLY); | 814 RecordWriteStub::STORE_BUFFER_ONLY); |
| 815 DeactivateIncrementalWriteBarrier(); | 815 DeactivateIncrementalWriteBarrier(); |
| 816 ASSERT(marking_deque_.IsEmpty()); | 816 ASSERT(marking_deque_.IsEmpty()); |
| 817 heap_->isolate()->stack_guard()->Continue(GC_REQUEST); | 817 heap_->isolate()->stack_guard()->ClearGC(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 | 820 |
| 821 void IncrementalMarking::MarkingComplete(CompletionAction action) { | 821 void IncrementalMarking::MarkingComplete(CompletionAction action) { |
| 822 state_ = COMPLETE; | 822 state_ = COMPLETE; |
| 823 // We will set the stack guard to request a GC now. This will mean the rest | 823 // We will set the stack guard to request a GC now. This will mean the rest |
| 824 // of the GC gets performed as soon as possible (we can't do a GC here in a | 824 // of the GC gets performed as soon as possible (we can't do a GC here in a |
| 825 // record-write context). If a few things get allocated between now and then | 825 // record-write context). If a few things get allocated between now and then |
| 826 // that shouldn't make us do a scavenge and keep being incremental, so we set | 826 // that shouldn't make us do a scavenge and keep being incremental, so we set |
| 827 // the should-hurry flag to indicate that there can't be much work left to do. | 827 // the should-hurry flag to indicate that there can't be much work left to do. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 bytes_scanned_ = 0; | 992 bytes_scanned_ = 0; |
| 993 write_barriers_invoked_since_last_step_ = 0; | 993 write_barriers_invoked_since_last_step_ = 0; |
| 994 } | 994 } |
| 995 | 995 |
| 996 | 996 |
| 997 int64_t IncrementalMarking::SpaceLeftInOldSpace() { | 997 int64_t IncrementalMarking::SpaceLeftInOldSpace() { |
| 998 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); | 998 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 } } // namespace v8::internal | 1001 } } // namespace v8::internal |
| OLD | NEW |