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 RUNTIME_VM_ISOLATE_RELOAD_H_ | 5 #ifndef RUNTIME_VM_ISOLATE_RELOAD_H_ |
6 #define RUNTIME_VM_ISOLATE_RELOAD_H_ | 6 #define RUNTIME_VM_ISOLATE_RELOAD_H_ |
7 | 7 |
8 #include "include/dart_tools_api.h" | 8 #include "include/dart_tools_api.h" |
9 | 9 |
10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 class ObjectPointerVisitor; | 43 class ObjectPointerVisitor; |
44 class ObjectStore; | 44 class ObjectStore; |
45 class RawError; | 45 class RawError; |
46 class RawGrowableObjectArray; | 46 class RawGrowableObjectArray; |
47 class RawLibrary; | 47 class RawLibrary; |
48 class RawObject; | 48 class RawObject; |
49 class RawString; | 49 class RawString; |
50 class Script; | 50 class Script; |
51 class UpdateClassesVisitor; | 51 class UpdateClassesVisitor; |
52 | 52 |
53 | |
54 class InstanceMorpher : public ZoneAllocated { | 53 class InstanceMorpher : public ZoneAllocated { |
55 public: | 54 public: |
56 InstanceMorpher(Zone* zone, const Class& from, const Class& to); | 55 InstanceMorpher(Zone* zone, const Class& from, const Class& to); |
57 virtual ~InstanceMorpher() {} | 56 virtual ~InstanceMorpher() {} |
58 | 57 |
59 // Called on each instance that needs to be morphed. | 58 // Called on each instance that needs to be morphed. |
60 RawInstance* Morph(const Instance& instance) const; | 59 RawInstance* Morph(const Instance& instance) const; |
61 | 60 |
62 void RunNewFieldInitializers() const; | 61 void RunNewFieldInitializers() const; |
63 | 62 |
(...skipping 25 matching lines...) Expand all Loading... |
89 ZoneGrowableArray<intptr_t> mapping_; | 88 ZoneGrowableArray<intptr_t> mapping_; |
90 ZoneGrowableArray<const Instance*>* before_; | 89 ZoneGrowableArray<const Instance*>* before_; |
91 ZoneGrowableArray<const Instance*>* after_; | 90 ZoneGrowableArray<const Instance*>* after_; |
92 ZoneGrowableArray<const Field*>* new_fields_; | 91 ZoneGrowableArray<const Field*>* new_fields_; |
93 intptr_t cid_; | 92 intptr_t cid_; |
94 | 93 |
95 void ComputeMapping(); | 94 void ComputeMapping(); |
96 void DumpFormatFor(const Class& cls) const; | 95 void DumpFormatFor(const Class& cls) const; |
97 }; | 96 }; |
98 | 97 |
99 | |
100 class ReasonForCancelling : public ZoneAllocated { | 98 class ReasonForCancelling : public ZoneAllocated { |
101 public: | 99 public: |
102 explicit ReasonForCancelling(Zone* zone) {} | 100 explicit ReasonForCancelling(Zone* zone) {} |
103 virtual ~ReasonForCancelling() {} | 101 virtual ~ReasonForCancelling() {} |
104 | 102 |
105 // Reports a reason for cancelling reload. | 103 // Reports a reason for cancelling reload. |
106 void Report(IsolateReloadContext* context); | 104 void Report(IsolateReloadContext* context); |
107 | 105 |
108 // Conversion to a VM error object. | 106 // Conversion to a VM error object. |
109 // Default implementation calls ToString. | 107 // Default implementation calls ToString. |
110 virtual RawError* ToError(); | 108 virtual RawError* ToError(); |
111 | 109 |
112 // Conversion to a string object. | 110 // Conversion to a string object. |
113 // Default implementation calls ToError. | 111 // Default implementation calls ToError. |
114 virtual RawString* ToString(); | 112 virtual RawString* ToString(); |
115 | 113 |
116 // Append the reason to JSON array. | 114 // Append the reason to JSON array. |
117 virtual void AppendTo(JSONArray* array); | 115 virtual void AppendTo(JSONArray* array); |
118 | 116 |
119 // Concrete subclasses must override either ToError or ToString. | 117 // Concrete subclasses must override either ToError or ToString. |
120 }; | 118 }; |
121 | 119 |
122 | |
123 // Abstract class for also capturing the from_ and to_ class. | 120 // Abstract class for also capturing the from_ and to_ class. |
124 class ClassReasonForCancelling : public ReasonForCancelling { | 121 class ClassReasonForCancelling : public ReasonForCancelling { |
125 public: | 122 public: |
126 ClassReasonForCancelling(Zone* zone, const Class& from, const Class& to); | 123 ClassReasonForCancelling(Zone* zone, const Class& from, const Class& to); |
127 void AppendTo(JSONArray* array); | 124 void AppendTo(JSONArray* array); |
128 | 125 |
129 protected: | 126 protected: |
130 const Class& from_; | 127 const Class& from_; |
131 const Class& to_; | 128 const Class& to_; |
132 }; | 129 }; |
133 | 130 |
134 | |
135 class IsolateReloadContext { | 131 class IsolateReloadContext { |
136 public: | 132 public: |
137 explicit IsolateReloadContext(Isolate* isolate, JSONStream* js); | 133 explicit IsolateReloadContext(Isolate* isolate, JSONStream* js); |
138 ~IsolateReloadContext(); | 134 ~IsolateReloadContext(); |
139 | 135 |
140 void Reload(bool force_reload, | 136 void Reload(bool force_reload, |
141 const char* root_script_url = NULL, | 137 const char* root_script_url = NULL, |
142 const char* packages_url = NULL); | 138 const char* packages_url = NULL); |
143 | 139 |
144 // All zone allocated objects must be allocated from this zone. | 140 // All zone allocated objects must be allocated from this zone. |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 friend class ObjectLocator; | 353 friend class ObjectLocator; |
358 friend class MarkFunctionsForRecompilation; // IsDirty. | 354 friend class MarkFunctionsForRecompilation; // IsDirty. |
359 friend class ReasonForCancelling; | 355 friend class ReasonForCancelling; |
360 | 356 |
361 static Dart_FileModifiedCallback file_modified_callback_; | 357 static Dart_FileModifiedCallback file_modified_callback_; |
362 }; | 358 }; |
363 | 359 |
364 } // namespace dart | 360 } // namespace dart |
365 | 361 |
366 #endif // RUNTIME_VM_ISOLATE_RELOAD_H_ | 362 #endif // RUNTIME_VM_ISOLATE_RELOAD_H_ |
OLD | NEW |