Index: src/compiler/js-generic-lowering.cc |
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc |
index 731a45ed7c961d734b22294723bf0a8210464110..19d8ef16a5de04673bc58e411f7759ba5c745c70 100644 |
--- a/src/compiler/js-generic-lowering.cc |
+++ b/src/compiler/js-generic-lowering.cc |
@@ -632,6 +632,24 @@ void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { |
NodeProperties::ChangeOp(node, common()->Call(desc)); |
} |
+void JSGenericLowering::LowerJSCall(Node* node) { |
+ CallParameters const& p = CallParametersOf(node->op()); |
+ int const arg_count = static_cast<int>(p.arity() - 2); |
+ ConvertReceiverMode const mode = p.convert_mode(); |
+ Callable callable = CodeFactory::Call(isolate(), mode); |
+ CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
+ if (p.tail_call_mode() == TailCallMode::kAllow) { |
+ flags |= CallDescriptor::kSupportsTailCalls; |
+ } |
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
+ isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
+ Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
+ Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
+ node->InsertInput(zone(), 0, stub_code); |
+ node->InsertInput(zone(), 2, stub_arity); |
+ NodeProperties::ChangeOp(node, common()->Call(desc)); |
+} |
+ |
void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { |
CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op()); |
int const arg_count = static_cast<int>(p.arity() - 2); |
@@ -651,21 +669,23 @@ void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { |
NodeProperties::ChangeOp(node, common()->Call(desc)); |
} |
-void JSGenericLowering::LowerJSCall(Node* node) { |
- CallParameters const& p = CallParametersOf(node->op()); |
+void JSGenericLowering::LowerJSCallVarargs(Node* node) { |
+ CallVarargsParameters p = CallVarargsParametersOf(node->op()); |
int const arg_count = static_cast<int>(p.arity() - 2); |
- ConvertReceiverMode const mode = p.convert_mode(); |
- Callable callable = CodeFactory::Call(isolate(), mode); |
CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
- if (p.tail_call_mode() == TailCallMode::kAllow) { |
- flags |= CallDescriptor::kSupportsTailCalls; |
- } |
+ Callable callable = CodeFactory::CallVarargs(isolate()); |
CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
+ Node* arguments_list = node->InputAt(arg_count + 2); |
+ Node* arguments_length = node->InputAt(arg_count + 3); |
+ node->RemoveInput(arg_count + 3); |
+ node->RemoveInput(arg_count + 2); |
node->InsertInput(zone(), 0, stub_code); |
node->InsertInput(zone(), 2, stub_arity); |
+ node->InsertInput(zone(), 3, arguments_list); |
+ node->InsertInput(zone(), 4, arguments_length); |
NodeProperties::ChangeOp(node, common()->Call(desc)); |
} |