Index: src/compiler/node-properties.cc |
diff --git a/src/compiler/node-properties.cc b/src/compiler/node-properties.cc |
index 76ac16283c2f113088e003b9d357b27af9a34103..8956915a2c5fd8085937d2f8b6e8914f05ed8844 100644 |
--- a/src/compiler/node-properties.cc |
+++ b/src/compiler/node-properties.cc |
@@ -2,9 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "src/compiler/node-properties.h" |
- |
#include "src/compiler/common-operator.h" |
+#include "src/compiler/graph.h" |
+#include "src/compiler/node-properties.h" |
#include "src/compiler/operator-properties.h" |
namespace v8 { |
@@ -151,6 +151,22 @@ void NodeProperties::RemoveNonValueInputs(Node* node) { |
} |
+void NodeProperties::MergeControlToEnd(Graph* graph, |
+ CommonOperatorBuilder* common, |
+ Node* node) { |
+ // Connect the node to the merge exiting the graph. |
+ Node* end_pred = NodeProperties::GetControlInput(graph->end()); |
+ if (end_pred->opcode() == IrOpcode::kMerge) { |
+ int inputs = end_pred->op()->ControlInputCount() + 1; |
+ end_pred->AppendInput(graph->zone(), node); |
+ end_pred->set_op(common->Merge(inputs)); |
+ } else { |
+ Node* merge = graph->NewNode(common->Merge(2), end_pred, node); |
+ NodeProperties::ReplaceControlInput(graph->end(), merge); |
+ } |
+} |
+ |
+ |
// static |
void NodeProperties::ReplaceWithValue(Node* node, Node* value, Node* effect, |
Node* control) { |