Commit a5750db6 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS: [es6] generate rest parameters correctly for subclass constructors

Port bef80fcf

BUG=v8:3977
LOG=N

Review URL: https://codereview.chromium.org/1028703002

Cr-Commit-Position: refs/heads/master@{#27349}
parent a87e1dc3
......@@ -249,6 +249,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);
......@@ -257,6 +262,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;
}
__ Addu(a3, fp,
Operand(StandardFrameConstants::kCallerSPOffset + offset));
__ li(a2, Operand(Smi::FromInt(num_parameters)));
......@@ -291,10 +301,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;
......
......@@ -246,6 +246,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);
......@@ -254,6 +259,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;
}
__ Daddu(a3, fp,
Operand(StandardFrameConstants::kCallerSPOffset + offset));
__ li(a2, Operand(Smi::FromInt(num_parameters)));
......@@ -288,10 +298,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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment