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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 table_.Register(kVisitSeqOneByteString, &VisitSeqOneByteString); | 70 table_.Register(kVisitSeqOneByteString, &VisitSeqOneByteString); |
71 | 71 |
72 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 72 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
73 | 73 |
74 // Don't visit code entry. We are using this visitor only during scavenges. | 74 // Don't visit code entry. We are using this visitor only during scavenges. |
75 table_.Register( | 75 table_.Register( |
76 kVisitJSFunction, | 76 kVisitJSFunction, |
77 &FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 77 &FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
78 int>::Visit); | 78 int>::Visit); |
79 | 79 |
80 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | 80 table_.Register( |
| 81 kVisitJSArrayBuffer, |
| 82 &FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, |
| 83 int>::Visit); |
81 | 84 |
82 table_.Register(kVisitFreeSpace, &VisitFreeSpace); | 85 table_.Register(kVisitFreeSpace, &VisitFreeSpace); |
83 | 86 |
84 table_.Register(kVisitJSWeakCollection, &JSObjectVisitor::Visit); | 87 table_.Register(kVisitJSWeakCollection, &JSObjectVisitor::Visit); |
85 | 88 |
86 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); | 89 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); |
87 | 90 |
88 table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, | 91 table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, |
89 kVisitDataObjectGeneric>(); | 92 kVisitDataObjectGeneric>(); |
90 | 93 |
91 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, | 94 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSObject, |
92 kVisitJSObjectGeneric>(); | 95 kVisitJSObjectGeneric>(); |
93 | 96 |
94 // Not using specialized Api object visitor for newspace. | 97 // Not using specialized Api object visitor for newspace. |
95 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSApiObject, | 98 table_.template RegisterSpecializations<JSObjectVisitor, kVisitJSApiObject, |
96 kVisitJSApiObjectGeneric>(); | 99 kVisitJSApiObjectGeneric>(); |
97 | 100 |
98 table_.template RegisterSpecializations<StructVisitor, kVisitStruct, | 101 table_.template RegisterSpecializations<StructVisitor, kVisitStruct, |
99 kVisitStructGeneric>(); | 102 kVisitStructGeneric>(); |
100 } | 103 } |
101 | 104 |
102 | |
103 template <typename StaticVisitor> | |
104 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( | |
105 Map* map, HeapObject* object) { | |
106 typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, int> | |
107 JSArrayBufferBodyVisitor; | |
108 | |
109 if (!JSArrayBuffer::cast(object)->is_external()) { | |
110 Heap* heap = map->GetHeap(); | |
111 heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); | |
112 } | |
113 return JSArrayBufferBodyVisitor::Visit(map, object); | |
114 } | |
115 | |
116 | |
117 template <typename StaticVisitor> | 105 template <typename StaticVisitor> |
118 int StaticNewSpaceVisitor<StaticVisitor>::VisitBytecodeArray( | 106 int StaticNewSpaceVisitor<StaticVisitor>::VisitBytecodeArray( |
119 Map* map, HeapObject* object) { | 107 Map* map, HeapObject* object) { |
120 VisitPointers( | 108 VisitPointers( |
121 map->GetHeap(), object, | 109 map->GetHeap(), object, |
122 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), | 110 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), |
123 HeapObject::RawField(object, BytecodeArray::kFrameSizeOffset)); | 111 HeapObject::RawField(object, BytecodeArray::kFrameSizeOffset)); |
124 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); | 112 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); |
125 } | 113 } |
126 | 114 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 &FixedBodyVisitor<StaticVisitor, Oddball::BodyDescriptor, void>::Visit); | 166 &FixedBodyVisitor<StaticVisitor, Oddball::BodyDescriptor, void>::Visit); |
179 | 167 |
180 table_.Register(kVisitMap, &VisitMap); | 168 table_.Register(kVisitMap, &VisitMap); |
181 | 169 |
182 table_.Register(kVisitCode, &VisitCode); | 170 table_.Register(kVisitCode, &VisitCode); |
183 | 171 |
184 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | 172 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); |
185 | 173 |
186 table_.Register(kVisitJSFunction, &VisitJSFunction); | 174 table_.Register(kVisitJSFunction, &VisitJSFunction); |
187 | 175 |
188 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | 176 table_.Register( |
| 177 kVisitJSArrayBuffer, |
| 178 &FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, |
| 179 void>::Visit); |
189 | 180 |
190 // Registration for kVisitJSRegExp is done by StaticVisitor. | 181 // Registration for kVisitJSRegExp is done by StaticVisitor. |
191 | 182 |
192 table_.Register( | 183 table_.Register( |
193 kVisitCell, | 184 kVisitCell, |
194 &FixedBodyVisitor<StaticVisitor, Cell::BodyDescriptor, void>::Visit); | 185 &FixedBodyVisitor<StaticVisitor, Cell::BodyDescriptor, void>::Visit); |
195 | 186 |
196 table_.Register(kVisitPropertyCell, &VisitPropertyCell); | 187 table_.Register(kVisitPropertyCell, &VisitPropertyCell); |
197 | 188 |
198 table_.Register(kVisitWeakCell, &VisitWeakCell); | 189 table_.Register(kVisitWeakCell, &VisitWeakCell); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 VisitJSFunctionStrongCode(map, object); | 504 VisitJSFunctionStrongCode(map, object); |
514 } | 505 } |
515 | 506 |
516 | 507 |
517 template <typename StaticVisitor> | 508 template <typename StaticVisitor> |
518 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, | 509 void StaticMarkingVisitor<StaticVisitor>::VisitJSRegExp(Map* map, |
519 HeapObject* object) { | 510 HeapObject* object) { |
520 JSObjectVisitor::Visit(map, object); | 511 JSObjectVisitor::Visit(map, object); |
521 } | 512 } |
522 | 513 |
523 | |
524 template <typename StaticVisitor> | |
525 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( | |
526 Map* map, HeapObject* object) { | |
527 Heap* heap = map->GetHeap(); | |
528 | |
529 typedef FlexibleBodyVisitor<StaticVisitor, JSArrayBuffer::BodyDescriptor, | |
530 void> JSArrayBufferBodyVisitor; | |
531 | |
532 JSArrayBufferBodyVisitor::Visit(map, object); | |
533 | |
534 if (!JSArrayBuffer::cast(object)->is_external() && | |
535 !heap->InNewSpace(object)) { | |
536 heap->array_buffer_tracker()->MarkLive(JSArrayBuffer::cast(object)); | |
537 } | |
538 } | |
539 | |
540 | |
541 template <typename StaticVisitor> | 514 template <typename StaticVisitor> |
542 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( | 515 void StaticMarkingVisitor<StaticVisitor>::VisitBytecodeArray( |
543 Map* map, HeapObject* object) { | 516 Map* map, HeapObject* object) { |
544 StaticVisitor::VisitPointers( | 517 StaticVisitor::VisitPointers( |
545 map->GetHeap(), object, | 518 map->GetHeap(), object, |
546 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), | 519 HeapObject::RawField(object, BytecodeArray::kConstantPoolOffset), |
547 HeapObject::RawField(object, BytecodeArray::kFrameSizeOffset)); | 520 HeapObject::RawField(object, BytecodeArray::kFrameSizeOffset)); |
548 } | 521 } |
549 | 522 |
550 | 523 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 705 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
733 void> JSFunctionWeakCodeBodyVisitor; | 706 void> JSFunctionWeakCodeBodyVisitor; |
734 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 707 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
735 } | 708 } |
736 | 709 |
737 | 710 |
738 } // namespace internal | 711 } // namespace internal |
739 } // namespace v8 | 712 } // namespace v8 |
740 | 713 |
741 #endif // V8_OBJECTS_VISITING_INL_H_ | 714 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |