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 part of dart2js; | 5 part of dart2js; |
6 | 6 |
7 /** | 7 /** |
8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
9 * compiled. | 9 * compiled. |
10 */ | 10 */ |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 } | 86 } |
87 | 87 |
88 void registerInstantiatedType(InterfaceType type) { | 88 void registerInstantiatedType(InterfaceType type) { |
89 world.registerInstantiatedType(type, this); | 89 world.registerInstantiatedType(type, this); |
90 } | 90 } |
91 | 91 |
92 void registerStaticUse(Element element) { | 92 void registerStaticUse(Element element) { |
93 world.registerStaticUse(element); | 93 world.registerStaticUse(element); |
94 } | 94 } |
95 | 95 |
96 void registerDynamicInvocation(UniverseSelector selector) { | 96 void registerDynamicInvocation(Selector selector) { |
97 world.registerDynamicInvocation(selector); | 97 world.registerDynamicInvocation(selector); |
98 compiler.dumpInfoTask.elementUsesSelector(currentElement, selector); | 98 compiler.dumpInfoTask.elementUsesSelector(currentElement, selector); |
99 } | 99 } |
100 | 100 |
101 void registerDynamicSetter(UniverseSelector selector) { | 101 void registerDynamicSetter(Selector selector) { |
102 world.registerDynamicSetter(selector); | 102 world.registerDynamicSetter(selector); |
103 compiler.dumpInfoTask.elementUsesSelector(currentElement, selector); | 103 compiler.dumpInfoTask.elementUsesSelector(currentElement, selector); |
104 } | 104 } |
105 | 105 |
106 void registerDynamicGetter(UniverseSelector selector) { | 106 void registerDynamicGetter(Selector selector) { |
107 world.registerDynamicGetter(selector); | 107 world.registerDynamicGetter(selector); |
108 compiler.dumpInfoTask.elementUsesSelector(currentElement, selector); | 108 compiler.dumpInfoTask.elementUsesSelector(currentElement, selector); |
109 } | 109 } |
110 | 110 |
111 void registerGetterForSuperMethod(Element element) { | 111 void registerGetterForSuperMethod(Element element) { |
112 world.registerGetterForSuperMethod(element); | 112 world.registerGetterForSuperMethod(element); |
113 } | 113 } |
114 | 114 |
115 void registerFieldGetter(Element element) { | 115 void registerFieldGetter(Element element) { |
116 world.registerFieldGetter(element); | 116 world.registerFieldGetter(element); |
(...skipping 20 matching lines...) Expand all Loading... |
137 | 137 |
138 void registerInstantiatedClosure(LocalFunctionElement element) { | 138 void registerInstantiatedClosure(LocalFunctionElement element) { |
139 backend.registerInstantiatedClosure(element, this); | 139 backend.registerInstantiatedClosure(element, this); |
140 } | 140 } |
141 | 141 |
142 void registerGetOfStaticFunction(FunctionElement element) { | 142 void registerGetOfStaticFunction(FunctionElement element) { |
143 world.registerGetOfStaticFunction(element); | 143 world.registerGetOfStaticFunction(element); |
144 } | 144 } |
145 | 145 |
146 void registerSelectorUse(Selector selector) { | 146 void registerSelectorUse(Selector selector) { |
147 world.registerSelectorUse(new UniverseSelector(selector, null)); | 147 world.registerSelectorUse(selector); |
148 } | 148 } |
149 | 149 |
150 void registerConstSymbol(String name) { | 150 void registerConstSymbol(String name) { |
151 backend.registerConstSymbol(name, this); | 151 backend.registerConstSymbol(name, this); |
152 } | 152 } |
153 | 153 |
154 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { | 154 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { |
155 backend.registerSpecializedGetInterceptor(classes); | 155 backend.registerSpecializedGetInterceptor(classes); |
156 } | 156 } |
157 | 157 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 /// Interface for registration of element dependencies. | 232 /// Interface for registration of element dependencies. |
233 abstract class Registry { | 233 abstract class Registry { |
234 // TODO(johnniwinther): Remove this getter when [Registry] creates a | 234 // TODO(johnniwinther): Remove this getter when [Registry] creates a |
235 // dependency node. | 235 // dependency node. |
236 Iterable<Element> get otherDependencies; | 236 Iterable<Element> get otherDependencies; |
237 | 237 |
238 void registerDependency(Element element); | 238 void registerDependency(Element element); |
239 | 239 |
240 bool get isForResolution; | 240 bool get isForResolution; |
241 | 241 |
242 void registerDynamicInvocation(UniverseSelector selector); | 242 void registerDynamicInvocation(Selector selector); |
243 | 243 |
244 void registerDynamicGetter(UniverseSelector selector); | 244 void registerDynamicGetter(Selector selector); |
245 | 245 |
246 void registerDynamicSetter(UniverseSelector selector); | 246 void registerDynamicSetter(Selector selector); |
247 | 247 |
248 void registerStaticInvocation(Element element); | 248 void registerStaticInvocation(Element element); |
249 | 249 |
250 void registerInstantiation(InterfaceType type); | 250 void registerInstantiation(InterfaceType type); |
251 | 251 |
252 void registerGetOfStaticFunction(FunctionElement element); | 252 void registerGetOfStaticFunction(FunctionElement element); |
253 } | 253 } |
254 | 254 |
255 abstract class Backend { | 255 abstract class Backend { |
256 final Compiler compiler; | 256 final Compiler compiler; |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 */ | 1487 */ |
1488 Uri resolvePatchUri(String dartLibraryPath); | 1488 Uri resolvePatchUri(String dartLibraryPath); |
1489 | 1489 |
1490 Future runCompiler(Uri uri) { | 1490 Future runCompiler(Uri uri) { |
1491 // TODO(ahe): This prevents memory leaks when invoking the compiler | 1491 // TODO(ahe): This prevents memory leaks when invoking the compiler |
1492 // multiple times. Implement a better mechanism where we can store | 1492 // multiple times. Implement a better mechanism where we can store |
1493 // such caches in the compiler and get access to them through a | 1493 // such caches in the compiler and get access to them through a |
1494 // suitably maintained static reference to the current compiler. | 1494 // suitably maintained static reference to the current compiler. |
1495 StringToken.canonicalizedSubstrings.clear(); | 1495 StringToken.canonicalizedSubstrings.clear(); |
1496 Selector.canonicalizedValues.clear(); | 1496 Selector.canonicalizedValues.clear(); |
| 1497 world.canonicalizedValues.clear(); |
1497 | 1498 |
1498 assert(uri != null || analyzeOnly || hasIncrementalSupport); | 1499 assert(uri != null || analyzeOnly || hasIncrementalSupport); |
1499 return new Future.sync(() { | 1500 return new Future.sync(() { |
1500 if (librariesToAnalyzeWhenRun != null) { | 1501 if (librariesToAnalyzeWhenRun != null) { |
1501 return Future.forEach(librariesToAnalyzeWhenRun, (libraryUri) { | 1502 return Future.forEach(librariesToAnalyzeWhenRun, (libraryUri) { |
1502 log('Analyzing $libraryUri ($buildId)'); | 1503 log('Analyzing $libraryUri ($buildId)'); |
1503 return libraryLoader.loadLibrary(libraryUri); | 1504 return libraryLoader.loadLibrary(libraryUri); |
1504 }); | 1505 }); |
1505 } | 1506 } |
1506 }).then((_) { | 1507 }).then((_) { |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 InterfaceType streamType([DartType elementType]) { | 2508 InterfaceType streamType([DartType elementType]) { |
2508 InterfaceType type = streamClass.computeType(compiler); | 2509 InterfaceType type = streamClass.computeType(compiler); |
2509 if (elementType == null) { | 2510 if (elementType == null) { |
2510 return streamClass.rawType; | 2511 return streamClass.rawType; |
2511 } | 2512 } |
2512 return type.createInstantiation([elementType]); | 2513 return type.createInstantiation([elementType]); |
2513 } | 2514 } |
2514 } | 2515 } |
2515 | 2516 |
2516 typedef void InternalErrorFunction(Spannable location, String message); | 2517 typedef void InternalErrorFunction(Spannable location, String message); |
OLD | NEW |