| 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 #include "vm/isolate_reload.h" | 5 #include "vm/isolate_reload.h" |
| 6 | 6 |
| 7 #include "vm/become.h" | 7 #include "vm/become.h" |
| 8 #include "vm/bit_vector.h" | 8 #include "vm/bit_vector.h" |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 namespace dart { | 25 namespace dart { |
| 26 | 26 |
| 27 DEFINE_FLAG(bool, trace_reload, false, "Trace isolate reloading"); | 27 DEFINE_FLAG(bool, trace_reload, false, "Trace isolate reloading"); |
| 28 DEFINE_FLAG(bool, trace_reload_verbose, false, | 28 DEFINE_FLAG(bool, trace_reload_verbose, false, |
| 29 "trace isolate reloading verbose"); | 29 "trace isolate reloading verbose"); |
| 30 DEFINE_FLAG(bool, identity_reload, false, "Enable checks for identity reload."); | 30 DEFINE_FLAG(bool, identity_reload, false, "Enable checks for identity reload."); |
| 31 DEFINE_FLAG(int, reload_every, 0, "Reload every N stack overflow checks."); | 31 DEFINE_FLAG(int, reload_every, 0, "Reload every N stack overflow checks."); |
| 32 DEFINE_FLAG(bool, reload_every_optimized, true, "Only from optimized code."); | 32 DEFINE_FLAG(bool, reload_every_optimized, true, "Only from optimized code."); |
| 33 DEFINE_FLAG(bool, reload_every_back_off, false, | 33 DEFINE_FLAG(bool, reload_every_back_off, false, |
| 34 "Double the --reload-every value after each reload."); | 34 "Double the --reload-every value after each reload."); |
| 35 DEFINE_FLAG(bool, reload_force_rollback, false, |
| 36 "Force all reloads to fail and rollback."); |
| 35 DEFINE_FLAG(bool, check_reloaded, false, | 37 DEFINE_FLAG(bool, check_reloaded, false, |
| 36 "Assert that an isolate has reloaded at least once.") | 38 "Assert that an isolate has reloaded at least once.") |
| 37 #ifndef PRODUCT | 39 #ifndef PRODUCT |
| 38 | 40 |
| 39 #define I (isolate()) | 41 #define I (isolate()) |
| 40 #define Z (thread->zone()) | 42 #define Z (thread->zone()) |
| 41 | 43 |
| 42 #define TIMELINE_SCOPE(name) \ | 44 #define TIMELINE_SCOPE(name) \ |
| 43 TimelineDurationScope tds##name(Thread::Current(), \ | 45 TimelineDurationScope tds##name(Thread::Current(), \ |
| 44 Timeline::GetIsolateStream(), \ | 46 Timeline::GetIsolateStream(), \ |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 } | 1100 } |
| 1099 | 1101 |
| 1100 | 1102 |
| 1101 void IsolateReloadContext::AddInstanceMorpher(InstanceMorpher* morpher) { | 1103 void IsolateReloadContext::AddInstanceMorpher(InstanceMorpher* morpher) { |
| 1102 instance_morphers_.Add(morpher); | 1104 instance_morphers_.Add(morpher); |
| 1103 cid_mapper_.Insert(morpher); | 1105 cid_mapper_.Insert(morpher); |
| 1104 } | 1106 } |
| 1105 | 1107 |
| 1106 | 1108 |
| 1107 void IsolateReloadContext::ReportReasonsForCancelling() { | 1109 void IsolateReloadContext::ReportReasonsForCancelling() { |
| 1108 ASSERT(HasReasonsForCancelling()); | 1110 ASSERT(FLAG_reload_force_rollback || HasReasonsForCancelling()); |
| 1109 for (int i = 0; i < reasons_to_cancel_reload_.length(); i++) { | 1111 for (int i = 0; i < reasons_to_cancel_reload_.length(); i++) { |
| 1110 reasons_to_cancel_reload_.At(i)->Report(this); | 1112 reasons_to_cancel_reload_.At(i)->Report(this); |
| 1111 } | 1113 } |
| 1112 } | 1114 } |
| 1113 | 1115 |
| 1114 | 1116 |
| 1115 // The ObjectLocator is used for collecting instances that | 1117 // The ObjectLocator is used for collecting instances that |
| 1116 // needs to be morphed. | 1118 // needs to be morphed. |
| 1117 class ObjectLocator : public ObjectVisitor { | 1119 class ObjectLocator : public ObjectVisitor { |
| 1118 public: | 1120 public: |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 const intptr_t entry = it.Current(); | 1227 const intptr_t entry = it.Current(); |
| 1226 new_cls = Class::RawCast(map.GetKey(entry)); | 1228 new_cls = Class::RawCast(map.GetKey(entry)); |
| 1227 cls = Class::RawCast(map.GetPayload(entry, 0)); | 1229 cls = Class::RawCast(map.GetPayload(entry, 0)); |
| 1228 if (new_cls.raw() != cls.raw()) { | 1230 if (new_cls.raw() != cls.raw()) { |
| 1229 cls.CheckReload(new_cls, this); | 1231 cls.CheckReload(new_cls, this); |
| 1230 } | 1232 } |
| 1231 } | 1233 } |
| 1232 map.Release(); | 1234 map.Release(); |
| 1233 } | 1235 } |
| 1234 | 1236 |
| 1235 return !HasReasonsForCancelling(); | 1237 return !FLAG_reload_force_rollback && !HasReasonsForCancelling(); |
| 1236 } | 1238 } |
| 1237 | 1239 |
| 1238 | 1240 |
| 1239 RawClass* IsolateReloadContext::FindOriginalClass(const Class& cls) { | 1241 RawClass* IsolateReloadContext::FindOriginalClass(const Class& cls) { |
| 1240 return MappedClass(cls); | 1242 return MappedClass(cls); |
| 1241 } | 1243 } |
| 1242 | 1244 |
| 1243 | 1245 |
| 1244 RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) { | 1246 RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) { |
| 1245 if (saved_class_table_ != NULL) { | 1247 if (saved_class_table_ != NULL) { |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 ASSERT(!super_cls.IsNull()); | 1575 ASSERT(!super_cls.IsNull()); |
| 1574 super_cls.AddDirectSubclass(cls); | 1576 super_cls.AddDirectSubclass(cls); |
| 1575 } | 1577 } |
| 1576 } | 1578 } |
| 1577 } | 1579 } |
| 1578 } | 1580 } |
| 1579 | 1581 |
| 1580 #endif // !PRODUCT | 1582 #endif // !PRODUCT |
| 1581 | 1583 |
| 1582 } // namespace dart | 1584 } // namespace dart |
| OLD | NEW |