[turbofan] Verify uses of Deoptimize and Return in graph.
authormstarzinger <mstarzinger@chromium.org>
Tue, 26 May 2015 11:52:44 +0000 (04:52 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 26 May 2015 11:52:56 +0000 (11:52 +0000)
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/1153963006

Cr-Commit-Position: refs/heads/master@{#28624}

src/compiler/verifier.cc

index 9ddb604..da94390 100644 (file)
@@ -270,11 +270,17 @@ void Verifier::Visitor::Check(Node* node) {
       CheckNotTyped(node);
       break;
     case IrOpcode::kDeoptimize:
-      // TODO(rossberg): check successor is End
+      // Deoptimize uses are End.
+      for (auto use : node->uses()) {
+        CHECK_EQ(IrOpcode::kEnd, use->opcode());
+      }
       // Type is empty.
       CheckNotTyped(node);
     case IrOpcode::kReturn:
-      // TODO(rossberg): check successor is End
+      // Return uses are End.
+      for (auto use : node->uses()) {
+        CHECK_EQ(IrOpcode::kEnd, use->opcode());
+      }
       // Type is empty.
       CheckNotTyped(node);
       break;
@@ -284,19 +290,25 @@ void Verifier::Visitor::Check(Node* node) {
       CheckNotTyped(node);
       break;
     case IrOpcode::kTerminate:
+      // Terminates take one loop and effect.
+      CHECK_EQ(1, control_count);
+      CHECK_EQ(1, effect_count);
+      CHECK_EQ(2, input_count);
       CHECK_EQ(IrOpcode::kLoop,
                NodeProperties::GetControlInput(node)->opcode());
+      // Terminate uses are End.
+      for (auto use : node->uses()) {
+        CHECK_EQ(IrOpcode::kEnd, use->opcode());
+      }
       // Type is empty.
       CheckNotTyped(node);
-      CHECK_EQ(1, control_count);
-      CHECK_EQ(1, effect_count);
-      CHECK_EQ(2, input_count);
       break;
     case IrOpcode::kOsrNormalEntry:
     case IrOpcode::kOsrLoopEntry:
-      // Osr entries have
-      CHECK_EQ(1, effect_count);
+      // Osr entries take one control and effect.
       CHECK_EQ(1, control_count);
+      CHECK_EQ(1, effect_count);
+      CHECK_EQ(2, input_count);
       // Type is empty.
       CheckNotTyped(node);
       break;