Commit 96ebd756 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [builtins] Add receiver to builtin exit frames

Port f59a2335

Original commit message:

    Stack trace generation requires access to the receiver; and while the
    receiver is already on the stack, we cannot determine its position
    during stack trace generation (it's stored in argv[0], and argc is only
    stored in a callee-saved register).

    This patch grants access to the receiver by pushing argc onto builtin
    exit frames as an extra argument. Compared to simply pushing the
    receiver, this requires an additional dereference during stack trace
    generation, but one fewer during builtin calls.

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

BUG=v8:4815
LOG=N

Review-Url: https://codereview.chromium.org/2129643002
Cr-Commit-Position: refs/heads/master@{#37563}
parent 5b823bfc
...@@ -36,14 +36,16 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, ...@@ -36,14 +36,16 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
// ordinary functions). // ordinary functions).
__ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
// Insert extra arguments.
const int num_extra_args = 2;
__ Push(r4, r6);
// JumpToExternalReference expects r3 to contain the number of arguments // JumpToExternalReference expects r3 to contain the number of arguments
// including the receiver and the extra arguments. // including the receiver and the extra arguments.
const int num_extra_args = 3;
__ addi(r3, r3, Operand(num_extra_args + 1)); __ addi(r3, r3, Operand(num_extra_args + 1));
// Insert extra arguments.
__ SmiTag(r3);
__ Push(r3, r4, r6);
__ SmiUntag(r3);
__ JumpToExternalReference(ExternalReference(id, masm->isolate()), __ JumpToExternalReference(ExternalReference(id, masm->isolate()),
exit_frame_type == BUILTIN_EXIT); exit_frame_type == BUILTIN_EXIT);
} }
......
...@@ -34,13 +34,16 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, ...@@ -34,13 +34,16 @@ void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
// ordinary functions). // ordinary functions).
__ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset)); __ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset));
// Insert extra arguments.
const int num_extra_args = 2;
__ Push(r3, r5);
// JumpToExternalReference expects r2 to contain the number of arguments // JumpToExternalReference expects r2 to contain the number of arguments
// including the receiver and the extra arguments. // including the receiver and the extra arguments.
const int num_extra_args = 3;
__ AddP(r2, r2, Operand(num_extra_args + 1)); __ AddP(r2, r2, Operand(num_extra_args + 1));
// Insert extra arguments.
__ SmiTag(r2);
__ Push(r2, r3, r5);
__ SmiUntag(r2);
__ JumpToExternalReference(ExternalReference(id, masm->isolate()), __ JumpToExternalReference(ExternalReference(id, masm->isolate()),
exit_frame_type == BUILTIN_EXIT); exit_frame_type == BUILTIN_EXIT);
} }
......
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