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/hash_map.h" | 10 #include "vm/hash_map.h" |
11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
12 #include "vm/growable_array.h" | 12 #include "vm/growable_array.h" |
13 #include "vm/log.h" | 13 #include "vm/log.h" |
14 | 14 |
15 DECLARE_FLAG(bool, trace_reload); | 15 DECLARE_FLAG(bool, trace_reload); |
16 DECLARE_FLAG(bool, trace_reload_verbose); | 16 DECLARE_FLAG(bool, trace_reload_verbose); |
17 | 17 |
18 // 'Trace Isolate Reload' TIR_Print | 18 // 'Trace Isolate Reload' TIR_Print |
19 #if defined(_MSC_VER) | 19 #if defined(_MSC_VER) |
20 #define TIR_Print(format, ...) \ | 20 #define TIR_Print(format, ...) \ |
21 if (FLAG_trace_reload) Log::Current()->Print(format, __VA_ARGS__) | 21 if (FLAG_trace_reload) Log::Current()->Print(format, __VA_ARGS__) |
22 #else | 22 #else |
23 #define TIR_Print(format, ...) \ | 23 #define TIR_Print(format, ...) \ |
24 if (FLAG_trace_reload) Log::Current()->Print(format, ##__VA_ARGS__) | 24 if (FLAG_trace_reload) Log::Current()->Print(format, ##__VA_ARGS__) |
25 #endif | 25 #endif |
26 | 26 |
27 // 'Verbose Trace Isolate Reload' VTIR_Print | 27 // 'Verbose Trace Isolate Reload' VTIR_Print |
28 #if defined(_MSC_VER) | 28 #if defined(_MSC_VER) |
29 #define VTIR_Print(format, ...) \ | 29 #define VTIR_Print(format, ...) \ |
30 if (FLAG_trace_reload_verbose) Log::Current()->Print(format, __VA_ARGS__) | 30 if (FLAG_trace_reload_verbose) Log::Current()->Print(format, __VA_ARGS__) |
31 #else | 31 #else |
32 #define VTIR_Print(format, ...) \ | 32 #define VTIR_Print(format, ...) \ |
33 if (FLAG_trace_reload_verbose) Log::Current()->Print(format, ##__VA_ARGS__) | 33 if (FLAG_trace_reload_verbose) Log::Current()->Print(format, ##__VA_ARGS__) |
34 #endif | 34 #endif |
35 | 35 |
36 namespace dart { | 36 namespace dart { |
37 | 37 |
38 class BitVector; | 38 class BitVector; |
39 class GrowableObjectArray; | 39 class GrowableObjectArray; |
40 class Isolate; | 40 class Isolate; |
41 class Library; | 41 class Library; |
42 class ObjectPointerVisitor; | 42 class ObjectPointerVisitor; |
43 class ObjectStore; | 43 class ObjectStore; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void AppendTo(JSONArray* array); | 121 void AppendTo(JSONArray* array); |
122 | 122 |
123 protected: | 123 protected: |
124 const Class& from_; | 124 const Class& from_; |
125 const Class& to_; | 125 const Class& to_; |
126 }; | 126 }; |
127 | 127 |
128 | 128 |
129 class IsolateReloadContext { | 129 class IsolateReloadContext { |
130 public: | 130 public: |
131 explicit IsolateReloadContext(Isolate* isolate, | 131 explicit IsolateReloadContext(Isolate* isolate, JSONStream* js); |
132 JSONStream* js); | |
133 ~IsolateReloadContext(); | 132 ~IsolateReloadContext(); |
134 | 133 |
135 void Reload(bool force_reload); | 134 void Reload(bool force_reload); |
136 | 135 |
137 // All zone allocated objects must be allocated from this zone. | 136 // All zone allocated objects must be allocated from this zone. |
138 Zone* zone() const { return zone_; } | 137 Zone* zone() const { return zone_; } |
139 | 138 |
140 bool reload_skipped() const { return reload_skipped_; } | 139 bool reload_skipped() const { return reload_skipped_; } |
141 bool reload_aborted() const { return reload_aborted_; } | 140 bool reload_aborted() const { return reload_aborted_; } |
142 RawError* error() const; | 141 RawError* error() const; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Reports all reasons for cancelling reload. | 183 // Reports all reasons for cancelling reload. |
185 void ReportReasonsForCancelling(); | 184 void ReportReasonsForCancelling(); |
186 | 185 |
187 // Reports the deails of a reload operation. | 186 // Reports the deails of a reload operation. |
188 void ReportOnJSON(JSONStream* stream); | 187 void ReportOnJSON(JSONStream* stream); |
189 | 188 |
190 // Store morphing operation. | 189 // Store morphing operation. |
191 void AddInstanceMorpher(InstanceMorpher* morpher); | 190 void AddInstanceMorpher(InstanceMorpher* morpher); |
192 | 191 |
193 // Tells whether instance in the heap must be morphed. | 192 // Tells whether instance in the heap must be morphed. |
194 bool HasInstanceMorphers() const { | 193 bool HasInstanceMorphers() const { return !instance_morphers_.is_empty(); } |
195 return !instance_morphers_.is_empty(); | |
196 } | |
197 | 194 |
198 // NOTE: FinalizeLoading will be called *before* Reload() returns. This | 195 // NOTE: FinalizeLoading will be called *before* Reload() returns. This |
199 // function will not be called if the embedder does not call | 196 // function will not be called if the embedder does not call |
200 // Dart_FinalizeLoading. | 197 // Dart_FinalizeLoading. |
201 void FinalizeLoading(); | 198 void FinalizeLoading(); |
202 | 199 |
203 // NOTE: FinalizeFailedLoad will be called *before* Reload returns. This | 200 // NOTE: FinalizeFailedLoad will be called *before* Reload returns. This |
204 // function will not be called if the embedder calls Dart_FinalizeLoading. | 201 // function will not be called if the embedder calls Dart_FinalizeLoading. |
205 void FinalizeFailedLoad(const Error& error); | 202 void FinalizeFailedLoad(const Error& error); |
206 | 203 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 MallocGrowableArray<LibraryInfo> library_infos_; | 297 MallocGrowableArray<LibraryInfo> library_infos_; |
301 | 298 |
302 // A bit vector indicating which of the original libraries were modified. | 299 // A bit vector indicating which of the original libraries were modified. |
303 BitVector* modified_libs_; | 300 BitVector* modified_libs_; |
304 | 301 |
305 RawClass* OldClassOrNull(const Class& replacement_or_new); | 302 RawClass* OldClassOrNull(const Class& replacement_or_new); |
306 | 303 |
307 RawLibrary* OldLibraryOrNull(const Library& replacement_or_new); | 304 RawLibrary* OldLibraryOrNull(const Library& replacement_or_new); |
308 void BuildLibraryMapping(); | 305 void BuildLibraryMapping(); |
309 | 306 |
310 void AddClassMapping(const Class& replacement_or_new, | 307 void AddClassMapping(const Class& replacement_or_new, const Class& original); |
311 const Class& original); | |
312 | 308 |
313 void AddLibraryMapping(const Library& replacement_or_new, | 309 void AddLibraryMapping(const Library& replacement_or_new, |
314 const Library& original); | 310 const Library& original); |
315 | 311 |
316 void AddStaticFieldMapping(const Field& old_field, const Field& new_field); | 312 void AddStaticFieldMapping(const Field& old_field, const Field& new_field); |
317 | 313 |
318 void AddBecomeMapping(const Object& old, const Object& neu); | 314 void AddBecomeMapping(const Object& old, const Object& neu); |
319 void AddEnumBecomeMapping(const Object& old, const Object& neu); | 315 void AddEnumBecomeMapping(const Object& old, const Object& neu); |
320 | 316 |
321 void RebuildDirectSubclasses(); | 317 void RebuildDirectSubclasses(); |
(...skipping 19 matching lines...) Expand all Loading... |
341 friend class Library; | 337 friend class Library; |
342 friend class ObjectLocator; | 338 friend class ObjectLocator; |
343 friend class MarkFunctionsForRecompilation; // IsDirty. | 339 friend class MarkFunctionsForRecompilation; // IsDirty. |
344 friend class ReasonForCancelling; | 340 friend class ReasonForCancelling; |
345 | 341 |
346 static Dart_FileModifiedCallback file_modified_callback_; | 342 static Dart_FileModifiedCallback file_modified_callback_; |
347 }; | 343 }; |
348 | 344 |
349 } // namespace dart | 345 } // namespace dart |
350 | 346 |
351 #endif // RUNTIME_VM_ISOLATE_RELOAD_H_ | 347 #endif // RUNTIME_VM_ISOLATE_RELOAD_H_ |
OLD | NEW |