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 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 /// factory constructors. These types are preserved in [HInvokeStatic]s and | 108 /// factory constructors. These types are preserved in [HInvokeStatic]s and |
109 /// [HCreate]s inside the inline code and registered during code generation | 109 /// [HCreate]s inside the inline code and registered during code generation |
110 /// for these nodes. | 110 /// for these nodes. |
111 // TODO(karlklose): consider removing this and keeping the (substituted) types | 111 // TODO(karlklose): consider removing this and keeping the (substituted) types |
112 // of the type variables in an environment (like the [LocalsHandler]). | 112 // of the type variables in an environment (like the [LocalsHandler]). |
113 final List<ResolutionDartType> currentImplicitInstantiations = | 113 final List<ResolutionDartType> currentImplicitInstantiations = |
114 <ResolutionDartType>[]; | 114 <ResolutionDartType>[]; |
115 | 115 |
116 HInstruction rethrowableException; | 116 HInstruction rethrowableException; |
117 | 117 |
| 118 final Compiler compiler; |
| 119 |
118 @override | 120 @override |
119 JavaScriptBackend get backend => compiler.backend; | 121 JavaScriptBackend get backend => compiler.backend; |
120 | 122 |
121 @override | 123 @override |
122 TreeElements get elements => astAdapter.elements; | 124 TreeElements get elements => astAdapter.elements; |
123 | 125 |
124 SourceInformationBuilder sourceInformationBuilder; | 126 SourceInformationBuilder sourceInformationBuilder; |
125 KernelAstAdapter astAdapter; | 127 KernelAstAdapter astAdapter; |
126 LoopHandler<ir.Node> loopHandler; | 128 LoopHandler<ir.Node> loopHandler; |
127 TypeBuilder typeBuilder; | 129 TypeBuilder typeBuilder; |
128 | 130 |
129 final Map<ir.VariableDeclaration, HInstruction> letBindings = | 131 final Map<ir.VariableDeclaration, HInstruction> letBindings = |
130 <ir.VariableDeclaration, HInstruction>{}; | 132 <ir.VariableDeclaration, HInstruction>{}; |
131 | 133 |
132 /// True if we are visiting the expression of a throw statement; we assume | 134 /// True if we are visiting the expression of a throw statement; we assume |
133 /// this is a slow path. | 135 /// this is a slow path. |
134 bool _inExpressionOfThrow = false; | 136 bool _inExpressionOfThrow = false; |
135 | 137 |
136 KernelSsaBuilder( | 138 KernelSsaBuilder( |
137 this.targetElement, | 139 this.targetElement, |
138 this.resolvedAst, | 140 this.resolvedAst, |
139 Compiler compiler, | 141 this.compiler, |
140 this.closedWorld, | 142 this.closedWorld, |
141 this.registry, | 143 this.registry, |
142 SourceInformationStrategy sourceInformationFactory, | 144 SourceInformationStrategy sourceInformationFactory, |
143 Kernel kernel) { | 145 Kernel kernel) { |
144 this.compiler = compiler; | |
145 this.loopHandler = new KernelLoopHandler(this); | 146 this.loopHandler = new KernelLoopHandler(this); |
146 typeBuilder = new TypeBuilder(this); | 147 typeBuilder = new TypeBuilder(this); |
147 graph.element = targetElement; | 148 graph.element = targetElement; |
148 // TODO(het): Should sourceInformationBuilder be in GraphBuilder? | 149 // TODO(het): Should sourceInformationBuilder be in GraphBuilder? |
149 this.sourceInformationBuilder = | 150 this.sourceInformationBuilder = |
150 sourceInformationFactory.createBuilderForContext(resolvedAst); | 151 sourceInformationFactory.createBuilderForContext(resolvedAst); |
151 graph.sourceInformation = | 152 graph.sourceInformation = |
152 sourceInformationBuilder.buildVariableDeclaration(); | 153 sourceInformationBuilder.buildVariableDeclaration(); |
153 this.localsHandler = new LocalsHandler( | 154 this.localsHandler = new LocalsHandler( |
154 this, targetElement, null, nativeData, interceptorData); | 155 this, targetElement, null, nativeData, interceptorData); |
(...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 enterBlock.setBlockFlow( | 3225 enterBlock.setBlockFlow( |
3225 new HTryBlockInformation( | 3226 new HTryBlockInformation( |
3226 kernelBuilder.wrapStatementGraph(bodyGraph), | 3227 kernelBuilder.wrapStatementGraph(bodyGraph), |
3227 exception, | 3228 exception, |
3228 kernelBuilder.wrapStatementGraph(catchGraph), | 3229 kernelBuilder.wrapStatementGraph(catchGraph), |
3229 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3230 kernelBuilder.wrapStatementGraph(finallyGraph)), |
3230 exitBlock); | 3231 exitBlock); |
3231 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3232 kernelBuilder.inTryStatement = previouslyInTryStatement; |
3232 } | 3233 } |
3233 } | 3234 } |
OLD | NEW |