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