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

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: remove meaningless assertion 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
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // TODO(srdjan): Add XMM registers once they are used by the compiler.
1678 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4 1678 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4
1679 pushq(RAX); 1679 static const intptr_t kNumberOfVolatileCpuRegisters = 9;
1680 pushq(RCX); 1680 static const Register volatile_cpu_registers[kNumberOfVolatileCpuRegisters] = {
1681 pushq(RDX); 1681 RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11
1682 pushq(RSI); 1682 };
1683 pushq(RDI); 1683
1684 pushq(R8); 1684
1685 pushq(R9); 1685 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) {
1686 pushq(R10); 1686 enter(Immediate(0));
1687 pushq(R11); 1687
1688 // TODO(srdjan): Add XMM registers once they are used by the compiler. 1688 // Preserve volatile registers.
1689 for (intptr_t i = 0; i < kNumberOfVolatileCpuRegisters; i++) {
1690 pushq(volatile_cpu_registers[i]);
1691 }
1692
1693 ReserveAlignedFrameSpace(frame_space);
1689 } 1694 }
1690 1695
1691 1696
1692 void Assembler::RestoreCallerSavedRegisters() { 1697 void Assembler::LeaveCallRuntimeFrame() {
1693 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4 1698 // RSP might have been modified to reserve space for arguments
1694 // TODO(srdjan): Add XMM registers once they are used by the compiler. 1699 // and ensure proper alignment of the stack frame.
1695 popq(R11); 1700 // We need to restore it before restoring registers.
1696 popq(R10); 1701 leaq(RSP, Address(RBP, -kNumberOfVolatileCpuRegisters * kWordSize));
1697 popq(R9); 1702
1698 popq(R8); 1703 // Restore volatile registers.
1699 popq(RDI); 1704 for (intptr_t i = kNumberOfVolatileCpuRegisters - 1; i >= 0; i--) {
1700 popq(RSI); 1705 popq(volatile_cpu_registers[i]);
1701 popq(RDX); 1706 }
1702 popq(RCX); 1707
1703 popq(RAX); 1708 leave();
1704 } 1709 }
1705 1710
1706 1711
1707 void Assembler::CallRuntime(const RuntimeEntry& entry) { 1712 void Assembler::CallRuntime(const RuntimeEntry& entry) {
1708 entry.Call(this); 1713 entry.Call(this);
1709 } 1714 }
1710 1715
1711 1716
1712 void Assembler::Align(int alignment, int offset) { 1717 void Assembler::Align(int alignment, int offset) {
1713 ASSERT(Utils::IsPowerOfTwo(alignment)); 1718 ASSERT(Utils::IsPowerOfTwo(alignment));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1916
1912 const char* Assembler::RegisterName(Register reg) { 1917 const char* Assembler::RegisterName(Register reg) {
1913 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); 1918 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters));
1914 return cpu_reg_names[reg]; 1919 return cpu_reg_names[reg];
1915 } 1920 }
1916 1921
1917 1922
1918 } // namespace dart 1923 } // namespace dart
1919 1924
1920 #endif // defined TARGET_ARCH_X64 1925 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698