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