Chromium Code Reviews| 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1518 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { | 1518 void Assembler::ReserveAlignedFrameSpace(intptr_t frame_space) { |
| 1519 // Reserve space for arguments and align frame before entering | 1519 // Reserve space for arguments and align frame before entering |
| 1520 // the C++ world. | 1520 // the C++ world. |
| 1521 AddImmediate(ESP, Immediate(-frame_space)); | 1521 AddImmediate(ESP, Immediate(-frame_space)); |
| 1522 if (OS::ActivationFrameAlignment() > 0) { | 1522 if (OS::ActivationFrameAlignment() > 0) { |
| 1523 andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); | 1523 andl(ESP, Immediate(~(OS::ActivationFrameAlignment() - 1))); |
| 1524 } | 1524 } |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 | 1527 |
| 1528 void Assembler::PreserveCallerSavedRegisters() { | 1528 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { |
| 1529 enter(Immediate(0)); | |
| 1530 | |
| 1531 // Preserve volatile registers. | |
|
siva
2012/07/27 20:41:21
ASSERT(kNumberOfVolatileRegisters == 3);
or better
| |
| 1529 pushl(EAX); | 1532 pushl(EAX); |
| 1530 pushl(ECX); | 1533 pushl(ECX); |
| 1531 pushl(EDX); | 1534 pushl(EDX); |
| 1535 | |
| 1536 ReserveAlignedFrameSpace(frame_space); | |
| 1532 } | 1537 } |
| 1533 | 1538 |
| 1534 | 1539 |
| 1535 void Assembler::RestoreCallerSavedRegisters() { | 1540 void Assembler::LeaveCallRuntimeFrame() { |
| 1541 // ESP might have been modified to reserve space for arguments | |
| 1542 // and ensure proper alignment of the stack frame. | |
| 1543 // We need to restore it before restoring registers. | |
| 1544 const intptr_t kNumberOfVolatileRegisters = 3; | |
|
siva
2012/07/27 20:41:21
Pull this to the class so that it is accessible fr
| |
| 1545 leal(ESP, Address(EBP, -kNumberOfVolatileRegisters * kWordSize)); | |
| 1546 | |
| 1547 // Restore volatile registers. | |
|
siva
2012/07/27 20:41:21
ASSERT(kNumberofVolatileRegisters == 3);
| |
| 1536 popl(EDX); | 1548 popl(EDX); |
| 1537 popl(ECX); | 1549 popl(ECX); |
| 1538 popl(EAX); | 1550 popl(EAX); |
| 1551 | |
| 1552 leave(); | |
| 1539 } | 1553 } |
| 1540 | 1554 |
| 1541 | 1555 |
| 1542 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 1556 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
| 1543 entry.Call(this); | 1557 entry.Call(this); |
| 1544 } | 1558 } |
| 1545 | 1559 |
| 1546 | 1560 |
| 1547 void Assembler::Align(int alignment, int offset) { | 1561 void Assembler::Align(int alignment, int offset) { |
| 1548 ASSERT(Utils::IsPowerOfTwo(alignment)); | 1562 ASSERT(Utils::IsPowerOfTwo(alignment)); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1765 | 1779 |
| 1766 const char* Assembler::RegisterName(Register reg) { | 1780 const char* Assembler::RegisterName(Register reg) { |
| 1767 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); | 1781 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); |
| 1768 return cpu_reg_names[reg]; | 1782 return cpu_reg_names[reg]; |
| 1769 } | 1783 } |
| 1770 | 1784 |
| 1771 | 1785 |
| 1772 } // namespace dart | 1786 } // namespace dart |
| 1773 | 1787 |
| 1774 #endif // defined TARGET_ARCH_IA32 | 1788 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |