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

S390: [Interpreter] Fix incorrect frame walking in arguments create stubs

Port 40f34541

Original commit message:

    The previous approach taken by FastNew[Sloppy,Strict,Rest]ArgumentsStub
    looked at the function slot in order to skip stub frames
    and find the JS frame. However, stub frames do not have a
    function slot (in fact their fixed frame ends one slot
    before the JS frame's function slot). Therefore, if this
    location in the stub frame happens to have the function
    object the create arguments stubs won't skip this frame
    correctly.

    Replace this approach with one where the stub is
    specialized to either skip a frame if required (since
    there will only ever be one extra frame on Ignition
    the loop approach isn't necessary).

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

Review-Url: https://codereview.chromium.org/1978823002
Cr-Commit-Position: refs/heads/master@{#36252}
parent 56716012
...@@ -4708,20 +4708,20 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) { ...@@ -4708,20 +4708,20 @@ void FastNewRestParameterStub::Generate(MacroAssembler* masm) {
// ----------------------------------- // -----------------------------------
__ AssertFunction(r3); __ AssertFunction(r3);
// For Ignition we need to skip all possible handler/stub frames until // Make r4 point to the JavaScript frame.
// we reach the JavaScript frame for the function (similar to what the __ LoadRR(r4, fp);
// runtime fallback implementation does). So make r4 point to that if (skip_stub_frame()) {
// JavaScript frame. // For Ignition we need to skip the handler/stub frame to reach the
{ // JavaScript frame for the function.
Label loop, loop_entry;
__ LoadRR(r4, fp);
__ b(&loop_entry, Label::kNear);
__ bind(&loop);
__ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); __ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset));
__ bind(&loop_entry); }
if (FLAG_debug_code) {
Label ok;
__ LoadP(ip, MemOperand(r4, StandardFrameConstants::kFunctionOffset)); __ LoadP(ip, MemOperand(r4, StandardFrameConstants::kFunctionOffset));
__ CmpP(ip, r3); __ CmpP(ip, r3);
__ bne(&loop, Label::kNear); __ b(&ok, Label::kNear);
__ Abort(kInvalidFrameForFastNewRestArgumentsStub);
__ bind(&ok);
} }
// Check if we have rest parameters (only possible if we have an // Check if we have rest parameters (only possible if we have an
...@@ -4855,20 +4855,20 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) { ...@@ -4855,20 +4855,20 @@ void FastNewSloppyArgumentsStub::Generate(MacroAssembler* masm) {
// ----------------------------------- // -----------------------------------
__ AssertFunction(r3); __ AssertFunction(r3);
// For Ignition we need to skip all possible handler/stub frames until // Make r9 point to the JavaScript frame.
// we reach the JavaScript frame for the function (similar to what the __ LoadRR(r9, fp);
// runtime fallback implementation does). So make r9 point to that if (skip_stub_frame()) {
// JavaScript frame. // For Ignition we need to skip the handler/stub frame to reach the
{ // JavaScript frame for the function.
Label loop, loop_entry;
__ LoadRR(r9, fp);
__ b(&loop_entry);
__ bind(&loop);
__ LoadP(r9, MemOperand(r9, StandardFrameConstants::kCallerFPOffset)); __ LoadP(r9, MemOperand(r9, StandardFrameConstants::kCallerFPOffset));
__ bind(&loop_entry); }
if (FLAG_debug_code) {
Label ok;
__ LoadP(ip, MemOperand(r9, StandardFrameConstants::kFunctionOffset)); __ LoadP(ip, MemOperand(r9, StandardFrameConstants::kFunctionOffset));
__ CmpP(ip, r3); __ CmpP(ip, r3);
__ bne(&loop); __ beq(&ok, Label::kNear);
__ Abort(kInvalidFrameForFastNewRestArgumentsStub);
__ bind(&ok);
} }
// TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub. // TODO(bmeurer): Cleanup to match the FastNewStrictArgumentsStub.
...@@ -5109,20 +5109,20 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) { ...@@ -5109,20 +5109,20 @@ void FastNewStrictArgumentsStub::Generate(MacroAssembler* masm) {
// ----------------------------------- // -----------------------------------
__ AssertFunction(r3); __ AssertFunction(r3);
// For Ignition we need to skip all possible handler/stub frames until // Make r4 point to the JavaScript frame.
// we reach the JavaScript frame for the function (similar to what the __ LoadRR(r4, fp);
// runtime fallback implementation does). So make r4 point to that if (skip_stub_frame()) {
// JavaScript frame. // For Ignition we need to skip the handler/stub frame to reach the
{ // JavaScript frame for the function.
Label loop, loop_entry;
__ LoadRR(r4, fp);
__ b(&loop_entry);
__ bind(&loop);
__ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset)); __ LoadP(r4, MemOperand(r4, StandardFrameConstants::kCallerFPOffset));
__ bind(&loop_entry); }
if (FLAG_debug_code) {
Label ok;
__ LoadP(ip, MemOperand(r4, StandardFrameConstants::kFunctionOffset)); __ LoadP(ip, MemOperand(r4, StandardFrameConstants::kFunctionOffset));
__ CmpP(ip, r3); __ CmpP(ip, r3);
__ bne(&loop); __ beq(&ok, Label::kNear);
__ Abort(kInvalidFrameForFastNewRestArgumentsStub);
__ bind(&ok);
} }
// Check if we have an arguments adaptor frame below the function frame. // Check if we have an arguments adaptor frame below the function 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