Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index ff42e9e04833e16d8a917b1178a63fa2ef394f3f..64717b979db00d8884583ba4d74060bf1906c5c7 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -232,6 +232,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); |
@@ -240,6 +245,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; |
+ } |
+ |
__ leap(rdx, |
Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); |
__ Push(rdx); |
@@ -275,10 +285,6 @@ void FullCodeGenerator::Generate() { |
// 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; |