OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_ISOLATE_RELOAD_H_ | 5 #ifndef VM_ISOLATE_RELOAD_H_ |
6 #define VM_ISOLATE_RELOAD_H_ | 6 #define VM_ISOLATE_RELOAD_H_ |
7 | 7 |
8 #include "vm/hash_map.h" | 8 #include "vm/hash_map.h" |
9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 // Adds an object to be morphed. | 57 // Adds an object to be morphed. |
58 void AddObject(RawObject* object) const; | 58 void AddObject(RawObject* object) const; |
59 | 59 |
60 // Create the morphed objects based on the before() list. | 60 // Create the morphed objects based on the before() list. |
61 void CreateMorphedCopies() const; | 61 void CreateMorphedCopies() const; |
62 | 62 |
63 // Dump the state of the morpher. | 63 // Dump the state of the morpher. |
64 void Dump() const; | 64 void Dump() const; |
65 | 65 |
| 66 // Append the morper info to JSON array. |
| 67 void AppendTo(JSONArray* array); |
| 68 |
66 // Returns the list of objects that need to be morphed. | 69 // Returns the list of objects that need to be morphed. |
67 ZoneGrowableArray<const Instance*>* before() const { return before_; } | 70 ZoneGrowableArray<const Instance*>* before() const { return before_; } |
68 // Returns the list of morphed objects (matches order in before()). | 71 // Returns the list of morphed objects (matches order in before()). |
69 ZoneGrowableArray<const Instance*>* after() const { return after_; } | 72 ZoneGrowableArray<const Instance*>* after() const { return after_; } |
70 | 73 |
71 // Returns the cid associated with the from_ and to_ class. | 74 // Returns the cid associated with the from_ and to_ class. |
72 intptr_t cid() const { return cid_; } | 75 intptr_t cid() const { return cid_; } |
73 | 76 |
74 private: | 77 private: |
75 const Class& from_; | 78 const Class& from_; |
(...skipping 17 matching lines...) Expand all Loading... |
93 void Report(IsolateReloadContext* context); | 96 void Report(IsolateReloadContext* context); |
94 | 97 |
95 // Conversion to a VM error object. | 98 // Conversion to a VM error object. |
96 // Default implementation calls ToString. | 99 // Default implementation calls ToString. |
97 virtual RawError* ToError(); | 100 virtual RawError* ToError(); |
98 | 101 |
99 // Conversion to a string object. | 102 // Conversion to a string object. |
100 // Default implementation calls ToError. | 103 // Default implementation calls ToError. |
101 virtual RawString* ToString(); | 104 virtual RawString* ToString(); |
102 | 105 |
| 106 // Append the reason to JSON array. |
| 107 virtual void AppendTo(JSONArray* array); |
| 108 |
103 // Concrete subclasses must override either ToError or ToString. | 109 // Concrete subclasses must override either ToError or ToString. |
104 }; | 110 }; |
105 | 111 |
106 | 112 |
107 // Abstract class for also capturing the from_ and to_ class. | 113 // Abstract class for also capturing the from_ and to_ class. |
108 class ClassReasonForCancelling : public ReasonForCancelling { | 114 class ClassReasonForCancelling : public ReasonForCancelling { |
109 public: | 115 public: |
110 ClassReasonForCancelling(const Class& from, const Class& to) | 116 ClassReasonForCancelling(const Class& from, const Class& to) |
111 : from_(from), to_(to) { } | 117 : from_(from), to_(to) { } |
112 | 118 |
| 119 void AppendTo(JSONArray* array); |
| 120 |
113 protected: | 121 protected: |
114 const Class& from_; | 122 const Class& from_; |
115 const Class& to_; | 123 const Class& to_; |
116 }; | 124 }; |
117 | 125 |
118 | 126 |
119 class IsolateReloadContext { | 127 class IsolateReloadContext { |
120 public: | 128 public: |
121 explicit IsolateReloadContext(Isolate* isolate); | 129 explicit IsolateReloadContext(Isolate* isolate); |
122 ~IsolateReloadContext(); | 130 ~IsolateReloadContext(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 int64_t start_time_micros() const { return start_time_micros_; } | 164 int64_t start_time_micros() const { return start_time_micros_; } |
157 | 165 |
158 // Tells whether there are reasons for cancelling the reload. | 166 // Tells whether there are reasons for cancelling the reload. |
159 bool HasReasonsForCancelling() const { | 167 bool HasReasonsForCancelling() const { |
160 return !reasons_to_cancel_reload_.is_empty(); | 168 return !reasons_to_cancel_reload_.is_empty(); |
161 } | 169 } |
162 | 170 |
163 // Record problem for this reload. | 171 // Record problem for this reload. |
164 void AddReasonForCancelling(ReasonForCancelling* reason); | 172 void AddReasonForCancelling(ReasonForCancelling* reason); |
165 | 173 |
166 // Report all reasons for cancelling reload. | 174 // Reports all reasons for cancelling reload. |
167 void ReportReasonsForCancelling(); | 175 void ReportReasonsForCancelling(); |
168 | 176 |
| 177 // Reports the deails of a reload operation. |
| 178 void ReportOnJSON(JSONStream* stream); |
| 179 |
169 // Store morphing operation. | 180 // Store morphing operation. |
170 void AddInstanceMorpher(InstanceMorpher* morpher); | 181 void AddInstanceMorpher(InstanceMorpher* morpher); |
171 | 182 |
172 // Tells whether instance in the heap must be morphed. | 183 // Tells whether instance in the heap must be morphed. |
173 bool HasInstanceMorphers() const { | 184 bool HasInstanceMorphers() const { |
174 return !instance_morphers_.is_empty(); | 185 return !instance_morphers_.is_empty(); |
175 } | 186 } |
176 | 187 |
177 private: | 188 private: |
178 void set_saved_root_library(const Library& value); | 189 void set_saved_root_library(const Library& value); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 RawObject** to() { return reinterpret_cast<RawObject**>(&saved_libraries_); } | 300 RawObject** to() { return reinterpret_cast<RawObject**>(&saved_libraries_); } |
290 | 301 |
291 friend class Isolate; | 302 friend class Isolate; |
292 friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping. | 303 friend class Class; // AddStaticFieldMapping, AddEnumBecomeMapping. |
293 friend class ObjectLocator; | 304 friend class ObjectLocator; |
294 }; | 305 }; |
295 | 306 |
296 } // namespace dart | 307 } // namespace dart |
297 | 308 |
298 #endif // VM_ISOLATE_RELOAD_H_ | 309 #endif // VM_ISOLATE_RELOAD_H_ |
OLD | NEW |