Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: runtime/vm/assembler_x64.cc

Issue 10820053: Fix kStoreBufferBlockProcessRuntimeEntry call sequence. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: always restore stack pointer Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/heap.h" 9 #include "vm/heap.h"
10 #include "vm/memory_region.h" 10 #include "vm/memory_region.h"
(...skipping 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { 1667 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) {
1668 // Reserve space for arguments and align frame before entering 1668 // Reserve space for arguments and align frame before entering
1669 // the C++ world. 1669 // the C++ world.
1670 AddImmediate(RSP, Immediate(-frame_space)); 1670 AddImmediate(RSP, Immediate(-frame_space));
1671 if (OS::ActivationFrameAlignment() > 0) { 1671 if (OS::ActivationFrameAlignment() > 0) {
1672 andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); 1672 andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1)));
1673 } 1673 }
1674 } 1674 }
1675 1675
1676 1676
1677 void Assembler::PreserveCallerSavedRegisters() { 1677 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) {
1678 enter(Immediate(0));
1679 // Preserve volatile registers.
siva 2012/07/27 20:41:21 ASSERT(kNumberOfVolatileRegisters == 9);
1678 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4 1680 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4
1679 pushq(RAX); 1681 pushq(RAX);
1680 pushq(RCX); 1682 pushq(RCX);
1681 pushq(RDX); 1683 pushq(RDX);
1682 pushq(RSI); 1684 pushq(RSI);
1683 pushq(RDI); 1685 pushq(RDI);
1684 pushq(R8); 1686 pushq(R8);
1685 pushq(R9); 1687 pushq(R9);
1686 pushq(R10); 1688 pushq(R10);
1687 pushq(R11); 1689 pushq(R11);
1688 // TODO(srdjan): Add XMM registers once they are used by the compiler. 1690 // TODO(srdjan): Add XMM registers once they are used by the compiler.
1691
1692 ReserveAlignedFrameSpace(frame_space);
1689 } 1693 }
1690 1694
1691 1695
1692 void Assembler::RestoreCallerSavedRegisters() { 1696 void Assembler::LeaveCallRuntimeFrame() {
1697 // RSP might have been modified to reserve space for arguments
1698 // and ensure proper alignment of the stack frame.
1699 // We need to restore it before restoring registers.
1700 const intptr_t kNumberOfVolatileRegisters = 9;
siva 2012/07/27 20:41:21 ditto comment regarding kNumberOfVolatileRegisters
1701 leaq(RSP, Address(RBP, -kNumberOfVolatileRegisters * kWordSize));
1702
1703 // Restore volatile registers.
1693 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4 1704 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4
1694 // TODO(srdjan): Add XMM registers once they are used by the compiler.
1695 popq(R11); 1705 popq(R11);
1696 popq(R10); 1706 popq(R10);
1697 popq(R9); 1707 popq(R9);
1698 popq(R8); 1708 popq(R8);
1699 popq(RDI); 1709 popq(RDI);
1700 popq(RSI); 1710 popq(RSI);
1701 popq(RDX); 1711 popq(RDX);
1702 popq(RCX); 1712 popq(RCX);
1703 popq(RAX); 1713 popq(RAX);
siva 2012/07/27 20:41:21 ditto comment regarding kNumberOfVolatileRegisters
1714 leave();
1704 } 1715 }
1705 1716
1706 1717
1707 void Assembler::CallRuntime(const RuntimeEntry& entry) { 1718 void Assembler::CallRuntime(const RuntimeEntry& entry) {
1708 entry.Call(this); 1719 entry.Call(this);
1709 } 1720 }
1710 1721
1711 1722
1712 void Assembler::Align(int alignment, int offset) { 1723 void Assembler::Align(int alignment, int offset) {
1713 ASSERT(Utils::IsPowerOfTwo(alignment)); 1724 ASSERT(Utils::IsPowerOfTwo(alignment));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1922
1912 const char* Assembler::RegisterName(Register reg) { 1923 const char* Assembler::RegisterName(Register reg) {
1913 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); 1924 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
1914 return cpu_reg_names[reg]; 1925 return cpu_reg_names[reg];
1915 } 1926 }
1916 1927
1917 1928
1918 } // namespace dart 1929 } // namespace dart
1919 1930
1920 #endif // defined TARGET_ARCH_X64 1931 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698