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 3335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3346 for (int i = 0; i < live_objects; i++) { | 3346 for (int i = 0; i < live_objects; i++) { |
3347 Address object_addr = cell_base + offsets[i] * kPointerSize; | 3347 Address object_addr = cell_base + offsets[i] * kPointerSize; |
3348 HeapObject* object = HeapObject::FromAddress(object_addr); | 3348 HeapObject* object = HeapObject::FromAddress(object_addr); |
3349 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); | 3349 DCHECK(Marking::IsBlack(Marking::MarkBitFrom(object))); |
3350 | 3350 |
3351 int size = object->Size(); | 3351 int size = object->Size(); |
3352 AllocationAlignment alignment = object->RequiredAlignment(); | 3352 AllocationAlignment alignment = object->RequiredAlignment(); |
3353 HeapObject* target_object = nullptr; | 3353 HeapObject* target_object = nullptr; |
3354 AllocationResult allocation = target_space->AllocateRaw(size, alignment); | 3354 AllocationResult allocation = target_space->AllocateRaw(size, alignment); |
3355 if (!allocation.To(&target_object)) { | 3355 if (!allocation.To(&target_object)) { |
| 3356 // We need to abort compaction for this page. Make sure that we reset |
| 3357 // the mark bits for objects that have already been migrated. |
| 3358 if (i > 0) { |
| 3359 p->markbits()->ClearRange(p->AddressToMarkbitIndex(p->area_start()), |
| 3360 p->AddressToMarkbitIndex(object_addr)); |
| 3361 } |
3356 return false; | 3362 return false; |
3357 } | 3363 } |
3358 | 3364 |
3359 MigrateObject(target_object, object, size, target_space->identity(), | 3365 MigrateObject(target_object, object, size, target_space->identity(), |
3360 evacuation_slots_buffer); | 3366 evacuation_slots_buffer); |
3361 DCHECK(object->map_word().IsForwardingAddress()); | 3367 DCHECK(object->map_word().IsForwardingAddress()); |
3362 } | 3368 } |
3363 | 3369 |
3364 // Clear marking bits for current cell. | 3370 // Clear marking bits for current cell. |
3365 *cell = 0; | 3371 *cell = 0; |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4600 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4606 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4601 if (Marking::IsBlack(mark_bit)) { | 4607 if (Marking::IsBlack(mark_bit)) { |
4602 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4608 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); |
4603 RecordRelocSlot(&rinfo, target); | 4609 RecordRelocSlot(&rinfo, target); |
4604 } | 4610 } |
4605 } | 4611 } |
4606 } | 4612 } |
4607 | 4613 |
4608 } // namespace internal | 4614 } // namespace internal |
4609 } // namespace v8 | 4615 } // namespace v8 |
OLD | NEW |