OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_HEAP_SCAVENGER_INL_H_ | 5 #ifndef V8_HEAP_SCAVENGER_INL_H_ |
6 #define V8_HEAP_SCAVENGER_INL_H_ | 6 #define V8_HEAP_SCAVENGER_INL_H_ |
7 | 7 |
8 #include "src/heap/scavenger.h" | 8 #include "src/heap/scavenger.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 ScavengeObject(reinterpret_cast<HeapObject**>(slot), heap_object); | 48 ScavengeObject(reinterpret_cast<HeapObject**>(slot), heap_object); |
49 | 49 |
50 object = *slot; | 50 object = *slot; |
51 // If the object was in from space before and is after executing the | 51 // If the object was in from space before and is after executing the |
52 // callback in to space, the object is still live. | 52 // callback in to space, the object is still live. |
53 // Unfortunately, we do not know about the slot. It could be in a | 53 // Unfortunately, we do not know about the slot. It could be in a |
54 // just freed free space object. | 54 // just freed free space object. |
55 if (heap->InToSpace(object)) { | 55 if (heap->InToSpace(object)) { |
56 return KEEP_SLOT; | 56 return KEEP_SLOT; |
57 } | 57 } |
58 } else { | |
59 DCHECK(!heap->InNewSpace(object)); | |
60 } | 58 } |
| 59 // Slots can point to "to" space if the slot has been recorded multiple |
| 60 // times in the remembered set. We remove the redundant slot now. |
61 return REMOVE_SLOT; | 61 return REMOVE_SLOT; |
62 } | 62 } |
63 | 63 |
64 // static | 64 // static |
65 template <PromotionMode promotion_mode> | 65 template <PromotionMode promotion_mode> |
66 void StaticScavengeVisitor<promotion_mode>::VisitPointer(Heap* heap, | 66 void StaticScavengeVisitor<promotion_mode>::VisitPointer(Heap* heap, |
67 HeapObject* obj, | 67 HeapObject* obj, |
68 Object** p) { | 68 Object** p) { |
69 Object* object = *p; | 69 Object* object = *p; |
70 if (!heap->InNewSpace(object)) return; | 70 if (!heap->InNewSpace(object)) return; |
71 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 71 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
72 reinterpret_cast<HeapObject*>(object)); | 72 reinterpret_cast<HeapObject*>(object)); |
73 } | 73 } |
74 | 74 |
75 } // namespace internal | 75 } // namespace internal |
76 } // namespace v8 | 76 } // namespace v8 |
77 | 77 |
78 #endif // V8_HEAP_SCAVENGER_INL_H_ | 78 #endif // V8_HEAP_SCAVENGER_INL_H_ |
OLD | NEW |