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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 base->ExecuteMigrationObservers(dest, src, dst, size); | 1680 base->ExecuteMigrationObservers(dest, src, dst, size); |
1681 dst->IterateBodyFast(dst->map()->instance_type(), size, | 1681 dst->IterateBodyFast(dst->map()->instance_type(), size, |
1682 base->record_visitor_); | 1682 base->record_visitor_); |
1683 } else { | 1683 } else { |
1684 DCHECK_OBJECT_SIZE(size); | 1684 DCHECK_OBJECT_SIZE(size); |
1685 DCHECK(dest == NEW_SPACE); | 1685 DCHECK(dest == NEW_SPACE); |
1686 base->heap_->CopyBlock(dst_addr, src_addr, size); | 1686 base->heap_->CopyBlock(dst_addr, src_addr, size); |
1687 if (mode != MigrationMode::kFast) | 1687 if (mode != MigrationMode::kFast) |
1688 base->ExecuteMigrationObservers(dest, src, dst, size); | 1688 base->ExecuteMigrationObservers(dest, src, dst, size); |
1689 } | 1689 } |
1690 base::NoBarrier_Store(reinterpret_cast<base::AtomicWord*>(src_addr), | 1690 base::Relaxed_Store(reinterpret_cast<base::AtomicWord*>(src_addr), |
1691 reinterpret_cast<base::AtomicWord>(dst_addr)); | 1691 reinterpret_cast<base::AtomicWord>(dst_addr)); |
1692 } | 1692 } |
1693 | 1693 |
1694 EvacuateVisitorBase(Heap* heap, CompactionSpaceCollection* compaction_spaces, | 1694 EvacuateVisitorBase(Heap* heap, CompactionSpaceCollection* compaction_spaces, |
1695 RecordMigratedSlotVisitor* record_visitor) | 1695 RecordMigratedSlotVisitor* record_visitor) |
1696 : heap_(heap), | 1696 : heap_(heap), |
1697 compaction_spaces_(compaction_spaces), | 1697 compaction_spaces_(compaction_spaces), |
1698 record_visitor_(record_visitor) { | 1698 record_visitor_(record_visitor) { |
1699 migration_function_ = RawMigrateObject<MigrationMode::kFast>; | 1699 migration_function_ = RawMigrateObject<MigrationMode::kFast>; |
1700 } | 1700 } |
1701 | 1701 |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3407 slot_type = OBJECT_SLOT; | 3407 slot_type = OBJECT_SLOT; |
3408 } | 3408 } |
3409 } | 3409 } |
3410 RememberedSet<OLD_TO_OLD>::InsertTyped( | 3410 RememberedSet<OLD_TO_OLD>::InsertTyped( |
3411 source_page, reinterpret_cast<Address>(host), slot_type, addr); | 3411 source_page, reinterpret_cast<Address>(host), slot_type, addr); |
3412 } | 3412 } |
3413 } | 3413 } |
3414 | 3414 |
3415 static inline SlotCallbackResult UpdateSlot(Object** slot) { | 3415 static inline SlotCallbackResult UpdateSlot(Object** slot) { |
3416 Object* obj = reinterpret_cast<Object*>( | 3416 Object* obj = reinterpret_cast<Object*>( |
3417 base::NoBarrier_Load(reinterpret_cast<base::AtomicWord*>(slot))); | 3417 base::Relaxed_Load(reinterpret_cast<base::AtomicWord*>(slot))); |
3418 | 3418 |
3419 if (obj->IsHeapObject()) { | 3419 if (obj->IsHeapObject()) { |
3420 HeapObject* heap_obj = HeapObject::cast(obj); | 3420 HeapObject* heap_obj = HeapObject::cast(obj); |
3421 MapWord map_word = heap_obj->map_word(); | 3421 MapWord map_word = heap_obj->map_word(); |
3422 if (map_word.IsForwardingAddress()) { | 3422 if (map_word.IsForwardingAddress()) { |
3423 DCHECK(heap_obj->GetHeap()->InFromSpace(heap_obj) || | 3423 DCHECK(heap_obj->GetHeap()->InFromSpace(heap_obj) || |
3424 MarkCompactCollector::IsOnEvacuationCandidate(heap_obj) || | 3424 MarkCompactCollector::IsOnEvacuationCandidate(heap_obj) || |
3425 Page::FromAddress(heap_obj->address()) | 3425 Page::FromAddress(heap_obj->address()) |
3426 ->IsFlagSet(Page::COMPACTION_WAS_ABORTED)); | 3426 ->IsFlagSet(Page::COMPACTION_WAS_ABORTED)); |
3427 HeapObject* target = map_word.ToForwardingAddress(); | 3427 HeapObject* target = map_word.ToForwardingAddress(); |
3428 base::NoBarrier_CompareAndSwap( | 3428 base::Relaxed_CompareAndSwap(reinterpret_cast<base::AtomicWord*>(slot), |
3429 reinterpret_cast<base::AtomicWord*>(slot), | 3429 reinterpret_cast<base::AtomicWord>(obj), |
3430 reinterpret_cast<base::AtomicWord>(obj), | 3430 reinterpret_cast<base::AtomicWord>(target)); |
3431 reinterpret_cast<base::AtomicWord>(target)); | |
3432 DCHECK(!heap_obj->GetHeap()->InFromSpace(target)); | 3431 DCHECK(!heap_obj->GetHeap()->InFromSpace(target)); |
3433 DCHECK(!MarkCompactCollector::IsOnEvacuationCandidate(target)); | 3432 DCHECK(!MarkCompactCollector::IsOnEvacuationCandidate(target)); |
3434 } | 3433 } |
3435 } | 3434 } |
3436 return REMOVE_SLOT; | 3435 return REMOVE_SLOT; |
3437 } | 3436 } |
3438 | 3437 |
3439 // Visitor for updating root pointers and to-space pointers. | 3438 // Visitor for updating root pointers and to-space pointers. |
3440 // It does not expect to encounter pointers to dead objects. | 3439 // It does not expect to encounter pointers to dead objects. |
3441 // TODO(ulan): Remove code object specific functions. This visitor | 3440 // TODO(ulan): Remove code object specific functions. This visitor |
(...skipping 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4714 // The target is always in old space, we don't have to record the slot in | 4713 // The target is always in old space, we don't have to record the slot in |
4715 // the old-to-new remembered set. | 4714 // the old-to-new remembered set. |
4716 DCHECK(!heap()->InNewSpace(target)); | 4715 DCHECK(!heap()->InNewSpace(target)); |
4717 RecordRelocSlot(host, &rinfo, target); | 4716 RecordRelocSlot(host, &rinfo, target); |
4718 } | 4717 } |
4719 } | 4718 } |
4720 } | 4719 } |
4721 | 4720 |
4722 } // namespace internal | 4721 } // namespace internal |
4723 } // namespace v8 | 4722 } // namespace v8 |
OLD | NEW |