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 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 HeapObject::RawField(object, AllocationSite::kPointerFieldsEndOffset)); | 395 HeapObject::RawField(object, AllocationSite::kPointerFieldsEndOffset)); |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 template<typename StaticVisitor> | 399 template<typename StaticVisitor> |
400 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCollection( | 400 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCollection( |
401 Map* map, HeapObject* object) { | 401 Map* map, HeapObject* object) { |
402 Heap* heap = map->GetHeap(); | 402 Heap* heap = map->GetHeap(); |
403 JSWeakCollection* weak_collection = | 403 JSWeakCollection* weak_collection = |
404 reinterpret_cast<JSWeakCollection*>(object); | 404 reinterpret_cast<JSWeakCollection*>(object); |
405 MarkCompactCollector* collector = heap->mark_compact_collector(); | |
406 | 405 |
407 // Enqueue weak collection in linked list of encountered weak collections. | 406 // Enqueue weak collection in linked list of encountered weak collections. |
408 if (weak_collection->next() == heap->undefined_value()) { | 407 if (weak_collection->next() == heap->undefined_value()) { |
409 weak_collection->set_next(collector->encountered_weak_collections()); | 408 weak_collection->set_next(heap->encountered_weak_collections()); |
410 collector->set_encountered_weak_collections(weak_collection); | 409 heap->set_encountered_weak_collections(weak_collection); |
411 } | 410 } |
412 | 411 |
413 // Skip visiting the backing hash table containing the mappings and the | 412 // Skip visiting the backing hash table containing the mappings and the |
414 // pointer to the other enqueued weak collections, both are post-processed. | 413 // pointer to the other enqueued weak collections, both are post-processed. |
415 StaticVisitor::VisitPointers(heap, | 414 StaticVisitor::VisitPointers(heap, |
416 HeapObject::RawField(object, JSWeakCollection::kPropertiesOffset), | 415 HeapObject::RawField(object, JSWeakCollection::kPropertiesOffset), |
417 HeapObject::RawField(object, JSWeakCollection::kTableOffset)); | 416 HeapObject::RawField(object, JSWeakCollection::kTableOffset)); |
418 STATIC_ASSERT(JSWeakCollection::kTableOffset + kPointerSize == | 417 STATIC_ASSERT(JSWeakCollection::kTableOffset + kPointerSize == |
419 JSWeakCollection::kNextOffset); | 418 JSWeakCollection::kNextOffset); |
420 STATIC_ASSERT(JSWeakCollection::kNextOffset + kPointerSize == | 419 STATIC_ASSERT(JSWeakCollection::kNextOffset + kPointerSize == |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 RelocIterator it(this, mode_mask); | 959 RelocIterator it(this, mode_mask); |
961 for (; !it.done(); it.next()) { | 960 for (; !it.done(); it.next()) { |
962 it.rinfo()->template Visit<StaticVisitor>(heap); | 961 it.rinfo()->template Visit<StaticVisitor>(heap); |
963 } | 962 } |
964 } | 963 } |
965 | 964 |
966 | 965 |
967 } } // namespace v8::internal | 966 } } // namespace v8::internal |
968 | 967 |
969 #endif // V8_OBJECTS_VISITING_INL_H_ | 968 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |