Reviewers: Toon Verwaest,
Message:
Hi Toon, this is the CL we discussed two weeks ago. After this change,
there is
no difference between x64 port and x32 port in the builtin-x64.cc. PTAL.
Description:
Introduce DropUnderReturnAddress for x64 port.
Please review this at https://codereview.chromium.org/242113005/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+25, -5 lines):
M src/x64/builtins-x64.cc
M src/x64/macro-assembler-x64.h
M src/x64/macro-assembler-x64.cc
Index: src/x64/builtins-x64.cc
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
index
19e7b533c9d425ed5062526818ae7f86e679db8d..a07473d989d15caf51ee13b31aaa9a05aed35e20
100644
--- a/src/x64/builtins-x64.cc
+++ b/src/x64/builtins-x64.cc
@@ -749,7 +749,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.
}
@@ -926,12 +926,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).
}
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index
1fd7c2c94624a1a7e0b8b5426dbbf18c44d146ad..a5c4c5615986437f3b3d60eb4d99a00668531bdc
100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -2666,6 +2666,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);
Index: src/x64/macro-assembler-x64.h
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
index
a2163642d5c0e841248df843eac860d8c8f7a5d0..8fd31fc6e39fef43b3aca2a2ceea756637dfcf71
100644
--- a/src/x64/macro-assembler-x64.h
+++ b/src/x64/macro-assembler-x64.h
@@ -840,6 +840,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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.