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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 | 347 |
348 template <typename StaticVisitor> | 348 template <typename StaticVisitor> |
349 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, | 349 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, |
350 HeapObject* object) { | 350 HeapObject* object) { |
351 Heap* heap = map->GetHeap(); | 351 Heap* heap = map->GetHeap(); |
352 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); | 352 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); |
353 // Enqueue weak cell in linked list of encountered weak collections. | 353 // Enqueue weak cell in linked list of encountered weak collections. |
354 // We can ignore weak cells with cleared values because they will always | 354 // We can ignore weak cells with cleared values because they will always |
355 // contain smi zero. | 355 // contain smi zero. |
356 if (weak_cell->next_cleared() && !weak_cell->cleared()) { | 356 if (weak_cell->next_cleared() && !weak_cell->cleared()) { |
357 weak_cell->set_next(heap->encountered_weak_cells(), | 357 HeapObject* value = HeapObject::cast(weak_cell->value()); |
358 UPDATE_WEAK_WRITE_BARRIER); | 358 if (MarkCompactCollector::IsMarked(value)) { |
ulan
2015/09/22 11:30:46
Please add a comment explaining that this is done
Hannes Payer (out of office)
2015/09/22 13:22:57
Done.
| |
359 heap->set_encountered_weak_cells(weak_cell); | 359 Object** slot = HeapObject::RawField(weak_cell, WeakCell::kValueOffset); |
360 map->GetHeap()->mark_compact_collector()->RecordSlot(weak_cell, slot, | |
361 *slot); | |
362 } else { | |
363 weak_cell->set_next(heap->encountered_weak_cells(), | |
364 UPDATE_WEAK_WRITE_BARRIER); | |
365 heap->set_encountered_weak_cells(weak_cell); | |
366 } | |
360 } | 367 } |
361 } | 368 } |
362 | 369 |
363 | 370 |
364 template <typename StaticVisitor> | 371 template <typename StaticVisitor> |
365 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( | 372 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( |
366 Map* map, HeapObject* object) { | 373 Map* map, HeapObject* object) { |
367 Heap* heap = map->GetHeap(); | 374 Heap* heap = map->GetHeap(); |
368 | 375 |
369 StaticVisitor::VisitPointers( | 376 StaticVisitor::VisitPointers( |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 | 894 |
888 RelocIterator it(this, mode_mask); | 895 RelocIterator it(this, mode_mask); |
889 for (; !it.done(); it.next()) { | 896 for (; !it.done(); it.next()) { |
890 it.rinfo()->template Visit<StaticVisitor>(heap); | 897 it.rinfo()->template Visit<StaticVisitor>(heap); |
891 } | 898 } |
892 } | 899 } |
893 } | 900 } |
894 } // namespace v8::internal | 901 } // namespace v8::internal |
895 | 902 |
896 #endif // V8_OBJECTS_VISITING_INL_H_ | 903 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |