Index: src/compiler/js-generic-lowering.cc |
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc |
index 9f240c5a9b66f6d4a79e7c3da80ccf1cd2a36898..4cd53210d0150c44c677da04e2e89bc442b70f24 100644 |
--- a/src/compiler/js-generic-lowering.cc |
+++ b/src/compiler/js-generic-lowering.cc |
@@ -523,6 +523,28 @@ void JSGenericLowering::LowerJSCreateScriptContext(Node* node) { |
ReplaceWithRuntimeCall(node, Runtime::kNewScriptContext); |
} |
+void JSGenericLowering::LowerJSConstructForwardVarargs(Node* node) { |
+ ConstructForwardVarargsParameters p = |
+ ConstructForwardVarargsParametersOf(node->op()); |
+ int const arg_count = static_cast<int>(p.arity() - 2); |
+ CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
+ Callable callable = CodeFactory::ConstructForwardVarargs(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* start_index = jsgraph()->Uint32Constant(p.start_index()); |
+ Node* new_target = node->InputAt(arg_count + 1); |
+ Node* receiver = jsgraph()->UndefinedConstant(); |
+ node->RemoveInput(arg_count + 1); // Drop new target. |
+ node->InsertInput(zone(), 0, stub_code); |
+ node->InsertInput(zone(), 2, new_target); |
+ node->InsertInput(zone(), 3, stub_arity); |
+ node->InsertInput(zone(), 4, start_index); |
+ node->InsertInput(zone(), 5, receiver); |
+ NodeProperties::ChangeOp(node, common()->Call(desc)); |
+} |
+ |
void JSGenericLowering::LowerJSConstruct(Node* node) { |
ConstructParameters const& p = ConstructParametersOf(node->op()); |
int const arg_count = static_cast<int>(p.arity() - 2); |
@@ -563,17 +585,20 @@ void JSGenericLowering::LowerJSConstructWithSpread(Node* node) { |
void JSGenericLowering::LowerJSCallForwardVarargs(Node* node) { |
CallForwardVarargsParameters p = CallForwardVarargsParametersOf(node->op()); |
- Callable callable = CodeFactory::CallForwardVarargs(isolate()); |
+ int const arg_count = static_cast<int>(p.arity() - 2); |
CallDescriptor::Flags flags = FrameStateFlagForCall(node); |
+ Callable callable = CodeFactory::CallForwardVarargs(isolate()); |
if (p.tail_call_mode() == TailCallMode::kAllow) { |
flags |= CallDescriptor::kSupportsTailCalls; |
} |
CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
- isolate(), zone(), callable.descriptor(), 1, flags); |
+ isolate(), zone(), callable.descriptor(), arg_count + 1, flags); |
Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
+ Node* stub_arity = jsgraph()->Int32Constant(arg_count); |
Node* start_index = jsgraph()->Uint32Constant(p.start_index()); |
node->InsertInput(zone(), 0, stub_code); |
- node->InsertInput(zone(), 2, start_index); |
+ node->InsertInput(zone(), 2, stub_arity); |
+ node->InsertInput(zone(), 3, start_index); |
NodeProperties::ChangeOp(node, common()->Call(desc)); |
} |