Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index fe7cee5b4601c265b2154be86ba41beeb40458aa..3f26b3fe4d80dad362a614df1cddd7f48a43f9c7 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -240,6 +240,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); |
@@ -248,6 +253,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(r3, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); |
__ mov(r2, Operand(Smi::FromInt(num_parameters))); |
__ mov(r1, Operand(Smi::FromInt(rest_index))); |
@@ -281,10 +291,6 @@ void FullCodeGenerator::Generate() { |
// function, receiver address, parameter count. |
// The stub will rewrite receiever 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; |