Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: pkg/compiler/lib/src/dart_backend/backend.dart

Issue 795933005: Create a Tree IR builder for JavaScript specific nodes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 traceGraph("Redundant phi elimination", cpsDefinition); 156 traceGraph("Redundant phi elimination", cpsDefinition);
157 new ShrinkingReducer().rewrite(cpsDefinition); 157 new ShrinkingReducer().rewrite(cpsDefinition);
158 traceGraph("Shrinking reductions", cpsDefinition); 158 traceGraph("Shrinking reductions", cpsDefinition);
159 159
160 // Do not rewrite the IR after variable allocation. Allocation 160 // Do not rewrite the IR after variable allocation. Allocation
161 // makes decisions based on an approximation of IR variable live 161 // makes decisions based on an approximation of IR variable live
162 // ranges that can be invalidated by transforming the IR. 162 // ranges that can be invalidated by transforming the IR.
163 new cps_ir.RegisterAllocator().visit(cpsDefinition); 163 new cps_ir.RegisterAllocator().visit(cpsDefinition);
164 164
165 tree_builder.Builder builder = new tree_builder.Builder( 165 tree_builder.Builder builder = new tree_builder.Builder(
166 new Glue(compiler), compiler.internalError, compiler.identicalFunction); 166 compiler.internalError, compiler.identicalFunction);
167 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition); 167 tree_ir.ExecutableDefinition treeDefinition = builder.build(cpsDefinition);
168 assert(treeDefinition != null); 168 assert(treeDefinition != null);
169 traceGraph('Tree builder', treeDefinition); 169 traceGraph('Tree builder', treeDefinition);
170 170
171 // Transformations on the Tree IR. 171 // Transformations on the Tree IR.
172 new StatementRewriter().rewrite(treeDefinition); 172 new StatementRewriter().rewrite(treeDefinition);
173 traceGraph('Statement rewriter', treeDefinition); 173 traceGraph('Statement rewriter', treeDefinition);
174 new CopyPropagator().rewrite(treeDefinition); 174 new CopyPropagator().rewrite(treeDefinition);
175 traceGraph('Copy propagation', treeDefinition); 175 traceGraph('Copy propagation', treeDefinition);
176 new LoopRewriter().rewrite(treeDefinition); 176 new LoopRewriter().rewrite(treeDefinition);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 522
523 ConstantExpression compileMetadata(MetadataAnnotation metadata, 523 ConstantExpression compileMetadata(MetadataAnnotation metadata,
524 Node node, 524 Node node,
525 TreeElements elements) { 525 TreeElements elements) {
526 return measure(() { 526 return measure(() {
527 return constantCompiler.compileMetadata(metadata, node, elements); 527 return constantCompiler.compileMetadata(metadata, node, elements);
528 }); 528 });
529 } 529 }
530 } 530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698