Commit fc23b494 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: Partial revert of rest parameter desugaring.

Port d3f074b2

Original commit message:
    We'll be able to optimize rest parameters in TurboFan similarly to
    the arguments array. This CL restores the previous behavior, and a
    follow-on will enable TurboFan optimization.

R=mvstanton@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#33028}
parent 953c35f6
......@@ -264,6 +264,28 @@ void FullCodeGenerator::Generate() {
SetVar(new_target_var, r6, r3, r5);
}
// Possibly allocate RestParameters
int rest_index;
Variable* rest_param = scope()->rest_parameter(&rest_index);
if (rest_param) {
Comment cmnt(masm_, "[ Allocate rest parameter array");
int num_parameters = info->scope()->num_parameters();
int offset = num_parameters * kPointerSize;
__ addi(r6, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset));
__ LoadSmiLiteral(r5, Smi::FromInt(num_parameters));
__ LoadSmiLiteral(r4, Smi::FromInt(rest_index));
__ LoadSmiLiteral(r3, Smi::FromInt(language_mode()));
__ Push(r6, r5, r4, r3);
function_in_register_r4 = false;
RestParamAccessStub stub(isolate());
__ CallStub(&stub);
SetVar(rest_param, r3, r4, r5);
}
Variable* arguments = scope()->arguments();
if (arguments != NULL) {
// Function uses arguments object.
......
......@@ -1987,6 +1987,32 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
}
void RestParamAccessStub::GenerateNew(MacroAssembler* masm) {
// Stack layout on entry.
// sp[0] : language mode
// sp[4] : index of rest parameter
// sp[8] : number of parameters
// sp[12] : receiver displacement
Label runtime;
__ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset));
__ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
__ bne(&runtime);
// Patch the arguments.length and the parameters pointer.
__ LoadP(r4, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset));
__ StoreP(r4, MemOperand(sp, 2 * kPointerSize));
__ SmiToPtrArrayOffset(r0, r4);
__ add(r6, r5, r0);
__ addi(r6, r6, Operand(StandardFrameConstants::kCallerSPOffset));
__ StoreP(r6, MemOperand(sp, 3 * kPointerSize));
__ bind(&runtime);
__ TailCallRuntime(Runtime::kNewRestParam, 4, 1);
}
void RegExpExecStub::Generate(MacroAssembler* masm) {
// Just jump directly to runtime if native RegExp is not selected at compile
// time or if regexp entry in generated code is turned off runtime switch or
......
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