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 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3255 // moved, others are still in place. | 3255 // moved, others are still in place. |
3256 // We need to: | 3256 // We need to: |
3257 // - Leave the evacuation candidate flag for later processing of | 3257 // - Leave the evacuation candidate flag for later processing of |
3258 // slots buffer entries. | 3258 // slots buffer entries. |
3259 // - Leave the slots buffer there for processing of entries added by | 3259 // - Leave the slots buffer there for processing of entries added by |
3260 // the write barrier. | 3260 // the write barrier. |
3261 // - Rescan the page as slot recording in the migration buffer only | 3261 // - Rescan the page as slot recording in the migration buffer only |
3262 // happens upon moving (which we potentially didn't do). | 3262 // happens upon moving (which we potentially didn't do). |
3263 // - Leave the page in the list of pages of a space since we could not | 3263 // - Leave the page in the list of pages of a space since we could not |
3264 // fully evacuate it. | 3264 // fully evacuate it. |
| 3265 // - Mark them for rescanning for store buffer entries as we otherwise |
| 3266 // might have stale store buffer entries that become "valid" again |
| 3267 // after reusing the memory. Note that clearing store buffer entries |
| 3268 // for aborted pages happens below this block. |
3265 DCHECK(p->IsEvacuationCandidate()); | 3269 DCHECK(p->IsEvacuationCandidate()); |
3266 p->SetFlag(Page::COMPACTION_WAS_ABORTED); | 3270 p->SetFlag(Page::COMPACTION_WAS_ABORTED); |
| 3271 p->set_scan_on_scavenge(true); |
3267 abandoned_pages++; | 3272 abandoned_pages++; |
3268 break; | 3273 break; |
3269 case MemoryChunk::kCompactingFinalize: | 3274 case MemoryChunk::kCompactingFinalize: |
3270 DCHECK(p->IsEvacuationCandidate()); | 3275 DCHECK(p->IsEvacuationCandidate()); |
3271 p->SetWasSwept(); | 3276 p->SetWasSwept(); |
3272 p->Unlink(); | 3277 p->Unlink(); |
3273 break; | 3278 break; |
3274 case MemoryChunk::kCompactingDone: | 3279 case MemoryChunk::kCompactingDone: |
3275 DCHECK(p->IsFlagSet(Page::POPULAR_PAGE)); | 3280 DCHECK(p->IsFlagSet(Page::POPULAR_PAGE)); |
3276 DCHECK(p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); | 3281 DCHECK(p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); |
3277 break; | 3282 break; |
3278 default: | 3283 default: |
3279 // We should not observe kCompactingInProgress, or kCompactingDone. | 3284 // We should not observe kCompactingInProgress, or kCompactingDone. |
3280 UNREACHABLE(); | 3285 UNREACHABLE(); |
3281 } | 3286 } |
3282 p->parallel_compaction_state().SetValue(MemoryChunk::kCompactingDone); | 3287 p->parallel_compaction_state().SetValue(MemoryChunk::kCompactingDone); |
3283 } | 3288 } |
| 3289 if (abandoned_pages > 0) { |
| 3290 heap()->FilterStoreBufferEntriesForAbortedPages(); |
| 3291 } |
3284 if (FLAG_trace_fragmentation) { | 3292 if (FLAG_trace_fragmentation) { |
3285 PrintIsolate(isolate(), | 3293 PrintIsolate(isolate(), |
3286 "%8.0f ms: compaction: parallel=%d pages=%d aborted=%d " | 3294 "%8.0f ms: compaction: parallel=%d pages=%d aborted=%d " |
3287 "tasks=%d cores=%d live_bytes=%" V8_PTR_PREFIX | 3295 "tasks=%d cores=%d live_bytes=%" V8_PTR_PREFIX |
3288 "d compaction_speed=%" V8_PTR_PREFIX "d\n", | 3296 "d compaction_speed=%" V8_PTR_PREFIX "d\n", |
3289 isolate()->time_millis_since_init(), FLAG_parallel_compaction, | 3297 isolate()->time_millis_since_init(), FLAG_parallel_compaction, |
3290 num_pages, abandoned_pages, num_tasks, | 3298 num_pages, abandoned_pages, num_tasks, |
3291 base::SysInfo::NumberOfProcessors(), live_bytes, | 3299 base::SysInfo::NumberOfProcessors(), live_bytes, |
3292 compaction_speed); | 3300 compaction_speed); |
3293 } | 3301 } |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4108 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4116 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4109 if (Marking::IsBlack(mark_bit)) { | 4117 if (Marking::IsBlack(mark_bit)) { |
4110 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); | 4118 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4111 RecordRelocSlot(&rinfo, target); | 4119 RecordRelocSlot(&rinfo, target); |
4112 } | 4120 } |
4113 } | 4121 } |
4114 } | 4122 } |
4115 | 4123 |
4116 } // namespace internal | 4124 } // namespace internal |
4117 } // namespace v8 | 4125 } // namespace v8 |
OLD | NEW |