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 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2751 } | 2751 } |
2752 heap()->OnMoveEvent(dst, src, size); | 2752 heap()->OnMoveEvent(dst, src, size); |
2753 Memory::Address_at(src_addr) = dst_addr; | 2753 Memory::Address_at(src_addr) = dst_addr; |
2754 } | 2754 } |
2755 | 2755 |
2756 | 2756 |
2757 static inline void UpdateSlot(Isolate* isolate, ObjectVisitor* v, | 2757 static inline void UpdateSlot(Isolate* isolate, ObjectVisitor* v, |
2758 SlotsBuffer::SlotType slot_type, Address addr) { | 2758 SlotsBuffer::SlotType slot_type, Address addr) { |
2759 switch (slot_type) { | 2759 switch (slot_type) { |
2760 case SlotsBuffer::CODE_TARGET_SLOT: { | 2760 case SlotsBuffer::CODE_TARGET_SLOT: { |
2761 RelocInfo rinfo(addr, RelocInfo::CODE_TARGET, 0, NULL); | 2761 RelocInfo rinfo(isolate, addr, RelocInfo::CODE_TARGET, 0, NULL); |
2762 rinfo.Visit(isolate, v); | 2762 rinfo.Visit(isolate, v); |
2763 break; | 2763 break; |
2764 } | 2764 } |
2765 case SlotsBuffer::CELL_TARGET_SLOT: { | 2765 case SlotsBuffer::CELL_TARGET_SLOT: { |
2766 RelocInfo rinfo(addr, RelocInfo::CELL, 0, NULL); | 2766 RelocInfo rinfo(isolate, addr, RelocInfo::CELL, 0, NULL); |
2767 rinfo.Visit(isolate, v); | 2767 rinfo.Visit(isolate, v); |
2768 break; | 2768 break; |
2769 } | 2769 } |
2770 case SlotsBuffer::CODE_ENTRY_SLOT: { | 2770 case SlotsBuffer::CODE_ENTRY_SLOT: { |
2771 v->VisitCodeEntry(addr); | 2771 v->VisitCodeEntry(addr); |
2772 break; | 2772 break; |
2773 } | 2773 } |
2774 case SlotsBuffer::RELOCATED_CODE_OBJECT: { | 2774 case SlotsBuffer::RELOCATED_CODE_OBJECT: { |
2775 HeapObject* obj = HeapObject::FromAddress(addr); | 2775 HeapObject* obj = HeapObject::FromAddress(addr); |
2776 Code::BodyDescriptor::IterateBody(obj, v); | 2776 Code::BodyDescriptor::IterateBody(obj, v); |
2777 break; | 2777 break; |
2778 } | 2778 } |
2779 case SlotsBuffer::DEBUG_TARGET_SLOT: { | 2779 case SlotsBuffer::DEBUG_TARGET_SLOT: { |
2780 RelocInfo rinfo(addr, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION, 0, NULL); | 2780 RelocInfo rinfo(isolate, addr, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION, 0, |
| 2781 NULL); |
2781 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); | 2782 if (rinfo.IsPatchedDebugBreakSlotSequence()) rinfo.Visit(isolate, v); |
2782 break; | 2783 break; |
2783 } | 2784 } |
2784 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { | 2785 case SlotsBuffer::EMBEDDED_OBJECT_SLOT: { |
2785 RelocInfo rinfo(addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); | 2786 RelocInfo rinfo(isolate, addr, RelocInfo::EMBEDDED_OBJECT, 0, NULL); |
2786 rinfo.Visit(isolate, v); | 2787 rinfo.Visit(isolate, v); |
2787 break; | 2788 break; |
2788 } | 2789 } |
2789 case SlotsBuffer::OBJECT_SLOT: { | 2790 case SlotsBuffer::OBJECT_SLOT: { |
2790 v->VisitPointer(reinterpret_cast<Object**>(addr)); | 2791 v->VisitPointer(reinterpret_cast<Object**>(addr)); |
2791 break; | 2792 break; |
2792 } | 2793 } |
2793 default: | 2794 default: |
2794 UNREACHABLE(); | 2795 UNREACHABLE(); |
2795 break; | 2796 break; |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4114 | 4115 |
4115 | 4116 |
4116 void MarkCompactCollector::RecordCodeTargetPatch(Address pc, Code* target) { | 4117 void MarkCompactCollector::RecordCodeTargetPatch(Address pc, Code* target) { |
4117 DCHECK(heap()->gc_state() == Heap::MARK_COMPACT); | 4118 DCHECK(heap()->gc_state() == Heap::MARK_COMPACT); |
4118 if (is_compacting()) { | 4119 if (is_compacting()) { |
4119 Code* host = | 4120 Code* host = |
4120 isolate()->inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer( | 4121 isolate()->inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer( |
4121 pc); | 4122 pc); |
4122 MarkBit mark_bit = Marking::MarkBitFrom(host); | 4123 MarkBit mark_bit = Marking::MarkBitFrom(host); |
4123 if (Marking::IsBlack(mark_bit)) { | 4124 if (Marking::IsBlack(mark_bit)) { |
4124 RelocInfo rinfo(pc, RelocInfo::CODE_TARGET, 0, host); | 4125 RelocInfo rinfo(isolate(), pc, RelocInfo::CODE_TARGET, 0, host); |
4125 RecordRelocSlot(&rinfo, target); | 4126 RecordRelocSlot(&rinfo, target); |
4126 } | 4127 } |
4127 } | 4128 } |
4128 } | 4129 } |
4129 | 4130 |
4130 } // namespace internal | 4131 } // namespace internal |
4131 } // namespace v8 | 4132 } // namespace v8 |
OLD | NEW |