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/runtime_entry.h" | 9 #include "vm/runtime_entry.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 ReportOnJSON(js_); | 565 ReportOnJSON(js_); |
566 TIR_Print("---- SKIPPING RELOAD (No libraries were modified)\n"); | 566 TIR_Print("---- SKIPPING RELOAD (No libraries were modified)\n"); |
567 return; | 567 return; |
568 } | 568 } |
569 | 569 |
570 TIR_Print("---- STARTING RELOAD\n"); | 570 TIR_Print("---- STARTING RELOAD\n"); |
571 | 571 |
572 // Preallocate storage for maps. | 572 // Preallocate storage for maps. |
573 old_classes_set_storage_ = | 573 old_classes_set_storage_ = |
574 HashTables::New<UnorderedHashSet<ClassMapTraits> >(4); | 574 HashTables::New<UnorderedHashSet<ClassMapTraits> >(4); |
575 class_map_storage_ = HashTables::New<UnorderedHashMap<ClassMapTraits> >(4); | 575 class_map_storage_ = |
| 576 HashTables::New<UnorderedHashMap<ClassMapTraits> >(4, Heap::kOld); |
576 old_libraries_set_storage_ = | 577 old_libraries_set_storage_ = |
577 HashTables::New<UnorderedHashSet<LibraryMapTraits> >(4); | 578 HashTables::New<UnorderedHashSet<LibraryMapTraits> >(4); |
578 library_map_storage_ = | 579 library_map_storage_ = |
579 HashTables::New<UnorderedHashMap<LibraryMapTraits> >(4); | 580 HashTables::New<UnorderedHashMap<LibraryMapTraits> >(4); |
580 become_map_storage_ = HashTables::New<UnorderedHashMap<BecomeMapTraits> >(4); | 581 become_map_storage_ = |
| 582 HashTables::New<UnorderedHashMap<BecomeMapTraits> >(4, Heap::kOld); |
581 // Keep a separate array for enum mappings to avoid having to invoke | 583 // Keep a separate array for enum mappings to avoid having to invoke |
582 // hashCode on the instances. | 584 // hashCode on the instances. |
583 become_enum_mappings_ = GrowableObjectArray::New(Heap::kOld); | 585 become_enum_mappings_ = GrowableObjectArray::New(Heap::kOld); |
584 | 586 |
585 // Disable the background compiler while we are performing the reload. | 587 // Disable the background compiler while we are performing the reload. |
586 BackgroundCompiler::Disable(); | 588 BackgroundCompiler::Disable(); |
587 | 589 |
588 // Ensure all functions on the stack have unoptimized code. | 590 // Ensure all functions on the stack have unoptimized code. |
589 EnsuredUnoptimizedCodeForStack(); | 591 EnsuredUnoptimizedCodeForStack(); |
590 // Deoptimize all code that had optimizing decisions that are dependent on | 592 // Deoptimize all code that had optimizing decisions that are dependent on |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1753 // Attempt to find the pair to |replacement_or_new| with the knowledge that | 1755 // Attempt to find the pair to |replacement_or_new| with the knowledge that |
1754 // the base url prefix has moved. | 1756 // the base url prefix has moved. |
1755 RawLibrary* IsolateReloadContext::OldLibraryOrNullBaseMoved( | 1757 RawLibrary* IsolateReloadContext::OldLibraryOrNullBaseMoved( |
1756 const Library& replacement_or_new) { | 1758 const Library& replacement_or_new) { |
1757 const String& url_prefix = String::Handle(root_url_prefix_); | 1759 const String& url_prefix = String::Handle(root_url_prefix_); |
1758 const String& old_url_prefix = String::Handle(old_root_url_prefix_); | 1760 const String& old_url_prefix = String::Handle(old_root_url_prefix_); |
1759 const intptr_t prefix_length = url_prefix.Length(); | 1761 const intptr_t prefix_length = url_prefix.Length(); |
1760 const intptr_t old_prefix_length = old_url_prefix.Length(); | 1762 const intptr_t old_prefix_length = old_url_prefix.Length(); |
1761 const String& new_url = String::Handle(replacement_or_new.url()); | 1763 const String& new_url = String::Handle(replacement_or_new.url()); |
1762 const String& suffix = | 1764 const String& suffix = |
1763 String::Handle(String::SubString(new_url, prefix_length)); | 1765 String::Handle(String::SubString(new_url, prefix_length, Heap::kOld)); |
1764 if (!new_url.StartsWith(url_prefix)) { | 1766 if (!new_url.StartsWith(url_prefix)) { |
1765 return Library::null(); | 1767 return Library::null(); |
1766 } | 1768 } |
1767 Library& old = Library::Handle(); | 1769 Library& old = Library::Handle(); |
1768 String& old_url = String::Handle(); | 1770 String& old_url = String::Handle(); |
1769 String& old_suffix = String::Handle(); | 1771 String& old_suffix = String::Handle(); |
1770 GrowableObjectArray& saved_libs = | 1772 GrowableObjectArray& saved_libs = |
1771 GrowableObjectArray::Handle(saved_libraries()); | 1773 GrowableObjectArray::Handle(saved_libraries()); |
1772 ASSERT(!saved_libs.IsNull()); | 1774 ASSERT(!saved_libs.IsNull()); |
1773 for (intptr_t i = 0; i < saved_libs.Length(); i++) { | 1775 for (intptr_t i = 0; i < saved_libs.Length(); i++) { |
1774 old = Library::RawCast(saved_libs.At(i)); | 1776 old = Library::RawCast(saved_libs.At(i)); |
1775 old_url = old.url(); | 1777 old_url = old.url(); |
1776 if (!old_url.StartsWith(old_url_prefix)) { | 1778 if (!old_url.StartsWith(old_url_prefix)) { |
1777 continue; | 1779 continue; |
1778 } | 1780 } |
1779 old_suffix ^= String::SubString(old_url, old_prefix_length); | 1781 old_suffix ^= String::SubString(old_url, old_prefix_length, Heap::kOld); |
1780 if (old_suffix.IsNull()) { | 1782 if (old_suffix.IsNull()) { |
1781 continue; | 1783 continue; |
1782 } | 1784 } |
1783 if (old_suffix.Equals(suffix)) { | 1785 if (old_suffix.Equals(suffix)) { |
1784 TIR_Print("`%s` is moving to `%s`\n", old_url.ToCString(), | 1786 TIR_Print("`%s` is moving to `%s`\n", old_url.ToCString(), |
1785 new_url.ToCString()); | 1787 new_url.ToCString()); |
1786 return old.raw(); | 1788 return old.raw(); |
1787 } | 1789 } |
1788 } | 1790 } |
1789 return Library::null(); | 1791 return Library::null(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 ASSERT(!super_cls.IsNull()); | 1900 ASSERT(!super_cls.IsNull()); |
1899 super_cls.AddDirectSubclass(cls); | 1901 super_cls.AddDirectSubclass(cls); |
1900 } | 1902 } |
1901 } | 1903 } |
1902 } | 1904 } |
1903 } | 1905 } |
1904 | 1906 |
1905 #endif // !PRODUCT | 1907 #endif // !PRODUCT |
1906 | 1908 |
1907 } // namespace dart | 1909 } // namespace dart |
OLD | NEW |