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 |
(...skipping 26 matching lines...) Expand all Loading... |
37 void SelectScavengingVisitorsTable(); | 37 void SelectScavengingVisitorsTable(); |
38 | 38 |
39 Isolate* isolate(); | 39 Isolate* isolate(); |
40 Heap* heap() { return heap_; } | 40 Heap* heap() { return heap_; } |
41 | 41 |
42 private: | 42 private: |
43 Heap* heap_; | 43 Heap* heap_; |
44 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; | 44 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; |
45 }; | 45 }; |
46 | 46 |
47 | |
48 // Helper class for turning the scavenger into an object visitor that is also | 47 // Helper class for turning the scavenger into an object visitor that is also |
49 // filtering out non-HeapObjects and objects which do not reside in new space. | 48 // filtering out non-HeapObjects and objects which do not reside in new space. |
50 class ScavengeVisitor : public ObjectVisitor { | 49 // TODO(ulan): ObjectVisitor is needed only for code flusher. Remove it after |
| 50 // changing the scanvenger to treat JSFunction->next_link strongly. |
| 51 class RootScavengeVisitor : public ObjectVisitor, public RootVisitor { |
51 public: | 52 public: |
52 explicit ScavengeVisitor(Heap* heap) : heap_(heap) {} | 53 explicit RootScavengeVisitor(Heap* heap) : heap_(heap) {} |
53 | 54 |
54 void VisitPointer(Object** p) override; | 55 void VisitPointer(Object** p) override; |
55 void VisitPointers(Object** start, Object** end) override; | 56 void VisitPointers(Object** start, Object** end) override; |
56 | 57 |
| 58 void VisitRootPointer(Root root, Object** p) override; |
| 59 void VisitRootPointers(Root root, Object** start, Object** end) override; |
| 60 |
57 private: | 61 private: |
58 inline void ScavengePointer(Object** p); | 62 inline void ScavengePointer(Object** p); |
59 | 63 |
60 Heap* heap_; | 64 Heap* heap_; |
61 }; | 65 }; |
62 | 66 |
63 | 67 |
64 // Helper class for turning the scavenger into an object visitor that is also | 68 // Helper class for turning the scavenger into an object visitor that is also |
65 // filtering out non-HeapObjects and objects which do not reside in new space. | 69 // filtering out non-HeapObjects and objects which do not reside in new space. |
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 |