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_H_ | 5 #ifndef V8_HEAP_SCAVENGER_H_ |
6 #define V8_HEAP_SCAVENGER_H_ | 6 #define V8_HEAP_SCAVENGER_H_ |
7 | 7 |
8 #include "src/heap/objects-visiting.h" | 8 #include "src/heap/objects-visiting.h" |
| 9 #include "src/heap/slot-set.h" |
9 | 10 |
10 namespace v8 { | 11 namespace v8 { |
11 namespace internal { | 12 namespace internal { |
12 | 13 |
13 typedef void (*ScavengingCallback)(Map* map, HeapObject** slot, | 14 typedef void (*ScavengingCallback)(Map* map, HeapObject** slot, |
14 HeapObject* object); | 15 HeapObject* object); |
15 | 16 |
16 class Scavenger { | 17 class Scavenger { |
17 public: | 18 public: |
18 explicit Scavenger(Heap* heap) : heap_(heap) {} | 19 explicit Scavenger(Heap* heap) : heap_(heap) {} |
19 | 20 |
20 // Initializes static visitor dispatch tables. | 21 // Initializes static visitor dispatch tables. |
21 static void Initialize(); | 22 static void Initialize(); |
22 | 23 |
23 // Callback function passed to Heap::Iterate etc. Copies an object if | 24 // Callback function passed to Heap::Iterate etc. Copies an object if |
24 // necessary, the object might be promoted to an old space. The caller must | 25 // necessary, the object might be promoted to an old space. The caller must |
25 // ensure the precondition that the object is (a) a heap object and (b) in | 26 // ensure the precondition that the object is (a) a heap object and (b) in |
26 // the heap's from space. | 27 // the heap's from space. |
27 static inline void ScavengeObject(HeapObject** p, HeapObject* object); | 28 static inline void ScavengeObject(HeapObject** p, HeapObject* object); |
| 29 static inline SlotCallbackResult CheckAndScavengeObject(Heap* heap, |
| 30 Address slot_address); |
28 | 31 |
29 // Slow part of {ScavengeObject} above. | 32 // Slow part of {ScavengeObject} above. |
30 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); | 33 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); |
31 | 34 |
32 // Chooses an appropriate static visitor table depending on the current state | 35 // Chooses an appropriate static visitor table depending on the current state |
33 // of the heap (i.e. incremental marking, logging and profiling). | 36 // of the heap (i.e. incremental marking, logging and profiling). |
34 void SelectScavengingVisitorsTable(); | 37 void SelectScavengingVisitorsTable(); |
35 | 38 |
36 Isolate* isolate(); | 39 Isolate* isolate(); |
37 Heap* heap() { return heap_; } | 40 Heap* heap() { return heap_; } |
(...skipping 25 matching lines...) Expand all Loading... |
63 class StaticScavengeVisitor | 66 class StaticScavengeVisitor |
64 : public StaticNewSpaceVisitor<StaticScavengeVisitor> { | 67 : public StaticNewSpaceVisitor<StaticScavengeVisitor> { |
65 public: | 68 public: |
66 static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p); | 69 static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p); |
67 }; | 70 }; |
68 | 71 |
69 } // namespace internal | 72 } // namespace internal |
70 } // namespace v8 | 73 } // namespace v8 |
71 | 74 |
72 #endif // V8_HEAP_SCAVENGER_H_ | 75 #endif // V8_HEAP_SCAVENGER_H_ |
OLD | NEW |