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 #include "src/heap/array-buffer-tracker.h" | 8 #include "src/heap/array-buffer-tracker.h" |
9 #include "src/heap/objects-visiting.h" | 9 #include "src/heap/objects-visiting.h" |
10 #include "src/ic/ic-state.h" | 10 #include "src/ic/ic-state.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 template <typename StaticVisitor> | 335 template <typename StaticVisitor> |
336 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, | 336 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, |
337 HeapObject* object) { | 337 HeapObject* object) { |
338 Heap* heap = map->GetHeap(); | 338 Heap* heap = map->GetHeap(); |
339 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); | 339 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); |
340 // Enqueue weak cell in linked list of encountered weak collections. | 340 // Enqueue weak cell in linked list of encountered weak collections. |
341 // We can ignore weak cells with cleared values because they will always | 341 // We can ignore weak cells with cleared values because they will always |
342 // contain smi zero. | 342 // contain smi zero. |
343 if (weak_cell->next_cleared() && !weak_cell->cleared()) { | 343 if (weak_cell->next_cleared() && !weak_cell->cleared()) { |
344 HeapObject* value = HeapObject::cast(weak_cell->value()); | 344 HeapObject* value = HeapObject::cast(weak_cell->value()); |
345 if (MarkCompactCollector::IsMarked(value)) { | 345 if (ObjectMarking::IsBlackOrGrey(value)) { |
346 // Weak cells with live values are directly processed here to reduce | 346 // Weak cells with live values are directly processed here to reduce |
347 // the processing time of weak cells during the main GC pause. | 347 // the processing time of weak cells during the main GC pause. |
348 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); | 348 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); |
349 map->GetHeap()->mark_compact_collector()->RecordSlot(weak_cell, slot, | 349 map->GetHeap()->mark_compact_collector()->RecordSlot(weak_cell, slot, |
350 *slot); | 350 *slot); |
351 } else { | 351 } else { |
352 // If we do not know about liveness of values of weak cells, we have to | 352 // If we do not know about liveness of values of weak cells, we have to |
353 // process them when we know the liveness of the whole transitive | 353 // process them when we know the liveness of the whole transitive |
354 // closure. | 354 // closure. |
355 weak_cell->set_next(heap->encountered_weak_cells(), | 355 weak_cell->set_next(heap->encountered_weak_cells(), |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, | 651 typedef FlexibleBodyVisitor<StaticVisitor, JSFunction::BodyDescriptorWeakCode, |
652 void> JSFunctionWeakCodeBodyVisitor; | 652 void> JSFunctionWeakCodeBodyVisitor; |
653 JSFunctionWeakCodeBodyVisitor::Visit(map, object); | 653 JSFunctionWeakCodeBodyVisitor::Visit(map, object); |
654 } | 654 } |
655 | 655 |
656 | 656 |
657 } // namespace internal | 657 } // namespace internal |
658 } // namespace v8 | 658 } // namespace v8 |
659 | 659 |
660 #endif // V8_OBJECTS_VISITING_INL_H_ | 660 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |