| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // TODO(karlklose): enable type propagation for dart2dart when constant | 160 // TODO(karlklose): enable type propagation for dart2dart when constant |
| 161 // types are correctly marked as instantiated (Issue 21880). | 161 // types are correctly marked as instantiated (Issue 21880). |
| 162 TypePropagator typePropagator = new TypePropagator( | 162 TypePropagator typePropagator = new TypePropagator( |
| 163 context.dartTypes, | 163 context.dartTypes, |
| 164 context.constantSystem, | 164 context.constantSystem, |
| 165 new UnitTypeSystem(), | 165 new UnitTypeSystem(), |
| 166 context.internalError); | 166 context.internalError); |
| 167 applyCpsPass(typePropagator); | 167 applyCpsPass(typePropagator); |
| 168 applyCpsPass(new RedundantPhiEliminator()); | 168 applyCpsPass(new RedundantPhiEliminator()); |
| 169 applyCpsPass(new ShrinkingReducer()); | 169 applyCpsPass(new ShrinkingReducer()); |
| 170 //print(cpsDefinition.accept(new SExpressionStringifier())); | |
| 171 | 170 |
| 172 // Do not rewrite the IR after variable allocation. Allocation | 171 // Do not rewrite the IR after variable allocation. Allocation |
| 173 // makes decisions based on an approximation of IR variable live | 172 // makes decisions based on an approximation of IR variable live |
| 174 // ranges that can be invalidated by transforming the IR. | 173 // ranges that can be invalidated by transforming the IR. |
| 175 new cps_ir.RegisterAllocator(context.internalError).visit(cpsDefinition); | 174 new cps_ir.RegisterAllocator(context.internalError).visit(cpsDefinition); |
| 176 | 175 |
| 177 tree_builder.Builder builder = | 176 tree_builder.Builder builder = |
| 178 new tree_builder.Builder(context.internalError); | 177 new tree_builder.Builder(context.internalError); |
| 179 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); | 178 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); |
| 180 assert(treeDefinition != null); | 179 assert(treeDefinition != null); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 } | 562 } |
| 564 | 563 |
| 565 void traceGraph(String title, var irObject) { | 564 void traceGraph(String title, var irObject) { |
| 566 compiler.tracer.traceGraph(title, irObject); | 565 compiler.tracer.traceGraph(title, irObject); |
| 567 } | 566 } |
| 568 | 567 |
| 569 DartTypes get dartTypes => compiler.types; | 568 DartTypes get dartTypes => compiler.types; |
| 570 | 569 |
| 571 InternalErrorFunction get internalError => compiler.internalError; | 570 InternalErrorFunction get internalError => compiler.internalError; |
| 572 } | 571 } |
| OLD | NEW |