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 <deque> | 8 #include <deque> |
9 | 9 |
10 #include "TracingStatus.h" | 10 #include "TracingStatus.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 protected: | 117 protected: |
118 PtrEdge(Edge* ptr) : ptr_(ptr) { | 118 PtrEdge(Edge* ptr) : ptr_(ptr) { |
119 assert(ptr && "EdgePtr pointer must be non-null"); | 119 assert(ptr && "EdgePtr pointer must be non-null"); |
120 } | 120 } |
121 private: | 121 private: |
122 Edge* ptr_; | 122 Edge* ptr_; |
123 }; | 123 }; |
124 | 124 |
125 class RawPtr : public PtrEdge { | 125 class RawPtr : public PtrEdge { |
126 public: | 126 public: |
127 explicit RawPtr(Edge* ptr, bool is_ptr_class) | 127 RawPtr(Edge* ptr, bool is_ptr_class, bool is_ref_type) |
128 : PtrEdge(ptr), is_ptr_class_(is_ptr_class) { } | 128 : PtrEdge(ptr) |
| 129 , is_ptr_class_(is_ptr_class) |
| 130 , is_ref_type_(is_ref_type) |
| 131 { |
| 132 assert(!(is_ptr_class_ && is_ref_type_)); |
| 133 } |
| 134 |
129 bool IsRawPtr() { return true; } | 135 bool IsRawPtr() { return true; } |
130 bool IsRawPtrClass() { return is_ptr_class_; } | 136 bool IsRawPtrClass() { return is_ptr_class_; } |
131 LivenessKind Kind() { return kWeak; } | 137 LivenessKind Kind() { return kWeak; } |
132 bool NeedsFinalization() { return false; } | 138 bool NeedsFinalization() { return false; } |
133 TracingStatus NeedsTracing(NeedsTracingOption) { | 139 TracingStatus NeedsTracing(NeedsTracingOption) { |
134 return TracingStatus::Unneeded(); | 140 return TracingStatus::Unneeded(); |
135 } | 141 } |
136 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } | 142 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } |
| 143 |
| 144 bool HasReferenceType() { return is_ref_type_; } |
137 private: | 145 private: |
138 bool is_ptr_class_; | 146 bool is_ptr_class_; |
| 147 bool is_ref_type_; |
139 }; | 148 }; |
140 | 149 |
141 class RefPtr : public PtrEdge { | 150 class RefPtr : public PtrEdge { |
142 public: | 151 public: |
143 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } | 152 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } |
144 bool IsRefPtr() { return true; } | 153 bool IsRefPtr() { return true; } |
145 LivenessKind Kind() { return kStrong; } | 154 LivenessKind Kind() { return kStrong; } |
146 bool NeedsFinalization() { return true; } | 155 bool NeedsFinalization() { return true; } |
147 TracingStatus NeedsTracing(NeedsTracingOption) { | 156 TracingStatus NeedsTracing(NeedsTracingOption) { |
148 return TracingStatus::Unneeded(); | 157 return TracingStatus::Unneeded(); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 246 } |
238 | 247 |
239 private: | 248 private: |
240 RecordInfo* info_; | 249 RecordInfo* info_; |
241 Members members_; | 250 Members members_; |
242 bool on_heap_; | 251 bool on_heap_; |
243 bool is_root_; | 252 bool is_root_; |
244 }; | 253 }; |
245 | 254 |
246 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ | 255 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ |
OLD | NEW |