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/names.dart' show | 10 import 'common/names.dart' show |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 worldImpact.closurizedFunctions.forEach(registerGetOfStaticFunction); | 189 worldImpact.closurizedFunctions.forEach(registerGetOfStaticFunction); |
190 } | 190 } |
191 | 191 |
192 // TODO(johnniwinther): Remove the need for passing the [registry]. | 192 // TODO(johnniwinther): Remove the need for passing the [registry]. |
193 void registerInstantiatedType(InterfaceType type, Registry registry, | 193 void registerInstantiatedType(InterfaceType type, Registry registry, |
194 {bool mirrorUsage: false}) { | 194 {bool mirrorUsage: false}) { |
195 task.measure(() { | 195 task.measure(() { |
196 ClassElement cls = type.element; | 196 ClassElement cls = type.element; |
197 registry.registerDependency(cls); | 197 registry.registerDependency(cls); |
198 cls.ensureResolved(compiler); | 198 cls.ensureResolved(compiler); |
199 universe.registerTypeInstantiation(type, byMirrors: mirrorUsage); | 199 universe.registerTypeInstantiation( |
| 200 type, |
| 201 byMirrors: mirrorUsage, |
| 202 onImplemented: (ClassElement cls) { |
| 203 compiler.backend.registerImplementedClass( |
| 204 cls, this, compiler.globalDependencies); |
| 205 }); |
200 processInstantiatedClass(cls); | 206 processInstantiatedClass(cls); |
201 compiler.backend.registerInstantiatedType(type, registry); | 207 compiler.backend.registerInstantiatedType(type, registry); |
202 }); | 208 }); |
203 } | 209 } |
204 | 210 |
205 bool checkNoEnqueuedInvokedInstanceMethods() { | 211 bool checkNoEnqueuedInvokedInstanceMethods() { |
206 return filter.checkNoEnqueuedInvokedInstanceMethods(this); | 212 return filter.checkNoEnqueuedInvokedInstanceMethods(this); |
207 } | 213 } |
208 | 214 |
209 void processInstantiatedClassMembers(ClassElement cls) { | 215 void processInstantiatedClassMembers(ClassElement cls) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 321 |
316 void enableIsolateSupport() {} | 322 void enableIsolateSupport() {} |
317 | 323 |
318 void processInstantiatedClass(ClassElement cls) { | 324 void processInstantiatedClass(ClassElement cls) { |
319 task.measure(() { | 325 task.measure(() { |
320 if (_processedClasses.contains(cls)) return; | 326 if (_processedClasses.contains(cls)) return; |
321 // The class must be resolved to compute the set of all | 327 // The class must be resolved to compute the set of all |
322 // supertypes. | 328 // supertypes. |
323 cls.ensureResolved(compiler); | 329 cls.ensureResolved(compiler); |
324 | 330 |
325 void processClass(ClassElement cls) { | 331 void processClass(ClassElement superclass) { |
326 if (_processedClasses.contains(cls)) return; | 332 if (_processedClasses.contains(superclass)) return; |
327 | 333 |
328 _processedClasses.add(cls); | 334 _processedClasses.add(superclass); |
329 recentClasses.add(cls); | 335 recentClasses.add(superclass); |
330 cls.ensureResolved(compiler); | 336 superclass.ensureResolved(compiler); |
331 cls.implementation.forEachMember(processInstantiatedClassMember); | 337 superclass.implementation.forEachMember(processInstantiatedClassMember); |
332 if (isResolutionQueue && !cls.isSynthesized) { | 338 if (isResolutionQueue && !superclass.isSynthesized) { |
333 compiler.resolver.checkClass(cls); | 339 compiler.resolver.checkClass(superclass); |
334 } | 340 } |
335 // We only tell the backend once that [cls] was instantiated, so | 341 // We only tell the backend once that [superclass] was instantiated, so |
336 // any additional dependencies must be treated as global | 342 // any additional dependencies must be treated as global |
337 // dependencies. | 343 // dependencies. |
338 compiler.backend.registerInstantiatedClass( | 344 compiler.backend.registerInstantiatedClass( |
339 cls, this, compiler.globalDependencies); | 345 superclass, this, compiler.globalDependencies); |
340 } | 346 } |
341 processClass(cls); | 347 |
342 for (Link<DartType> supertypes = cls.allSupertypes; | 348 while (cls != null) { |
343 !supertypes.isEmpty; supertypes = supertypes.tail) { | 349 processClass(cls); |
344 processClass(supertypes.head.element); | 350 cls = cls.superclass; |
345 } | 351 } |
346 }); | 352 }); |
347 } | 353 } |
348 | 354 |
349 void registerInvocation(UniverseSelector selector) { | 355 void registerInvocation(UniverseSelector selector) { |
350 task.measure(() { | 356 task.measure(() { |
351 if (universe.registerInvocation(selector)) { | 357 if (universe.registerInvocation(selector)) { |
352 handleUnseenSelector(selector); | 358 handleUnseenSelector(selector); |
353 } | 359 } |
354 }); | 360 }); |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 @override | 1077 @override |
1072 void processStaticUse(Enqueuer enqueuer, Element element) { | 1078 void processStaticUse(Enqueuer enqueuer, Element element) { |
1073 enqueuer.registerStaticUseInternal(element); | 1079 enqueuer.registerStaticUseInternal(element); |
1074 } | 1080 } |
1075 | 1081 |
1076 @override | 1082 @override |
1077 void processSelector(Enqueuer enqueuer, UniverseSelector selector) { | 1083 void processSelector(Enqueuer enqueuer, UniverseSelector selector) { |
1078 enqueuer.handleUnseenSelectorInternal(selector); | 1084 enqueuer.handleUnseenSelectorInternal(selector); |
1079 } | 1085 } |
1080 } | 1086 } |
OLD | NEW |