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

Side by Side Diff: lib/compiler/implementation/ssa/validate.dart

Issue 10091048: Fix remaining warnings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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
« no previous file with comments | « lib/compiler/implementation/ssa/optimize.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 class HValidator extends HInstructionVisitor { 5 class HValidator extends HInstructionVisitor {
6 bool isValid = true; 6 bool isValid = true;
7 HGraph graph; 7 HGraph graph;
8 8
9 void visitGraph(HGraph graph) { 9 void visitGraph(HGraph visitee) {
10 this.graph = graph; 10 graph = visitee;
11 visitDominatorTree(graph); 11 visitDominatorTree(visitee);
12 } 12 }
13 13
14 void markInvalid(String reason) { 14 void markInvalid(String reason) {
15 print(reason); 15 print(reason);
16 isValid = false; 16 isValid = false;
17 } 17 }
18 18
19 // Note that during construction of the Ssa graph the basic blocks are 19 // Note that during construction of the Ssa graph the basic blocks are
20 // not required to be valid yet. 20 // not required to be valid yet.
21 void visitBasicBlock(HBasicBlock block) { 21 void visitBasicBlock(HBasicBlock block) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 count++; 114 count++;
115 } 115 }
116 } 116 }
117 if (!f(current, count)) return false; 117 if (!f(current, count)) return false;
118 } 118 }
119 return true; 119 return true;
120 } 120 }
121 121
122 void visitInstruction(HInstruction instruction) { 122 void visitInstruction(HInstruction instruction) {
123 // Verifies that we are in the use list of our inputs. 123 // Verifies that we are in the use list of our inputs.
124 bool hasCorrectInputs(instruction) { 124 bool hasCorrectInputs() {
125 bool inBasicBlock = instruction.isInBasicBlock(); 125 bool inBasicBlock = instruction.isInBasicBlock();
126 return everyInstruction(instruction.inputs, (input, count) { 126 return everyInstruction(instruction.inputs, (input, count) {
127 if (inBasicBlock) { 127 if (inBasicBlock) {
128 return countInstruction(input.usedBy, instruction) == count; 128 return countInstruction(input.usedBy, instruction) == count;
129 } else { 129 } else {
130 return countInstruction(input.usedBy, instruction) == 0; 130 return countInstruction(input.usedBy, instruction) == 0;
131 } 131 }
132 }); 132 });
133 } 133 }
134 134
135 // Verifies that all our uses have us in their inputs. 135 // Verifies that all our uses have us in their inputs.
136 bool hasCorrectUses(instruction) { 136 bool hasCorrectUses() {
137 if (!instruction.isInBasicBlock()) return true; 137 if (!instruction.isInBasicBlock()) return true;
138 return everyInstruction(instruction.usedBy, (use, count) { 138 return everyInstruction(instruction.usedBy, (use, count) {
139 return countInstruction(use.inputs, instruction) == count; 139 return countInstruction(use.inputs, instruction) == count;
140 }); 140 });
141 } 141 }
142 142
143 if (instruction.block !== currentBlock) { 143 if (instruction.block !== currentBlock) {
144 markInvalid("Instruction in wrong block"); 144 markInvalid("Instruction in wrong block");
145 } 145 }
146 if (!hasCorrectInputs(instruction)) { 146 if (!hasCorrectInputs()) {
147 markInvalid("Incorrect inputs"); 147 markInvalid("Incorrect inputs");
148 } 148 }
149 if (!hasCorrectUses(instruction)) { 149 if (!hasCorrectUses()) {
150 markInvalid("Incorrect uses"); 150 markInvalid("Incorrect uses");
151 } 151 }
152 } 152 }
153 } 153 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/optimize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698