Chromium Code Reviews| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 void>::Visit); | 142 void>::Visit); |
| 143 | 143 |
| 144 table_.Register(kVisitMap, &VisitMap); | 144 table_.Register(kVisitMap, &VisitMap); |
| 145 | 145 |
| 146 table_.Register(kVisitCode, &VisitCode); | 146 table_.Register(kVisitCode, &VisitCode); |
| 147 | 147 |
| 148 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); | 148 table_.Register(kVisitSharedFunctionInfo, &VisitSharedFunctionInfo); |
| 149 | 149 |
| 150 table_.Register(kVisitJSFunction, &VisitJSFunction); | 150 table_.Register(kVisitJSFunction, &VisitJSFunction); |
| 151 | 151 |
| 152 table_.Register(kVisitJSArrayBuffer, &VisitJSArrayBuffer); | |
| 153 | |
| 154 table_.Register(kVisitJSTypedArray, &VisitJSTypedArray); | |
| 155 | |
| 156 | |
| 152 // Registration for kVisitJSRegExp is done by StaticVisitor. | 157 // Registration for kVisitJSRegExp is done by StaticVisitor. |
| 153 | 158 |
| 154 table_.Register(kVisitPropertyCell, | 159 table_.Register(kVisitPropertyCell, |
| 155 &FixedBodyVisitor<StaticVisitor, | 160 &FixedBodyVisitor<StaticVisitor, |
| 156 JSGlobalPropertyCell::BodyDescriptor, | 161 JSGlobalPropertyCell::BodyDescriptor, |
| 157 void>::Visit); | 162 void>::Visit); |
| 158 | 163 |
| 159 table_.template RegisterSpecializations<DataObjectVisitor, | 164 table_.template RegisterSpecializations<DataObjectVisitor, |
| 160 kVisitDataObject, | 165 kVisitDataObject, |
| 161 kVisitDataObjectGeneric>(); | 166 kVisitDataObjectGeneric>(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 Map* map, HeapObject* object) { | 399 Map* map, HeapObject* object) { |
| 395 int last_property_offset = | 400 int last_property_offset = |
| 396 JSRegExp::kSize + kPointerSize * map->inobject_properties(); | 401 JSRegExp::kSize + kPointerSize * map->inobject_properties(); |
| 397 StaticVisitor::VisitPointers(map->GetHeap(), | 402 StaticVisitor::VisitPointers(map->GetHeap(), |
| 398 HeapObject::RawField(object, JSRegExp::kPropertiesOffset), | 403 HeapObject::RawField(object, JSRegExp::kPropertiesOffset), |
| 399 HeapObject::RawField(object, last_property_offset)); | 404 HeapObject::RawField(object, last_property_offset)); |
| 400 } | 405 } |
| 401 | 406 |
| 402 | 407 |
| 403 template<typename StaticVisitor> | 408 template<typename StaticVisitor> |
| 409 void StaticMarkingVisitor<StaticVisitor>::VisitJSArrayBuffer( | |
| 410 Map* map, HeapObject* object) { | |
| 411 Heap* heap = map->GetHeap(); | |
| 412 JSArrayBuffer* array_buffer = JSArrayBuffer::cast(object); | |
| 413 MarkCompactCollector* collector = heap->mark_compact_collector(); | |
| 414 if (array_buffer->next() == Smi::FromInt(0)) { | |
|
Michael Starzinger
2013/05/21 15:48:04
This might cause an array buffer to be enqueued tw
| |
| 415 array_buffer->set_next(collector->encountered_array_buffers()); | |
| 416 collector->set_encountered_array_buffers(array_buffer); | |
| 417 } | |
| 418 | |
| 419 int object_size = JSArrayBuffer::BodyDescriptor::SizeOf(map, object); | |
| 420 StaticVisitor::VisitPointers( | |
| 421 heap, | |
| 422 HeapObject::RawField(object, JSArrayBuffer::BodyDescriptor::kStartOffset), | |
| 423 HeapObject::RawField(object, JSArrayBuffer::kFirstArrayOffset)); | |
| 424 StaticVisitor::VisitPointers( | |
| 425 heap, | |
| 426 HeapObject::RawField(object, JSArrayBuffer::kFirstArrayOffset + kPointerSi ze), | |
| 427 HeapObject::RawField(object, object_size)); | |
| 428 } | |
| 429 | |
| 430 template<typename StaticVisitor> | |
| 431 void StaticMarkingVisitor<StaticVisitor>::VisitJSTypedArray( | |
| 432 Map* map, HeapObject* object) { | |
| 433 int object_size = JSTypedArray::BodyDescriptor::SizeOf(map, object); | |
| 434 StaticVisitor::VisitPointers( | |
| 435 map->GetHeap(), | |
| 436 HeapObject::RawField(object, JSTypedArray::BodyDescriptor::kStartOffset), | |
| 437 HeapObject::RawField(object, JSTypedArray::kNextOffset)); | |
| 438 StaticVisitor::VisitPointers( | |
| 439 map->GetHeap(), | |
| 440 HeapObject::RawField(object, JSTypedArray::kNextOffset + kPointerSize), | |
| 441 HeapObject::RawField(object, object_size)); | |
| 442 } | |
| 443 | |
| 444 | |
| 445 template<typename StaticVisitor> | |
| 404 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( | 446 void StaticMarkingVisitor<StaticVisitor>::MarkMapContents( |
| 405 Heap* heap, Map* map) { | 447 Heap* heap, Map* map) { |
| 406 // Make sure that the back pointer stored either in the map itself or | 448 // Make sure that the back pointer stored either in the map itself or |
| 407 // inside its transitions array is marked. Skip recording the back | 449 // inside its transitions array is marked. Skip recording the back |
| 408 // pointer slot since map space is not compacted. | 450 // pointer slot since map space is not compacted. |
| 409 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); | 451 StaticVisitor::MarkObject(heap, HeapObject::cast(map->GetBackPointer())); |
| 410 | 452 |
| 411 // Treat pointers in the transitions array as weak and also mark that | 453 // Treat pointers in the transitions array as weak and also mark that |
| 412 // array to prevent visiting it later. Skip recording the transition | 454 // array to prevent visiting it later. Skip recording the transition |
| 413 // array slot, since it will be implicitly recorded when the pointer | 455 // 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); | 787 RelocIterator it(this, mode_mask); |
| 746 for (; !it.done(); it.next()) { | 788 for (; !it.done(); it.next()) { |
| 747 it.rinfo()->template Visit<StaticVisitor>(heap); | 789 it.rinfo()->template Visit<StaticVisitor>(heap); |
| 748 } | 790 } |
| 749 } | 791 } |
| 750 | 792 |
| 751 | 793 |
| 752 } } // namespace v8::internal | 794 } } // namespace v8::internal |
| 753 | 795 |
| 754 #endif // V8_OBJECTS_VISITING_INL_H_ | 796 #endif // V8_OBJECTS_VISITING_INL_H_ |
| OLD | NEW |