| OLD | NEW |
| 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 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { | 1538 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 1539 // Reserve space for arguments and align frame before entering | 1539 // Reserve space for arguments and align frame before entering |
| 1540 // the C++ world. | 1540 // the C++ world. |
| 1541 AddImmediate(RSP, Immediate(-frame_space)); | 1541 AddImmediate(RSP, Immediate(-frame_space)); |
| 1542 if (OS::ActivationFrameAlignment() > 0) { | 1542 if (OS::ActivationFrameAlignment() > 0) { |
| 1543 andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 1543 andq(RSP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 1544 } | 1544 } |
| 1545 } | 1545 } |
| 1546 | 1546 |
| 1547 | 1547 |
| 1548 void Assembler::PreserveCallerSavedRegisters() { |
| 1549 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4 |
| 1550 pushq(RAX); |
| 1551 pushq(RCX); |
| 1552 pushq(RDX); |
| 1553 pushq(RSI); |
| 1554 pushq(RDI); |
| 1555 pushq(R8); |
| 1556 pushq(R9); |
| 1557 pushq(R10); |
| 1558 pushq(R11); |
| 1559 // TODO(srdjan): Add XMM registers once they are used by the compiler. |
| 1560 } |
| 1561 |
| 1562 |
| 1563 void Assembler::RestoreCallerSavedRegisters() { |
| 1564 // Based on http://x86-64.org/documentation/abi.pdf Fig. 3.4 |
| 1565 // TODO(srdjan): Add XMM registers once they are used by the compiler. |
| 1566 popq(R11); |
| 1567 popq(R10); |
| 1568 popq(R9); |
| 1569 popq(R8); |
| 1570 popq(RDI); |
| 1571 popq(RSI); |
| 1572 popq(RDX); |
| 1573 popq(RCX); |
| 1574 popq(RAX); |
| 1575 } |
| 1576 |
| 1577 |
| 1548 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 1578 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 1549 entry.Call(this); | 1579 entry.Call(this); |
| 1550 } | 1580 } |
| 1551 | 1581 |
| 1552 | 1582 |
| 1553 void Assembler::Align(int alignment, int offset) { | 1583 void Assembler::Align(int alignment, int offset) { |
| 1554 ASSERT(Utils::IsPowerOfTwo(alignment)); | 1584 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| 1555 int pos = offset + buffer_.GetPosition(); | 1585 int pos = offset + buffer_.GetPosition(); |
| 1556 int mod = pos & (alignment - 1); | 1586 int mod = pos & (alignment - 1); |
| 1557 if (mod == 0) { | 1587 if (mod == 0) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1740 comments.SetCommentAt(i, comments_[i]->comment()); | 1770 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1741 } | 1771 } |
| 1742 | 1772 |
| 1743 return comments; | 1773 return comments; |
| 1744 } | 1774 } |
| 1745 | 1775 |
| 1746 | 1776 |
| 1747 } // namespace dart | 1777 } // namespace dart |
| 1748 | 1778 |
| 1749 #endif // defined TARGET_ARCH_X64 | 1779 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |