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 28 matching lines...) Expand all Loading... |
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 // 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 |
48 // 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. |
49 // TODO(ulan): ObjectVisitor is needed only for code flusher. Remove it after | 49 class RootScavengeVisitor : public RootVisitor { |
50 // changing the scanvenger to treat JSFunction->next_link strongly. | |
51 class RootScavengeVisitor : public ObjectVisitor, public RootVisitor { | |
52 public: | 50 public: |
53 explicit RootScavengeVisitor(Heap* heap) : heap_(heap) {} | 51 explicit RootScavengeVisitor(Heap* heap) : heap_(heap) {} |
54 | 52 |
55 void VisitPointer(Object** p) override; | |
56 void VisitPointers(Object** start, Object** end) override; | |
57 | |
58 void VisitRootPointer(Root root, Object** p) override; | 53 void VisitRootPointer(Root root, Object** p) override; |
59 void VisitRootPointers(Root root, Object** start, Object** end) override; | 54 void VisitRootPointers(Root root, Object** start, Object** end) override; |
60 | 55 |
61 private: | 56 private: |
62 inline void ScavengePointer(Object** p); | 57 inline void ScavengePointer(Object** p); |
63 | 58 |
64 Heap* heap_; | 59 Heap* heap_; |
65 }; | 60 }; |
66 | 61 |
67 | 62 |
68 // Helper class for turning the scavenger into an object visitor that is also | 63 // Helper class for turning the scavenger into an object visitor that is also |
69 // filtering out non-HeapObjects and objects which do not reside in new space. | 64 // filtering out non-HeapObjects and objects which do not reside in new space. |
70 class StaticScavengeVisitor | 65 class StaticScavengeVisitor |
71 : public StaticNewSpaceVisitor<StaticScavengeVisitor> { | 66 : public StaticNewSpaceVisitor<StaticScavengeVisitor> { |
72 public: | 67 public: |
73 static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p); | 68 static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p); |
74 }; | 69 }; |
75 | 70 |
76 } // namespace internal | 71 } // namespace internal |
77 } // namespace v8 | 72 } // namespace v8 |
78 | 73 |
79 #endif // V8_HEAP_SCAVENGER_H_ | 74 #endif // V8_HEAP_SCAVENGER_H_ |
OLD | NEW |