Commit bf338d78 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Introduce DropUnderReturnAddress for x64 port.

R=verwaest@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@21082 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1b3b9220
......@@ -724,7 +724,7 @@ static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
// Tear down internal frame.
}
__ Pop(MemOperand(rsp, 0)); // Ignore state offset
__ DropUnderReturnAddress(1); // Ignore state offset
__ ret(0); // Return to IC Miss stub, continuation still on stack.
}
......@@ -901,12 +901,13 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
__ bind(&shift_arguments);
{ Label loop;
__ movp(rcx, rax);
StackArgumentsAccessor args(rsp, rcx);
__ bind(&loop);
__ movp(rbx, Operand(rsp, rcx, times_pointer_size, 0));
__ movp(Operand(rsp, rcx, times_pointer_size, 1 * kPointerSize), rbx);
__ movp(rbx, args.GetArgumentOperand(1));
__ movp(args.GetArgumentOperand(0), rbx);
__ decp(rcx);
__ j(not_sign, &loop); // While non-negative (to copy return address).
__ popq(rbx); // Discard copy of return address.
__ j(not_zero, &loop); // While non-zero.
__ DropUnderReturnAddress(1, rbx); // Drop one slot under return address.
__ decp(rax); // One fewer argument (first argument is new receiver).
}
......
......@@ -2685,6 +2685,20 @@ void MacroAssembler::Drop(int stack_elements) {
}
void MacroAssembler::DropUnderReturnAddress(int stack_elements,
Register scratch) {
ASSERT(stack_elements > 0);
if (kPointerSize == kInt64Size && stack_elements == 1) {
popq(MemOperand(rsp, 0));
return;
}
PopReturnAddressTo(scratch);
Drop(stack_elements);
PushReturnAddressFrom(scratch);
}
void MacroAssembler::Push(Register src) {
if (kPointerSize == kInt64Size) {
pushq(src);
......
......@@ -815,6 +815,11 @@ class MacroAssembler: public Assembler {
// Emit code to discard a non-negative number of pointer-sized elements
// from the stack, clobbering only the rsp register.
void Drop(int stack_elements);
// Emit code to discard a positive number of pointer-sized elements
// from the stack under the return address which remains on the top,
// clobbering the rsp register.
void DropUnderReturnAddress(int stack_elements,
Register scratch = kScratchRegister);
void Call(Label* target) { call(target); }
void Push(Register src);
......
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