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/array-buffer-tracker.h" | 8 #include "src/heap/array-buffer-tracker.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 65 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
66 | 66 |
67 // Don't visit code entry. We are using this visitor only during scavenges. | 67 // Don't visit code entry. We are using this visitor only during scavenges. |
68 table_.Register( | 68 table_.Register( |
69 kVisitJSFunction, | 69 kVisitJSFunction, |
70 &FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 70 &FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
71 int>::Visit); | 71 int>::Visit); |
72 | 72 |
73 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | 73 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
74 | 74 |
75 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); | |
76 | |
77 table_.Register(kVisitJSDataView, &VisitJSDataView); | |
78 | |
79 table_.Register(kVisitFreeSpace, &VisitFreeSpace); | 75 table_.Register(kVisitFreeSpace, &VisitFreeSpace); |
80 | 76 |
81 table_.Register(kVisitJSWeakCollection, &JSObjectVisitor::Visit); | 77 table_.Register(kVisitJSWeakCollection, &JSObjectVisitor::Visit); |
82 | 78 |
83 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); | 79 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); |
84 | 80 |
85 table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, | 81 table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, |
86 kVisitDataObjectGeneric>(); | 82 kVisitDataObjectGeneric>(); |
87 | 83 |
88 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, | 84 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, |
(...skipping 11 matching lines...) Expand all Loading... |
100 | 96 |
101 if (!JSArrayBuffer::cast(object)->is_external()) { | 97 if (!JSArrayBuffer::cast(object)->is_external()) { |
102 Heap* heap = map->GetHeap(); | 98 Heap* heap = map->GetHeap(); |
103 heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); | 99 heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); |
104 } | 100 } |
105 return JSArrayBufferBodyVisitor::Visit(map, object); | 101 return JSArrayBufferBodyVisitor::Visit(map, object); |
106 } | 102 } |
107 | 103 |
108 | 104 |
109 template <typename StaticVisitor> | 105 template <typename StaticVisitor> |
110 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSTypedArray( | |
111 Map* map, HeapObject* object) { | |
112 VisitPointers( | |
113 map->GetHeap(), object, | |
114 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), | |
115 HeapObject::RawField(object, JSTypedArray::kSizeWithInternalFields)); | |
116 return JSTypedArray::kSizeWithInternalFields; | |
117 } | |
118 | |
119 | |
120 template <typename StaticVisitor> | |
121 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSDataView(Map* map, | |
122 HeapObject* object) { | |
123 VisitPointers( | |
124 map->GetHeap(), object, | |
125 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), | |
126 HeapObject::RawField(object, JSDataView::kSizeWithInternalFields)); | |
127 return JSDataView::kSizeWithInternalFields; | |
128 } | |
129 | |
130 | |
131 template <typename StaticVisitor> | |
132 int StaticNewSpaceVisitor<StaticVisitor>::VisitBytecodeArray( | 106 int StaticNewSpaceVisitor<StaticVisitor>::VisitBytecodeArray( |
133 Map* map, HeapObject* object) { | 107 Map* map, HeapObject* object) { |
134 VisitPointers( | 108 VisitPointers( |
135 map->GetHeap(), object, | 109 map->GetHeap(), object, |
136 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), | 110 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), |
137 HeapObject::RawField(object, BytecodeArray::kHeaderSize)); | 111 HeapObject::RawField(object, BytecodeArray::kHeaderSize)); |
138 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); | 112 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); |
139 } | 113 } |
140 | 114 |
141 | 115 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 table_.Register(kVisitMap, &VisitMap); | 162 table_.Register(kVisitMap, &VisitMap); |
189 | 163 |
190 table_.Register(kVisitCode, &VisitCode); | 164 table_.Register(kVisitCode, &VisitCode); |
191 | 165 |
192 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | 166 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); |
193 | 167 |
194 table_.Register(kVisitJSFunction, &VisitJSFunction); | 168 table_.Register(kVisitJSFunction, &VisitJSFunction); |
195 | 169 |
196 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | 170 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
197 | 171 |
198 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); | |
199 | |
200 table_.Register(kVisitJSDataView, &VisitJSDataView); | |
201 | |
202 // Registration for kVisitJSRegExp is done by StaticVisitor. | 172 // Registration for kVisitJSRegExp is done by StaticVisitor. |
203 | 173 |
204 table_.Register( | 174 table_.Register( |
205 kVisitCell, | 175 kVisitCell, |
206 &FixedBodyVisitor<StaticVisitor, Cell::BodyDescriptor, void>::Visit); | 176 &FixedBodyVisitor<StaticVisitor, Cell::BodyDescriptor, void>::Visit); |
207 | 177 |
208 table_.Register(kVisitPropertyCell, &VisitPropertyCell); | 178 table_.Register(kVisitPropertyCell, &VisitPropertyCell); |
209 | 179 |
210 table_.Register(kVisitWeakCell, &VisitWeakCell); | 180 table_.Register(kVisitWeakCell, &VisitWeakCell); |
211 | 181 |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 JSArrayBufferBodyVisitor::Visit(map, object); | 502 JSArrayBufferBodyVisitor::Visit(map, object); |
533 | 503 |
534 if (!JSArrayBuffer::cast(object)->is_external() && | 504 if (!JSArrayBuffer::cast(object)->is_external() && |
535 !heap->InNewSpace(object)) { | 505 !heap->InNewSpace(object)) { |
536 heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); | 506 heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); |
537 } | 507 } |
538 } | 508 } |
539 | 509 |
540 | 510 |
541 template <typename StaticVisitor> | 511 template <typename StaticVisitor> |
542 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( | |
543 Map* map, HeapObject* object) { | |
544 typedef FlexibleBodyVisitor<StaticVisitor, JSTypedArray::BodyDescriptor, void> | |
545 JSTypedArrayBodyVisitor; | |
546 JSTypedArrayBodyVisitor::Visit(map, object); | |
547 } | |
548 | |
549 | |
550 template <typename StaticVisitor> | |
551 void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView(Map* map, | |
552 HeapObject* object) { | |
553 typedef FlexibleBodyVisitor<StaticVisitor, JSDataView::BodyDescriptor, void> | |
554 JSDataViewBodyVisitor; | |
555 JSDataViewBodyVisitor::Visit(map, object); | |
556 } | |
557 | |
558 | |
559 template <typename StaticVisitor> | |
560 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( | 512 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( |
561 Map* map, HeapObject* object) { | 513 Map* map, HeapObject* object) { |
562 StaticVisitor::VisitPointers( | 514 StaticVisitor::VisitPointers( |
563 map->GetHeap(), object, | 515 map->GetHeap(), object, |
564 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), | 516 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), |
565 HeapObject::RawField(object, BytecodeArray::kHeaderSize)); | 517 HeapObject::RawField(object, BytecodeArray::kHeaderSize)); |
566 } | 518 } |
567 | 519 |
568 | 520 |
569 template <typename StaticVisitor> | 521 template <typename StaticVisitor> |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 760 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
809 void> JSFunctionWeakCodeBodyVisitor; | 761 void> JSFunctionWeakCodeBodyVisitor; |
810 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 762 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
811 } | 763 } |
812 | 764 |
813 | 765 |
814 } // namespace internal | 766 } // namespace internal |
815 } // namespace v8 | 767 } // namespace v8 |
816 | 768 |
817 #endif // V8_OBJECTS_VISITING_INL_H_ | 769 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |