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