| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index 5237e7c8cca01b2adfe4b82b15d79db199357d29..497af6ecacb5e83aa456ebc353bccea31f139925 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.cc
|
| @@ -3271,9 +3271,6 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
|
| expr->expression()->AsSuperCallReference();
|
| DCHECK_NOT_NULL(super_call_ref);
|
|
|
| - VariableProxy* new_target_proxy = super_call_ref->new_target_var();
|
| - VisitForStackValue(new_target_proxy);
|
| -
|
| EmitLoadSuperConstructor(super_call_ref);
|
| __ Push(result_register());
|
|
|
| @@ -3288,7 +3285,11 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
|
| // constructor invocation.
|
| SetConstructCallPosition(expr);
|
|
|
| - // Load function and argument count into edi and eax.
|
| + // Load original constructor into rcx.
|
| + VisitForAccumulatorValue(super_call_ref->new_target_var());
|
| + __ movp(rcx, result_register());
|
| +
|
| + // Load function and argument count into rdi and rax.
|
| __ Set(rax, arg_count);
|
| __ movp(rdi, Operand(rsp, arg_count * kPointerSize));
|
|
|
| @@ -3308,8 +3309,6 @@ void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
|
| CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
|
| __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
|
|
|
| - __ Drop(1);
|
| -
|
| RecordJSReturnSite(expr);
|
|
|
| EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
|
| @@ -4232,11 +4231,14 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
|
| __ CallRuntime(Runtime::kGetPrototype, 1);
|
| __ Push(result_register());
|
|
|
| + // Load original constructor into rcx.
|
| + __ movp(rcx, Operand(rsp, 1 * kPointerSize));
|
| +
|
| // Check if the calling frame is an arguments adaptor frame.
|
| Label adaptor_frame, args_set_up, runtime;
|
| __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
|
| - __ movp(rcx, Operand(rdx, StandardFrameConstants::kContextOffset));
|
| - __ Cmp(rcx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| + __ movp(rbx, Operand(rdx, StandardFrameConstants::kContextOffset));
|
| + __ Cmp(rbx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
|
| __ j(equal, &adaptor_frame);
|
| // default constructor has no arguments, so no adaptor frame means no args.
|
| __ movp(rax, Immediate(0));
|
| @@ -4245,17 +4247,17 @@ void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
|
| // Copy arguments from adaptor frame.
|
| {
|
| __ bind(&adaptor_frame);
|
| - __ movp(rcx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| - __ SmiToInteger64(rcx, rcx);
|
| + __ movp(rbx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| + __ SmiToInteger64(rbx, rbx);
|
|
|
| - __ movp(rax, rcx);
|
| - __ leap(rdx, Operand(rdx, rcx, times_pointer_size,
|
| + __ movp(rax, rbx);
|
| + __ leap(rdx, Operand(rdx, rbx, times_pointer_size,
|
| StandardFrameConstants::kCallerSPOffset));
|
| Label loop;
|
| __ bind(&loop);
|
| __ Push(Operand(rdx, -1 * kPointerSize));
|
| __ subp(rdx, Immediate(kPointerSize));
|
| - __ decp(rcx);
|
| + __ decp(rbx);
|
| __ j(not_zero, &loop);
|
| }
|
|
|
|
|