Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index abb3d4a988e58c1cb7ab7e6b16deaaa4892b8007..e56fc4a5702f3662125b6b911d8bd61d88418c0c 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -539,6 +539,7 @@ void FunctionPrototypeStub::Generate(MacroAssembler* masm) { |
void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
+ CHECK(!has_new_target()); |
// The key is in rdx and the parameter count is in rax. |
DCHECK(rdx.is(ArgumentsAccessReadDescriptor::index())); |
DCHECK(rax.is(ArgumentsAccessReadDescriptor::parameter_count())); |
@@ -606,6 +607,8 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
// rbx: the mapped parameter count (untagged) |
// rax: the allocated object (tagged). |
+ CHECK(!has_new_target()); |
+ |
Factory* factory = isolate()->factory(); |
StackArgumentsAccessor args(rsp, 3, ARGUMENTS_DONT_CONTAIN_RECEIVER); |
@@ -819,6 +822,7 @@ void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
// rsp[8] : number of parameters |
// rsp[16] : receiver displacement |
// rsp[24] : function |
+ CHECK(!has_new_target()); |
// Check if the calling frame is an arguments adaptor frame. |
Label runtime; |
@@ -928,6 +932,13 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
// Patch the arguments.length and the parameters pointer. |
__ bind(&adaptor_frame); |
__ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
+ |
+ if (has_new_target()) { |
+ // Subtract 1 from smi-tagged arguments count. |
+ __ SmiToInteger32(rcx, rcx); |
+ __ decp(rcx); |
+ __ Integer32ToSmi(rcx, rcx); |
+ } |
__ movp(args.GetArgumentOperand(2), rcx); |
__ SmiToInteger64(rcx, rcx); |
__ leap(rdx, Operand(rdx, rcx, times_pointer_size, |
@@ -2018,7 +2029,11 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
} |
// Pass original constructor to construct stub. |
- __ movp(rdx, rdi); |
+ if (IsSuperConstructorCall()) { |
+ __ movp(rdx, Operand(rsp, rax, times_pointer_size, 2 * kPointerSize)); |
+ } else { |
+ __ movp(rdx, rdi); |
+ } |
// Jump to the function-specific construct stub. |
Register jmp_reg = rcx; |