| 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" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 | 52 |
| 53 class InstanceMorpher : public ZoneAllocated { | 53 class InstanceMorpher : public ZoneAllocated { |
| 54 public: | 54 public: |
| 55 InstanceMorpher(Zone* zone, const Class& from, const Class& to); | 55 InstanceMorpher(Zone* zone, const Class& from, const Class& to); |
| 56 virtual ~InstanceMorpher() {} | 56 virtual ~InstanceMorpher() {} |
| 57 | 57 |
| 58 // Called on each instance that needs to be morphed. | 58 // Called on each instance that needs to be morphed. |
| 59 RawInstance* Morph(const Instance& instance) const; | 59 RawInstance* Morph(const Instance& instance) const; |
| 60 | 60 |
| 61 void RunNewFieldInitializers() const; |
| 62 |
| 61 // Adds an object to be morphed. | 63 // Adds an object to be morphed. |
| 62 void AddObject(RawObject* object) const; | 64 void AddObject(RawObject* object) const; |
| 63 | 65 |
| 64 // Create the morphed objects based on the before() list. | 66 // Create the morphed objects based on the before() list. |
| 65 void CreateMorphedCopies() const; | 67 void CreateMorphedCopies() const; |
| 66 | 68 |
| 67 // Dump the state of the morpher. | 69 // Dump the state of the morpher. |
| 68 void Dump() const; | 70 void Dump() const; |
| 69 | 71 |
| 70 // Append the morper info to JSON array. | 72 // Append the morper info to JSON array. |
| 71 void AppendTo(JSONArray* array); | 73 void AppendTo(JSONArray* array); |
| 72 | 74 |
| 73 // Returns the list of objects that need to be morphed. | 75 // Returns the list of objects that need to be morphed. |
| 74 ZoneGrowableArray<const Instance*>* before() const { return before_; } | 76 ZoneGrowableArray<const Instance*>* before() const { return before_; } |
| 75 // Returns the list of morphed objects (matches order in before()). | 77 // Returns the list of morphed objects (matches order in before()). |
| 76 ZoneGrowableArray<const Instance*>* after() const { return after_; } | 78 ZoneGrowableArray<const Instance*>* after() const { return after_; } |
| 79 // Returns the list of new fields. |
| 80 ZoneGrowableArray<const Field*>* new_fields() const { return new_fields_; } |
| 77 | 81 |
| 78 // Returns the cid associated with the from_ and to_ class. | 82 // Returns the cid associated with the from_ and to_ class. |
| 79 intptr_t cid() const { return cid_; } | 83 intptr_t cid() const { return cid_; } |
| 80 | 84 |
| 81 private: | 85 private: |
| 82 const Class& from_; | 86 const Class& from_; |
| 83 const Class& to_; | 87 const Class& to_; |
| 84 ZoneGrowableArray<intptr_t> mapping_; | 88 ZoneGrowableArray<intptr_t> mapping_; |
| 85 ZoneGrowableArray<const Instance*>* before_; | 89 ZoneGrowableArray<const Instance*>* before_; |
| 86 ZoneGrowableArray<const Instance*>* after_; | 90 ZoneGrowableArray<const Instance*>* after_; |
| 91 ZoneGrowableArray<const Field*>* new_fields_; |
| 87 intptr_t cid_; | 92 intptr_t cid_; |
| 88 | 93 |
| 89 void ComputeMapping(); | 94 void ComputeMapping(); |
| 90 void DumpFormatFor(const Class& cls) const; | 95 void DumpFormatFor(const Class& cls) const; |
| 91 }; | 96 }; |
| 92 | 97 |
| 93 | 98 |
| 94 class ReasonForCancelling : public ZoneAllocated { | 99 class ReasonForCancelling : public ZoneAllocated { |
| 95 public: | 100 public: |
| 96 explicit ReasonForCancelling(Zone* zone) {} | 101 explicit ReasonForCancelling(Zone* zone) {} |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 friend class ObjectLocator; | 347 friend class ObjectLocator; |
| 343 friend class MarkFunctionsForRecompilation; // IsDirty. | 348 friend class MarkFunctionsForRecompilation; // IsDirty. |
| 344 friend class ReasonForCancelling; | 349 friend class ReasonForCancelling; |
| 345 | 350 |
| 346 static Dart_FileModifiedCallback file_modified_callback_; | 351 static Dart_FileModifiedCallback file_modified_callback_; |
| 347 }; | 352 }; |
| 348 | 353 |
| 349 } // namespace dart | 354 } // namespace dart |
| 350 | 355 |
| 351 #endif // RUNTIME_VM_ISOLATE_RELOAD_H_ | 356 #endif // RUNTIME_VM_ISOLATE_RELOAD_H_ |
| OLD | NEW |