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 3120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3131 USE(result); | 3131 USE(result); |
3132 break; | 3132 break; |
3133 case kPageNewToOld: | 3133 case kPageNewToOld: |
3134 result = EvacuateSinglePage<kKeepMarking>(page, &new_space_page_visitor); | 3134 result = EvacuateSinglePage<kKeepMarking>(page, &new_space_page_visitor); |
3135 DCHECK(result); | 3135 DCHECK(result); |
3136 USE(result); | 3136 USE(result); |
3137 break; | 3137 break; |
3138 case kObjectsOldToOld: | 3138 case kObjectsOldToOld: |
3139 result = EvacuateSinglePage<kClearMarkbits>(page, &old_space_visitor_); | 3139 result = EvacuateSinglePage<kClearMarkbits>(page, &old_space_visitor_); |
3140 if (!result) { | 3140 if (!result) { |
3141 // Aborted compaction page. We can record slots here to have them | 3141 // Aborted compaction page. We have to record slots here, since we might |
3142 // processed in parallel later on. | 3142 // not have recorded them in first place. |
| 3143 // Note: We mark the page as aborted here to be able to record slots |
| 3144 // for code objects in |RecordMigratedSlotVisitor|. |
| 3145 page->SetFlag(Page::COMPACTION_WAS_ABORTED); |
3143 EvacuateRecordOnlyVisitor record_visitor(collector_->heap()); | 3146 EvacuateRecordOnlyVisitor record_visitor(collector_->heap()); |
3144 result = EvacuateSinglePage<kKeepMarking>(page, &record_visitor); | 3147 result = EvacuateSinglePage<kKeepMarking>(page, &record_visitor); |
3145 DCHECK(result); | 3148 DCHECK(result); |
3146 USE(result); | 3149 USE(result); |
3147 // We need to return failure here to indicate that we want this page | 3150 // We need to return failure here to indicate that we want this page |
3148 // added to the sweeper. | 3151 // added to the sweeper. |
3149 return false; | 3152 return false; |
3150 } | 3153 } |
3151 break; | 3154 break; |
3152 default: | 3155 default: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 p->owner()->identity(), p); | 3230 p->owner()->identity(), p); |
3228 } else { | 3231 } else { |
3229 Page* p = static_cast<Page*>(chunk); | 3232 Page* p = static_cast<Page*>(chunk); |
3230 if (success) { | 3233 if (success) { |
3231 DCHECK(p->IsEvacuationCandidate()); | 3234 DCHECK(p->IsEvacuationCandidate()); |
3232 DCHECK(p->SweepingDone()); | 3235 DCHECK(p->SweepingDone()); |
3233 p->Unlink(); | 3236 p->Unlink(); |
3234 } else { | 3237 } else { |
3235 // We have partially compacted the page, i.e., some objects may have | 3238 // We have partially compacted the page, i.e., some objects may have |
3236 // moved, others are still in place. | 3239 // moved, others are still in place. |
3237 p->SetFlag(Page::COMPACTION_WAS_ABORTED); | |
3238 p->ClearEvacuationCandidate(); | 3240 p->ClearEvacuationCandidate(); |
3239 // Slots have already been recorded so we just need to add it to the | 3241 // Slots have already been recorded so we just need to add it to the |
3240 // sweeper. | 3242 // sweeper. |
3241 *data += 1; | 3243 *data += 1; |
3242 } | 3244 } |
3243 } | 3245 } |
3244 } | 3246 } |
3245 }; | 3247 }; |
3246 | 3248 |
3247 void MarkCompactCollector::EvacuatePagesInParallel() { | 3249 void MarkCompactCollector::EvacuatePagesInParallel() { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3941 MarkBit mark_bit = Marking::MarkBitFrom(host); | 3943 MarkBit mark_bit = Marking::MarkBitFrom(host); |
3942 if (Marking::IsBlack(mark_bit)) { | 3944 if (Marking::IsBlack(mark_bit)) { |
3943 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 3945 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
3944 RecordRelocSlot(host, &rinfo, target); | 3946 RecordRelocSlot(host, &rinfo, target); |
3945 } | 3947 } |
3946 } | 3948 } |
3947 } | 3949 } |
3948 | 3950 |
3949 } // namespace internal | 3951 } // namespace internal |
3950 } // namespace v8 | 3952 } // namespace v8 |
OLD | NEW |