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

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

Issue 16004005: Fix generation of a bailout method when a BailoutTarget was in the middle of a loop/labeled block. … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
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 part of ssa; 5 part of ssa;
6 6
7 class HValidator extends HInstructionVisitor { 7 class HValidator extends HInstructionVisitor {
8 bool isValid = true; 8 bool isValid = true;
9 HGraph graph; 9 HGraph graph;
10 10
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 143 }
144 return true; 144 return true;
145 } 145 }
146 146
147 void visitInstruction(HInstruction instruction) { 147 void visitInstruction(HInstruction instruction) {
148 // Verifies that we are in the use list of our inputs. 148 // Verifies that we are in the use list of our inputs.
149 bool hasCorrectInputs() { 149 bool hasCorrectInputs() {
150 bool inBasicBlock = instruction.isInBasicBlock(); 150 bool inBasicBlock = instruction.isInBasicBlock();
151 return everyInstruction(instruction.inputs, (input, count) { 151 return everyInstruction(instruction.inputs, (input, count) {
152 if (inBasicBlock) { 152 if (inBasicBlock) {
153 return countInstruction(input.usedBy, instruction) == count; 153 return input.isInBasicBlock()
154 && countInstruction(input.usedBy, instruction) == count;
154 } else { 155 } else {
155 return countInstruction(input.usedBy, instruction) == 0; 156 return countInstruction(input.usedBy, instruction) == 0;
156 } 157 }
157 }); 158 });
158 } 159 }
159 160
160 // Verifies that all our uses have us in their inputs. 161 // Verifies that all our uses have us in their inputs.
161 bool hasCorrectUses() { 162 bool hasCorrectUses() {
162 if (!instruction.isInBasicBlock()) return true; 163 if (!instruction.isInBasicBlock()) return true;
163 return everyInstruction(instruction.usedBy, (use, count) { 164 return everyInstruction(instruction.usedBy, (use, count) {
164 return countInstruction(use.inputs, instruction) == count; 165 return use.isInBasicBlock()
166 && countInstruction(use.inputs, instruction) == count;
165 }); 167 });
166 } 168 }
167 169
168 if (!identical(instruction.block, currentBlock)) { 170 if (!identical(instruction.block, currentBlock)) {
169 markInvalid("Instruction in wrong block"); 171 markInvalid("Instruction in wrong block");
170 } 172 }
171 if (!hasCorrectInputs()) { 173 if (!hasCorrectInputs()) {
172 markInvalid("Incorrect inputs"); 174 markInvalid("Incorrect inputs");
173 } 175 }
174 if (!hasCorrectUses()) { 176 if (!hasCorrectUses()) {
175 markInvalid("Incorrect uses"); 177 markInvalid("Incorrect uses");
176 } 178 }
177 } 179 }
178 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698