| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.kernel.backend_strategy; | 5 library dart2js.kernel.backend_strategy; |
| 6 | 6 |
| 7 import 'package:kernel/ast.dart' as ir; | 7 import 'package:kernel/ast.dart' as ir; |
| 8 | 8 |
| 9 import '../backend_strategy.dart'; | 9 import '../backend_strategy.dart'; |
| 10 import '../closure.dart'; | 10 import '../closure.dart'; |
| 11 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 11 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
| 12 import '../common/tasks.dart'; | 12 import '../common/tasks.dart'; |
| 13 import '../compiler.dart'; | 13 import '../compiler.dart'; |
| 14 import '../elements/elements.dart' show JumpTarget; |
| 14 import '../elements/entities.dart'; | 15 import '../elements/entities.dart'; |
| 15 import '../elements/entity_utils.dart' as utils; | 16 import '../elements/entity_utils.dart' as utils; |
| 16 import '../enqueue.dart'; | 17 import '../enqueue.dart'; |
| 17 import '../io/source_information.dart'; | 18 import '../io/source_information.dart'; |
| 18 import '../js/js_source_mapping.dart'; | 19 import '../js/js_source_mapping.dart'; |
| 19 import '../js_backend/backend.dart'; | 20 import '../js_backend/backend.dart'; |
| 20 import '../js_backend/native_data.dart'; | 21 import '../js_backend/native_data.dart'; |
| 21 import '../js_emitter/sorter.dart'; | 22 import '../js_emitter/sorter.dart'; |
| 22 import '../kernel/element_map.dart'; | 23 import '../kernel/element_map.dart'; |
| 23 import '../kernel/element_map_impl.dart'; | 24 import '../kernel/element_map_impl.dart'; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 129 |
| 129 @override | 130 @override |
| 130 HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) { | 131 HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) { |
| 131 KernelSsaBuilder builder = new KernelSsaBuilder( | 132 KernelSsaBuilder builder = new KernelSsaBuilder( |
| 132 work.element, | 133 work.element, |
| 133 work.element.enclosingClass, | 134 work.element.enclosingClass, |
| 134 _elementMap.getMemberNode(work.element), | 135 _elementMap.getMemberNode(work.element), |
| 135 _compiler, | 136 _compiler, |
| 136 _elementMap, | 137 _elementMap, |
| 137 new KernelToTypeInferenceMapImpl(closedWorld), | 138 new KernelToTypeInferenceMapImpl(closedWorld), |
| 139 null, |
| 138 closedWorld, | 140 closedWorld, |
| 139 work.registry, | 141 work.registry, |
| 140 // TODO(johnniwinther): Support these: | 142 // TODO(johnniwinther): Support these: |
| 141 const KernelClosureClassMaps(), | 143 const KernelClosureClassMaps(), |
| 142 const SourceInformationBuilder(), | 144 const SourceInformationBuilder(), |
| 143 null, // Function node used as capture scope id. | 145 null, // Function node used as capture scope id. |
| 144 targetIsConstructorBody: false); | 146 targetIsConstructorBody: false); |
| 145 return builder.build(); | 147 return builder.build(); |
| 146 } | 148 } |
| 147 } | 149 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 ir.MethodInvocation invocation, ClosedWorld closedWorld) { | 221 ir.MethodInvocation invocation, ClosedWorld closedWorld) { |
| 220 return _closedWorld.commonMasks.dynamicType; | 222 return _closedWorld.commonMasks.dynamicType; |
| 221 } | 223 } |
| 222 | 224 |
| 223 @override | 225 @override |
| 224 TypeMask getReturnTypeOf(FunctionEntity function) { | 226 TypeMask getReturnTypeOf(FunctionEntity function) { |
| 225 return _closedWorld.commonMasks.dynamicType; | 227 return _closedWorld.commonMasks.dynamicType; |
| 226 } | 228 } |
| 227 } | 229 } |
| 228 | 230 |
| 231 class KernelToLocalsMapImpl implements KernelToLocalsMap { |
| 232 @override |
| 233 void enterInlinedMember(MemberEntity member) {} |
| 234 |
| 235 @override |
| 236 void leaveInlinedMember(MemberEntity member) {} |
| 237 |
| 238 @override |
| 239 JumpTarget getJumpTarget(ir.TreeNode node, {bool isContinueTarget: false}) { |
| 240 throw new UnimplementedError('KernelToLocalsMapImpl.getJumpTarget'); |
| 241 } |
| 242 |
| 243 @override |
| 244 Local getLocal(ir.VariableDeclaration node) { |
| 245 throw new UnimplementedError('KernelToLocalsMapImpl.getLocal'); |
| 246 } |
| 247 } |
| 248 |
| 229 /// TODO(johnniwinther,efortuna): Implement this. | 249 /// TODO(johnniwinther,efortuna): Implement this. |
| 230 class KernelClosureClassMaps implements ClosureClassMaps { | 250 class KernelClosureClassMaps implements ClosureClassMaps { |
| 231 const KernelClosureClassMaps(); | 251 const KernelClosureClassMaps(); |
| 232 | 252 |
| 233 @override | 253 @override |
| 234 ClosureClassMap getLocalFunctionMap(Local localFunction) { | 254 ClosureClassMap getLocalFunctionMap(Local localFunction) { |
| 235 return new ClosureClassMap(null, null, null, null); | 255 return new ClosureClassMap(null, null, null, null); |
| 236 } | 256 } |
| 237 | 257 |
| 238 @override | 258 @override |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { | 301 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { |
| 282 return classes.toList() | 302 return classes.toList() |
| 283 ..sort((ClassEntity a, ClassEntity b) { | 303 ..sort((ClassEntity a, ClassEntity b) { |
| 284 int r = _compareLibraries(a.library, b.library); | 304 int r = _compareLibraries(a.library, b.library); |
| 285 if (r != 0) return r; | 305 if (r != 0) return r; |
| 286 return _compareNodes( | 306 return _compareNodes( |
| 287 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); | 307 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); |
| 288 }); | 308 }); |
| 289 } | 309 } |
| 290 } | 310 } |
| OLD | NEW |