| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 169 } |
| 170 | 170 |
| 171 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { | 171 cps.FunctionDefinition optimizeCpsIR(cps.FunctionDefinition cpsNode) { |
| 172 // Transformations on the CPS IR. | 172 // Transformations on the CPS IR. |
| 173 void applyCpsPass(cps_opt.Pass pass) { | 173 void applyCpsPass(cps_opt.Pass pass) { |
| 174 pass.rewrite(cpsNode); | 174 pass.rewrite(cpsNode); |
| 175 traceGraph(pass.passName, cpsNode); | 175 traceGraph(pass.passName, cpsNode); |
| 176 assert(checkCpsIntegrity(cpsNode)); | 176 assert(checkCpsIntegrity(cpsNode)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 TypePropagator typePropagator = new TypePropagator(compiler); | 179 TypePropagator typePropagator = new TypePropagator(compiler, this); |
| 180 applyCpsPass(typePropagator); | 180 applyCpsPass(typePropagator); |
| 181 dumpTypedIR(cpsNode, typePropagator); | 181 dumpTypedIR(cpsNode, typePropagator); |
| 182 applyCpsPass(new ShrinkingReducer()); | 182 applyCpsPass(new ShrinkingReducer()); |
| 183 applyCpsPass(new MutableVariableEliminator()); | 183 applyCpsPass(new MutableVariableEliminator()); |
| 184 applyCpsPass(new RedundantJoinEliminator()); | 184 applyCpsPass(new RedundantJoinEliminator()); |
| 185 applyCpsPass(new RedundantPhiEliminator()); | 185 applyCpsPass(new RedundantPhiEliminator()); |
| 186 applyCpsPass(new ShrinkingReducer()); | 186 applyCpsPass(new ShrinkingReducer()); |
| 187 applyCpsPass(new LetSinker()); | 187 applyCpsPass(new LetSinker()); |
| 188 | 188 |
| 189 return cpsNode; | 189 return cpsNode; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // TODO(sigurdm): Make a better list of tasks. | 236 // TODO(sigurdm): Make a better list of tasks. |
| 237 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 237 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
| 238 } | 238 } |
| 239 | 239 |
| 240 js.Node attachPosition(js.Node node, AstElement element) { | 240 js.Node attachPosition(js.Node node, AstElement element) { |
| 241 return node.withSourceInformation( | 241 return node.withSourceInformation( |
| 242 sourceInformationFactory.createBuilderForContext(element) | 242 sourceInformationFactory.createBuilderForContext(element) |
| 243 .buildDeclaration(element)); | 243 .buildDeclaration(element)); |
| 244 } | 244 } |
| 245 } | 245 } |
| OLD | NEW |