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/code_generator.h" | 8 #include "vm/code_generator.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 InvalidateWorld(); | 720 InvalidateWorld(); |
721 } | 721 } |
722 | 722 |
723 | 723 |
724 bool IsolateReloadContext::ValidateReload() { | 724 bool IsolateReloadContext::ValidateReload() { |
725 TIMELINE_SCOPE(ValidateReload); | 725 TIMELINE_SCOPE(ValidateReload); |
726 if (has_error_) { | 726 if (has_error_) { |
727 return false; | 727 return false; |
728 } | 728 } |
729 | 729 |
730 // Already built. | 730 // Validate libraries. |
731 ASSERT(class_map_storage_ != Array::null()); | 731 { |
732 UnorderedHashMap<ClassMapTraits> map(class_map_storage_); | 732 ASSERT(library_map_storage_ != Array::null()); |
733 UnorderedHashMap<ClassMapTraits>::Iterator it(&map); | 733 UnorderedHashMap<LibraryMapTraits> map(library_map_storage_); |
734 Class& cls = Class::Handle(); | 734 UnorderedHashMap<LibraryMapTraits>::Iterator it(&map); |
735 Class& new_cls = Class::Handle(); | 735 Library& lib = Library::Handle(); |
736 while (it.MoveNext()) { | 736 Library& new_lib = Library::Handle(); |
737 const intptr_t entry = it.Current(); | 737 while (it.MoveNext()) { |
738 new_cls = Class::RawCast(map.GetKey(entry)); | 738 const intptr_t entry = it.Current(); |
739 cls = Class::RawCast(map.GetPayload(entry, 0)); | 739 new_lib = Library::RawCast(map.GetKey(entry)); |
740 if (new_cls.raw() != cls.raw()) { | 740 lib = Library::RawCast(map.GetPayload(entry, 0)); |
741 if (!cls.CanReload(new_cls)) { | 741 if (new_lib.raw() != lib.raw()) { |
742 map.Release(); | 742 if (!lib.CanReload(new_lib)) { |
743 return false; | 743 map.Release(); |
| 744 return false; |
| 745 } |
744 } | 746 } |
745 } | 747 } |
| 748 map.Release(); |
746 } | 749 } |
747 map.Release(); | 750 |
| 751 // Validate classes. |
| 752 { |
| 753 ASSERT(class_map_storage_ != Array::null()); |
| 754 UnorderedHashMap<ClassMapTraits> map(class_map_storage_); |
| 755 UnorderedHashMap<ClassMapTraits>::Iterator it(&map); |
| 756 Class& cls = Class::Handle(); |
| 757 Class& new_cls = Class::Handle(); |
| 758 while (it.MoveNext()) { |
| 759 const intptr_t entry = it.Current(); |
| 760 new_cls = Class::RawCast(map.GetKey(entry)); |
| 761 cls = Class::RawCast(map.GetPayload(entry, 0)); |
| 762 if (new_cls.raw() != cls.raw()) { |
| 763 if (!cls.CanReload(new_cls)) { |
| 764 map.Release(); |
| 765 return false; |
| 766 } |
| 767 } |
| 768 } |
| 769 map.Release(); |
| 770 } |
748 return true; | 771 return true; |
749 } | 772 } |
750 | 773 |
751 | 774 |
752 RawClass* IsolateReloadContext::FindOriginalClass(const Class& cls) { | 775 RawClass* IsolateReloadContext::FindOriginalClass(const Class& cls) { |
753 return MappedClass(cls); | 776 return MappedClass(cls); |
754 } | 777 } |
755 | 778 |
756 | 779 |
757 RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) { | 780 RawClass* IsolateReloadContext::GetClassForHeapWalkAt(intptr_t cid) { |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 ASSERT(!super_cls.IsNull()); | 1098 ASSERT(!super_cls.IsNull()); |
1076 super_cls.AddDirectSubclass(cls); | 1099 super_cls.AddDirectSubclass(cls); |
1077 } | 1100 } |
1078 } | 1101 } |
1079 } | 1102 } |
1080 } | 1103 } |
1081 | 1104 |
1082 #endif // !PRODUCT | 1105 #endif // !PRODUCT |
1083 | 1106 |
1084 } // namespace dart | 1107 } // namespace dart |
OLD | NEW |