| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library dart2js.enqueue; | 5 library dart2js.enqueue; |
| 6 | 6 |
| 7 import 'dart:collection' show | 7 import 'dart:collection' show |
| 8 Queue; | 8 Queue; |
| 9 | 9 |
| 10 import 'common.dart'; | 10 import 'common.dart'; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 Name, | 44 Name, |
| 45 TypedElement, | 45 TypedElement, |
| 46 TypedefElement; | 46 TypedefElement; |
| 47 import 'js/js.dart' as js; | 47 import 'js/js.dart' as js; |
| 48 import 'native/native.dart' as native; | 48 import 'native/native.dart' as native; |
| 49 import 'types/types.dart' show | 49 import 'types/types.dart' show |
| 50 TypeMaskStrategy; | 50 TypeMaskStrategy; |
| 51 import 'universe/selector.dart' show | 51 import 'universe/selector.dart' show |
| 52 Selector; | 52 Selector; |
| 53 import 'universe/universe.dart'; | 53 import 'universe/universe.dart'; |
| 54 import 'universe/world_impact.dart' show |
| 55 WorldImpact; |
| 54 import 'util/util.dart' show | 56 import 'util/util.dart' show |
| 55 Link, | 57 Link, |
| 56 Setlet; | 58 Setlet; |
| 57 | 59 |
| 58 typedef ItemCompilationContext ItemCompilationContextCreator(); | 60 typedef ItemCompilationContext ItemCompilationContextCreator(); |
| 59 | 61 |
| 60 class EnqueueTask extends CompilerTask { | 62 class EnqueueTask extends CompilerTask { |
| 61 final ResolutionEnqueuer resolution; | 63 final ResolutionEnqueuer resolution; |
| 62 final CodegenEnqueuer codegen; | 64 final CodegenEnqueuer codegen; |
| 63 | 65 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 79 resolution.nativeEnqueuer = | 81 resolution.nativeEnqueuer = |
| 80 compiler.backend.nativeResolutionEnqueuer(resolution); | 82 compiler.backend.nativeResolutionEnqueuer(resolution); |
| 81 } | 83 } |
| 82 | 84 |
| 83 void forgetElement(Element element) { | 85 void forgetElement(Element element) { |
| 84 resolution.forgetElement(element); | 86 resolution.forgetElement(element); |
| 85 codegen.forgetElement(element); | 87 codegen.forgetElement(element); |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 | 90 |
| 89 class WorldImpact { | |
| 90 const WorldImpact(); | |
| 91 | |
| 92 Iterable<UniverseSelector> get dynamicInvocations => | |
| 93 const <UniverseSelector>[]; | |
| 94 Iterable<UniverseSelector> get dynamicGetters => const <UniverseSelector>[]; | |
| 95 Iterable<UniverseSelector> get dynamicSetters => const <UniverseSelector>[]; | |
| 96 | |
| 97 // TODO(johnniwinther): Split this into more precise subsets. | |
| 98 Iterable<Element> get staticUses => const <Element>[]; | |
| 99 | |
| 100 // TODO(johnniwinther): Replace this by called constructors with type | |
| 101 // arguments. | |
| 102 Iterable<InterfaceType> get instantiatedTypes => const <InterfaceType>[]; | |
| 103 | |
| 104 // TODO(johnniwinther): Collect checked types for checked mode separately to | |
| 105 // support serialization. | |
| 106 Iterable<DartType> get isChecks => const <DartType>[]; | |
| 107 | |
| 108 Iterable<DartType> get checkedModeChecks => const <DartType>[]; | |
| 109 | |
| 110 Iterable<DartType> get asCasts => const <DartType>[]; | |
| 111 | |
| 112 Iterable<MethodElement> get closurizedFunctions => const <MethodElement>[]; | |
| 113 | |
| 114 Iterable<LocalFunctionElement> get closures => const <LocalFunctionElement>[]; | |
| 115 | |
| 116 Iterable<DartType> get typeLiterals => const <DartType>[]; | |
| 117 | |
| 118 String toString() { | |
| 119 StringBuffer sb = new StringBuffer(); | |
| 120 | |
| 121 void add(String title, Iterable iterable) { | |
| 122 if (iterable.isNotEmpty) { | |
| 123 sb.write('\n $title:'); | |
| 124 iterable.forEach((e) => sb.write('\n $e')); | |
| 125 } | |
| 126 } | |
| 127 | |
| 128 add('dynamic invocations', dynamicInvocations); | |
| 129 add('dynamic getters', dynamicGetters); | |
| 130 add('dynamic setters', dynamicSetters); | |
| 131 add('static uses', staticUses); | |
| 132 add('instantiated types', instantiatedTypes); | |
| 133 add('is-checks', isChecks); | |
| 134 add('checked-mode checks', checkedModeChecks); | |
| 135 add('as-casts', asCasts); | |
| 136 add('closurized functions', closurizedFunctions); | |
| 137 add('closures', closures); | |
| 138 add('type literals', typeLiterals); | |
| 139 | |
| 140 return sb.toString(); | |
| 141 } | |
| 142 } | |
| 143 | |
| 144 abstract class Enqueuer { | 91 abstract class Enqueuer { |
| 145 final String name; | 92 final String name; |
| 146 final Compiler compiler; // TODO(ahe): Remove this dependency. | 93 final Compiler compiler; // TODO(ahe): Remove this dependency. |
| 147 final EnqueuerStrategy strategy; | 94 final EnqueuerStrategy strategy; |
| 148 final ItemCompilationContextCreator itemCompilationContextCreator; | 95 final ItemCompilationContextCreator itemCompilationContextCreator; |
| 149 final Map<String, Set<Element>> instanceMembersByName | 96 final Map<String, Set<Element>> instanceMembersByName |
| 150 = new Map<String, Set<Element>>(); | 97 = new Map<String, Set<Element>>(); |
| 151 final Map<String, Set<Element>> instanceFunctionsByName | 98 final Map<String, Set<Element>> instanceFunctionsByName |
| 152 = new Map<String, Set<Element>>(); | 99 = new Map<String, Set<Element>>(); |
| 153 final Set<ClassElement> _processedClasses = new Set<ClassElement>(); | 100 final Set<ClassElement> _processedClasses = new Set<ClassElement>(); |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 @override | 1057 @override |
| 1111 void processStaticUse(Enqueuer enqueuer, Element element) { | 1058 void processStaticUse(Enqueuer enqueuer, Element element) { |
| 1112 enqueuer.registerStaticUseInternal(element); | 1059 enqueuer.registerStaticUseInternal(element); |
| 1113 } | 1060 } |
| 1114 | 1061 |
| 1115 @override | 1062 @override |
| 1116 void processSelector(Enqueuer enqueuer, UniverseSelector selector) { | 1063 void processSelector(Enqueuer enqueuer, UniverseSelector selector) { |
| 1117 enqueuer.handleUnseenSelectorInternal(selector); | 1064 enqueuer.handleUnseenSelectorInternal(selector); |
| 1118 } | 1065 } |
| 1119 } | 1066 } |
| OLD | NEW |