| 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())); |
| 170 | 171 |
| 171 // Do not rewrite the IR after variable allocation. Allocation | 172 // Do not rewrite the IR after variable allocation. Allocation |
| 172 // makes decisions based on an approximation of IR variable live | 173 // makes decisions based on an approximation of IR variable live |
| 173 // ranges that can be invalidated by transforming the IR. | 174 // ranges that can be invalidated by transforming the IR. |
| 174 new cps_ir.RegisterAllocator(context.internalError).visit(cpsDefinition); | 175 new cps_ir.RegisterAllocator(context.internalError).visit(cpsDefinition); |
| 175 | 176 |
| 176 tree_builder.Builder builder = | 177 tree_builder.Builder builder = |
| 177 new tree_builder.Builder(context.internalError); | 178 new tree_builder.Builder(context.internalError); |
| 178 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); | 179 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); |
| 179 assert(treeDefinition != null); | 180 assert(treeDefinition != null); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 } | 563 } |
| 563 | 564 |
| 564 void traceGraph(String title, var irObject) { | 565 void traceGraph(String title, var irObject) { |
| 565 compiler.tracer.traceGraph(title, irObject); | 566 compiler.tracer.traceGraph(title, irObject); |
| 566 } | 567 } |
| 567 | 568 |
| 568 DartTypes get dartTypes => compiler.types; | 569 DartTypes get dartTypes => compiler.types; |
| 569 | 570 |
| 570 InternalErrorFunction get internalError => compiler.internalError; | 571 InternalErrorFunction get internalError => compiler.internalError; |
| 571 } | 572 } |
| OLD | NEW |