OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1785 | 1785 |
1786 // Return the current stack pointer address, used to do stack alignment checks. | 1786 // Return the current stack pointer address, used to do stack alignment checks. |
1787 // TOS + 0: return address | 1787 // TOS + 0: return address |
1788 // Result in EAX. | 1788 // Result in EAX. |
1789 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { | 1789 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { |
1790 __ leal(EAX, Address(ESP, kWordSize)); | 1790 __ leal(EAX, Address(ESP, kWordSize)); |
1791 __ ret(); | 1791 __ ret(); |
1792 } | 1792 } |
1793 | 1793 |
1794 | 1794 |
1795 // Jump to a frame on the call stack. | 1795 // Jump to the exception or error handler. |
1796 // TOS + 0: return address | 1796 // TOS + 0: return address |
1797 // TOS + 1: program_counter | 1797 // TOS + 1: program_counter |
1798 // TOS + 2: stack_pointer | 1798 // TOS + 2: stack_pointer |
1799 // TOS + 3: frame_pointer | 1799 // TOS + 3: frame_pointer |
1800 // TOS + 4: thread | 1800 // TOS + 4: exception object |
| 1801 // TOS + 5: stacktrace object |
| 1802 // TOS + 6: thread |
1801 // No Result. | 1803 // No Result. |
1802 void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { | 1804 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
1803 __ movl(THR, Address(ESP, 4 * kWordSize)); // Load target thread. | 1805 ASSERT(kExceptionObjectReg == EAX); |
| 1806 ASSERT(kStackTraceObjectReg == EDX); |
| 1807 __ movl(THR, Address(ESP, 6 * kWordSize)); // Load target thread. |
| 1808 __ movl(kStackTraceObjectReg, Address(ESP, 5 * kWordSize)); |
| 1809 __ movl(kExceptionObjectReg, Address(ESP, 4 * kWordSize)); |
1804 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. | 1810 __ movl(EBP, Address(ESP, 3 * kWordSize)); // Load target frame_pointer. |
1805 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. | 1811 __ movl(EBX, Address(ESP, 1 * kWordSize)); // Load target PC into EBX. |
1806 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. | 1812 __ movl(ESP, Address(ESP, 2 * kWordSize)); // Load target stack_pointer. |
1807 // Set tag. | 1813 // Set tag. |
1808 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); | 1814 __ movl(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId)); |
1809 // Clear top exit frame. | 1815 // Clear top exit frame. |
1810 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); | 1816 __ movl(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0)); |
1811 __ jmp(EBX); // Jump to the exception handler code. | 1817 __ jmp(EBX); // Jump to the exception handler code. |
1812 } | 1818 } |
1813 | 1819 |
1814 | 1820 |
1815 // Run an exception handler. Execution comes from JumpToFrame stub. | |
1816 // | |
1817 // The arguments are stored in the Thread object. | |
1818 // No result. | |
1819 void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { | |
1820 ASSERT(kExceptionObjectReg == EAX); | |
1821 ASSERT(kStackTraceObjectReg == EDX); | |
1822 __ movl(EBX, Address(THR, Thread::resume_pc_offset())); | |
1823 | |
1824 // Load the exception from the current thread. | |
1825 Address exception_addr(THR, Thread::active_exception_offset()); | |
1826 __ movl(kExceptionObjectReg, exception_addr); | |
1827 __ movl(exception_addr, Immediate(0)); | |
1828 | |
1829 // Load the stacktrace from the current thread. | |
1830 Address stacktrace_addr(THR, Thread::active_stacktrace_offset()); | |
1831 __ movl(kStackTraceObjectReg, stacktrace_addr); | |
1832 __ movl(stacktrace_addr, Immediate(0)); | |
1833 | |
1834 __ jmp(EBX); // Jump to continuation point. | |
1835 } | |
1836 | |
1837 | |
1838 // Calls to the runtime to optimize the given function. | 1821 // Calls to the runtime to optimize the given function. |
1839 // EBX: function to be reoptimized. | 1822 // EBX: function to be reoptimized. |
1840 // EDX: argument descriptor (preserved). | 1823 // EDX: argument descriptor (preserved). |
1841 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1824 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
1842 __ EnterStubFrame(); | 1825 __ EnterStubFrame(); |
1843 __ pushl(EDX); | 1826 __ pushl(EDX); |
1844 __ pushl(Immediate(0)); // Setup space on stack for return value. | 1827 __ pushl(Immediate(0)); // Setup space on stack for return value. |
1845 __ pushl(EBX); | 1828 __ pushl(EBX); |
1846 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); | 1829 __ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1); |
1847 __ popl(EAX); // Discard argument. | 1830 __ popl(EAX); // Discard argument. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 } | 2053 } |
2071 | 2054 |
2072 | 2055 |
2073 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2056 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2074 __ int3(); | 2057 __ int3(); |
2075 } | 2058 } |
2076 | 2059 |
2077 } // namespace dart | 2060 } // namespace dart |
2078 | 2061 |
2079 #endif // defined TARGET_ARCH_IA32 | 2062 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |