OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium 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 TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 5 #ifndef TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
7 | 7 |
8 #include <cassert> | 8 #include <cassert> |
9 #include <deque> | 9 #include <deque> |
10 #include <vector> | 10 #include <vector> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual ~Edge() {} | 80 virtual ~Edge() {} |
81 virtual LivenessKind Kind() = 0; | 81 virtual LivenessKind Kind() = 0; |
82 virtual void Accept(EdgeVisitor*) = 0; | 82 virtual void Accept(EdgeVisitor*) = 0; |
83 virtual bool NeedsFinalization() = 0; | 83 virtual bool NeedsFinalization() = 0; |
84 virtual TracingStatus NeedsTracing(NeedsTracingOption) { | 84 virtual TracingStatus NeedsTracing(NeedsTracingOption) { |
85 return TracingStatus::Unknown(); | 85 return TracingStatus::Unknown(); |
86 } | 86 } |
87 | 87 |
88 virtual bool IsValue() { return false; } | 88 virtual bool IsValue() { return false; } |
89 virtual bool IsRawPtr() { return false; } | 89 virtual bool IsRawPtr() { return false; } |
90 virtual bool IsRawPtrClass() { return false; } | |
91 virtual bool IsRefPtr() { return false; } | 90 virtual bool IsRefPtr() { return false; } |
92 virtual bool IsOwnPtr() { return false; } | 91 virtual bool IsOwnPtr() { return false; } |
93 virtual bool IsMember() { return false; } | 92 virtual bool IsMember() { return false; } |
94 virtual bool IsWeakMember() { return false; } | 93 virtual bool IsWeakMember() { return false; } |
95 virtual bool IsPersistent() { return false; } | 94 virtual bool IsPersistent() { return false; } |
96 virtual bool IsCollection() { return false; } | 95 virtual bool IsCollection() { return false; } |
97 }; | 96 }; |
98 | 97 |
99 // A value edge is a direct edge to some type, eg, part-object edges. | 98 // A value edge is a direct edge to some type, eg, part-object edges. |
100 class Value : public Edge { | 99 class Value : public Edge { |
(...skipping 18 matching lines...) Expand all Loading... |
119 protected: | 118 protected: |
120 PtrEdge(Edge* ptr) : ptr_(ptr) { | 119 PtrEdge(Edge* ptr) : ptr_(ptr) { |
121 assert(ptr && "EdgePtr pointer must be non-null"); | 120 assert(ptr && "EdgePtr pointer must be non-null"); |
122 } | 121 } |
123 private: | 122 private: |
124 Edge* ptr_; | 123 Edge* ptr_; |
125 }; | 124 }; |
126 | 125 |
127 class RawPtr : public PtrEdge { | 126 class RawPtr : public PtrEdge { |
128 public: | 127 public: |
129 RawPtr(Edge* ptr, bool is_ptr_class, bool is_ref_type) | 128 RawPtr(Edge* ptr, bool is_ref_type) |
130 : PtrEdge(ptr) | 129 : PtrEdge(ptr) |
131 , is_ptr_class_(is_ptr_class) | |
132 , is_ref_type_(is_ref_type) | 130 , is_ref_type_(is_ref_type) |
133 { | 131 { |
134 assert(!(is_ptr_class_ && is_ref_type_)); | |
135 } | 132 } |
136 | 133 |
137 bool IsRawPtr() { return true; } | 134 bool IsRawPtr() { return true; } |
138 bool IsRawPtrClass() { return is_ptr_class_; } | |
139 LivenessKind Kind() { return kWeak; } | 135 LivenessKind Kind() { return kWeak; } |
140 bool NeedsFinalization() { return false; } | 136 bool NeedsFinalization() { return false; } |
141 TracingStatus NeedsTracing(NeedsTracingOption) { | 137 TracingStatus NeedsTracing(NeedsTracingOption) { |
142 return TracingStatus::Unneeded(); | 138 return TracingStatus::Unneeded(); |
143 } | 139 } |
144 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } | 140 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } |
145 | 141 |
146 bool HasReferenceType() { return is_ref_type_; } | 142 bool HasReferenceType() { return is_ref_type_; } |
147 private: | 143 private: |
148 bool is_ptr_class_; | |
149 bool is_ref_type_; | 144 bool is_ref_type_; |
150 }; | 145 }; |
151 | 146 |
152 class RefPtr : public PtrEdge { | 147 class RefPtr : public PtrEdge { |
153 public: | 148 public: |
154 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } | 149 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } |
155 bool IsRefPtr() { return true; } | 150 bool IsRefPtr() { return true; } |
156 LivenessKind Kind() { return kStrong; } | 151 LivenessKind Kind() { return kStrong; } |
157 bool NeedsFinalization() { return true; } | 152 bool NeedsFinalization() { return true; } |
158 TracingStatus NeedsTracing(NeedsTracingOption) { | 153 TracingStatus NeedsTracing(NeedsTracingOption) { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 243 } |
249 | 244 |
250 private: | 245 private: |
251 RecordInfo* info_; | 246 RecordInfo* info_; |
252 Members members_; | 247 Members members_; |
253 bool on_heap_; | 248 bool on_heap_; |
254 bool is_root_; | 249 bool is_root_; |
255 }; | 250 }; |
256 | 251 |
257 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 252 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
OLD | NEW |