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

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

Issue 350903002: Move validation to validate.dart and add comments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Upload Created 6 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 18 matching lines...) Expand all
29 if (block.first == null || block.last == null) { 29 if (block.first == null || block.last == null) {
30 markInvalid("empty block"); 30 markInvalid("empty block");
31 } 31 }
32 if (block.last is !HControlFlow) { 32 if (block.last is !HControlFlow) {
33 markInvalid("block ends with non-tail node."); 33 markInvalid("block ends with non-tail node.");
34 } 34 }
35 if (block.last is HIf && block.successors.length != 2) { 35 if (block.last is HIf && block.successors.length != 2) {
36 markInvalid("If node without two successors"); 36 markInvalid("If node without two successors");
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 }
41 if (block.last is HLoopBranch) {
ngeoffray 2014/06/24 15:45:00 Why just limiting to HLoopBranch? A generic critic
floitsch 2014/06/24 18:29:43 Done.
42 // Assert that the block we inserted to avoid critical edges satisfies
43 // our assumptions. That is, it must not contain any instructions
44 // (although it may contain phy-updates).
ngeoffray 2014/06/24 15:45:01 phy -> phi
floitsch 2014/06/24 18:29:43 Done.
45 HBasicBlock avoidCriticalEdgeBlock = block.successors.last;
46 if (avoidCriticalEdgeBlock.first is! HGoto) {
47 markInvalid("Critical edge block contains instructions");
48 }
40 } 49 }
41 if (block.last is HGoto && block.successors.length != 1) { 50 if (block.last is HGoto && block.successors.length != 1) {
42 markInvalid("Goto node with not exactly one successor"); 51 markInvalid("Goto node with not exactly one successor");
43 } 52 }
44 if (block.last is HJump && block.successors.length != 1) { 53 if (block.last is HJump && block.successors.length != 1) {
45 markInvalid("Break or continue node without one successor"); 54 markInvalid("Break or continue node without one successor");
46 } 55 }
47 if ((block.last is HReturn || block.last is HThrow) && 56 if ((block.last is HReturn || block.last is HThrow) &&
48 (block.successors.length != 1 || !block.successors[0].isExitBlock())) { 57 (block.successors.length != 1 || !block.successors[0].isExitBlock())) {
49 markInvalid("Return or throw node with > 1 successor " 58 markInvalid("Return or throw node with > 1 successor "
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 markInvalid("Instruction in wrong block"); 180 markInvalid("Instruction in wrong block");
172 } 181 }
173 if (!hasCorrectInputs()) { 182 if (!hasCorrectInputs()) {
174 markInvalid("Incorrect inputs"); 183 markInvalid("Incorrect inputs");
175 } 184 }
176 if (!hasCorrectUses()) { 185 if (!hasCorrectUses()) {
177 markInvalid("Incorrect uses"); 186 markInvalid("Incorrect uses");
178 } 187 }
179 } 188 }
180 } 189 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/codegen.dart ('k') | tests/language/critical_edge2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698