Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index 9a26c3d60b720c733870031ee79f9fc1f868d1ff..28cbf7cde647fcc1afb7737d6fdd92ddd4b815a8 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -1643,6 +1643,7 @@ void InstanceofStub::Generate(MacroAssembler* masm) { |
void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
+ CHECK(!has_new_target()); |
Register arg_count = ArgumentsAccessReadDescriptor::parameter_count(); |
Register key = ArgumentsAccessReadDescriptor::index(); |
DCHECK(arg_count.is(x0)); |
@@ -1699,6 +1700,8 @@ void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { |
// jssp[8]: address of receiver argument |
// jssp[16]: function |
+ CHECK(!has_new_target()); |
+ |
// Check if the calling frame is an arguments adaptor frame. |
Label runtime; |
Register caller_fp = x10; |
@@ -1730,6 +1733,8 @@ void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { |
// |
// Returns pointer to result object in x0. |
+ CHECK(!has_new_target()); |
+ |
// Note: arg_count_smi is an alias of param_count_smi. |
Register arg_count_smi = x3; |
Register param_count_smi = x3; |
@@ -2056,6 +2061,11 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { |
MemOperand(caller_fp, |
ArgumentsAdaptorFrameConstants::kLengthOffset)); |
__ SmiUntag(param_count, param_count_smi); |
+ if (has_new_target()) { |
+ // Skip new.target: it is not a part of arguments. |
+ __ Sub(param_count, param_count, Operand(1)); |
+ __ SmiTag(param_count_smi, param_count); |
+ } |
__ Add(x10, caller_fp, Operand(param_count, LSL, kPointerSizeLog2)); |
__ Add(params, x10, StandardFrameConstants::kCallerSPOffset); |
@@ -2939,7 +2949,13 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ AssertUndefinedOrAllocationSite(x2, x5); |
} |
- __ Mov(x3, function); |
+ if (IsSuperConstructorCall()) { |
+ __ Mov(x4, Operand(1 * kPointerSize)); |
+ __ Add(x4, x4, Operand(x0, LSL, kPointerSizeLog2)); |
+ __ Peek(x3, x4); |
+ } else { |
+ __ Mov(x3, function); |
+ } |
// Jump to the function-specific construct stub. |
Register jump_reg = x4; |