OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import '../common/tasks.dart'; | 5 import '../common/tasks.dart'; |
6 import '../elements/elements.dart'; | 6 import '../elements/elements.dart'; |
7 import '../io/source_information.dart'; | 7 import '../io/source_information.dart'; |
8 import '../js_backend/backend.dart' show JavaScriptBackend; | 8 import '../js_backend/backend.dart' show JavaScriptBackend; |
9 import '../js_backend/element_strategy.dart' show ElementCodegenWorkItem; | 9 import '../js_backend/element_strategy.dart' show ElementCodegenWorkItem; |
10 import '../kernel/kernel.dart'; | 10 import '../kernel/kernel.dart'; |
11 import '../world.dart'; | 11 import '../world.dart'; |
12 import 'builder.dart'; | 12 import 'builder.dart'; |
13 import 'kernel_ast_adapter.dart'; | 13 import 'kernel_ast_adapter.dart'; |
14 import 'nodes.dart'; | 14 import 'nodes.dart'; |
15 import 'builder_kernel.dart'; | 15 import 'builder_kernel.dart'; |
16 | 16 |
17 /// Task for building SSA kernel IR generated from rasta. | 17 /// Task for building SSA kernel IR generated from rasta. |
18 class RastaSsaBuilder extends SsaAstBuilderBase { | 18 class RastaSsaBuilder extends SsaAstBuilderBase { |
19 final SourceInformationStrategy sourceInformationFactory; | 19 final SourceInformationStrategy sourceInformationFactory; |
20 | 20 |
21 String get name => 'SSA kernel builder'; | 21 String get name => 'SSA kernel builder'; |
22 | 22 |
23 RastaSsaBuilder(CompilerTask task, JavaScriptBackend backend, | 23 RastaSsaBuilder(CompilerTask task, JavaScriptBackend backend, |
24 this.sourceInformationFactory) | 24 this.sourceInformationFactory) |
25 : super(task, backend); | 25 : super(task, backend); |
26 | 26 |
27 HGraph build(ElementCodegenWorkItem work, ClosedWorld closedWorld) { | 27 HGraph build(ElementCodegenWorkItem work, ClosedWorld closedWorld) { |
28 return task.measure(() { | 28 return task.measure(() { |
29 if (handleConstantField(work, closedWorld)) { | 29 if (handleConstantField(work.element, work.registry, closedWorld)) { |
30 // No code is generated for `work.element`. | 30 // No code is generated for `work.element`. |
31 return null; | 31 return null; |
32 } | 32 } |
33 MemberElement element = work.element.implementation; | 33 MemberElement element = work.element.implementation; |
34 ResolvedAst resolvedAst = work.resolvedAst; | 34 ResolvedAst resolvedAst = work.resolvedAst; |
35 Kernel kernel = backend.kernelTask.kernel; | 35 Kernel kernel = backend.kernelTask.kernel; |
36 KernelAstAdapter astAdapter = new KernelAstAdapter(kernel, backend, | 36 KernelAstAdapter astAdapter = new KernelAstAdapter(kernel, backend, |
37 work.resolvedAst, kernel.nodeToAst, kernel.nodeToElement); | 37 work.resolvedAst, kernel.nodeToAst, kernel.nodeToElement); |
38 KernelAstTypeInferenceMap typeInferenceMap = | 38 KernelAstTypeInferenceMap typeInferenceMap = |
39 new KernelAstTypeInferenceMap(astAdapter); | 39 new KernelAstTypeInferenceMap(astAdapter); |
(...skipping 27 matching lines...) Expand all Loading... |
67 name = "${element.name}"; | 67 name = "${element.name}"; |
68 } | 68 } |
69 backend.tracer.traceCompilation(name); | 69 backend.tracer.traceCompilation(name); |
70 backend.tracer.traceGraph('builder', graph); | 70 backend.tracer.traceGraph('builder', graph); |
71 } | 71 } |
72 | 72 |
73 return graph; | 73 return graph; |
74 }); | 74 }); |
75 } | 75 } |
76 } | 76 } |
OLD | NEW |