| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 cls.ToCString(), cls2.ToCString(), new_cls.ToCString()); | 649 cls.ToCString(), cls2.ToCString(), new_cls.ToCString()); |
| 650 UNREACHABLE(); | 650 UNREACHABLE(); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 } | 656 } |
| 657 class_map.Release(); | 657 class_map.Release(); |
| 658 } | 658 } |
| 659 | |
| 660 | |
| 661 void IsolateReloadContext::VerifyCanonicalTypeArguments() { | |
| 662 Thread* thread = Thread::Current(); | |
| 663 const Array& table = | |
| 664 Array::Handle(Z, I->object_store()->canonical_type_arguments()); | |
| 665 const intptr_t table_size = table.Length() - 1; | |
| 666 ASSERT(Utils::IsPowerOfTwo(table_size)); | |
| 667 TypeArguments& element = TypeArguments::Handle(Z); | |
| 668 TypeArguments& other_element = TypeArguments::Handle(); | |
| 669 for (intptr_t i = 0; i < table_size; i++) { | |
| 670 element ^= table.At(i); | |
| 671 for (intptr_t j = 0; j < table_size; j++) { | |
| 672 if ((i != j) && (table.At(j) != TypeArguments::null())) { | |
| 673 other_element ^= table.At(j); | |
| 674 if (element.Equals(other_element)) { | |
| 675 // Recursive types may be equal, but have different hashes. | |
| 676 ASSERT(element.IsRecursive()); | |
| 677 ASSERT(other_element.IsRecursive()); | |
| 678 ASSERT(element.Hash() != other_element.Hash()); | |
| 679 } | |
| 680 } | |
| 681 } | |
| 682 } | |
| 683 } | |
| 684 #endif | 659 #endif |
| 685 | 660 |
| 686 | 661 |
| 687 void IsolateReloadContext::Commit() { | 662 void IsolateReloadContext::Commit() { |
| 688 TIMELINE_SCOPE(Commit); | 663 TIMELINE_SCOPE(Commit); |
| 689 TIR_Print("---- COMMITTING REVERSE MAP\n"); | 664 TIR_Print("---- COMMITTING REVERSE MAP\n"); |
| 690 | 665 |
| 691 #ifdef DEBUG | 666 #ifdef DEBUG |
| 692 VerifyMaps(); | 667 VerifyMaps(); |
| 693 #endif | 668 #endif |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 const GrowableObjectArray& saved_libs = | 777 const GrowableObjectArray& saved_libs = |
| 803 GrowableObjectArray::Handle(saved_libraries()); | 778 GrowableObjectArray::Handle(saved_libraries()); |
| 804 const GrowableObjectArray& libs = | 779 const GrowableObjectArray& libs = |
| 805 GrowableObjectArray::Handle(I->object_store()->libraries()); | 780 GrowableObjectArray::Handle(I->object_store()->libraries()); |
| 806 if (saved_libs.Length() != libs.Length()) { | 781 if (saved_libs.Length() != libs.Length()) { |
| 807 TIR_Print("Identity reload failed! B#L=%" Pd " A#L=%" Pd "\n", | 782 TIR_Print("Identity reload failed! B#L=%" Pd " A#L=%" Pd "\n", |
| 808 saved_libs.Length(), | 783 saved_libs.Length(), |
| 809 libs.Length()); | 784 libs.Length()); |
| 810 } | 785 } |
| 811 } | 786 } |
| 812 | |
| 813 #ifdef DEBUG | |
| 814 // TODO(turnidge): Remove before committing to main branch. | |
| 815 VerifyCanonicalTypeArguments(); | |
| 816 #endif | |
| 817 } | 787 } |
| 818 | 788 |
| 819 | 789 |
| 820 bool IsolateReloadContext::IsDirty(const Library& lib) { | 790 bool IsolateReloadContext::IsDirty(const Library& lib) { |
| 821 const intptr_t index = lib.index(); | 791 const intptr_t index = lib.index(); |
| 822 if (index == static_cast<classid_t>(-1)) { | 792 if (index == static_cast<classid_t>(-1)) { |
| 823 // Treat deleted libraries as dirty. | 793 // Treat deleted libraries as dirty. |
| 824 return true; | 794 return true; |
| 825 } | 795 } |
| 826 ASSERT((index >= 0) && (index < library_infos_.length())); | 796 ASSERT((index >= 0) && (index < library_infos_.length())); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 ASSERT(!super_cls.IsNull()); | 1186 ASSERT(!super_cls.IsNull()); |
| 1217 super_cls.AddDirectSubclass(cls); | 1187 super_cls.AddDirectSubclass(cls); |
| 1218 } | 1188 } |
| 1219 } | 1189 } |
| 1220 } | 1190 } |
| 1221 } | 1191 } |
| 1222 | 1192 |
| 1223 #endif // !PRODUCT | 1193 #endif // !PRODUCT |
| 1224 | 1194 |
| 1225 } // namespace dart | 1195 } // namespace dart |
| OLD | NEW |