Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index a219ac05af176b01247d56c5fae31ac8babb2618..786d5fee967af9e8f5fa48ed73967ff2cc7dce85 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -241,6 +241,11 @@ void FullCodeGenerator::Generate() { |
} |
} |
+ ArgumentsAccessStub::HasNewTarget has_new_target = |
+ IsSubclassConstructor(info->function()->kind()) |
+ ? ArgumentsAccessStub::HAS_NEW_TARGET |
+ : ArgumentsAccessStub::NO_NEW_TARGET; |
+ |
// Possibly allocate RestParameters |
int rest_index; |
Variable* rest_param = scope()->rest_parameter(&rest_index); |
@@ -249,6 +254,11 @@ void FullCodeGenerator::Generate() { |
int num_parameters = info->scope()->num_parameters(); |
int offset = num_parameters * kPointerSize; |
+ if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) { |
+ --num_parameters; |
+ ++rest_index; |
+ } |
+ |
__ Add(x3, fp, StandardFrameConstants::kCallerSPOffset + offset); |
__ Mov(x2, Smi::FromInt(num_parameters)); |
__ Mov(x1, Smi::FromInt(rest_index)); |
@@ -281,10 +291,6 @@ void FullCodeGenerator::Generate() { |
// function, receiver address, parameter count. |
// The stub will rewrite receiver and parameter count if the previous |
// stack frame was an arguments adapter frame. |
- ArgumentsAccessStub::HasNewTarget has_new_target = |
- IsSubclassConstructor(info->function()->kind()) |
- ? ArgumentsAccessStub::HAS_NEW_TARGET |
- : ArgumentsAccessStub::NO_NEW_TARGET; |
ArgumentsAccessStub::Type type; |
if (is_strict(language_mode()) || !is_simple_parameter_list()) { |
type = ArgumentsAccessStub::NEW_STRICT; |