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 3247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3258 // moved, others are still in place. | 3258 // moved, others are still in place. |
3259 // We need to: | 3259 // We need to: |
3260 // - Leave the evacuation candidate flag for later processing of | 3260 // - Leave the evacuation candidate flag for later processing of |
3261 // slots buffer entries. | 3261 // slots buffer entries. |
3262 // - Leave the slots buffer there for processing of entries added by | 3262 // - Leave the slots buffer there for processing of entries added by |
3263 // the write barrier. | 3263 // the write barrier. |
3264 // - Rescan the page as slot recording in the migration buffer only | 3264 // - Rescan the page as slot recording in the migration buffer only |
3265 // happens upon moving (which we potentially didn't do). | 3265 // happens upon moving (which we potentially didn't do). |
3266 // - Leave the page in the list of pages of a space since we could not | 3266 // - Leave the page in the list of pages of a space since we could not |
3267 // fully evacuate it. | 3267 // fully evacuate it. |
3268 // - Mark them for rescanning for store buffer entries as we otherwise | |
3269 // might have stale store buffer entries that become "valid" again | |
3270 // after reusing the memory. Note that all existing store buffer | |
3271 // entries of such pages are filtered before rescanning. | |
3268 DCHECK(p->IsEvacuationCandidate()); | 3272 DCHECK(p->IsEvacuationCandidate()); |
3269 p->SetFlag(Page::COMPACTION_WAS_ABORTED); | 3273 p->SetFlag(Page::COMPACTION_WAS_ABORTED); |
3274 p->set_scan_on_scavenge(true); | |
3270 abandoned_pages++; | 3275 abandoned_pages++; |
3271 break; | 3276 break; |
3272 case MemoryChunk::kCompactingFinalize: | 3277 case MemoryChunk::kCompactingFinalize: |
3273 DCHECK(p->IsEvacuationCandidate()); | 3278 DCHECK(p->IsEvacuationCandidate()); |
3274 p->SetWasSwept(); | 3279 p->SetWasSwept(); |
3275 p->Unlink(); | 3280 p->Unlink(); |
3276 break; | 3281 break; |
3277 case MemoryChunk::kCompactingDone: | 3282 case MemoryChunk::kCompactingDone: |
3278 DCHECK(p->IsFlagSet(Page::POPULAR_PAGE)); | 3283 DCHECK(p->IsFlagSet(Page::POPULAR_PAGE)); |
3279 DCHECK(p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); | 3284 DCHECK(p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3672 | 3677 |
3673 // Important: skip list should be cleared only after roots were updated | 3678 // Important: skip list should be cleared only after roots were updated |
3674 // because root iteration traverses the stack and might have to find | 3679 // because root iteration traverses the stack and might have to find |
3675 // code objects from non-updated pc pointing into evacuation candidate. | 3680 // code objects from non-updated pc pointing into evacuation candidate. |
3676 SkipList* list = p->skip_list(); | 3681 SkipList* list = p->skip_list(); |
3677 if (list != NULL) list->Clear(); | 3682 if (list != NULL) list->Clear(); |
3678 | 3683 |
3679 // First pass on aborted pages, fixing up all live objects. | 3684 // First pass on aborted pages, fixing up all live objects. |
3680 if (p->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) { | 3685 if (p->IsFlagSet(Page::COMPACTION_WAS_ABORTED)) { |
3681 // Clearing the evacuation candidate flag here has the effect of | 3686 // Clearing the evacuation candidate flag here has the effect of |
3682 // stopping recording of slots for it in the following pointer | 3687 // stopping recording of slots for it in the following pointer |
Hannes Payer (out of office)
2015/12/04 11:29:10
I just stumbled over this comment: where to we rec
Michael Lippautz
2015/12/04 11:34:19
The comment was wrong. I removed it.
| |
3683 // update phases. | 3688 // update phases. |
3684 p->ClearEvacuationCandidate(); | 3689 p->ClearEvacuationCandidate(); |
3685 VisitLiveObjects(p, &updating_visitor); | 3690 VisitLiveObjects(p, &updating_visitor); |
3686 } | 3691 } |
3687 } | 3692 } |
3688 | 3693 |
3689 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { | 3694 if (p->IsFlagSet(Page::RESCAN_ON_EVACUATION)) { |
3690 if (FLAG_gc_verbose) { | 3695 if (FLAG_gc_verbose) { |
3691 PrintF("Sweeping 0x%" V8PRIxPTR " during evacuation.\n", | 3696 PrintF("Sweeping 0x%" V8PRIxPTR " during evacuation.\n", |
3692 reinterpret_cast<intptr_t>(p)); | 3697 reinterpret_cast<intptr_t>(p)); |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4111 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4116 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4112 if (Marking::IsBlack(mark_bit)) { | 4117 if (Marking::IsBlack(mark_bit)) { |
4113 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4118 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4114 RecordRelocSlot(&rinfo, target); | 4119 RecordRelocSlot(&rinfo, target); |
4115 } | 4120 } |
4116 } | 4121 } |
4117 } | 4122 } |
4118 | 4123 |
4119 } // namespace internal | 4124 } // namespace internal |
4120 } // namespace v8 | 4125 } // namespace v8 |
OLD | NEW |