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.frontend_strategy; | 5 library dart2js.kernel.frontend_strategy; |
6 | 6 |
7 import '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../backend_strategy.dart'; | 8 import '../backend_strategy.dart'; |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common_elements.dart'; | 10 import '../common_elements.dart'; |
(...skipping 13 matching lines...) Expand all Loading... |
24 import '../js_backend/backend.dart'; | 24 import '../js_backend/backend.dart'; |
25 import '../js_backend/backend_usage.dart'; | 25 import '../js_backend/backend_usage.dart'; |
26 import '../js_backend/custom_elements_analysis.dart'; | 26 import '../js_backend/custom_elements_analysis.dart'; |
27 import '../js_backend/interceptor_data.dart'; | 27 import '../js_backend/interceptor_data.dart'; |
28 import '../js_backend/mirrors_analysis.dart'; | 28 import '../js_backend/mirrors_analysis.dart'; |
29 import '../js_backend/mirrors_data.dart'; | 29 import '../js_backend/mirrors_data.dart'; |
30 import '../js_backend/native_data.dart'; | 30 import '../js_backend/native_data.dart'; |
31 import '../js_backend/no_such_method_registry.dart'; | 31 import '../js_backend/no_such_method_registry.dart'; |
32 import '../js_backend/runtime_types.dart'; | 32 import '../js_backend/runtime_types.dart'; |
33 import '../js_emitter/sorter.dart'; | 33 import '../js_emitter/sorter.dart'; |
| 34 import '../kernel/element_map.dart'; |
34 import '../library_loader.dart'; | 35 import '../library_loader.dart'; |
35 import '../native/resolver.dart'; | 36 import '../native/resolver.dart'; |
36 import '../serialization/task.dart'; | 37 import '../serialization/task.dart'; |
37 import '../ssa/builder_kernel.dart'; | 38 import '../ssa/builder_kernel.dart'; |
| 39 import '../ssa/nodes.dart'; |
38 import '../ssa/ssa.dart'; | 40 import '../ssa/ssa.dart'; |
39 import '../patch_parser.dart'; | 41 import '../patch_parser.dart'; |
40 import '../resolved_uri_translator.dart'; | 42 import '../resolved_uri_translator.dart'; |
41 import '../universe/world_builder.dart'; | 43 import '../universe/world_builder.dart'; |
42 import '../universe/world_impact.dart'; | 44 import '../universe/world_impact.dart'; |
43 import '../world.dart'; | 45 import '../world.dart'; |
44 import 'element_map_impl.dart'; | 46 import 'element_map_impl.dart'; |
45 | 47 |
46 /// Front end strategy that loads '.dill' files and builds a resolved element | 48 /// Front end strategy that loads '.dill' files and builds a resolved element |
47 /// model from kernel IR nodes. | 49 /// model from kernel IR nodes. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 NativeBasicData nativeBasicData, | 278 NativeBasicData nativeBasicData, |
277 ClosedWorld closedWorld, | 279 ClosedWorld closedWorld, |
278 SelectorConstraintsStrategy selectorConstraintsStrategy) { | 280 SelectorConstraintsStrategy selectorConstraintsStrategy) { |
279 return new KernelCodegenWorldBuilder(_compiler.elementEnvironment, | 281 return new KernelCodegenWorldBuilder(_compiler.elementEnvironment, |
280 nativeBasicData, closedWorld, selectorConstraintsStrategy); | 282 nativeBasicData, closedWorld, selectorConstraintsStrategy); |
281 } | 283 } |
282 | 284 |
283 @override | 285 @override |
284 SsaBuilderTask createSsaBuilderTask(JavaScriptBackend backend, | 286 SsaBuilderTask createSsaBuilderTask(JavaScriptBackend backend, |
285 SourceInformationStrategy sourceInformationStrategy) { | 287 SourceInformationStrategy sourceInformationStrategy) { |
286 return new KernelSsaBuilderTask(backend.compiler.measurer); | 288 return new KernelSsaBuilderTask(backend.compiler); |
287 } | 289 } |
288 } | 290 } |
289 | 291 |
290 class MirrorsCodegenAnalysisImpl implements MirrorsCodegenAnalysis { | 292 class MirrorsCodegenAnalysisImpl implements MirrorsCodegenAnalysis { |
291 @override | 293 @override |
292 int get preMirrorsMethodCount { | 294 int get preMirrorsMethodCount { |
293 throw new UnimplementedError( | 295 throw new UnimplementedError( |
294 'MirrorsCodegenAnalysisImpl.preMirrorsMethodCount'); | 296 'MirrorsCodegenAnalysisImpl.preMirrorsMethodCount'); |
295 } | 297 } |
296 | 298 |
(...skipping 22 matching lines...) Expand all Loading... |
319 final CodegenRegistry registry; | 321 final CodegenRegistry registry; |
320 | 322 |
321 KernelCodegenWorkItem(this._backend, this._closedWorld, this.element) | 323 KernelCodegenWorkItem(this._backend, this._closedWorld, this.element) |
322 : registry = new CodegenRegistry(element); | 324 : registry = new CodegenRegistry(element); |
323 | 325 |
324 @override | 326 @override |
325 WorldImpact run() { | 327 WorldImpact run() { |
326 return _backend.codegen(this, _closedWorld); | 328 return _backend.codegen(this, _closedWorld); |
327 } | 329 } |
328 } | 330 } |
| 331 |
| 332 /// Task for building SSA from kernel IR loaded from .dill. |
| 333 class KernelSsaBuilderTask extends CompilerTask implements SsaBuilderTask { |
| 334 final Compiler _compiler; |
| 335 |
| 336 KernelSsaBuilderTask(this._compiler) : super(_compiler.measurer); |
| 337 |
| 338 KernelToElementMap get _elementMap { |
| 339 KernelFrontEndStrategy frontEndStrategy = _compiler.frontEndStrategy; |
| 340 return frontEndStrategy.elementMap; |
| 341 } |
| 342 |
| 343 @override |
| 344 HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) { |
| 345 KernelSsaBuilder builder = new KernelSsaBuilder( |
| 346 work.element, |
| 347 _compiler, |
| 348 _elementMap, |
| 349 closedWorld, |
| 350 work.registry, |
| 351 const SourceInformationBuilder(), |
| 352 null); |
| 353 return builder.build(); |
| 354 } |
| 355 } |
OLD | NEW |