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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 } | 352 } |
353 | 353 |
354 | 354 |
355 template <typename StaticVisitor> | 355 template <typename StaticVisitor> |
356 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, | 356 void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, |
357 HeapObject* object) { | 357 HeapObject* object) { |
358 Heap* heap = map->GetHeap(); | 358 Heap* heap = map->GetHeap(); |
359 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); | 359 WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); |
360 Object* undefined = heap->undefined_value(); | 360 Object* undefined = heap->undefined_value(); |
361 // Enqueue weak cell in linked list of encountered weak collections. | 361 // Enqueue weak cell in linked list of encountered weak collections. |
362 // We can ignore weak cells with cleared values because they will always point | 362 // We can ignore weak cells with cleared values because they will always |
363 // to the undefined_value. | 363 // contain smi zero. |
364 if (weak_cell->next() == undefined && weak_cell->value() != undefined) { | 364 if (weak_cell->next() == undefined && !weak_cell->cleared()) { |
365 weak_cell->set_next(heap->encountered_weak_cells()); | 365 weak_cell->set_next(heap->encountered_weak_cells()); |
366 heap->set_encountered_weak_cells(weak_cell); | 366 heap->set_encountered_weak_cells(weak_cell); |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 | 370 |
371 template <typename StaticVisitor> | 371 template <typename StaticVisitor> |
372 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( | 372 void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( |
373 Map* map, HeapObject* object) { | 373 Map* map, HeapObject* object) { |
374 Heap* heap = map->GetHeap(); | 374 Heap* heap = map->GetHeap(); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
944 | 944 |
945 RelocIterator it(this, mode_mask); | 945 RelocIterator it(this, mode_mask); |
946 for (; !it.done(); it.next()) { | 946 for (; !it.done(); it.next()) { |
947 it.rinfo()->template Visit<StaticVisitor>(heap); | 947 it.rinfo()->template Visit<StaticVisitor>(heap); |
948 } | 948 } |
949 } | 949 } |
950 } | 950 } |
951 } // namespace v8::internal | 951 } // namespace v8::internal |
952 | 952 |
953 #endif // V8_OBJECTS_VISITING_INL_H_ | 953 #endif // V8_OBJECTS_VISITING_INL_H_ |
OLD | NEW |