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

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

Issue 14071003: Fix first part on liveness analysis of bug https://code.google.com/p/dart/issues/detail?id=9687: a … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
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 26 matching lines...) Expand all
37 } 37 }
38 if (block.last is HConditionalBranch && block.successors.length != 2) { 38 if (block.last is HConditionalBranch && block.successors.length != 2) {
39 markInvalid("Conditional node without two successors"); 39 markInvalid("Conditional node without two successors");
40 } 40 }
41 if (block.last is HGoto && block.successors.length != 1) { 41 if (block.last is HGoto && block.successors.length != 1) {
42 markInvalid("Goto node with not exactly one successor"); 42 markInvalid("Goto node with not exactly one successor");
43 } 43 }
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 || block.last is HThrow) &&
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 or throw node with > 1 successor "
50 "or not going to exit-block");
50 } 51 }
51 if (block.last is HExit && !block.successors.isEmpty) { 52 if (block.last is HExit && !block.successors.isEmpty) {
52 markInvalid("Exit block with successor"); 53 markInvalid("Exit block with successor");
53 } 54 }
54 if (block.last is HThrow && !block.successors.isEmpty) {
55 markInvalid("Throw block with successor");
56 }
57 55
58 if (block.successors.isEmpty && 56 if (block.successors.isEmpty && !block.isExitBlock()) {
59 block.last is !HThrow && 57 markInvalid("Non-exit block without successor");
60 !block.isExitBlock()) {
61 markInvalid("Non-exit or throw block without successor");
62 } 58 }
63 59
64 // Check that successors ids are always higher than the current one. 60 // Check that successors ids are always higher than the current one.
65 // TODO(floitsch): this is, of course, not true for back-branches. 61 // TODO(floitsch): this is, of course, not true for back-branches.
66 if (block.id == null) markInvalid("block without id"); 62 if (block.id == null) markInvalid("block without id");
67 for (HBasicBlock successor in block.successors) { 63 for (HBasicBlock successor in block.successors) {
68 if (!isValid) break; 64 if (!isValid) break;
69 if (successor.id == null) markInvalid("successor without id"); 65 if (successor.id == null) markInvalid("successor without id");
70 if (successor.id <= block.id && !successor.isLoopHeader()) { 66 if (successor.id <= block.id && !successor.isLoopHeader()) {
71 markInvalid("successor with lower id, but not a loop-header"); 67 markInvalid("successor with lower id, but not a loop-header");
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 markInvalid("Instruction in wrong block"); 169 markInvalid("Instruction in wrong block");
174 } 170 }
175 if (!hasCorrectInputs()) { 171 if (!hasCorrectInputs()) {
176 markInvalid("Incorrect inputs"); 172 markInvalid("Incorrect inputs");
177 } 173 }
178 if (!hasCorrectUses()) { 174 if (!hasCorrectUses()) {
179 markInvalid("Incorrect uses"); 175 markInvalid("Incorrect uses");
180 } 176 }
181 } 177 }
182 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698