| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart_backend; | 5 part of dart_backend; |
| 6 | 6 |
| 7 // TODO(ahe): This class is simply wrong. This backend should use | 7 // TODO(ahe): This class is simply wrong. This backend should use |
| 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, | 8 // elements when it can, not AST nodes. Perhaps a [Map<Element, |
| 9 // TreeElements>] is what is needed. | 9 // TreeElements>] is what is needed. |
| 10 class ElementAst { | 10 class ElementAst { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 .rewrite(cpsDefinition); | 148 .rewrite(cpsDefinition); |
| 149 context.traceGraph("Sparse constant propagation", cpsDefinition); | 149 context.traceGraph("Sparse constant propagation", cpsDefinition); |
| 150 new RedundantPhiEliminator().rewrite(cpsDefinition); | 150 new RedundantPhiEliminator().rewrite(cpsDefinition); |
| 151 context.traceGraph("Redundant phi elimination", cpsDefinition); | 151 context.traceGraph("Redundant phi elimination", cpsDefinition); |
| 152 new ShrinkingReducer().rewrite(cpsDefinition); | 152 new ShrinkingReducer().rewrite(cpsDefinition); |
| 153 context.traceGraph("Shrinking reductions", cpsDefinition); | 153 context.traceGraph("Shrinking reductions", cpsDefinition); |
| 154 | 154 |
| 155 // Do not rewrite the IR after variable allocation. Allocation | 155 // Do not rewrite the IR after variable allocation. Allocation |
| 156 // makes decisions based on an approximation of IR variable live | 156 // makes decisions based on an approximation of IR variable live |
| 157 // ranges that can be invalidated by transforming the IR. | 157 // ranges that can be invalidated by transforming the IR. |
| 158 new cps_ir.RegisterAllocator().visit(cpsDefinition); | 158 new cps_ir.RegisterAllocator(context.internalError).visit(cpsDefinition); |
| 159 | 159 |
| 160 tree_builder.Builder builder = | 160 tree_builder.Builder builder = |
| 161 new tree_builder.Builder(context.internalError); | 161 new tree_builder.Builder(context.internalError); |
| 162 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); | 162 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); |
| 163 assert(treeDefinition != null); | 163 assert(treeDefinition != null); |
| 164 context.traceGraph('Tree builder', treeDefinition); | 164 context.traceGraph('Tree builder', treeDefinition); |
| 165 | 165 |
| 166 // Transformations on the Tree IR. | 166 // Transformations on the Tree IR. |
| 167 new StatementRewriter().rewrite(treeDefinition); | 167 new StatementRewriter().rewrite(treeDefinition); |
| 168 context.traceGraph('Statement rewriter', treeDefinition); | 168 context.traceGraph('Statement rewriter', treeDefinition); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } | 541 } |
| 542 | 542 |
| 543 void traceGraph(String title, var irObject) { | 543 void traceGraph(String title, var irObject) { |
| 544 compiler.tracer.traceGraph(title, irObject); | 544 compiler.tracer.traceGraph(title, irObject); |
| 545 } | 545 } |
| 546 | 546 |
| 547 DartTypes get dartTypes => compiler.types; | 547 DartTypes get dartTypes => compiler.types; |
| 548 | 548 |
| 549 InternalErrorFunction get internalError => compiler.internalError; | 549 InternalErrorFunction get internalError => compiler.internalError; |
| 550 } | 550 } |
| OLD | NEW |