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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/optimization/copy_propagator.dart

Issue 981523002: Integrity checker for CPS and Tree IR. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Stronger checks on Tree IR and update status file Created 5 years, 9 months 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 tree_ir.optimization; 5 part of tree_ir.optimization;
6 6
7 /// Eliminates moving assignments, such as w := v, by assigning directly to w 7 /// Eliminates moving assignments, such as w := v, by assigning directly to w
8 /// at the definition of v. 8 /// at the definition of v.
9 /// 9 ///
10 /// This compensates for suboptimal register allocation, and merges closure 10 /// This compensates for suboptimal register allocation, and merges closure
11 /// variables with local temporaries that were left behind when translating 11 /// variables with local temporaries that were left behind when translating
12 /// out of CPS (where closure variables live in a separate space). 12 /// out of CPS (where closure variables live in a separate space).
13 class CopyPropagator extends RecursiveVisitor with PassMixin { 13 class CopyPropagator extends RecursiveVisitor with PassMixin {
14 String get passName => 'Copy propagation';
14 15
15 /// After visitStatement returns, [move] maps a variable v to an 16 /// After visitStatement returns, [move] maps a variable v to an
16 /// assignment A of form w := v, under the following conditions: 17 /// assignment A of form w := v, under the following conditions:
17 /// - there are no reads or writes of w before A 18 /// - there are no reads or writes of w before A
18 /// - A is the only use of v 19 /// - A is the only use of v
19 Map<Variable, Assign> move = <Variable, Assign>{}; 20 Map<Variable, Assign> move = <Variable, Assign>{};
20 21
21 /// Like [move], except w is the key instead of v. 22 /// Like [move], except w is the key instead of v.
22 Map<Variable, Assign> inverseMove = <Variable, Assign>{}; 23 Map<Variable, Assign> inverseMove = <Variable, Assign>{};
23 24
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 246
246 void visitFunctionExpression(FunctionExpression node) { 247 void visitFunctionExpression(FunctionExpression node) {
247 new CopyPropagator().rewrite(node.definition); 248 new CopyPropagator().rewrite(node.definition);
248 } 249 }
249 250
250 void visitFieldInitializer(FieldInitializer node) { 251 void visitFieldInitializer(FieldInitializer node) {
251 visitStatement(node.body); 252 visitStatement(node.body);
252 } 253 }
253 254
254 } 255 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/codegen/task.dart ('k') | pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698