| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 final elementAsts = new Map<Element, ElementAst>(); | 227 final elementAsts = new Map<Element, ElementAst>(); |
| 228 | 228 |
| 229 ElementAst parse(AstElement element) { | 229 ElementAst parse(AstElement element) { |
| 230 if (!compiler.irBuilder.hasIr(element)) { | 230 if (!compiler.irBuilder.hasIr(element)) { |
| 231 return new ElementAst(element); | 231 return new ElementAst(element); |
| 232 } else { | 232 } else { |
| 233 cps_ir.FunctionDefinition function = compiler.irBuilder.getIr(element); | 233 cps_ir.FunctionDefinition function = compiler.irBuilder.getIr(element); |
| 234 new RedundantPhiEliminator().rewrite(function); | 234 new RedundantPhiEliminator().rewrite(function); |
| 235 compiler.tracer.traceGraph("Redundant phi elimination", function); | 235 compiler.tracer.traceGraph("Redundant phi elimination", function); |
| 236 new ShrinkingReducer().rewrite(function); |
| 237 compiler.tracer.traceGraph("Shrinking reductions", function); |
| 236 tree_builder.Builder builder = new tree_builder.Builder(compiler); | 238 tree_builder.Builder builder = new tree_builder.Builder(compiler); |
| 237 tree_ir.FunctionDefinition definition = builder.build(function); | 239 tree_ir.FunctionDefinition definition = builder.build(function); |
| 238 assert(definition != null); | 240 assert(definition != null); |
| 239 compiler.tracer.traceCompilation(element.name, null, compiler); | 241 compiler.tracer.traceCompilation(element.name, null, compiler); |
| 240 compiler.tracer.traceGraph('Tree builder', definition); | 242 compiler.tracer.traceGraph('Tree builder', definition); |
| 241 TreeElementMapping treeElements = new TreeElementMapping(element); | 243 TreeElementMapping treeElements = new TreeElementMapping(element); |
| 242 new StatementRewriter().rewrite(definition); | 244 new StatementRewriter().rewrite(definition); |
| 243 compiler.tracer.traceGraph('Statement rewriter', definition); | 245 compiler.tracer.traceGraph('Statement rewriter', definition); |
| 244 new CopyPropagator().rewrite(definition); | 246 new CopyPropagator().rewrite(definition); |
| 245 compiler.tracer.traceGraph('Copy propagation', definition); | 247 compiler.tracer.traceGraph('Copy propagation', definition); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 } | 669 } |
| 668 | 670 |
| 669 Constant compileMetadata(MetadataAnnotation metadata, | 671 Constant compileMetadata(MetadataAnnotation metadata, |
| 670 Node node, | 672 Node node, |
| 671 TreeElements elements) { | 673 TreeElements elements) { |
| 672 return measure(() { | 674 return measure(() { |
| 673 return constantCompiler.compileMetadata(metadata, node, elements); | 675 return constantCompiler.compileMetadata(metadata, node, elements); |
| 674 }); | 676 }); |
| 675 } | 677 } |
| 676 } | 678 } |
| OLD | NEW |