OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | 189 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); |
190 | 190 |
191 table_.Register(kVisitJSFunction, &VisitJSFunction); | 191 table_.Register(kVisitJSFunction, &VisitJSFunction); |
192 | 192 |
193 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | 193 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
194 | 194 |
195 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); | 195 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); |
196 | 196 |
197 // Registration for kVisitJSRegExp is done by StaticVisitor. | 197 // Registration for kVisitJSRegExp is done by StaticVisitor. |
198 | 198 |
| 199 table_.Register(kVisitCell, |
| 200 &FixedBodyVisitor<StaticVisitor, |
| 201 Cell::BodyDescriptor, |
| 202 void>::Visit); |
| 203 |
199 table_.Register(kVisitPropertyCell, | 204 table_.Register(kVisitPropertyCell, |
200 &FixedBodyVisitor<StaticVisitor, | 205 &FixedBodyVisitor<StaticVisitor, |
201 JSGlobalPropertyCell::BodyDescriptor, | 206 JSGlobalPropertyCell::BodyDescriptor, |
202 void>::Visit); | 207 void>::Visit); |
203 | 208 |
204 table_.template RegisterSpecializations<DataObjectVisitor, | 209 table_.template RegisterSpecializations<DataObjectVisitor, |
205 kVisitDataObject, | 210 kVisitDataObject, |
206 kVisitDataObjectGeneric>(); | 211 kVisitDataObjectGeneric>(); |
207 | 212 |
208 table_.template RegisterSpecializations<JSObjectVisitor, | 213 table_.template RegisterSpecializations<JSObjectVisitor, |
(...skipping 24 matching lines...) Expand all Loading... |
233 if (!FLAG_weak_embedded_maps_in_optimized_code || !FLAG_collect_maps || | 238 if (!FLAG_weak_embedded_maps_in_optimized_code || !FLAG_collect_maps || |
234 rinfo->host()->kind() != Code::OPTIMIZED_FUNCTION || | 239 rinfo->host()->kind() != Code::OPTIMIZED_FUNCTION || |
235 !object->IsMap() || !Map::cast(object)->CanTransition()) { | 240 !object->IsMap() || !Map::cast(object)->CanTransition()) { |
236 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); | 241 heap->mark_compact_collector()->RecordRelocSlot(rinfo, object); |
237 StaticVisitor::MarkObject(heap, object); | 242 StaticVisitor::MarkObject(heap, object); |
238 } | 243 } |
239 } | 244 } |
240 | 245 |
241 | 246 |
242 template<typename StaticVisitor> | 247 template<typename StaticVisitor> |
243 void StaticMarkingVisitor<StaticVisitor>::VisitGlobalPropertyCell( | 248 void StaticMarkingVisitor<StaticVisitor>::VisitCell( |
244 Heap* heap, RelocInfo* rinfo) { | 249 Heap* heap, RelocInfo* rinfo) { |
245 ASSERT(rinfo->rmode() == RelocInfo::GLOBAL_PROPERTY_CELL); | 250 ASSERT(rinfo->rmode() == RelocInfo::CELL); |
246 JSGlobalPropertyCell* cell = rinfo->target_cell(); | 251 Cell* cell = rinfo->target_cell(); |
247 StaticVisitor::MarkObject(heap, cell); | 252 StaticVisitor::MarkObject(heap, cell); |
248 } | 253 } |
249 | 254 |
250 | 255 |
251 template<typename StaticVisitor> | 256 template<typename StaticVisitor> |
252 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget( | 257 void StaticMarkingVisitor<StaticVisitor>::VisitDebugTarget( |
253 Heap* heap, RelocInfo* rinfo) { | 258 Heap* heap, RelocInfo* rinfo) { |
254 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && | 259 ASSERT((RelocInfo::IsJSReturn(rinfo->rmode()) && |
255 rinfo->IsPatchedReturnSequence()) || | 260 rinfo->IsPatchedReturnSequence()) || |
256 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && | 261 (RelocInfo::IsDebugBreakSlot(rinfo->rmode()) && |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 HeapObject::RawField(object, JSFunction::kPrototypeOrInitialMapOffset); | 775 HeapObject::RawField(object, JSFunction::kPrototypeOrInitialMapOffset); |
771 end_slot = | 776 end_slot = |
772 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset); | 777 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset); |
773 StaticVisitor::VisitPointers(heap, start_slot, end_slot); | 778 StaticVisitor::VisitPointers(heap, start_slot, end_slot); |
774 } | 779 } |
775 | 780 |
776 | 781 |
777 void Code::CodeIterateBody(ObjectVisitor* v) { | 782 void Code::CodeIterateBody(ObjectVisitor* v) { |
778 int mode_mask = RelocInfo::kCodeTargetMask | | 783 int mode_mask = RelocInfo::kCodeTargetMask | |
779 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 784 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
780 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 785 RelocInfo::ModeMask(RelocInfo::CELL) | |
781 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 786 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
782 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 787 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
783 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 788 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
784 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 789 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
785 | 790 |
786 // There are two places where we iterate code bodies: here and the | 791 // There are two places where we iterate code bodies: here and the |
787 // templated CodeIterateBody (below). They should be kept in sync. | 792 // templated CodeIterateBody (below). They should be kept in sync. |
788 IteratePointer(v, kRelocationInfoOffset); | 793 IteratePointer(v, kRelocationInfoOffset); |
789 IteratePointer(v, kHandlerTableOffset); | 794 IteratePointer(v, kHandlerTableOffset); |
790 IteratePointer(v, kDeoptimizationDataOffset); | 795 IteratePointer(v, kDeoptimizationDataOffset); |
791 IteratePointer(v, kTypeFeedbackInfoOffset); | 796 IteratePointer(v, kTypeFeedbackInfoOffset); |
792 | 797 |
793 RelocIterator it(this, mode_mask); | 798 RelocIterator it(this, mode_mask); |
794 for (; !it.done(); it.next()) { | 799 for (; !it.done(); it.next()) { |
795 it.rinfo()->Visit(v); | 800 it.rinfo()->Visit(v); |
796 } | 801 } |
797 } | 802 } |
798 | 803 |
799 | 804 |
800 template<typename StaticVisitor> | 805 template<typename StaticVisitor> |
801 void Code::CodeIterateBody(Heap* heap) { | 806 void Code::CodeIterateBody(Heap* heap) { |
802 int mode_mask = RelocInfo::kCodeTargetMask | | 807 int mode_mask = RelocInfo::kCodeTargetMask | |
803 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 808 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
804 RelocInfo::ModeMask(RelocInfo::GLOBAL_PROPERTY_CELL) | | 809 RelocInfo::ModeMask(RelocInfo::CELL) | |
805 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | | 810 RelocInfo::ModeMask(RelocInfo::EXTERNAL_REFERENCE) | |
806 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | | 811 RelocInfo::ModeMask(RelocInfo::JS_RETURN) | |
807 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | | 812 RelocInfo::ModeMask(RelocInfo::DEBUG_BREAK_SLOT) | |
808 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); | 813 RelocInfo::ModeMask(RelocInfo::RUNTIME_ENTRY); |
809 | 814 |
810 // There are two places where we iterate code bodies: here and the non- | 815 // There are two places where we iterate code bodies: here and the non- |
811 // templated CodeIterateBody (above). They should be kept in sync. | 816 // templated CodeIterateBody (above). They should be kept in sync. |
812 StaticVisitor::VisitPointer( | 817 StaticVisitor::VisitPointer( |
813 heap, | 818 heap, |
814 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); | 819 reinterpret_cast<Object**>(this->address() + kRelocationInfoOffset)); |
(...skipping 10 matching lines...) Expand all Loading... |
825 RelocIterator it(this, mode_mask); | 830 RelocIterator it(this, mode_mask); |
826 for (; !it.done(); it.next()) { | 831 for (; !it.done(); it.next()) { |
827 it.rinfo()->template Visit<StaticVisitor>(heap); | 832 it.rinfo()->template Visit<StaticVisitor>(heap); |
828 } | 833 } |
829 } | 834 } |
830 | 835 |
831 | 836 |
832 } } // namespace v8::internal | 837 } } // namespace v8::internal |
833 | 838 |
834 #endif // V8_OBJECTS_VISITING_INL_H_ | 839 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |