| 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.js.enqueue; | 5 library dart2js.js.enqueue; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common/tasks.dart' show CompilerTask; | 9 import '../common/tasks.dart' show CompilerTask; |
| 10 import '../common/work.dart' show WorkItem; | 10 import '../common/work.dart' show WorkItem; |
| 11 import '../common.dart'; | 11 import '../common.dart'; |
| 12 import '../common_elements.dart' show ElementEnvironment; | 12 import '../common_elements.dart' show ElementEnvironment; |
| 13 import '../elements/resolution_types.dart' | |
| 14 show ResolutionDartType, ResolutionInterfaceType; | |
| 15 import '../elements/entities.dart'; | 13 import '../elements/entities.dart'; |
| 14 import '../elements/types.dart'; |
| 16 import '../enqueue.dart'; | 15 import '../enqueue.dart'; |
| 17 import '../options.dart'; | 16 import '../options.dart'; |
| 18 import '../universe/world_builder.dart'; | 17 import '../universe/world_builder.dart'; |
| 19 import '../universe/use.dart' | 18 import '../universe/use.dart' |
| 20 show | 19 show |
| 21 ConstantUse, | 20 ConstantUse, |
| 22 DynamicUse, | 21 DynamicUse, |
| 23 StaticUse, | 22 StaticUse, |
| 24 StaticUseKind, | 23 StaticUseKind, |
| 25 TypeUse, | 24 TypeUse, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 applyImpact(listener.registerUsedElement(entity)); | 90 applyImpact(listener.registerUsedElement(entity)); |
| 92 _queue.add(workItem); | 91 _queue.add(workItem); |
| 93 } | 92 } |
| 94 | 93 |
| 95 void applyImpact(WorldImpact worldImpact, {var impactSource}) { | 94 void applyImpact(WorldImpact worldImpact, {var impactSource}) { |
| 96 if (worldImpact.isEmpty) return; | 95 if (worldImpact.isEmpty) return; |
| 97 impactStrategy.visitImpact( | 96 impactStrategy.visitImpact( |
| 98 impactSource, worldImpact, _impactVisitor, impactUse); | 97 impactSource, worldImpact, _impactVisitor, impactUse); |
| 99 } | 98 } |
| 100 | 99 |
| 101 void _registerInstantiatedType(ResolutionInterfaceType type, | 100 void _registerInstantiatedType(InterfaceType type, |
| 102 {bool mirrorUsage: false, bool nativeUsage: false}) { | 101 {bool mirrorUsage: false, bool nativeUsage: false}) { |
| 103 task.measure(() { | 102 task.measure(() { |
| 104 _worldBuilder.registerTypeInstantiation(type, _applyClassUse, | 103 _worldBuilder.registerTypeInstantiation(type, _applyClassUse, |
| 105 byMirrors: mirrorUsage); | 104 byMirrors: mirrorUsage); |
| 106 listener.registerInstantiatedType(type, nativeUsage: nativeUsage); | 105 listener.registerInstantiatedType(type, nativeUsage: nativeUsage); |
| 107 }); | 106 }); |
| 108 } | 107 } |
| 109 | 108 |
| 110 bool checkNoEnqueuedInvokedInstanceMethods( | 109 bool checkNoEnqueuedInvokedInstanceMethods( |
| 111 ElementEnvironment elementEnvironment) { | 110 ElementEnvironment elementEnvironment) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 case StaticUseKind.INLINING: | 165 case StaticUseKind.INLINING: |
| 167 // TODO(johnniwinther): Should this be tracked with _MemberUsage ? | 166 // TODO(johnniwinther): Should this be tracked with _MemberUsage ? |
| 168 listener.registerUsedElement(staticUse.element); | 167 listener.registerUsedElement(staticUse.element); |
| 169 break; | 168 break; |
| 170 default: | 169 default: |
| 171 break; | 170 break; |
| 172 } | 171 } |
| 173 } | 172 } |
| 174 | 173 |
| 175 void processTypeUse(TypeUse typeUse) { | 174 void processTypeUse(TypeUse typeUse) { |
| 176 ResolutionDartType type = typeUse.type; | 175 DartType type = typeUse.type; |
| 177 switch (typeUse.kind) { | 176 switch (typeUse.kind) { |
| 178 case TypeUseKind.INSTANTIATION: | 177 case TypeUseKind.INSTANTIATION: |
| 179 _registerInstantiatedType(type); | 178 _registerInstantiatedType(type); |
| 180 break; | 179 break; |
| 181 case TypeUseKind.MIRROR_INSTANTIATION: | 180 case TypeUseKind.MIRROR_INSTANTIATION: |
| 182 _registerInstantiatedType(type, mirrorUsage: true); | 181 _registerInstantiatedType(type, mirrorUsage: true); |
| 183 break; | 182 break; |
| 184 case TypeUseKind.NATIVE_INSTANTIATION: | 183 case TypeUseKind.NATIVE_INSTANTIATION: |
| 185 _registerInstantiatedType(type, nativeUsage: true); | 184 _registerInstantiatedType(type, nativeUsage: true); |
| 186 break; | 185 break; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 201 | 200 |
| 202 void processConstantUse(ConstantUse constantUse) { | 201 void processConstantUse(ConstantUse constantUse) { |
| 203 task.measure(() { | 202 task.measure(() { |
| 204 if (_worldBuilder.registerConstantUse(constantUse)) { | 203 if (_worldBuilder.registerConstantUse(constantUse)) { |
| 205 applyImpact(listener.registerUsedConstant(constantUse.value)); | 204 applyImpact(listener.registerUsedConstant(constantUse.value)); |
| 206 _recentConstants = true; | 205 _recentConstants = true; |
| 207 } | 206 } |
| 208 }); | 207 }); |
| 209 } | 208 } |
| 210 | 209 |
| 211 void _registerIsCheck(ResolutionDartType type) { | 210 void _registerIsCheck(DartType type) { |
| 212 _worldBuilder.registerIsCheck(type); | 211 _worldBuilder.registerIsCheck(type); |
| 213 } | 212 } |
| 214 | 213 |
| 215 void _registerClosurizedMember(FunctionEntity element) { | 214 void _registerClosurizedMember(FunctionEntity element) { |
| 216 assert(element.isInstanceMember); | 215 assert(element.isInstanceMember); |
| 217 applyImpact(listener.registerClosurizedMember(element)); | 216 applyImpact(listener.registerClosurizedMember(element)); |
| 218 _worldBuilder.registerClosurizedMember(element); | 217 _worldBuilder.registerClosurizedMember(element); |
| 219 } | 218 } |
| 220 | 219 |
| 221 void forEach(void f(WorkItem work)) { | 220 void forEach(void f(WorkItem work)) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 String toString() => 'Enqueuer($name)'; | 256 String toString() => 'Enqueuer($name)'; |
| 258 | 257 |
| 259 ImpactUseCase get impactUse => IMPACT_USE; | 258 ImpactUseCase get impactUse => IMPACT_USE; |
| 260 | 259 |
| 261 @override | 260 @override |
| 262 Iterable<MemberEntity> get processedEntities => _processedEntities; | 261 Iterable<MemberEntity> get processedEntities => _processedEntities; |
| 263 | 262 |
| 264 @override | 263 @override |
| 265 Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses; | 264 Iterable<ClassEntity> get processedClasses => _worldBuilder.processedClasses; |
| 266 } | 265 } |
| OLD | NEW |