| 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.common.codegen; | 5 library dart2js.common.codegen; |
| 6 | 6 |
| 7 import '../elements/elements.dart' show ClassElement, LocalFunctionElement; | 7 import '../common_elements.dart'; |
| 8 import '../elements/elements.dart' show LocalFunctionElement; |
| 8 import '../elements/entities.dart'; | 9 import '../elements/entities.dart'; |
| 9 import '../elements/types.dart' show DartType, InterfaceType; | 10 import '../elements/types.dart' show DartType, InterfaceType; |
| 10 import '../universe/use.dart' show ConstantUse, DynamicUse, StaticUse, TypeUse; | 11 import '../universe/use.dart' show ConstantUse, DynamicUse, StaticUse, TypeUse; |
| 11 import '../universe/world_impact.dart' | 12 import '../universe/world_impact.dart' |
| 12 show WorldImpact, WorldImpactBuilderImpl, WorldImpactVisitor; | 13 show WorldImpact, WorldImpactBuilderImpl, WorldImpactVisitor; |
| 13 import '../util/enumset.dart'; | 14 import '../util/enumset.dart'; |
| 14 import '../util/util.dart' show Pair, Setlet; | 15 import '../util/util.dart' show Pair, Setlet; |
| 15 import 'work.dart' show WorkItem; | 16 import 'work.dart' show WorkItem; |
| 16 | 17 |
| 17 class CodegenImpact extends WorldImpact { | 18 class CodegenImpact extends WorldImpact { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 Iterable<AsyncMarker> get asyncMarkers { | 103 Iterable<AsyncMarker> get asyncMarkers { |
| 103 return _asyncMarkers != null | 104 return _asyncMarkers != null |
| 104 ? _asyncMarkers.iterable(AsyncMarker.values) | 105 ? _asyncMarkers.iterable(AsyncMarker.values) |
| 105 : const <AsyncMarker>[]; | 106 : const <AsyncMarker>[]; |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 // TODO(johnniwinther): Split this class into interface and implementation. | 110 // TODO(johnniwinther): Split this class into interface and implementation. |
| 110 // TODO(johnniwinther): Move this implementation to the JS backend. | 111 // TODO(johnniwinther): Move this implementation to the JS backend. |
| 111 class CodegenRegistry { | 112 class CodegenRegistry { |
| 113 final ElementEnvironment _elementEnvironment; |
| 112 final MemberEntity currentElement; | 114 final MemberEntity currentElement; |
| 113 final _CodegenImpact worldImpact; | 115 final _CodegenImpact worldImpact; |
| 114 | 116 |
| 115 CodegenRegistry(this.currentElement) | 117 CodegenRegistry(this._elementEnvironment, this.currentElement) |
| 116 : this.worldImpact = new _CodegenImpact(); | 118 : this.worldImpact = new _CodegenImpact(); |
| 117 | 119 |
| 118 bool get isForResolution => false; | 120 bool get isForResolution => false; |
| 119 | 121 |
| 120 String toString() => 'CodegenRegistry for $currentElement'; | 122 String toString() => 'CodegenRegistry for $currentElement'; |
| 121 | 123 |
| 122 @deprecated | 124 @deprecated |
| 123 void registerInstantiatedClass(ClassElement element) { | 125 void registerInstantiatedClass(ClassEntity element) { |
| 124 registerInstantiation(element.rawType); | 126 registerInstantiation(_elementEnvironment.getRawType(element)); |
| 125 } | 127 } |
| 126 | 128 |
| 127 void registerStaticUse(StaticUse staticUse) { | 129 void registerStaticUse(StaticUse staticUse) { |
| 128 worldImpact.registerStaticUse(staticUse); | 130 worldImpact.registerStaticUse(staticUse); |
| 129 } | 131 } |
| 130 | 132 |
| 131 void registerDynamicUse(DynamicUse dynamicUse) { | 133 void registerDynamicUse(DynamicUse dynamicUse) { |
| 132 worldImpact.registerDynamicUse(dynamicUse); | 134 worldImpact.registerDynamicUse(dynamicUse); |
| 133 } | 135 } |
| 134 | 136 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 169 |
| 168 void registerAsyncMarker(AsyncMarker asyncMarker) { | 170 void registerAsyncMarker(AsyncMarker asyncMarker) { |
| 169 worldImpact.registerAsyncMarker(asyncMarker); | 171 worldImpact.registerAsyncMarker(asyncMarker); |
| 170 } | 172 } |
| 171 } | 173 } |
| 172 | 174 |
| 173 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. | 175 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. |
| 174 abstract class CodegenWorkItem extends WorkItem { | 176 abstract class CodegenWorkItem extends WorkItem { |
| 175 CodegenRegistry get registry; | 177 CodegenRegistry get registry; |
| 176 } | 178 } |
| OLD | NEW |