OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Generate code using the cps-based IR pipeline. | 5 /// Generate code using the cps-based IR pipeline. |
6 library code_generator_task; | 6 library code_generator_task; |
7 | 7 |
8 import 'glue.dart'; | 8 import 'glue.dart'; |
9 import 'codegen.dart'; | 9 import 'codegen.dart'; |
10 import 'unsugar.dart'; | 10 import 'unsugar.dart'; |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 } | 174 } |
175 | 175 |
176 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { | 176 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { |
177 // Transformations on the CPS IR. | 177 // Transformations on the CPS IR. |
178 void applyCpsPass(cps_opt.Pass pass) { | 178 void applyCpsPass(cps_opt.Pass pass) { |
179 pass.rewrite(cpsNode); | 179 pass.rewrite(cpsNode); |
180 traceGraph(pass.passName, cpsNode); | 180 traceGraph(pass.passName, cpsNode); |
181 assert(checkCpsIntegrity(cpsNode)); | 181 assert(checkCpsIntegrity(cpsNode)); |
182 } | 182 } |
183 | 183 |
| 184 applyCpsPass(new RedundantPhiEliminator()); |
184 TypePropagator typePropagator = new TypePropagator(compiler); | 185 TypePropagator typePropagator = new TypePropagator(compiler); |
185 applyCpsPass(typePropagator); | 186 applyCpsPass(typePropagator); |
186 dumpTypedIR(cpsNode, typePropagator); | 187 dumpTypedIR(cpsNode, typePropagator); |
187 applyCpsPass(new RedundantPhiEliminator()); | 188 applyCpsPass(new RedundantPhiEliminator()); |
188 applyCpsPass(new ShrinkingReducer()); | 189 applyCpsPass(new ShrinkingReducer()); |
189 | 190 |
190 return cpsNode; | 191 return cpsNode; |
191 } | 192 } |
192 | 193 |
193 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { | 194 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // TODO(sigurdm): Make a better list of tasks. | 232 // TODO(sigurdm): Make a better list of tasks. |
232 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 233 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
233 } | 234 } |
234 | 235 |
235 js.Node attachPosition(js.Node node, AstElement element) { | 236 js.Node attachPosition(js.Node node, AstElement element) { |
236 return node.withSourceInformation( | 237 return node.withSourceInformation( |
237 sourceInformationFactory.createBuilderForContext(element) | 238 sourceInformationFactory.createBuilderForContext(element) |
238 .buildDeclaration(element)); | 239 .buildDeclaration(element)); |
239 } | 240 } |
240 } | 241 } |
OLD | NEW |