Index: src/compiler/tail-call-optimization.cc |
diff --git a/src/compiler/tail-call-optimization.cc b/src/compiler/tail-call-optimization.cc |
index 605b0e7282e3aac45c4b7bb11fa4d7d4817055de..7e1623aeca6147dda804b1375711aad7f55f67b4 100644 |
--- a/src/compiler/tail-call-optimization.cc |
+++ b/src/compiler/tail-call-optimization.cc |
@@ -7,7 +7,6 @@ |
#include "src/compiler/common-operator.h" |
#include "src/compiler/graph.h" |
#include "src/compiler/linkage.h" |
-#include "src/compiler/node-matchers.h" |
#include "src/compiler/node-properties.h" |
namespace v8 { |
@@ -19,15 +18,12 @@ |
// The value which is returned must be the result of a potential tail call, |
// there must be no try/catch/finally around the Call, and there must be no |
// other effect between the Call and the Return nodes. |
- Node* const call = NodeProperties::GetValueInput(node, 1); |
+ Node* const call = NodeProperties::GetValueInput(node, 0); |
if (call->opcode() == IrOpcode::kCall && |
CallDescriptorOf(call->op())->SupportsTailCalls() && |
NodeProperties::GetEffectInput(node) == call && |
!NodeProperties::IsExceptionalCall(call)) { |
Node* const control = NodeProperties::GetControlInput(node); |
- // Ensure that no additional arguments are being popped other than those in |
- // the CallDescriptor, otherwise the tail call transformation is invalid. |
- DCHECK_EQ(0, Int32Matcher(NodeProperties::GetValueInput(node, 0)).Value()); |
if (control->opcode() == IrOpcode::kIfSuccess && |
call->OwnedBy(node, control) && control->OwnedBy(node)) { |
// Furthermore, control has to flow via an IfSuccess from the Call, so |
@@ -66,10 +62,9 @@ |
// | |
DCHECK_EQ(call, NodeProperties::GetControlInput(control, 0)); |
- DCHECK_EQ(4, node->InputCount()); |
+ DCHECK_EQ(3, node->InputCount()); |
node->ReplaceInput(0, NodeProperties::GetEffectInput(call)); |
node->ReplaceInput(1, NodeProperties::GetControlInput(call)); |
- node->RemoveInput(3); |
node->RemoveInput(2); |
for (int index = 0; index < call->op()->ValueInputCount(); ++index) { |
node->InsertInput(graph()->zone(), index, |