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

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

Issue 11497009: Revive throw as an expression but not for rethrow. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 if (block.last is HJump && block.successors.length != 1) { 44 if (block.last is HJump && block.successors.length != 1) {
45 markInvalid("Break or continue node without one successor"); 45 markInvalid("Break or continue node without one successor");
46 } 46 }
47 if (block.last is HReturn && 47 if (block.last is HReturn &&
48 (block.successors.length != 1 || !block.successors[0].isExitBlock())) { 48 (block.successors.length != 1 || !block.successors[0].isExitBlock())) {
49 markInvalid("Return node with > 1 succesor or not going to exit-block"); 49 markInvalid("Return node with > 1 succesor or not going to exit-block");
50 } 50 }
51 if (block.last is HExit && !block.successors.isEmpty) { 51 if (block.last is HExit && !block.successors.isEmpty) {
52 markInvalid("Exit block with successor"); 52 markInvalid("Exit block with successor");
53 } 53 }
54 if (block.last is HThrow && !block.successors.isEmpty) { 54 if (block.last is HThrow && block.successors.length > 1) {
55 markInvalid("Throw block with successor"); 55 markInvalid("Throw block with more than one successor");
56 } 56 }
57 57
58 if (block.successors.isEmpty && 58 if (block.successors.isEmpty &&
59 block.last is !HThrow && 59 block.last is !HThrow &&
60 !block.isExitBlock()) { 60 !block.isExitBlock()) {
61 markInvalid("Non-exit or throw block without successor"); 61 markInvalid("Non-exit or throw block without successor");
62 } 62 }
63 63
64 // Check that successors ids are always higher than the current one. 64 // Check that successors ids are always higher than the current one.
65 // TODO(floitsch): this is, of course, not true for back-branches. 65 // TODO(floitsch): this is, of course, not true for back-branches.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 markInvalid("Instruction in wrong block"); 172 markInvalid("Instruction in wrong block");
173 } 173 }
174 if (!hasCorrectInputs()) { 174 if (!hasCorrectInputs()) {
175 markInvalid("Incorrect inputs"); 175 markInvalid("Incorrect inputs");
176 } 176 }
177 if (!hasCorrectUses()) { 177 if (!hasCorrectUses()) {
178 markInvalid("Incorrect uses"); 178 markInvalid("Incorrect uses");
179 } 179 }
180 } 180 }
181 } 181 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698