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

PPC: Use register arguments for RestParamAccessStub

Port 82ca2a41

Original commit message:
    This is preferable because in TurboFan we need to call it, and can't pass
    untagged external pointers on the stack.

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

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

Cr-Commit-Position: refs/heads/master@{#33092}
parent c958c98c
......@@ -273,11 +273,15 @@ void FullCodeGenerator::Generate() {
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);
__ LoadSmiLiteral(RestParamAccessDescriptor::parameter_count(),
Operand(Smi::FromInt(num_parameters)));
__ addi(RestParamAccessDescriptor::parameter_pointer(), fp,
Operand(StandardFrameConstants::kCallerSPOffset + offset));
__ LoadSmiLiteral(RestParamAccessDescriptor::rest_parameter_index(),
Operand(Smi::FromInt(rest_index)));
__ LoadSmiLiteral(RestParamAccessDescriptor::language_mode(),
Operand(Smi::FromInt(language_mode())));
DCHECK(r4.is(RestParamAccessDescriptor::language_mode()));
function_in_register_r4 = false;
RestParamAccessStub stub(isolate());
......
......@@ -1977,27 +1977,25 @@ 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
// r5 : number of parameters (tagged)
// r6 : parameters pointer
// r7 : rest parameter index (tagged)
// r4 : language mode (tagged)
Label runtime;
__ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset));
__ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
__ LoadP(r8, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
__ LoadP(r3, MemOperand(r8, StandardFrameConstants::kContextOffset));
__ CmpSmiLiteral(r3, 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);
__ LoadP(r5, MemOperand(r8, ArgumentsAdaptorFrameConstants::kLengthOffset));
__ SmiToPtrArrayOffset(r0, r5);
__ add(r6, r8, r0);
__ addi(r6, r6, Operand(StandardFrameConstants::kCallerSPOffset));
__ StoreP(r6, MemOperand(sp, 3 * kPointerSize));
__ bind(&runtime);
__ Push(r5, r6, r7, r4);
__ TailCallRuntime(Runtime::kNewRestParam);
}
......
......@@ -63,6 +63,12 @@ const Register ArgumentsAccessNewDescriptor::parameter_count() { return r5; }
const Register ArgumentsAccessNewDescriptor::parameter_pointer() { return r6; }
const Register RestParamAccessDescriptor::parameter_count() { return r5; }
const Register RestParamAccessDescriptor::parameter_pointer() { return r6; }
const Register RestParamAccessDescriptor::rest_parameter_index() { return r7; }
const Register RestParamAccessDescriptor::language_mode() { return r4; }
const Register ApiGetterDescriptor::function_address() { return r5; }
......
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