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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ir.FunctionDefinition function = compiler.irBuilder.getIr(element); | 233 ir.FunctionDefinition function = compiler.irBuilder.getIr(element); |
234 tree.Builder builder = new tree.Builder(compiler); | 234 tree.Builder builder = new tree.Builder(compiler); |
235 tree.FunctionDefinition definition = builder.build(function); | 235 tree.FunctionDefinition definition = builder.build(function); |
236 assert(definition != null); | 236 assert(definition != null); |
237 compiler.tracer.traceCompilation(element.name, null, compiler); | 237 compiler.tracer.traceCompilation(element.name, null, compiler); |
238 compiler.tracer.traceGraph('Tree builder', definition); | 238 compiler.tracer.traceGraph('Tree builder', definition); |
239 TreeElementMapping treeElements = new TreeElementMapping(element); | 239 TreeElementMapping treeElements = new TreeElementMapping(element); |
240 new tree.CopyPropagateClosureVariables().rewrite(definition); | |
241 compiler.tracer.traceGraph('Copy propagate closure vars', definition); | |
242 new tree.StatementRewriter().rewrite(definition); | 240 new tree.StatementRewriter().rewrite(definition); |
243 compiler.tracer.traceGraph('Statement rewriter', definition); | 241 compiler.tracer.traceGraph('Statement rewriter', definition); |
| 242 new tree.CopyPropagator().rewrite(definition); |
| 243 compiler.tracer.traceGraph('Copy propagation', definition); |
244 new tree.LoopRewriter().rewrite(definition); | 244 new tree.LoopRewriter().rewrite(definition); |
245 compiler.tracer.traceGraph('Loop rewriter', definition); | 245 compiler.tracer.traceGraph('Loop rewriter', definition); |
246 new tree.LogicalRewriter().rewrite(definition); | 246 new tree.LogicalRewriter().rewrite(definition); |
247 compiler.tracer.traceGraph('Logical rewriter', definition); | 247 compiler.tracer.traceGraph('Logical rewriter', definition); |
248 new dart_codegen.UnshadowParameters().unshadow(definition); | 248 new dart_codegen.UnshadowParameters().unshadow(definition); |
249 compiler.tracer.traceGraph('Unshadow parameters', definition); | 249 compiler.tracer.traceGraph('Unshadow parameters', definition); |
250 Node node = dart_codegen.emit(element, treeElements, definition); | 250 Node node = dart_codegen.emit(element, treeElements, definition); |
251 return new ElementAst.internal(node, treeElements); | 251 return new ElementAst.internal(node, treeElements); |
252 } | 252 } |
253 } | 253 } |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 } | 663 } |
664 | 664 |
665 Constant compileMetadata(MetadataAnnotation metadata, | 665 Constant compileMetadata(MetadataAnnotation metadata, |
666 Node node, | 666 Node node, |
667 TreeElements elements) { | 667 TreeElements elements) { |
668 return measure(() { | 668 return measure(() { |
669 return constantCompiler.compileMetadata(metadata, node, elements); | 669 return constantCompiler.compileMetadata(metadata, node, elements); |
670 }); | 670 }); |
671 } | 671 } |
672 } | 672 } |
OLD | NEW |