| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 // Return the current stack pointer address, used to stack alignment | 1840 // Return the current stack pointer address, used to stack alignment |
| 1841 // checks. | 1841 // checks. |
| 1842 // TOS + 0: return address | 1842 // TOS + 0: return address |
| 1843 // Result in RAX. | 1843 // Result in RAX. |
| 1844 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { | 1844 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { |
| 1845 __ leaq(RAX, Address(RSP, kWordSize)); | 1845 __ leaq(RAX, Address(RSP, kWordSize)); |
| 1846 __ ret(); | 1846 __ ret(); |
| 1847 } | 1847 } |
| 1848 | 1848 |
| 1849 | 1849 |
| 1850 // Jump to the exception handler. | 1850 // Jump to the exception or error handler. |
| 1851 // TOS + 0: return address | 1851 // TOS + 0: return address |
| 1852 // RDI: program counter | 1852 // RDI: program counter |
| 1853 // RSI: stack pointer | 1853 // RSI: stack pointer |
| 1854 // RDX: frame_pointer | 1854 // RDX: frame_pointer |
| 1855 // RCX: exception object | 1855 // RCX: exception object |
| 1856 // R8: stacktrace object | 1856 // R8: stacktrace object |
| 1857 // No Result. | 1857 // No Result. |
| 1858 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1858 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
| 1859 ASSERT(kExceptionObjectReg == RAX); | 1859 ASSERT(kExceptionObjectReg == RAX); |
| 1860 ASSERT(kStackTraceObjectReg == RDX); | 1860 ASSERT(kStackTraceObjectReg == RDX); |
| 1861 __ movq(RBP, RDX); // target frame pointer. | 1861 __ movq(RBP, RDX); // target frame pointer. |
| 1862 __ movq(kStackTraceObjectReg, R8); // stacktrace object. | 1862 __ movq(kStackTraceObjectReg, R8); // stacktrace object. |
| 1863 __ movq(kExceptionObjectReg, RCX); // exception object. | 1863 __ movq(kExceptionObjectReg, RCX); // exception object. |
| 1864 __ movq(RSP, RSI); // target stack_pointer. | 1864 __ movq(RSP, RSI); // target stack_pointer. |
| 1865 __ jmp(RDI); // Jump to the exception handler code. | 1865 __ jmp(RDI); // Jump to the exception handler code. |
| 1866 } | 1866 } |
| 1867 | 1867 |
| 1868 | 1868 |
| 1869 // Jump to the error handler. | |
| 1870 // TOS + 0: return address | |
| 1871 // RDI: program_counter | |
| 1872 // RSI: stack_pointer | |
| 1873 // RDX: frame_pointer | |
| 1874 // RCX: error object | |
| 1875 // No Result. | |
| 1876 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { | |
| 1877 ASSERT(kExceptionObjectReg == RAX); | |
| 1878 __ movq(RAX, RCX); // error object. | |
| 1879 __ movq(RBP, RDX); // target frame_pointer. | |
| 1880 __ movq(RSP, RSI); // target stack_pointer. | |
| 1881 __ jmp(RDI); // Jump to the exception handler code. | |
| 1882 } | |
| 1883 | |
| 1884 | |
| 1885 // Implements equality operator when one of the arguments is null | 1869 // Implements equality operator when one of the arguments is null |
| 1886 // (identity check) and updates ICData if necessary. | 1870 // (identity check) and updates ICData if necessary. |
| 1887 // TOS + 0: return address | 1871 // TOS + 0: return address |
| 1888 // TOS + 1: right argument | 1872 // TOS + 1: right argument |
| 1889 // TOS + 2: left argument | 1873 // TOS + 2: left argument |
| 1890 // RBX: ICData. | 1874 // RBX: ICData. |
| 1891 // RAX: result. | 1875 // RAX: result. |
| 1892 // TODO(srdjan): Move to VM stubs once Boolean objects become VM objects. | 1876 // TODO(srdjan): Move to VM stubs once Boolean objects become VM objects. |
| 1893 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { | 1877 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { |
| 1894 static const intptr_t kNumArgsTested = 2; | 1878 static const intptr_t kNumArgsTested = 2; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 __ cmpq(left, right); | 2057 __ cmpq(left, right); |
| 2074 __ Bind(&done); | 2058 __ Bind(&done); |
| 2075 __ popq(right); | 2059 __ popq(right); |
| 2076 __ popq(left); | 2060 __ popq(left); |
| 2077 __ ret(); | 2061 __ ret(); |
| 2078 } | 2062 } |
| 2079 | 2063 |
| 2080 } // namespace dart | 2064 } // namespace dart |
| 2081 | 2065 |
| 2082 #endif // defined TARGET_ARCH_X64 | 2066 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |