Commit f356efcf authored by jyan's avatar jyan Committed by Commit bot

S390: [Interpreter] Use FastNewSloppyArguments when possible.

Port c005029a

Original commit message:

    Use the FastNewSloppyArgumentsStub in the interpreter when function doesn't have
    duplicate parameters.

R=rmcilroy@chromium.org, joransiu@ca.ibm.com, bjaideep@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=v8:4280
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#35803}
parent 1decc266
...@@ -4731,13 +4731,13 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { ...@@ -4731,13 +4731,13 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
{ {
Label loop, loop_entry; Label loop, loop_entry;
__ LoadRR(r4, fp); __ LoadRR(r4, fp);
__ b(&loop_entry); __ b(&loop_entry, Label::kNear);
__ bind(&loop); __ bind(&loop);
__ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); __ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset));
__ bind(&loop_entry); __ bind(&loop_entry);
__ LoadP(ip, MemOperand(r4, StandardFrameConstants::kFunctionOffset)); __ LoadP(ip, MemOperand(r4, StandardFrameConstants::kFunctionOffset));
__ CmpP(ip, r3); __ CmpP(ip, r3);
__ bne(&loop); __ bne(&loop, Label::kNear);
} }
// Check if we have rest parameters (only possible if we have an // Check if we have rest parameters (only possible if we have an
...@@ -4871,6 +4871,22 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { ...@@ -4871,6 +4871,22 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
// ----------------------------------- // -----------------------------------
__ AssertFunction(r3); __ AssertFunction(r3);
// For Ignition we need to skip all possible handler/stub frames until
// we reach the JavaScript frame for the function (similar to what the
// runtime fallback implementation does). So make r9 point to that
// JavaScript frame.
{
Label loop, loop_entry;
__ LoadRR(r9, fp);
__ b(&loop_entry);
__ bind(&loop);
__ LoadP(r9, MemOperand(r9, StandardFrameConstants::kCallerFPOffset));
__ bind(&loop_entry);
__ LoadP(ip, MemOperand(r9, StandardFrameConstants::kFunctionOffset));
__ CmpP(ip, r3);
__ bne(&loop);
}
// TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub.
__ LoadP(r4, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); __ LoadP(r4, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
__ LoadW( __ LoadW(
...@@ -4879,19 +4895,20 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { ...@@ -4879,19 +4895,20 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
__ SmiTag(r4); __ SmiTag(r4);
#endif #endif
__ SmiToPtrArrayOffset(r5, r4); __ SmiToPtrArrayOffset(r5, r4);
__ AddP(r5, fp, r5); __ AddP(r5, r9, r5);
__ AddP(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset)); __ AddP(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset));
// r3 : function // r3 : function
// r4 : number of parameters (tagged) // r4 : number of parameters (tagged)
// r5 : parameters pointer // r5 : parameters pointer
// r9 : JavaScript frame pointer
// Registers used over whole function: // Registers used over whole function:
// r7 : arguments count (tagged) // r7 : arguments count (tagged)
// r8 : mapped parameter count (tagged) // r8 : mapped parameter count (tagged)
// Check if the calling frame is an arguments adaptor frame. // Check if the calling frame is an arguments adaptor frame.
Label adaptor_frame, try_allocate, runtime; Label adaptor_frame, try_allocate, runtime;
__ LoadP(r6, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); __ LoadP(r6, MemOperand(r9, StandardFrameConstants::kCallerFPOffset));
__ LoadP(r2, MemOperand(r6, CommonFrameConstants::kContextOrFrameTypeOffset)); __ LoadP(r2, MemOperand(r6, CommonFrameConstants::kContextOrFrameTypeOffset));
__ CmpSmiLiteral(r2, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); __ CmpSmiLiteral(r2, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
__ beq(&adaptor_frame); __ beq(&adaptor_frame);
......
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