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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 worldImpact.staticUses.forEach(registerStaticUse); | 171 worldImpact.staticUses.forEach(registerStaticUse); |
172 worldImpact.typeUses.forEach(registerTypeUse); | 172 worldImpact.typeUses.forEach(registerTypeUse); |
173 worldImpact.closures.forEach(registerClosure); | 173 worldImpact.closures.forEach(registerClosure); |
174 } | 174 } |
175 | 175 |
176 void registerInstantiatedType(InterfaceType type, | 176 void registerInstantiatedType(InterfaceType type, |
177 {bool mirrorUsage: false}) { | 177 {bool mirrorUsage: false}) { |
178 task.measure(() { | 178 task.measure(() { |
179 ClassElement cls = type.element; | 179 ClassElement cls = type.element; |
180 cls.ensureResolved(resolution); | 180 cls.ensureResolved(resolution); |
181 bool isNative = compiler.backend.isNative(cls); | |
182 universe.registerTypeInstantiation( | 181 universe.registerTypeInstantiation( |
183 type, | 182 type, |
184 isNative: isNative, | 183 isNative: compiler.backend.isNative(cls), |
185 byMirrors: mirrorUsage, | 184 byMirrors: mirrorUsage, |
186 onImplemented: (ClassElement cls) { | 185 onImplemented: (ClassElement cls) { |
187 compiler.backend.registerImplementedClass( | 186 compiler.backend.registerImplementedClass( |
188 cls, this, compiler.globalDependencies); | 187 cls, this, compiler.globalDependencies); |
189 }); | 188 }); |
190 // TODO(johnniwinther): Share this reasoning with [Universe]. | 189 processInstantiatedClass(cls); |
191 if (!cls.isAbstract || isNative || mirrorUsage) { | |
192 processInstantiatedClass(cls); | |
193 } | |
194 }); | 190 }); |
195 } | 191 } |
196 | 192 |
197 bool checkNoEnqueuedInvokedInstanceMethods() { | 193 bool checkNoEnqueuedInvokedInstanceMethods() { |
198 return filter.checkNoEnqueuedInvokedInstanceMethods(this); | 194 return filter.checkNoEnqueuedInvokedInstanceMethods(this); |
199 } | 195 } |
200 | 196 |
201 void processInstantiatedClassMembers(ClassElement cls) { | 197 void processInstantiatedClassMembers(ClassElement cls) { |
202 strategy.processInstantiatedClass(this, cls); | 198 strategy.processInstantiatedClass(this, cls); |
203 } | 199 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 if (isResolutionQueue && !superclass.isSynthesized) { | 328 if (isResolutionQueue && !superclass.isSynthesized) { |
333 compiler.resolver.checkClass(superclass); | 329 compiler.resolver.checkClass(superclass); |
334 } | 330 } |
335 // We only tell the backend once that [superclass] was instantiated, so | 331 // We only tell the backend once that [superclass] was instantiated, so |
336 // any additional dependencies must be treated as global | 332 // any additional dependencies must be treated as global |
337 // dependencies. | 333 // dependencies. |
338 compiler.backend.registerInstantiatedClass( | 334 compiler.backend.registerInstantiatedClass( |
339 superclass, this, compiler.globalDependencies); | 335 superclass, this, compiler.globalDependencies); |
340 } | 336 } |
341 | 337 |
342 ClassElement superclass = cls; | 338 while (cls != null) { |
343 while (superclass != null) { | 339 processClass(cls); |
344 processClass(superclass); | 340 cls = cls.superclass; |
345 superclass = superclass.superclass; | |
346 } | 341 } |
347 }); | 342 }); |
348 } | 343 } |
349 | 344 |
350 void registerDynamicUse(DynamicUse dynamicUse) { | 345 void registerDynamicUse(DynamicUse dynamicUse) { |
351 task.measure(() { | 346 task.measure(() { |
352 if (universe.registerDynamicUse(dynamicUse)) { | 347 if (universe.registerDynamicUse(dynamicUse)) { |
353 handleUnseenSelector(dynamicUse); | 348 handleUnseenSelector(dynamicUse); |
354 } | 349 } |
355 }); | 350 }); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 @override | 1030 @override |
1036 void processStaticUse(Enqueuer enqueuer, StaticUse staticUse) { | 1031 void processStaticUse(Enqueuer enqueuer, StaticUse staticUse) { |
1037 enqueuer.registerStaticUseInternal(staticUse); | 1032 enqueuer.registerStaticUseInternal(staticUse); |
1038 } | 1033 } |
1039 | 1034 |
1040 @override | 1035 @override |
1041 void processDynamicUse(Enqueuer enqueuer, DynamicUse dynamicUse) { | 1036 void processDynamicUse(Enqueuer enqueuer, DynamicUse dynamicUse) { |
1042 enqueuer.handleUnseenSelectorInternal(dynamicUse); | 1037 enqueuer.handleUnseenSelectorInternal(dynamicUse); |
1043 } | 1038 } |
1044 } | 1039 } |
OLD | NEW |