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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 782 |
783 | 783 |
784 void Code::CodeIterateBody(ObjectVisitor* v) { | 784 void Code::CodeIterateBody(ObjectVisitor* v) { |
785 int mode_mask = RelocInfo::kCodeTargetMask | | 785 int mode_mask = RelocInfo::kCodeTargetMask | |
786 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 786 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
787 RelocInfo::ModeMask(RelocInfo::CELL) | | 787 RelocInfo::ModeMask(RelocInfo::CELL) | |
788 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 788 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
789 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | 789 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | |
790 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | | 790 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | |
791 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 791 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
792 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 792 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
793 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 793 RelocInfo::kDebugBreakSlotMask; |
794 | 794 |
795 // There are two places where we iterate code bodies: here and the | 795 // There are two places where we iterate code bodies: here and the |
796 // templated CodeIterateBody (below). They should be kept in sync. | 796 // templated CodeIterateBody (below). They should be kept in sync. |
797 IteratePointer(v, kRelocationInfoOffset); | 797 IteratePointer(v, kRelocationInfoOffset); |
798 IteratePointer(v, kHandlerTableOffset); | 798 IteratePointer(v, kHandlerTableOffset); |
799 IteratePointer(v, kDeoptimizationDataOffset); | 799 IteratePointer(v, kDeoptimizationDataOffset); |
800 IteratePointer(v, kTypeFeedbackInfoOffset); | 800 IteratePointer(v, kTypeFeedbackInfoOffset); |
801 IterateNextCodeLink(v, kNextCodeLinkOffset); | 801 IterateNextCodeLink(v, kNextCodeLinkOffset); |
802 | 802 |
803 RelocIterator it(this, mode_mask); | 803 RelocIterator it(this, mode_mask); |
804 Isolate* isolate = this->GetIsolate(); | 804 Isolate* isolate = this->GetIsolate(); |
805 for (; !it.done(); it.next()) { | 805 for (; !it.done(); it.next()) { |
806 it.rinfo()->Visit(isolate, v); | 806 it.rinfo()->Visit(isolate, v); |
807 } | 807 } |
808 } | 808 } |
809 | 809 |
810 | 810 |
811 template <typename StaticVisitor> | 811 template <typename StaticVisitor> |
812 void Code::CodeIterateBody(Heap* heap) { | 812 void Code::CodeIterateBody(Heap* heap) { |
813 int mode_mask = RelocInfo::kCodeTargetMask | | 813 int mode_mask = RelocInfo::kCodeTargetMask | |
814 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 814 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
815 RelocInfo::ModeMask(RelocInfo::CELL) | | 815 RelocInfo::ModeMask(RelocInfo::CELL) | |
816 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 816 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
817 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | | 817 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE) | |
818 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | | 818 RelocInfo::ModeMask(RelocInfo::INTERNAL_REFERENCE_ENCODED) | |
819 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 819 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
820 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 820 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY) | |
821 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 821 RelocInfo::kDebugBreakSlotMask; |
822 | 822 |
823 // There are two places where we iterate code bodies: here and the non- | 823 // There are two places where we iterate code bodies: here and the non- |
824 // templated CodeIterateBody (above). They should be kept in sync. | 824 // templated CodeIterateBody (above). They should be kept in sync. |
825 StaticVisitor::VisitPointer( | 825 StaticVisitor::VisitPointer( |
826 heap, | 826 heap, |
827 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); | 827 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
828 StaticVisitor::VisitPointer( | 828 StaticVisitor::VisitPointer( |
829 heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); | 829 heap, reinterpret_cast<Object**>(this->address() + kHandlerTableOffset)); |
830 StaticVisitor::VisitPointer( | 830 StaticVisitor::VisitPointer( |
831 heap, | 831 heap, |
832 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); | 832 reinterpret_cast<Object**>(this->address() + kDeoptimizationDataOffset)); |
833 StaticVisitor::VisitPointer( | 833 StaticVisitor::VisitPointer( |
834 heap, | 834 heap, |
835 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); | 835 reinterpret_cast<Object**>(this->address() + kTypeFeedbackInfoOffset)); |
836 StaticVisitor::VisitNextCodeLink( | 836 StaticVisitor::VisitNextCodeLink( |
837 heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); | 837 heap, reinterpret_cast<Object**>(this->address() + kNextCodeLinkOffset)); |
838 | 838 |
839 | 839 |
840 RelocIterator it(this, mode_mask); | 840 RelocIterator it(this, mode_mask); |
841 for (; !it.done(); it.next()) { | 841 for (; !it.done(); it.next()) { |
842 it.rinfo()->template Visit<StaticVisitor>(heap); | 842 it.rinfo()->template Visit<StaticVisitor>(heap); |
843 } | 843 } |
844 } | 844 } |
845 } | 845 } |
846 } // namespace v8::internal | 846 } // namespace v8::internal |
847 | 847 |
848 #endif // V8_OBJECTS_VISITING_INL_H_ | 848 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |