| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 82 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
| 83 | 83 |
| 84 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); | 84 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); |
| 85 | 85 |
| 86 table_.Register(kVisitJSDataView, &VisitJSDataView); |
| 87 |
| 86 table_.Register(kVisitFreeSpace, &VisitFreeSpace); | 88 table_.Register(kVisitFreeSpace, &VisitFreeSpace); |
| 87 | 89 |
| 88 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit); | 90 table_.Register(kVisitJSWeakMap, &JSObjectVisitor::Visit); |
| 89 | 91 |
| 90 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); | 92 table_.Register(kVisitJSRegExp, &JSObjectVisitor::Visit); |
| 91 | 93 |
| 92 table_.template RegisterSpecializations<DataObjectVisitor, | 94 table_.template RegisterSpecializations<DataObjectVisitor, |
| 93 kVisitDataObject, | 95 kVisitDataObject, |
| 94 kVisitDataObjectGeneric>(); | 96 kVisitDataObjectGeneric>(); |
| 95 | 97 |
| 96 table_.template RegisterSpecializations<JSObjectVisitor, | 98 table_.template RegisterSpecializations<JSObjectVisitor, |
| 97 kVisitJSObject, | 99 kVisitJSObject, |
| 98 kVisitJSObjectGeneric>(); | 100 kVisitJSObjectGeneric>(); |
| 99 table_.template RegisterSpecializations<StructVisitor, | 101 table_.template RegisterSpecializations<StructVisitor, |
| 100 kVisitStruct, | 102 kVisitStruct, |
| 101 kVisitStructGeneric>(); | 103 kVisitStructGeneric>(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 | 106 |
| 105 template<typename StaticVisitor> | 107 template<typename StaticVisitor> |
| 106 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( | 108 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| 107 Map* map, HeapObject* object) { | 109 Map* map, HeapObject* object) { |
| 108 Heap* heap = map->GetHeap(); | 110 Heap* heap = map->GetHeap(); |
| 109 | 111 |
| 110 STATIC_ASSERT( | 112 STATIC_ASSERT( |
| 111 JSArrayBuffer::kWeakFirstArrayOffset == | 113 JSArrayBuffer::kWeakFirstViewOffset == |
| 112 JSArrayBuffer::kWeakNextOffset + kPointerSize); | 114 JSArrayBuffer::kWeakNextOffset + kPointerSize); |
| 113 VisitPointers( | 115 VisitPointers( |
| 114 heap, | 116 heap, |
| 115 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), | 117 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), |
| 116 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); | 118 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); |
| 117 VisitPointers( | 119 VisitPointers( |
| 118 heap, | 120 heap, |
| 119 HeapObject::RawField(object, | 121 HeapObject::RawField(object, |
| 120 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), | 122 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), |
| 121 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); | 123 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 133 VisitPointers( | 135 VisitPointers( |
| 134 map->GetHeap(), | 136 map->GetHeap(), |
| 135 HeapObject::RawField(object, | 137 HeapObject::RawField(object, |
| 136 JSTypedArray::kWeakNextOffset + kPointerSize), | 138 JSTypedArray::kWeakNextOffset + kPointerSize), |
| 137 HeapObject::RawField(object, JSTypedArray::kSize)); | 139 HeapObject::RawField(object, JSTypedArray::kSize)); |
| 138 return JSTypedArray::kSize; | 140 return JSTypedArray::kSize; |
| 139 } | 141 } |
| 140 | 142 |
| 141 | 143 |
| 142 template<typename StaticVisitor> | 144 template<typename StaticVisitor> |
| 145 int StaticNewSpaceVisitor<StaticVisitor>::VisitJSDataView( |
| 146 Map* map, HeapObject* object) { |
| 147 VisitPointers( |
| 148 map->GetHeap(), |
| 149 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |
| 150 HeapObject::RawField(object, JSDataView::kWeakNextOffset)); |
| 151 VisitPointers( |
| 152 map->GetHeap(), |
| 153 HeapObject::RawField(object, |
| 154 JSDataView::kWeakNextOffset + kPointerSize), |
| 155 HeapObject::RawField(object, JSDataView::kSize)); |
| 156 return JSDataView::kSize; |
| 157 } |
| 158 |
| 159 |
| 160 template<typename StaticVisitor> |
| 143 void StaticMarkingVisitor<StaticVisitor>::Initialize() { | 161 void StaticMarkingVisitor<StaticVisitor>::Initialize() { |
| 144 table_.Register(kVisitShortcutCandidate, | 162 table_.Register(kVisitShortcutCandidate, |
| 145 &FixedBodyVisitor<StaticVisitor, | 163 &FixedBodyVisitor<StaticVisitor, |
| 146 ConsString::BodyDescriptor, | 164 ConsString::BodyDescriptor, |
| 147 void>::Visit); | 165 void>::Visit); |
| 148 | 166 |
| 149 table_.Register(kVisitConsString, | 167 table_.Register(kVisitConsString, |
| 150 &FixedBodyVisitor<StaticVisitor, | 168 &FixedBodyVisitor<StaticVisitor, |
| 151 ConsString::BodyDescriptor, | 169 ConsString::BodyDescriptor, |
| 152 void>::Visit); | 170 void>::Visit); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 table_.Register(kVisitCode, &VisitCode); | 205 table_.Register(kVisitCode, &VisitCode); |
| 188 | 206 |
| 189 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | 207 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); |
| 190 | 208 |
| 191 table_.Register(kVisitJSFunction, &VisitJSFunction); | 209 table_.Register(kVisitJSFunction, &VisitJSFunction); |
| 192 | 210 |
| 193 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | 211 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); |
| 194 | 212 |
| 195 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); | 213 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); |
| 196 | 214 |
| 215 table_.Register(kVisitJSDataView, &VisitJSDataView); |
| 216 |
| 197 // Registration for kVisitJSRegExp is done by StaticVisitor. | 217 // Registration for kVisitJSRegExp is done by StaticVisitor. |
| 198 | 218 |
| 199 table_.Register(kVisitCell, | 219 table_.Register(kVisitCell, |
| 200 &FixedBodyVisitor<StaticVisitor, | 220 &FixedBodyVisitor<StaticVisitor, |
| 201 Cell::BodyDescriptor, | 221 Cell::BodyDescriptor, |
| 202 void>::Visit); | 222 void>::Visit); |
| 203 | 223 |
| 204 table_.Register(kVisitPropertyCell, | 224 table_.Register(kVisitPropertyCell, |
| 205 &FixedBodyVisitor<StaticVisitor, | 225 &FixedBodyVisitor<StaticVisitor, |
| 206 PropertyCell::BodyDescriptor, | 226 PropertyCell::BodyDescriptor, |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 HeapObject::RawField(object, last_property_offset)); | 469 HeapObject::RawField(object, last_property_offset)); |
| 450 } | 470 } |
| 451 | 471 |
| 452 | 472 |
| 453 template<typename StaticVisitor> | 473 template<typename StaticVisitor> |
| 454 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( | 474 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( |
| 455 Map* map, HeapObject* object) { | 475 Map* map, HeapObject* object) { |
| 456 Heap* heap = map->GetHeap(); | 476 Heap* heap = map->GetHeap(); |
| 457 | 477 |
| 458 STATIC_ASSERT( | 478 STATIC_ASSERT( |
| 459 JSArrayBuffer::kWeakFirstArrayOffset == | 479 JSArrayBuffer::kWeakFirstViewOffset == |
| 460 JSArrayBuffer::kWeakNextOffset + kPointerSize); | 480 JSArrayBuffer::kWeakNextOffset + kPointerSize); |
| 461 StaticVisitor::VisitPointers( | 481 StaticVisitor::VisitPointers( |
| 462 heap, | 482 heap, |
| 463 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), | 483 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), |
| 464 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); | 484 HeapObject::RawField(object, JSArrayBuffer::kWeakNextOffset)); |
| 465 StaticVisitor::VisitPointers( | 485 StaticVisitor::VisitPointers( |
| 466 heap, | 486 heap, |
| 467 HeapObject::RawField(object, | 487 HeapObject::RawField(object, |
| 468 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), | 488 JSArrayBuffer::kWeakNextOffset + 2 * kPointerSize), |
| 469 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); | 489 HeapObject::RawField(object, JSArrayBuffer::kSizeWithInternalFields)); |
| 470 } | 490 } |
| 471 | 491 |
| 472 | 492 |
| 473 template<typename StaticVisitor> | 493 template<typename StaticVisitor> |
| 474 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( | 494 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( |
| 475 Map* map, HeapObject* object) { | 495 Map* map, HeapObject* object) { |
| 476 StaticVisitor::VisitPointers( | 496 StaticVisitor::VisitPointers( |
| 477 map->GetHeap(), | 497 map->GetHeap(), |
| 478 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), | 498 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), |
| 479 HeapObject::RawField(object, JSTypedArray::kWeakNextOffset)); | 499 HeapObject::RawField(object, JSTypedArray::kWeakNextOffset)); |
| 480 StaticVisitor::VisitPointers( | 500 StaticVisitor::VisitPointers( |
| 481 map->GetHeap(), | 501 map->GetHeap(), |
| 482 HeapObject::RawField(object, | 502 HeapObject::RawField(object, |
| 483 JSTypedArray::kWeakNextOffset + kPointerSize), | 503 JSTypedArray::kWeakNextOffset + kPointerSize), |
| 484 HeapObject::RawField(object, JSTypedArray::kSize)); | 504 HeapObject::RawField(object, JSTypedArray::kSize)); |
| 485 } | 505 } |
| 486 | 506 |
| 487 | 507 |
| 488 template<typename StaticVisitor> | 508 template<typename StaticVisitor> |
| 509 void StaticMarkingVisitor<StaticVisitor>::VisitJSDataView( |
| 510 Map* map, HeapObject* object) { |
| 511 StaticVisitor::VisitPointers( |
| 512 map->GetHeap(), |
| 513 HeapObject::RawField(object, JSDataView::BodyDescriptor::kStartOffset), |
| 514 HeapObject::RawField(object, JSDataView::kWeakNextOffset)); |
| 515 StaticVisitor::VisitPointers( |
| 516 map->GetHeap(), |
| 517 HeapObject::RawField(object, |
| 518 JSDataView::kWeakNextOffset + kPointerSize), |
| 519 HeapObject::RawField(object, JSDataView::kSize)); |
| 520 } |
| 521 |
| 522 |
| 523 template<typename StaticVisitor> |
| 489 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( | 524 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( |
| 490 Heap* heap, Map* map) { | 525 Heap* heap, Map* map) { |
| 491 // Make sure that the back pointer stored either in the map itself or | 526 // Make sure that the back pointer stored either in the map itself or |
| 492 // inside its transitions array is marked. Skip recording the back | 527 // inside its transitions array is marked. Skip recording the back |
| 493 // pointer slot since map space is not compacted. | 528 // pointer slot since map space is not compacted. |
| 494 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); | 529 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); |
| 495 | 530 |
| 496 // Treat pointers in the transitions array as weak and also mark that | 531 // Treat pointers in the transitions array as weak and also mark that |
| 497 // array to prevent visiting it later. Skip recording the transition | 532 // array to prevent visiting it later. Skip recording the transition |
| 498 // array slot, since it will be implicitly recorded when the pointer | 533 // array slot, since it will be implicitly recorded when the pointer |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 RelocIterator it(this, mode_mask); | 852 RelocIterator it(this, mode_mask); |
| 818 for (; !it.done(); it.next()) { | 853 for (; !it.done(); it.next()) { |
| 819 it.rinfo()->template Visit<StaticVisitor>(heap); | 854 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 820 } | 855 } |
| 821 } | 856 } |
| 822 | 857 |
| 823 | 858 |
| 824 } } // namespace v8::internal | 859 } } // namespace v8::internal |
| 825 | 860 |
| 826 #endif // V8_OBJECTS_VISITING_INL_H_ | 861 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |