Commit ebae8c14 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

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

port bef80fcf (r27344)

  original commit message:

     [es6] generate rest parameters correctly for subclass constructors

BUG=

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

Cr-Commit-Position: refs/heads/master@{#27459}
parent aca928b7
......@@ -233,6 +233,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);
......@@ -241,6 +246,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;
}
__ lea(edx,
Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
__ push(edx);
......@@ -281,10 +291,7 @@ void FullCodeGenerator::Generate() {
} else {
type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
}
ArgumentsAccessStub::HasNewTarget has_new_target =
IsSubclassConstructor(info->function()->kind())
? ArgumentsAccessStub::HAS_NEW_TARGET
: ArgumentsAccessStub::NO_NEW_TARGET;
ArgumentsAccessStub stub(isolate(), type, has_new_target);
__ CallStub(&stub);
......
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