| 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 #ifndef V8_OBJECTS_VISITING_INL_H_ | 5 #ifndef V8_OBJECTS_VISITING_INL_H_ |
| 6 #define V8_OBJECTS_VISITING_INL_H_ | 6 #define V8_OBJECTS_VISITING_INL_H_ |
| 7 | 7 |
| 8 #include "src/heap/objects-visiting.h" | 8 #include "src/heap/objects-visiting.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 heap->mark_compact_collector()->RecordRelocSlot(rinfo, cell); | 226 heap->mark_compact_collector()->RecordRelocSlot(rinfo, cell); |
| 227 if (!rinfo->host()->IsWeakObject(cell)) { | 227 if (!rinfo->host()->IsWeakObject(cell)) { |
| 228 StaticVisitor::MarkObject(heap, cell); | 228 StaticVisitor::MarkObject(heap, cell); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 template <typename StaticVisitor> | 233 template <typename StaticVisitor> |
| 234 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget(Heap* heap, | 234 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget(Heap* heap, |
| 235 RelocInfo* rinfo) { | 235 RelocInfo* rinfo) { |
| 236 DCHECK((RelocInfo::IsJSReturn(rinfo->rmode()) && | 236 DCHECK(RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
| 237 rinfo->IsPatchedReturnSequence()) || | 237 rinfo->IsPatchedDebugBreakSlotSequence()); |
| 238 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 238 Code* target = Code::GetCodeFromTargetAddress(rinfo->debug_call_address()); |
| 239 rinfo->IsPatchedDebugBreakSlotSequence())); | |
| 240 Code* target = Code::GetCodeFromTargetAddress(rinfo->call_address()); | |
| 241 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); | 239 heap->mark_compact_collector()->RecordRelocSlot(rinfo, target); |
| 242 StaticVisitor::MarkObject(heap, target); | 240 StaticVisitor::MarkObject(heap, target); |
| 243 } | 241 } |
| 244 | 242 |
| 245 | 243 |
| 246 template <typename StaticVisitor> | 244 template <typename StaticVisitor> |
| 247 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(Heap* heap, | 245 void StaticMarkingVisitor<StaticVisitor>::VisitCodeTarget(Heap* heap, |
| 248 RelocInfo* rinfo) { | 246 RelocInfo* rinfo) { |
| 249 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); | 247 DCHECK(RelocInfo::IsCodeTarget(rinfo->rmode())); |
| 250 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 248 Code* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 779 } |
| 782 | 780 |
| 783 | 781 |
| 784 void Code::CodeIterateBody(ObjectVisitor* v) { | 782 void Code::CodeIterateBody(ObjectVisitor* v) { |
| 785 int mode_mask = RelocInfo::kCodeTargetMask | | 783 int mode_mask = RelocInfo::kCodeTargetMask | |
| 786 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 784 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 787 RelocInfo::ModeMask(RelocInfo::CELL) | | 785 RelocInfo::ModeMask(RelocInfo::CELL) | |
| 788 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 786 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 789 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | 787 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | |
| 790 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | | 788 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | |
| 791 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | |
| 792 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | | 789 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
| 793 RelocInfo::kDebugBreakSlotMask; | 790 RelocInfo::kDebugBreakSlotMask; |
| 794 | 791 |
| 795 // There are two places where we iterate code bodies: here and the | 792 // There are two places where we iterate code bodies: here and the |
| 796 // templated CodeIterateBody (below). They should be kept in sync. | 793 // templated CodeIterateBody (below). They should be kept in sync. |
| 797 IteratePointer(v, kRelocationInfoOffset); | 794 IteratePointer(v, kRelocationInfoOffset); |
| 798 IteratePointer(v, kHandlerTableOffset); | 795 IteratePointer(v, kHandlerTableOffset); |
| 799 IteratePointer(v, kDeoptimizationDataOffset); | 796 IteratePointer(v, kDeoptimizationDataOffset); |
| 800 IteratePointer(v, kTypeFeedbackInfoOffset); | 797 IteratePointer(v, kTypeFeedbackInfoOffset); |
| 801 IterateNextCodeLink(v, kNextCodeLinkOffset); | 798 IterateNextCodeLink(v, kNextCodeLinkOffset); |
| 802 | 799 |
| 803 RelocIterator it(this, mode_mask); | 800 RelocIterator it(this, mode_mask); |
| 804 Isolate* isolate = this->GetIsolate(); | 801 Isolate* isolate = this->GetIsolate(); |
| 805 for (; !it.done(); it.next()) { | 802 for (; !it.done(); it.next()) { |
| 806 it.rinfo()->Visit(isolate, v); | 803 it.rinfo()->Visit(isolate, v); |
| 807 } | 804 } |
| 808 } | 805 } |
| 809 | 806 |
| 810 | 807 |
| 811 template <typename StaticVisitor> | 808 template <typename StaticVisitor> |
| 812 void Code::CodeIterateBody(Heap* heap) { | 809 void Code::CodeIterateBody(Heap* heap) { |
| 813 int mode_mask = RelocInfo::kCodeTargetMask | | 810 int mode_mask = RelocInfo::kCodeTargetMask | |
| 814 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 811 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 815 RelocInfo::ModeMask(RelocInfo::CELL) | | 812 RelocInfo::ModeMask(RelocInfo::CELL) | |
| 816 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 813 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
| 817 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | 814 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | |
| 818 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | | 815 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | |
| 819 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | |
| 820 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | | 816 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
| 821 RelocInfo::kDebugBreakSlotMask; | 817 RelocInfo::kDebugBreakSlotMask; |
| 822 | 818 |
| 823 // There are two places where we iterate code bodies: here and the non- | 819 // There are two places where we iterate code bodies: here and the non- |
| 824 // templated CodeIterateBody (above). They should be kept in sync. | 820 // templated CodeIterateBody (above). They should be kept in sync. |
| 825 StaticVisitor::VisitPointer( | 821 StaticVisitor::VisitPointer( |
| 826 heap, | 822 heap, |
| 827 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); | 823 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
| 828 StaticVisitor::VisitPointer( | 824 StaticVisitor::VisitPointer( |
| 829 heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); | 825 heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
| 830 StaticVisitor::VisitPointer( | 826 StaticVisitor::VisitPointer( |
| 831 heap, | 827 heap, |
| 832 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); | 828 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
| 833 StaticVisitor::VisitPointer( | 829 StaticVisitor::VisitPointer( |
| 834 heap, | 830 heap, |
| 835 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); | 831 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); |
| 836 StaticVisitor::VisitNextCodeLink( | 832 StaticVisitor::VisitNextCodeLink( |
| 837 heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); | 833 heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); |
| 838 | 834 |
| 839 | 835 |
| 840 RelocIterator it(this, mode_mask); | 836 RelocIterator it(this, mode_mask); |
| 841 for (; !it.done(); it.next()) { | 837 for (; !it.done(); it.next()) { |
| 842 it.rinfo()->template Visit<StaticVisitor>(heap); | 838 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 843 } | 839 } |
| 844 } | 840 } |
| 845 } | 841 } |
| 846 } // namespace v8::internal | 842 } // namespace v8::internal |
| 847 | 843 |
| 848 #endif // V8_OBJECTS_VISITING_INL_H_ | 844 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |