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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 object->GetHeap()->UpdateAllocationSite<Heap::kGlobal>( | 31 object->GetHeap()->UpdateAllocationSite<Heap::kGlobal>( |
32 object, object->GetHeap()->global_pretenuring_feedback_); | 32 object, object->GetHeap()->global_pretenuring_feedback_); |
33 | 33 |
34 // AllocationMementos are unrooted and shouldn't survive a scavenge | 34 // AllocationMementos are unrooted and shouldn't survive a scavenge |
35 DCHECK(object->map() != object->GetHeap()->allocation_memento_map()); | 35 DCHECK(object->map() != object->GetHeap()->allocation_memento_map()); |
36 // Call the slow part of scavenge object. | 36 // Call the slow part of scavenge object. |
37 return ScavengeObjectSlow(p, object); | 37 return ScavengeObjectSlow(p, object); |
38 } | 38 } |
39 | 39 |
40 void Scavenger::ScavengeObjectSlow(HeapObject** p, HeapObject* object) { | |
41 SLOW_DCHECK(object->GetIsolate()->heap()->InFromSpace(object)); | |
42 MapWord first_word = object->map_word(); | |
43 SLOW_DCHECK(!first_word.IsForwardingAddress()); | |
44 Map* map = first_word.ToMap(); | |
45 Scavenger* scavenger = map->GetHeap()->scavenge_collector_; | |
46 scavenger->scavenging_visitors_table_.GetVisitor(map)(map, p, object); | |
47 } | |
48 | |
49 SlotCallbackResult Scavenger::CheckAndScavengeObject(Heap* heap, | 40 SlotCallbackResult Scavenger::CheckAndScavengeObject(Heap* heap, |
50 Address slot_address) { | 41 Address slot_address) { |
51 Object** slot = reinterpret_cast<Object**>(slot_address); | 42 Object** slot = reinterpret_cast<Object**>(slot_address); |
52 Object* object = *slot; | 43 Object* object = *slot; |
53 if (heap->InFromSpace(object)) { | 44 if (heap->InFromSpace(object)) { |
54 HeapObject* heap_object = reinterpret_cast<HeapObject*>(object); | 45 HeapObject* heap_object = reinterpret_cast<HeapObject*>(object); |
55 DCHECK(heap_object->IsHeapObject()); | 46 DCHECK(heap_object->IsHeapObject()); |
56 | 47 |
57 ScavengeObject(reinterpret_cast<HeapObject**>(slot), heap_object); | 48 ScavengeObject(reinterpret_cast<HeapObject**>(slot), heap_object); |
58 | 49 |
(...skipping 18 matching lines...) Expand all Loading... |
77 if (!heap_->InNewSpace(object)) continue; | 68 if (!heap_->InNewSpace(object)) continue; |
78 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), | 69 Scavenger::ScavengeObject(reinterpret_cast<HeapObject**>(p), |
79 reinterpret_cast<HeapObject*>(object)); | 70 reinterpret_cast<HeapObject*>(object)); |
80 } | 71 } |
81 } | 72 } |
82 | 73 |
83 } // namespace internal | 74 } // namespace internal |
84 } // namespace v8 | 75 } // namespace v8 |
85 | 76 |
86 #endif // V8_HEAP_SCAVENGER_INL_H_ | 77 #endif // V8_HEAP_SCAVENGER_INL_H_ |
OLD | NEW |