| 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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 ASSERT((index >= 0) && (index < library_infos_.length())); | 730 ASSERT((index >= 0) && (index < library_infos_.length())); |
| 731 return library_infos_[index].dirty; | 731 return library_infos_[index].dirty; |
| 732 } | 732 } |
| 733 | 733 |
| 734 | 734 |
| 735 void IsolateReloadContext::PostCommit() { | 735 void IsolateReloadContext::PostCommit() { |
| 736 TIMELINE_SCOPE(PostCommit); | 736 TIMELINE_SCOPE(PostCommit); |
| 737 set_saved_root_library(Library::Handle()); | 737 set_saved_root_library(Library::Handle()); |
| 738 set_saved_libraries(GrowableObjectArray::Handle()); | 738 set_saved_libraries(GrowableObjectArray::Handle()); |
| 739 InvalidateWorld(); | 739 InvalidateWorld(); |
| 740 TIR_Print("---- DONE COMMIT\n"); |
| 740 } | 741 } |
| 741 | 742 |
| 742 | 743 |
| 743 bool IsolateReloadContext::ValidateReload() { | 744 bool IsolateReloadContext::ValidateReload() { |
| 744 TIMELINE_SCOPE(ValidateReload); | 745 TIMELINE_SCOPE(ValidateReload); |
| 745 if (has_error_) { | 746 if (has_error_) { |
| 746 return false; | 747 return false; |
| 747 } | 748 } |
| 748 | 749 |
| 749 // Validate libraries. | 750 // Validate libraries. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 code_ = func.CurrentCode(); | 903 code_ = func.CurrentCode(); |
| 903 ASSERT(!code_.IsNull()); | 904 ASSERT(!code_.IsNull()); |
| 904 const bool clear_code = IsFromDirtyLibrary(func); | 905 const bool clear_code = IsFromDirtyLibrary(func); |
| 905 const bool stub_code = code_.IsStubCode(); | 906 const bool stub_code = code_.IsStubCode(); |
| 906 | 907 |
| 907 // Zero edge counters. | 908 // Zero edge counters. |
| 908 func.ZeroEdgeCounters(); | 909 func.ZeroEdgeCounters(); |
| 909 | 910 |
| 910 if (!stub_code) { | 911 if (!stub_code) { |
| 911 if (clear_code) { | 912 if (clear_code) { |
| 913 VTIR_Print("Marking %s for recompilation, clearning code\n", |
| 914 func.ToCString()); |
| 912 ClearAllCode(func); | 915 ClearAllCode(func); |
| 913 } else { | 916 } else { |
| 914 PreserveUnoptimizedCode(); | 917 PreserveUnoptimizedCode(); |
| 915 } | 918 } |
| 916 } | 919 } |
| 917 | 920 |
| 918 // Clear counters. | 921 // Clear counters. |
| 919 func.set_usage_counter(0); | 922 func.set_usage_counter(0); |
| 920 func.set_deoptimization_counter(0); | 923 func.set_deoptimization_counter(0); |
| 921 func.set_optimized_instruction_count(0); | 924 func.set_optimized_instruction_count(0); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 947 Object& handle_; | 950 Object& handle_; |
| 948 Class& owning_class_; | 951 Class& owning_class_; |
| 949 Library& owning_lib_; | 952 Library& owning_lib_; |
| 950 Code& code_; | 953 Code& code_; |
| 951 IsolateReloadContext* reload_context_; | 954 IsolateReloadContext* reload_context_; |
| 952 }; | 955 }; |
| 953 | 956 |
| 954 | 957 |
| 955 void IsolateReloadContext::MarkAllFunctionsForRecompilation() { | 958 void IsolateReloadContext::MarkAllFunctionsForRecompilation() { |
| 956 TIMELINE_SCOPE(MarkAllFunctionsForRecompilation); | 959 TIMELINE_SCOPE(MarkAllFunctionsForRecompilation); |
| 960 TIR_Print("---- MARKING ALL FUNCTIONS FOR RECOMPILATION\n"); |
| 957 NoSafepointScope no_safepoint; | 961 NoSafepointScope no_safepoint; |
| 958 HeapIterationScope heap_iteration_scope; | 962 HeapIterationScope heap_iteration_scope; |
| 959 MarkFunctionsForRecompilation visitor(isolate_, this); | 963 MarkFunctionsForRecompilation visitor(isolate_, this); |
| 960 isolate_->heap()->VisitObjects(&visitor); | 964 isolate_->heap()->VisitObjects(&visitor); |
| 961 } | 965 } |
| 962 | 966 |
| 963 | 967 |
| 964 void IsolateReloadContext::InvalidateWorld() { | 968 void IsolateReloadContext::InvalidateWorld() { |
| 969 TIR_Print("---- INVALIDATING WORLD\n"); |
| 965 ResetMegamorphicCaches(); | 970 ResetMegamorphicCaches(); |
| 966 DeoptimizeFunctionsOnStack(); | 971 DeoptimizeFunctionsOnStack(); |
| 967 ResetUnoptimizedICsOnStack(); | 972 ResetUnoptimizedICsOnStack(); |
| 968 MarkAllFunctionsForRecompilation(); | 973 MarkAllFunctionsForRecompilation(); |
| 969 } | 974 } |
| 970 | 975 |
| 971 | 976 |
| 972 RawClass* IsolateReloadContext::MappedClass(const Class& replacement_or_new) { | 977 RawClass* IsolateReloadContext::MappedClass(const Class& replacement_or_new) { |
| 973 UnorderedHashMap<ClassMapTraits> map(class_map_storage_); | 978 UnorderedHashMap<ClassMapTraits> map(class_map_storage_); |
| 974 Class& cls = Class::Handle(); | 979 Class& cls = Class::Handle(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 ASSERT(!super_cls.IsNull()); | 1132 ASSERT(!super_cls.IsNull()); |
| 1128 super_cls.AddDirectSubclass(cls); | 1133 super_cls.AddDirectSubclass(cls); |
| 1129 } | 1134 } |
| 1130 } | 1135 } |
| 1131 } | 1136 } |
| 1132 } | 1137 } |
| 1133 | 1138 |
| 1134 #endif // !PRODUCT | 1139 #endif // !PRODUCT |
| 1135 | 1140 |
| 1136 } // namespace dart | 1141 } // namespace dart |
| OLD | NEW |