Chromium Code Reviews| Index: runtime/vm/stub_code_x64.cc |
| diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc |
| index a9d37774359b79ddd33f53a1694a47713f6be9bc..09286ed9ac356c4e9c12e5c75b6a1b13ba17126b 100644 |
| --- a/runtime/vm/stub_code_x64.cc |
| +++ b/runtime/vm/stub_code_x64.cc |
| @@ -765,12 +765,15 @@ void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) { |
| // RCX : new context containing the current isolate pointer. |
| void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| // Save frame pointer coming in. |
| - __ EnterStubFrame(); |
| + __ EnterStubFrameWithPP(); |
| + |
| + // The old frame pointer, the return address, the old R15 (for PP). |
| + const intptr_t kInitiallyPushedSlots = 3; |
|
siva
2013/09/19 00:45:37
Not sure if kInitiallyPushedSlots is a good name,
zra
2013/09/19 00:55:22
+1
rmacnak
2013/09/19 16:57:36
This stack looks upside down to me.
__ EnterStu
|
| // Save arguments descriptor array and new context. |
| - const intptr_t kArgumentsDescOffset = -2 * kWordSize; |
| + const intptr_t kArgumentsDescOffset = -(kInitiallyPushedSlots) * kWordSize; |
| __ pushq(RSI); |
| - const intptr_t kNewContextOffset = -3 * kWordSize; |
| + const intptr_t kNewContextOffset = -(kInitiallyPushedSlots + 1) * kWordSize; |
| __ pushq(RCX); |
| // Save C++ ABI callee-saved registers. |
| @@ -778,7 +781,8 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| __ pushq(R12); |
| __ pushq(R13); |
| __ pushq(R14); |
| - __ pushq(R15); |
| + // R15 is already saved above by EnterStubFrameWithPP. |
|
rmacnak
2013/09/18 21:04:24
Actually, we MUST not save R15 again, because it c
siva
2013/09/19 00:45:37
True, the comment is to make sure we document that
|
| + |
| // The new Context structure contains a pointer to the current Isolate |
| // structure. Cache the Context pointer in the CTX register so that it is |
| @@ -866,14 +870,14 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| __ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), RDX); |
| // Restore C++ ABI callee-saved registers. |
| - __ popq(R15); |
| + // R15 will be restored below by LeaveFrameWithPP. |
| __ popq(R14); |
| __ popq(R13); |
| __ popq(R12); |
| __ popq(RBX); |
| // Restore the frame pointer. |
| - __ LeaveFrame(); |
| + __ LeaveFrameWithPP(); |
| __ ret(); |
| } |