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

Side by Side Diff: pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.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 /** 7 /**
8 * Performs the following transformations on the tree: 8 * Performs the following transformations on the tree:
9 * - Assignment propagation 9 * - Assignment propagation
10 * - If-to-conditional conversion 10 * - If-to-conditional conversion
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 * For example, where 'jump' is either break or continue: 85 * For example, where 'jump' is either break or continue:
86 * 86 *
87 * L0: {... break L0 ...}; jump L1 87 * L0: {... break L0 ...}; jump L1
88 * ==> 88 * ==>
89 * {... jump L1 ...} 89 * {... jump L1 ...}
90 * 90 *
91 * This may trigger a flattening of nested ifs in case the eliminated label 91 * This may trigger a flattening of nested ifs in case the eliminated label
92 * separated two ifs. 92 * separated two ifs.
93 */ 93 */
94 class StatementRewriter extends Visitor<Statement, Expression> with PassMixin { 94 class StatementRewriter extends Visitor<Statement, Expression> with PassMixin {
95 String get passName => 'Statement rewriter';
96
95 // The binding environment. The rightmost element of the list is the nearest 97 // The binding environment. The rightmost element of the list is the nearest
96 // available enclosing binding. 98 // available enclosing binding.
97 List<Assign> environment; 99 List<Assign> environment;
98 100
99 /// Binding environment for variables that are assigned to effectively 101 /// Binding environment for variables that are assigned to effectively
100 /// constant expressions (see [isEffectivelyConstant]). 102 /// constant expressions (see [isEffectivelyConstant]).
101 final Map<Variable, Expression> constantEnvironment; 103 final Map<Variable, Expression> constantEnvironment;
102 104
103 /// Substitution map for labels. Any break to a label L should be substituted 105 /// Substitution map for labels. Any break to a label L should be substituted
104 /// for a break to L' if L maps to L'. 106 /// for a break to L' if L maps to L'.
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 659 }
658 660
659 Expression makeCondition(Expression e, bool polarity) { 661 Expression makeCondition(Expression e, bool polarity) {
660 return polarity ? e : new Not(e); 662 return polarity ? e : new Not(e);
661 } 663 }
662 664
663 Statement getBranch(If node, bool polarity) { 665 Statement getBranch(If node, bool polarity) {
664 return polarity ? node.thenStatement : node.elseStatement; 666 return polarity ? node.thenStatement : node.elseStatement;
665 } 667 }
666 } 668 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/optimization.dart ('k') | pkg/compiler/lib/src/tree_ir/tree_ir_integrity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698