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

Unified Diff: frog/leg/ssa/validate.dart

Issue 8513004: Throw and a small fix to If. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/ssa/tracer.dart ('k') | frog/tests/leg_only/src/Throw1Test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/validate.dart
diff --git a/frog/leg/ssa/validate.dart b/frog/leg/ssa/validate.dart
index 1f86e4670e7ce9cdabac2877dcaef1f26047f019..da9de34db3461452b6cb1e384a3e89d3c03090dc 100644
--- a/frog/leg/ssa/validate.dart
+++ b/frog/leg/ssa/validate.dart
@@ -26,10 +26,7 @@ class HValidator extends HInstructionVisitor {
if (block.first === null || block.last === null) {
markInvalid("empty block");
}
- if (block.last is !HIf &&
- block.last is !HGoto &&
- block.last is !HReturn &&
- block.last is !HExit) {
+ if (block.last is !HControlFlow) {
markInvalid("block ends with non-tail node.");
}
if (block.last is HIf && block.successors.length != 2) {
@@ -45,9 +42,14 @@ class HValidator extends HInstructionVisitor {
if (block.last is HExit && !block.successors.isEmpty()) {
markInvalid("Exit block with successor");
}
+ if (block.last is HThrow && !block.successors.isEmpty()) {
+ markInvalid("Throw block with successor");
+ }
- if (block.successors.isEmpty() && !block.isExitBlock()) {
- markInvalid("Non-exit block without successor");
+ if (block.successors.isEmpty() &&
+ block.last is !HThrow &&
+ !block.isExitBlock()) {
+ markInvalid("Non-exit or throw block without successor");
}
// Make sure that successors ids are always higher than the current one.
« no previous file with comments | « frog/leg/ssa/tracer.dart ('k') | frog/tests/leg_only/src/Throw1Test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698