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/mark-compact.h" | 5 #include "src/heap/mark-compact.h" |
6 | 6 |
7 #include "src/base/atomicops.h" | 7 #include "src/base/atomicops.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/base/sys-info.h" | 9 #include "src/base/sys-info.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 3765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3776 SlotsBuffer::SizeOfChain(p->slots_buffer())); | 3776 SlotsBuffer::SizeOfChain(p->slots_buffer())); |
3777 } | 3777 } |
3778 slots_buffer_allocator_->DeallocateChain(p->slots_buffer_address()); | 3778 slots_buffer_allocator_->DeallocateChain(p->slots_buffer_address()); |
3779 | 3779 |
3780 // Important: skip list should be cleared only after roots were updated | 3780 // Important: skip list should be cleared only after roots were updated |
3781 // because root iteration traverses the stack and might have to find | 3781 // because root iteration traverses the stack and might have to find |
3782 // code objects from non-updated pc pointing into evacuation candidate. | 3782 // code objects from non-updated pc pointing into evacuation candidate. |
3783 SkipList* list = p->skip_list(); | 3783 SkipList* list = p->skip_list(); |
3784 if (list != NULL) list->Clear(); | 3784 if (list != NULL) list->Clear(); |
3785 } | 3785 } |
| 3786 |
| 3787 if (p->IsEvacuationCandidate() && |
| 3788 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
| 3789 // Case where we've aborted compacting a page. Clear the flag here to |
| 3790 // avoid release the page later on. |
| 3791 p->ClearEvacuationCandidate(); |
| 3792 } |
| 3793 |
3786 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 3794 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
3787 if (FLAG_gc_verbose) { | 3795 if (FLAG_gc_verbose) { |
3788 PrintF("Sweeping 0x%" V8PRIxPTR " during evacuation.\n", | 3796 PrintF("Sweeping 0x%" V8PRIxPTR " during evacuation.\n", |
3789 reinterpret_cast<intptr_t>(p)); | 3797 reinterpret_cast<intptr_t>(p)); |
3790 } | 3798 } |
3791 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); | 3799 PagedSpace* space = static_cast<PagedSpace*>(p->owner()); |
3792 p->ClearFlag(MemoryChunk::RESCAN_ON_EVACUATION); | 3800 p->ClearFlag(MemoryChunk::RESCAN_ON_EVACUATION); |
3793 | 3801 |
3794 switch (space->identity()) { | 3802 switch (space->identity()) { |
3795 case OLD_SPACE: | 3803 case OLD_SPACE: |
(...skipping 10 matching lines...) Expand all Loading... |
3806 Sweep<SWEEP_AND_VISIT_LIVE_OBJECTS, SWEEP_ON_MAIN_THREAD, | 3814 Sweep<SWEEP_AND_VISIT_LIVE_OBJECTS, SWEEP_ON_MAIN_THREAD, |
3807 REBUILD_SKIP_LIST, IGNORE_FREE_SPACE>(space, NULL, p, | 3815 REBUILD_SKIP_LIST, IGNORE_FREE_SPACE>(space, NULL, p, |
3808 &updating_visitor); | 3816 &updating_visitor); |
3809 } | 3817 } |
3810 break; | 3818 break; |
3811 default: | 3819 default: |
3812 UNREACHABLE(); | 3820 UNREACHABLE(); |
3813 break; | 3821 break; |
3814 } | 3822 } |
3815 } | 3823 } |
3816 if (p->IsEvacuationCandidate() && | |
3817 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | |
3818 // Case where we've aborted compacting a page. Clear the flag here to | |
3819 // avoid release the page later on. | |
3820 p->ClearEvacuationCandidate(); | |
3821 } | |
3822 } | 3824 } |
3823 } | 3825 } |
3824 | 3826 |
3825 GCTracer::Scope gc_scope(heap()->tracer(), | 3827 GCTracer::Scope gc_scope(heap()->tracer(), |
3826 GCTracer::Scope::MC_UPDATE_MISC_POINTERS); | 3828 GCTracer::Scope::MC_UPDATE_MISC_POINTERS); |
3827 | 3829 |
3828 heap_->string_table()->Iterate(&updating_visitor); | 3830 heap_->string_table()->Iterate(&updating_visitor); |
3829 | 3831 |
3830 // Update pointers from external string table. | 3832 // Update pointers from external string table. |
3831 heap_->UpdateReferencesInExternalStringTable( | 3833 heap_->UpdateReferencesInExternalStringTable( |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4599 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4601 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4600 if (Marking::IsBlack(mark_bit)) { | 4602 if (Marking::IsBlack(mark_bit)) { |
4601 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4603 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
4602 RecordRelocSlot(&rinfo, target); | 4604 RecordRelocSlot(&rinfo, target); |
4603 } | 4605 } |
4604 } | 4606 } |
4605 } | 4607 } |
4606 | 4608 |
4607 } // namespace internal | 4609 } // namespace internal |
4608 } // namespace v8 | 4610 } // namespace v8 |
OLD | NEW |