| 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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 Script& script = Script::Handle(); | 707 Script& script = Script::Handle(); |
| 708 intptr_t num_libs = libs.Length(); | 708 intptr_t num_libs = libs.Length(); |
| 709 | 709 |
| 710 // Construct the imported-by graph. | 710 // Construct the imported-by graph. |
| 711 ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >* imported_by = | 711 ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >* imported_by = |
| 712 new ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >(num_libs); | 712 new ZoneGrowableArray<ZoneGrowableArray<intptr_t>* >(num_libs); |
| 713 imported_by->SetLength(num_libs); | 713 imported_by->SetLength(num_libs); |
| 714 for (intptr_t i = 0; i < num_libs; i++) { | 714 for (intptr_t i = 0; i < num_libs; i++) { |
| 715 (*imported_by)[i] = new ZoneGrowableArray<intptr_t>(); | 715 (*imported_by)[i] = new ZoneGrowableArray<intptr_t>(); |
| 716 } | 716 } |
| 717 Array& imports = Array::Handle(); | 717 Array& ports = Array::Handle(); |
| 718 Namespace& ns = Namespace::Handle(); | 718 Namespace& ns = Namespace::Handle(); |
| 719 Library& target = Library::Handle(); | 719 Library& target = Library::Handle(); |
| 720 | 720 |
| 721 for (intptr_t lib_idx = 0; lib_idx < num_libs; lib_idx++) { | 721 for (intptr_t lib_idx = 0; lib_idx < num_libs; lib_idx++) { |
| 722 lib ^= libs.At(lib_idx); | 722 lib ^= libs.At(lib_idx); |
| 723 ASSERT(lib_idx == lib.index()); | 723 ASSERT(lib_idx == lib.index()); |
| 724 if (lib.is_dart_scheme()) { | 724 if (lib.is_dart_scheme()) { |
| 725 // We don't care about imports among dart scheme libraries. | 725 // We don't care about imports among dart scheme libraries. |
| 726 continue; | 726 continue; |
| 727 } | 727 } |
| 728 | 728 |
| 729 // Add imports to the import-by graph. | 729 // Add imports to the import-by graph. |
| 730 imports = lib.imports(); | 730 ports = lib.imports(); |
| 731 for (intptr_t import_idx = 0; import_idx < imports.Length(); import_idx++) { | 731 for (intptr_t import_idx = 0; import_idx < ports.Length(); import_idx++) { |
| 732 ns ^= imports.At(import_idx); | 732 ns ^= ports.At(import_idx); |
| 733 if (!ns.IsNull()) { | 733 if (!ns.IsNull()) { |
| 734 target = ns.library(); | 734 target = ns.library(); |
| 735 (*imported_by)[target.index()]->Add(lib.index()); | 735 (*imported_by)[target.index()]->Add(lib.index()); |
| 736 } |
| 737 } |
| 738 |
| 739 // Add exports to the import-by graph. |
| 740 ports = lib.exports(); |
| 741 for (intptr_t export_idx = 0; export_idx < ports.Length(); export_idx++) { |
| 742 ns ^= ports.At(export_idx); |
| 743 if (!ns.IsNull()) { |
| 744 target = ns.library(); |
| 745 (*imported_by)[target.index()]->Add(lib.index()); |
| 736 } | 746 } |
| 737 } | 747 } |
| 738 | 748 |
| 739 // Add prefixed imports to the import-by graph. | 749 // Add prefixed imports to the import-by graph. |
| 740 DictionaryIterator entries(lib); | 750 DictionaryIterator entries(lib); |
| 741 Object& entry = Object::Handle(); | 751 Object& entry = Object::Handle(); |
| 742 LibraryPrefix& prefix = LibraryPrefix::Handle(); | 752 LibraryPrefix& prefix = LibraryPrefix::Handle(); |
| 743 while (entries.HasNext()) { | 753 while (entries.HasNext()) { |
| 744 entry = entries.GetNext(); | 754 entry = entries.GetNext(); |
| 745 if (entry.IsLibraryPrefix()) { | 755 if (entry.IsLibraryPrefix()) { |
| 746 prefix ^= entry.raw(); | 756 prefix ^= entry.raw(); |
| 747 imports = prefix.imports(); | 757 ports = prefix.imports(); |
| 748 for (intptr_t import_idx = 0; import_idx < imports.Length(); | 758 for (intptr_t import_idx = 0; import_idx < ports.Length(); |
| 749 import_idx++) { | 759 import_idx++) { |
| 750 ns ^= imports.At(import_idx); | 760 ns ^= ports.At(import_idx); |
| 751 if (!ns.IsNull()) { | 761 if (!ns.IsNull()) { |
| 752 target = ns.library(); | 762 target = ns.library(); |
| 753 (*imported_by)[target.index()]->Add(lib.index()); | 763 (*imported_by)[target.index()]->Add(lib.index()); |
| 754 } | 764 } |
| 755 } | 765 } |
| 756 } | 766 } |
| 757 } | 767 } |
| 758 } | 768 } |
| 759 | 769 |
| 760 BitVector* modified_libs = new(Z) BitVector(Z, num_libs); | 770 BitVector* modified_libs = new(Z) BitVector(Z, num_libs); |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 ASSERT(!super_cls.IsNull()); | 1583 ASSERT(!super_cls.IsNull()); |
| 1574 super_cls.AddDirectSubclass(cls); | 1584 super_cls.AddDirectSubclass(cls); |
| 1575 } | 1585 } |
| 1576 } | 1586 } |
| 1577 } | 1587 } |
| 1578 } | 1588 } |
| 1579 | 1589 |
| 1580 #endif // !PRODUCT | 1590 #endif // !PRODUCT |
| 1581 | 1591 |
| 1582 } // namespace dart | 1592 } // namespace dart |
| OLD | NEW |