| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 new RedundantPhiEliminator().rewrite(cpsDefinition); | 154 new RedundantPhiEliminator().rewrite(cpsDefinition); |
| 155 traceGraph("Redundant phi elimination", cpsDefinition); | 155 traceGraph("Redundant phi elimination", cpsDefinition); |
| 156 new ShrinkingReducer().rewrite(cpsDefinition); | 156 new ShrinkingReducer().rewrite(cpsDefinition); |
| 157 traceGraph("Shrinking reductions", cpsDefinition); | 157 traceGraph("Shrinking reductions", cpsDefinition); |
| 158 | 158 |
| 159 // Do not rewrite the IR after variable allocation. Allocation | 159 // Do not rewrite the IR after variable allocation. Allocation |
| 160 // makes decisions based on an approximation of IR variable live | 160 // makes decisions based on an approximation of IR variable live |
| 161 // ranges that can be invalidated by transforming the IR. | 161 // ranges that can be invalidated by transforming the IR. |
| 162 new cps_ir.RegisterAllocator().visit(cpsDefinition); | 162 new cps_ir.RegisterAllocator().visit(cpsDefinition); |
| 163 | 163 |
| 164 tree_builder.Builder builder = new tree_builder.Builder(compiler); | 164 tree_builder.Builder builder = |
| 165 new tree_builder.Builder(new Glue(compiler), compiler); |
| 165 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); | 166 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); |
| 166 assert(treeDefinition != null); | 167 assert(treeDefinition != null); |
| 167 traceGraph('Tree builder', treeDefinition); | 168 traceGraph('Tree builder', treeDefinition); |
| 168 | 169 |
| 169 // Transformations on the Tree IR. | 170 // Transformations on the Tree IR. |
| 170 new StatementRewriter().rewrite(treeDefinition); | 171 new StatementRewriter().rewrite(treeDefinition); |
| 171 traceGraph('Statement rewriter', treeDefinition); | 172 traceGraph('Statement rewriter', treeDefinition); |
| 172 new CopyPropagator().rewrite(treeDefinition); | 173 new CopyPropagator().rewrite(treeDefinition); |
| 173 traceGraph('Copy propagation', treeDefinition); | 174 traceGraph('Copy propagation', treeDefinition); |
| 174 new LoopRewriter().rewrite(treeDefinition); | 175 new LoopRewriter().rewrite(treeDefinition); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 } | 520 } |
| 520 | 521 |
| 521 ConstantExpression compileMetadata(MetadataAnnotation metadata, | 522 ConstantExpression compileMetadata(MetadataAnnotation metadata, |
| 522 Node node, | 523 Node node, |
| 523 TreeElements elements) { | 524 TreeElements elements) { |
| 524 return measure(() { | 525 return measure(() { |
| 525 return constantCompiler.compileMetadata(metadata, node, elements); | 526 return constantCompiler.compileMetadata(metadata, node, elements); |
| 526 }); | 527 }); |
| 527 } | 528 } |
| 528 } | 529 } |
| OLD | NEW |