| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 | 158 |
| 159 new RedundantPhiEliminator().rewrite(cpsNode); | 159 new RedundantPhiEliminator().rewrite(cpsNode); |
| 160 traceGraph("Redundant phi elimination", cpsNode); | 160 traceGraph("Redundant phi elimination", cpsNode); |
| 161 new ShrinkingReducer().rewrite(cpsNode); | 161 new ShrinkingReducer().rewrite(cpsNode); |
| 162 traceGraph("Shrinking reductions", cpsNode); | 162 traceGraph("Shrinking reductions", cpsNode); |
| 163 | 163 |
| 164 // Do not rewrite the IR after variable allocation. Allocation | 164 // Do not rewrite the IR after variable allocation. Allocation |
| 165 // makes decisions based on an approximation of IR variable live | 165 // makes decisions based on an approximation of IR variable live |
| 166 // ranges that can be invalidated by transforming the IR. | 166 // ranges that can be invalidated by transforming the IR. |
| 167 new cps.RegisterAllocator().visit(cpsNode); | 167 new cps.RegisterAllocator(compiler.internalError).visit(cpsNode); |
| 168 return cpsNode; | 168 return cpsNode; |
| 169 } | 169 } |
| 170 | 170 |
| 171 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { | 171 tree_ir.FunctionDefinition compileToTreeIR(cps.FunctionDefinition cpsNode) { |
| 172 tree_builder.Builder builder = new JsTreeBuilder( | 172 tree_builder.Builder builder = new JsTreeBuilder( |
| 173 compiler.internalError, compiler.identicalFunction, glue); | 173 compiler.internalError, compiler.identicalFunction, glue); |
| 174 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode); | 174 tree_ir.FunctionDefinition treeNode = builder.buildFunction(cpsNode); |
| 175 assert(treeNode != null); | 175 assert(treeNode != null); |
| 176 traceGraph('Tree builder', treeNode); | 176 traceGraph('Tree builder', treeNode); |
| 177 return treeNode; | 177 return treeNode; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 203 Iterable<CompilerTask> get tasks { | 203 Iterable<CompilerTask> get tasks { |
| 204 // TODO(sigurdm): Make a better list of tasks. | 204 // TODO(sigurdm): Make a better list of tasks. |
| 205 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); | 205 return <CompilerTask>[irBuilderTask]..addAll(fallbackCompiler.tasks); |
| 206 } | 206 } |
| 207 | 207 |
| 208 js.Node attachPosition(js.Node node, AstElement element) { | 208 js.Node attachPosition(js.Node node, AstElement element) { |
| 209 return node.withSourceInformation( | 209 return node.withSourceInformation( |
| 210 StartEndSourceInformation.computeSourceInformation(element)); | 210 StartEndSourceInformation.computeSourceInformation(element)); |
| 211 } | 211 } |
| 212 } | 212 } |
| OLD | NEW |