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.js_backend.element_strategy; | 5 library dart2js.js_backend.element_strategy; |
6 | 6 |
7 import '../backend_strategy.dart'; | 7 import '../backend_strategy.dart'; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/codegen.dart'; | 9 import '../common/codegen.dart'; |
10 import '../common/work.dart'; | 10 import '../common/work.dart'; |
11 import '../compiler.dart'; | 11 import '../compiler.dart'; |
12 import '../elements/elements.dart'; | 12 import '../elements/elements.dart'; |
13 import '../enqueue.dart'; | 13 import '../enqueue.dart'; |
14 import '../io/source_information.dart'; | 14 import '../io/source_information.dart'; |
15 import '../js_backend/backend.dart'; | 15 import '../js_backend/backend.dart'; |
16 import '../js_backend/native_data.dart'; | 16 import '../js_backend/native_data.dart'; |
17 import '../js_emitter/sorter.dart'; | 17 import '../js_emitter/sorter.dart'; |
18 import '../ssa/builder.dart'; | 18 import '../ssa/builder.dart'; |
19 import '../ssa/builder_kernel.dart'; | 19 import '../ssa/rasta_ssa_builder_task.dart'; |
20 import '../ssa/ssa.dart'; | 20 import '../ssa/ssa.dart'; |
21 import '../options.dart'; | 21 import '../options.dart'; |
22 import '../universe/world_builder.dart'; | 22 import '../universe/world_builder.dart'; |
23 import '../universe/world_impact.dart'; | 23 import '../universe/world_impact.dart'; |
24 import '../world.dart'; | 24 import '../world.dart'; |
25 | 25 |
26 /// Strategy for using the [Element] model from the resolver as the backend | 26 /// Strategy for using the [Element] model from the resolver as the backend |
27 /// model. | 27 /// model. |
28 class ElementBackendStrategy implements BackendStrategy { | 28 class ElementBackendStrategy implements BackendStrategy { |
29 final Compiler _compiler; | 29 final Compiler _compiler; |
(...skipping 25 matching lines...) Expand all Loading... |
55 @override | 55 @override |
56 WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) { | 56 WorkItemBuilder createCodegenWorkItemBuilder(ClosedWorld closedWorld) { |
57 return new ElementCodegenWorkItemBuilder( | 57 return new ElementCodegenWorkItemBuilder( |
58 _compiler.backend, closedWorld, _compiler.options); | 58 _compiler.backend, closedWorld, _compiler.options); |
59 } | 59 } |
60 | 60 |
61 @override | 61 @override |
62 SsaBuilderTask createSsaBuilderTask(JavaScriptBackend backend, | 62 SsaBuilderTask createSsaBuilderTask(JavaScriptBackend backend, |
63 SourceInformationStrategy sourceInformationStrategy) { | 63 SourceInformationStrategy sourceInformationStrategy) { |
64 return _compiler.options.useKernel | 64 return _compiler.options.useKernel |
65 ? new SsaAstKernelBuilderTask(backend, sourceInformationStrategy) | 65 ? new RastaSsaBuilderTask(backend, sourceInformationStrategy) |
66 : new SsaAstBuilderTask(backend, sourceInformationStrategy); | 66 : new SsaAstBuilderTask(backend, sourceInformationStrategy); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 /// Builder that creates the work item necessary for the code generation of a | 70 /// Builder that creates the work item necessary for the code generation of a |
71 /// [MemberElement]. | 71 /// [MemberElement]. |
72 class ElementCodegenWorkItemBuilder extends WorkItemBuilder { | 72 class ElementCodegenWorkItemBuilder extends WorkItemBuilder { |
73 final JavaScriptBackend _backend; | 73 final JavaScriptBackend _backend; |
74 final ClosedWorld _closedWorld; | 74 final ClosedWorld _closedWorld; |
75 final CompilerOptions _options; | 75 final CompilerOptions _options; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 MemberElement get element => resolvedAst.element; | 121 MemberElement get element => resolvedAst.element; |
122 | 122 |
123 WorldImpact run() { | 123 WorldImpact run() { |
124 registry = new CodegenRegistry(element); | 124 registry = new CodegenRegistry(element); |
125 return _backend.codegen(this, _closedWorld); | 125 return _backend.codegen(this, _closedWorld); |
126 } | 126 } |
127 | 127 |
128 String toString() => 'CodegenWorkItem(${resolvedAst.element})'; | 128 String toString() => 'CodegenWorkItem(${resolvedAst.element})'; |
129 } | 129 } |
OLD | NEW |