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 |
| 5 import '../common/tasks.dart'; |
4 import '../elements/elements.dart'; | 6 import '../elements/elements.dart'; |
5 import '../io/source_information.dart'; | 7 import '../io/source_information.dart'; |
6 import '../js_backend/backend.dart' show JavaScriptBackend; | 8 import '../js_backend/backend.dart' show JavaScriptBackend; |
7 import '../js_backend/element_strategy.dart' show ElementCodegenWorkItem; | 9 import '../js_backend/element_strategy.dart' show ElementCodegenWorkItem; |
8 import '../kernel/kernel.dart'; | 10 import '../kernel/kernel.dart'; |
9 import '../world.dart'; | 11 import '../world.dart'; |
10 import 'builder.dart'; | 12 import 'builder.dart'; |
11 import 'kernel_ast_adapter.dart'; | 13 import 'kernel_ast_adapter.dart'; |
12 import 'nodes.dart'; | 14 import 'nodes.dart'; |
13 import 'builder_kernel.dart'; | 15 import 'builder_kernel.dart'; |
14 | 16 |
15 /// Task for building SSA kernel IR generated from rasta. | 17 /// Task for building SSA kernel IR generated from rasta. |
16 class RastaSsaBuilderTask extends SsaAstBuilderBase { | 18 class RastaSsaBuilder extends SsaAstBuilderBase { |
17 final SourceInformationStrategy sourceInformationFactory; | 19 final SourceInformationStrategy sourceInformationFactory; |
18 | 20 |
19 String get name => 'SSA kernel builder'; | 21 String get name => 'SSA kernel builder'; |
20 | 22 |
21 RastaSsaBuilderTask(JavaScriptBackend backend, this.sourceInformationFactory) | 23 RastaSsaBuilder(CompilerTask task, JavaScriptBackend backend, |
22 : super(backend); | 24 this.sourceInformationFactory) |
| 25 : super(task, backend); |
23 | 26 |
24 HGraph build(ElementCodegenWorkItem work, ClosedWorld closedWorld) { | 27 HGraph build(ElementCodegenWorkItem work, ClosedWorld closedWorld) { |
25 return measure(() { | 28 return task.measure(() { |
26 if (handleConstantField(work, closedWorld)) { | 29 if (handleConstantField(work, closedWorld)) { |
27 // No code is generated for `work.element`. | 30 // No code is generated for `work.element`. |
28 return null; | 31 return null; |
29 } | 32 } |
30 MemberElement element = work.element.implementation; | 33 MemberElement element = work.element.implementation; |
31 ResolvedAst resolvedAst = work.resolvedAst; | 34 ResolvedAst resolvedAst = work.resolvedAst; |
32 Kernel kernel = backend.kernelTask.kernel; | 35 Kernel kernel = backend.kernelTask.kernel; |
33 KernelAstAdapter astAdapter = new KernelAstAdapter(kernel, backend, | 36 KernelAstAdapter astAdapter = new KernelAstAdapter(kernel, backend, |
34 work.resolvedAst, kernel.nodeToAst, kernel.nodeToElement); | 37 work.resolvedAst, kernel.nodeToAst, kernel.nodeToElement); |
35 KernelAstTypeInferenceMap typeInferenceMap = | 38 KernelAstTypeInferenceMap typeInferenceMap = |
36 new KernelAstTypeInferenceMap(astAdapter); | 39 new KernelAstTypeInferenceMap(astAdapter); |
37 KernelSsaBuilder builder = new KernelSsaBuilder( | 40 KernelSsaGraphBuilder builder = new KernelSsaGraphBuilder( |
38 element, | 41 element, |
39 element.contextClass, | 42 element.contextClass, |
40 astAdapter.getInitialKernelNode(element), | 43 astAdapter.getMemberNode(element), |
41 backend.compiler, | 44 backend.compiler, |
42 astAdapter, | 45 astAdapter, |
43 typeInferenceMap, | 46 typeInferenceMap, |
44 astAdapter, | 47 astAdapter, |
45 closedWorld, | 48 closedWorld, |
46 backend.compiler.codegenWorldBuilder, | 49 backend.compiler.codegenWorldBuilder, |
47 work.registry, | 50 work.registry, |
48 backend.compiler.closureDataLookup, | 51 backend.compiler.closureDataLookup, |
49 sourceInformationFactory.createBuilderForContext(work.element), | 52 sourceInformationFactory.createBuilderForContext(work.element), |
50 resolvedAst.kind == ResolvedAstKind.PARSED ? resolvedAst.node : null, | 53 resolvedAst.kind == ResolvedAstKind.PARSED ? resolvedAst.node : null, |
(...skipping 13 matching lines...) Expand all Loading... |
64 name = "${element.name}"; | 67 name = "${element.name}"; |
65 } | 68 } |
66 backend.tracer.traceCompilation(name); | 69 backend.tracer.traceCompilation(name); |
67 backend.tracer.traceGraph('builder', graph); | 70 backend.tracer.traceGraph('builder', graph); |
68 } | 71 } |
69 | 72 |
70 return graph; | 73 return graph; |
71 }); | 74 }); |
72 } | 75 } |
73 } | 76 } |
OLD | NEW |