| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 ElementAst parse(AstElement element) { | 225 ElementAst parse(AstElement element) { |
| 226 if (!compiler.irBuilder.hasIr(element)) { | 226 if (!compiler.irBuilder.hasIr(element)) { |
| 227 return new ElementAst(element); | 227 return new ElementAst(element); |
| 228 } else { | 228 } else { |
| 229 cps_ir.FunctionDefinition function = compiler.irBuilder.getIr(element); | 229 cps_ir.FunctionDefinition function = compiler.irBuilder.getIr(element); |
| 230 // Transformations on the CPS IR. | 230 // Transformations on the CPS IR. |
| 231 new RedundantPhiEliminator().rewrite(function); | 231 new RedundantPhiEliminator().rewrite(function); |
| 232 compiler.tracer.traceCompilation(element.name, null, compiler); | 232 compiler.tracer.traceCompilation(element.name, null, compiler); |
| 233 compiler.tracer.traceGraph("Redundant phi elimination", function); | 233 compiler.tracer.traceGraph("Redundant phi elimination", function); |
| 234 new ShrinkingReducer().rewrite(function); |
| 235 compiler.tracer.traceGraph("Shrinking reductions", function); |
| 234 // Do not rewrite the IR after variable allocation. Allocation | 236 // Do not rewrite the IR after variable allocation. Allocation |
| 235 // makes decisions based on an approximation of IR variable live | 237 // makes decisions based on an approximation of IR variable live |
| 236 // ranges that can be invalidated by transforming the IR. | 238 // ranges that can be invalidated by transforming the IR. |
| 237 new cps_ir.RegisterAllocator().visit(function); | 239 new cps_ir.RegisterAllocator().visit(function); |
| 238 | 240 |
| 239 tree_builder.Builder builder = new tree_builder.Builder(compiler); | 241 tree_builder.Builder builder = new tree_builder.Builder(compiler); |
| 240 tree_ir.FunctionDefinition definition = builder.build(function); | 242 tree_ir.FunctionDefinition definition = builder.build(function); |
| 241 assert(definition != null); | 243 assert(definition != null); |
| 242 compiler.tracer.traceGraph('Tree builder', definition); | 244 compiler.tracer.traceGraph('Tree builder', definition); |
| 243 | 245 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 } | 674 } |
| 673 | 675 |
| 674 Constant compileMetadata(MetadataAnnotation metadata, | 676 Constant compileMetadata(MetadataAnnotation metadata, |
| 675 Node node, | 677 Node node, |
| 676 TreeElements elements) { | 678 TreeElements elements) { |
| 677 return measure(() { | 679 return measure(() { |
| 678 return constantCompiler.compileMetadata(metadata, node, elements); | 680 return constantCompiler.compileMetadata(metadata, node, elements); |
| 679 }); | 681 }); |
| 680 } | 682 } |
| 681 } | 683 } |
| OLD | NEW |