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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 &FixedBodyVisitor<StaticVisitor, | 72 &FixedBodyVisitor<StaticVisitor, |
73 SharedFunctionInfo::BodyDescriptor, | 73 SharedFunctionInfo::BodyDescriptor, |
74 int>::Visit); | 74 int>::Visit); |
75 | 75 |
76 table_.Register(kVisitSeqOneByteString, &VisitSeqOneByteString); | 76 table_.Register(kVisitSeqOneByteString, &VisitSeqOneByteString); |
77 | 77 |
78 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); | 78 table_.Register(kVisitSeqTwoByteString, &VisitSeqTwoByteString); |
79 | 79 |
80 table_.Register(kVisitJSFunction, &VisitJSFunction); | 80 table_.Register(kVisitJSFunction, &VisitJSFunction); |
81 | 81 |
| 82 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
| 83 |
| 84 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); |
| 85 |
82 table_.Register(kVisitFreeSpace, &VisitFreeSpace); | 86 table_.Register(kVisitFreeSpace, &VisitFreeSpace); |
83 | 87 |
84 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit); | 88 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit); |
85 | 89 |
86 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); | 90 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); |
87 | 91 |
88 table_.template RegisterSpecializations<DataObjectVisitor, | 92 table_.template RegisterSpecializations<DataObjectVisitor, |
89 kVisitDataObject, | 93 kVisitDataObject, |
90 kVisitDataObjectGeneric>(); | 94 kVisitDataObjectGeneric>(); |
91 | 95 |
92 table_.template RegisterSpecializations<JSObjectVisitor, | 96 table_.template RegisterSpecializations<JSObjectVisitor, |
93 kVisitJSObject, | 97 kVisitJSObject, |
94 kVisitJSObjectGeneric>(); | 98 kVisitJSObjectGeneric>(); |
95 table_.template RegisterSpecializations<StructVisitor, | 99 table_.template RegisterSpecializations<StructVisitor, |
96 kVisitStruct, | 100 kVisitStruct, |
97 kVisitStructGeneric>(); | 101 kVisitStructGeneric>(); |
98 } | 102 } |
99 | 103 |
100 | 104 |
101 template<typename StaticVisitor> | 105 template<typename StaticVisitor> |
| 106 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| 107 Map* map, HeapObject* object) { |
| 108 Heap* heap = map->GetHeap(); |
| 109 |
| 110 int object_size = JSArrayBuffer::BodyDescriptor::SizeOf(map, object); |
| 111 STATIC_ASSERT( |
| 112 JSArrayBuffer::kWeakFirstArrayOffset == |
| 113 JSArrayBuffer::kWeakNextOffset + kPointerSize); |
| 114 VisitPointers( |
| 115 heap, |
| 116 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), |
| 117 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); |
| 118 VisitPointers( |
| 119 heap, |
| 120 HeapObject::RawField(object, |
| 121 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), |
| 122 HeapObject::RawField(object, object_size)); |
| 123 return object_size; |
| 124 } |
| 125 |
| 126 template<typename StaticVisitor> |
| 127 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSTypedArray( |
| 128 Map* map, HeapObject* object) { |
| 129 int object_size = JSTypedArray::BodyDescriptor::SizeOf(map, object); |
| 130 VisitPointers( |
| 131 map->GetHeap(), |
| 132 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |
| 133 HeapObject::RawField(object, JSTypedArray::kWeakNextOffset)); |
| 134 VisitPointers( |
| 135 map->GetHeap(), |
| 136 HeapObject::RawField(object, |
| 137 JSTypedArray::kWeakNextOffset + kPointerSize), |
| 138 HeapObject::RawField(object, object_size)); |
| 139 return object_size; |
| 140 } |
| 141 |
| 142 |
| 143 |
| 144 template<typename StaticVisitor> |
102 void StaticMarkingVisitor<StaticVisitor>::Initialize() { | 145 void StaticMarkingVisitor<StaticVisitor>::Initialize() { |
103 table_.Register(kVisitShortcutCandidate, | 146 table_.Register(kVisitShortcutCandidate, |
104 &FixedBodyVisitor<StaticVisitor, | 147 &FixedBodyVisitor<StaticVisitor, |
105 ConsString::BodyDescriptor, | 148 ConsString::BodyDescriptor, |
106 void>::Visit); | 149 void>::Visit); |
107 | 150 |
108 table_.Register(kVisitConsString, | 151 table_.Register(kVisitConsString, |
109 &FixedBodyVisitor<StaticVisitor, | 152 &FixedBodyVisitor<StaticVisitor, |
110 ConsString::BodyDescriptor, | 153 ConsString::BodyDescriptor, |
111 void>::Visit); | 154 void>::Visit); |
(...skipping 30 matching lines...) Expand all Loading... |
142 void>::Visit); | 185 void>::Visit); |
143 | 186 |
144 table_.Register(kVisitMap, &VisitMap); | 187 table_.Register(kVisitMap, &VisitMap); |
145 | 188 |
146 table_.Register(kVisitCode, &VisitCode); | 189 table_.Register(kVisitCode, &VisitCode); |
147 | 190 |
148 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | 191 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); |
149 | 192 |
150 table_.Register(kVisitJSFunction, &VisitJSFunction); | 193 table_.Register(kVisitJSFunction, &VisitJSFunction); |
151 | 194 |
| 195 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
| 196 |
| 197 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); |
| 198 |
| 199 |
152 // Registration for kVisitJSRegExp is done by StaticVisitor. | 200 // Registration for kVisitJSRegExp is done by StaticVisitor. |
153 | 201 |
154 table_.Register(kVisitPropertyCell, | 202 table_.Register(kVisitPropertyCell, |
155 &FixedBodyVisitor<StaticVisitor, | 203 &FixedBodyVisitor<StaticVisitor, |
156 JSGlobalPropertyCell::BodyDescriptor, | 204 JSGlobalPropertyCell::BodyDescriptor, |
157 void>::Visit); | 205 void>::Visit); |
158 | 206 |
159 table_.template RegisterSpecializations<DataObjectVisitor, | 207 table_.template RegisterSpecializations<DataObjectVisitor, |
160 kVisitDataObject, | 208 kVisitDataObject, |
161 kVisitDataObjectGeneric>(); | 209 kVisitDataObjectGeneric>(); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 Map* map, HeapObject* object) { | 442 Map* map, HeapObject* object) { |
395 int last_property_offset = | 443 int last_property_offset = |
396 JSRegExp::kSize + kPointerSize * map->inobject_properties(); | 444 JSRegExp::kSize + kPointerSize * map->inobject_properties(); |
397 StaticVisitor::VisitPointers(map->GetHeap(), | 445 StaticVisitor::VisitPointers(map->GetHeap(), |
398 HeapObject::RawField(object, JSRegExp::kPropertiesOffset), | 446 HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |
399 HeapObject::RawField(object, last_property_offset)); | 447 HeapObject::RawField(object, last_property_offset)); |
400 } | 448 } |
401 | 449 |
402 | 450 |
403 template<typename StaticVisitor> | 451 template<typename StaticVisitor> |
| 452 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| 453 Map* map, HeapObject* object) { |
| 454 Heap* heap = map->GetHeap(); |
| 455 |
| 456 int object_size = JSArrayBuffer::BodyDescriptor::SizeOf(map, object); |
| 457 STATIC_ASSERT( |
| 458 JSArrayBuffer::kWeakFirstArrayOffset == |
| 459 JSArrayBuffer::kWeakNextOffset + kPointerSize); |
| 460 StaticVisitor::VisitPointers( |
| 461 heap, |
| 462 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), |
| 463 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); |
| 464 StaticVisitor::VisitPointers( |
| 465 heap, |
| 466 HeapObject::RawField(object, |
| 467 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), |
| 468 HeapObject::RawField(object, object_size)); |
| 469 } |
| 470 |
| 471 template<typename StaticVisitor> |
| 472 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( |
| 473 Map* map, HeapObject* object) { |
| 474 int object_size = JSTypedArray::BodyDescriptor::SizeOf(map, object); |
| 475 StaticVisitor::VisitPointers( |
| 476 map->GetHeap(), |
| 477 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |
| 478 HeapObject::RawField(object, JSTypedArray::kWeakNextOffset)); |
| 479 StaticVisitor::VisitPointers( |
| 480 map->GetHeap(), |
| 481 HeapObject::RawField(object, |
| 482 JSTypedArray::kWeakNextOffset + kPointerSize), |
| 483 HeapObject::RawField(object, object_size)); |
| 484 } |
| 485 |
| 486 |
| 487 template<typename StaticVisitor> |
404 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( | 488 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( |
405 Heap* heap, Map* map) { | 489 Heap* heap, Map* map) { |
406 // Make sure that the back pointer stored either in the map itself or | 490 // Make sure that the back pointer stored either in the map itself or |
407 // inside its transitions array is marked. Skip recording the back | 491 // inside its transitions array is marked. Skip recording the back |
408 // pointer slot since map space is not compacted. | 492 // pointer slot since map space is not compacted. |
409 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); | 493 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); |
410 | 494 |
411 // Treat pointers in the transitions array as weak and also mark that | 495 // Treat pointers in the transitions array as weak and also mark that |
412 // array to prevent visiting it later. Skip recording the transition | 496 // array to prevent visiting it later. Skip recording the transition |
413 // array slot, since it will be implicitly recorded when the pointer | 497 // array slot, since it will be implicitly recorded when the pointer |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 RelocIterator it(this, mode_mask); | 829 RelocIterator it(this, mode_mask); |
746 for (; !it.done(); it.next()) { | 830 for (; !it.done(); it.next()) { |
747 it.rinfo()->template Visit<StaticVisitor>(heap); | 831 it.rinfo()->template Visit<StaticVisitor>(heap); |
748 } | 832 } |
749 } | 833 } |
750 | 834 |
751 | 835 |
752 } } // namespace v8::internal | 836 } } // namespace v8::internal |
753 | 837 |
754 #endif // V8_OBJECTS_VISITING_INL_H_ | 838 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |