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'; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 @override | 66 @override |
67 WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) { | 67 WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) { |
68 return new KernelCodegenWorkItemBuilder(_compiler.backend, closedWorld); | 68 return new KernelCodegenWorkItemBuilder(_compiler.backend, closedWorld); |
69 } | 69 } |
70 | 70 |
71 @override | 71 @override |
72 CodegenWorldBuilder createCodegenWorldBuilder( | 72 CodegenWorldBuilder createCodegenWorldBuilder( |
73 NativeBasicData nativeBasicData, | 73 NativeBasicData nativeBasicData, |
74 ClosedWorld closedWorld, | 74 ClosedWorld closedWorld, |
75 SelectorConstraintsStrategy selectorConstraintsStrategy) { | 75 SelectorConstraintsStrategy selectorConstraintsStrategy) { |
76 return new KernelCodegenWorldBuilder(closedWorld.elementEnvironment, | 76 KernelFrontEndStrategy frontendStrategy = _compiler.frontendStrategy; |
77 nativeBasicData, closedWorld, selectorConstraintsStrategy); | 77 return new KernelCodegenWorldBuilder( |
| 78 frontendStrategy.elementMap, |
| 79 closedWorld.elementEnvironment, |
| 80 nativeBasicData, |
| 81 closedWorld, |
| 82 selectorConstraintsStrategy); |
78 } | 83 } |
79 | 84 |
80 @override | 85 @override |
81 SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend, | 86 SsaBuilder createSsaBuilder(CompilerTask task, JavaScriptBackend backend, |
82 SourceInformationStrategy sourceInformationStrategy) { | 87 SourceInformationStrategy sourceInformationStrategy) { |
83 KernelFrontEndStrategy strategy = backend.compiler.frontendStrategy; | 88 KernelFrontEndStrategy strategy = backend.compiler.frontendStrategy; |
84 KernelToElementMap elementMap = strategy.elementMap; | 89 KernelToElementMap elementMap = strategy.elementMap; |
85 return new KernelSsaBuilder(task, backend.compiler, elementMap); | 90 return new KernelSsaBuilder(task, backend.compiler, elementMap); |
86 } | 91 } |
87 | 92 |
(...skipping 24 matching lines...) Expand all Loading... |
112 } | 117 } |
113 } | 118 } |
114 | 119 |
115 class KernelCodegenWorkItem extends CodegenWorkItem { | 120 class KernelCodegenWorkItem extends CodegenWorkItem { |
116 final JavaScriptBackend _backend; | 121 final JavaScriptBackend _backend; |
117 final ClosedWorld _closedWorld; | 122 final ClosedWorld _closedWorld; |
118 final MemberEntity element; | 123 final MemberEntity element; |
119 final CodegenRegistry registry; | 124 final CodegenRegistry registry; |
120 | 125 |
121 KernelCodegenWorkItem(this._backend, this._closedWorld, this.element) | 126 KernelCodegenWorkItem(this._backend, this._closedWorld, this.element) |
122 : registry = new CodegenRegistry(element); | 127 : registry = |
| 128 new CodegenRegistry(_closedWorld.elementEnvironment, element); |
123 | 129 |
124 @override | 130 @override |
125 WorldImpact run() { | 131 WorldImpact run() { |
126 return _backend.codegen(this, _closedWorld); | 132 return _backend.codegen(this, _closedWorld); |
127 } | 133 } |
128 } | 134 } |
129 | 135 |
130 /// Task for building SSA from kernel IR loaded from .dill. | 136 /// Task for building SSA from kernel IR loaded from .dill. |
131 class KernelSsaBuilder implements SsaBuilder { | 137 class KernelSsaBuilder implements SsaBuilder { |
132 final CompilerTask task; | 138 final CompilerTask task; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { | 403 Iterable<ClassEntity> sortClasses(Iterable<ClassEntity> classes) { |
398 return classes.toList() | 404 return classes.toList() |
399 ..sort((ClassEntity a, ClassEntity b) { | 405 ..sort((ClassEntity a, ClassEntity b) { |
400 int r = _compareLibraries(a.library, b.library); | 406 int r = _compareLibraries(a.library, b.library); |
401 if (r != 0) return r; | 407 if (r != 0) return r; |
402 return _compareNodes( | 408 return _compareNodes( |
403 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); | 409 a, elementMap.getClassNode(a), b, elementMap.getClassNode(b)); |
404 }); | 410 }); |
405 } | 411 } |
406 } | 412 } |
OLD | NEW |