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

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

Issue 10446080: Address review comments from https://chromiumcodereview.appspot.com/10454049/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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/tracer.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 visitee) { 9 void visitGraph(HGraph visitee) {
10 graph = visitee; 10 graph = visitee;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 if (dominated.id === null || dominated.id <= lastId) { 77 if (dominated.id === null || dominated.id <= lastId) {
78 markInvalid("dominated.id === null or dominated has <= id"); 78 markInvalid("dominated.id === null or dominated has <= id");
79 } 79 }
80 lastId = dominated.id; 80 lastId = dominated.id;
81 } 81 }
82 82
83 if (!isValid) return; 83 if (!isValid) return;
84 block.forEachPhi(visitInstruction); 84 block.forEachPhi(visitInstruction);
85 85
86 // Make sure the parameters of a phi are dominating the 86 // Make sure the blocks of the parameters of a phi are dominating the
Lasse Reichstein Nielsen 2012/05/31 07:11:58 Pedantry: "Make sure" -> "Check that". If you "mak
ngeoffray 2012/05/31 08:16:16 Done.
87 // corresponding predecessor block. 87 // corresponding predecessor block. Note that block dominates
Lasse Reichstein Nielsen 2012/05/31 07:11:58 "block dominates" -> "blocks dominate" (or "a bloc
ngeoffray 2012/05/31 08:16:16 Done.
88 // themselves.
88 block.forEachPhi((HPhi phi) { 89 block.forEachPhi((HPhi phi) {
89 for (int i = 0; i < phi.inputs.length; i++) { 90 for (int i = 0; i < phi.inputs.length; i++) {
90 HInstruction input = phi.inputs[i]; 91 HInstruction input = phi.inputs[i];
91 if (!input.block.dominates(block.predecessors[i])) { 92 if (!input.block.dominates(block.predecessors[i])) {
92 markInvalid("Definition does not dominate use"); 93 markInvalid("Definition does not dominate use");
93 } 94 }
94 } 95 }
95 }); 96 });
96 97
97 // Make sure the inputs of an instruction dominate the 98 // Make sure the blocks of the inputs of an instruction dominate the
98 // instruction. 99 // instruction's block.
99 block.forEachInstruction((HInstruction instruction) { 100 block.forEachInstruction((HInstruction instruction) {
100 for (HInstruction input in instruction.inputs) { 101 for (HInstruction input in instruction.inputs) {
101 if (!input.block.dominates(block)) { 102 if (!input.block.dominates(block)) {
102 markInvalid("Definition does not dominate use"); 103 markInvalid("Definition does not dominate use");
103 } 104 }
104 } 105 }
105 }); 106 });
106 107
107 super.visitBasicBlock(block); 108 super.visitBasicBlock(block);
108 } 109 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 markInvalid("Instruction in wrong block"); 167 markInvalid("Instruction in wrong block");
167 } 168 }
168 if (!hasCorrectInputs()) { 169 if (!hasCorrectInputs()) {
169 markInvalid("Incorrect inputs"); 170 markInvalid("Incorrect inputs");
170 } 171 }
171 if (!hasCorrectUses()) { 172 if (!hasCorrectUses()) {
172 markInvalid("Incorrect uses"); 173 markInvalid("Incorrect uses");
173 } 174 }
174 } 175 }
175 } 176 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/tracer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698