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/assembler_macros.h" | 9 #include "vm/assembler_macros.h" |
10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 // Used to check class and type arguments. Arguments passed on stack: | 1866 // Used to check class and type arguments. Arguments passed on stack: |
1867 // TOS + 0: return address. | 1867 // TOS + 0: return address. |
1868 // TOS + 1: instantiator type arguments. | 1868 // TOS + 1: instantiator type arguments. |
1869 // TOS + 2: instance. | 1869 // TOS + 2: instance. |
1870 // TOS + 3: cache array. | 1870 // TOS + 3: cache array. |
1871 // Result in RCX: null -> not found, otherwise result (true or false). | 1871 // Result in RCX: null -> not found, otherwise result (true or false). |
1872 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { | 1872 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { |
1873 GenerateSubtypeNTestCacheStub(assembler, 3); | 1873 GenerateSubtypeNTestCacheStub(assembler, 3); |
1874 } | 1874 } |
1875 | 1875 |
| 1876 |
| 1877 // Return the current stack pointer address, used to stack alignment |
| 1878 // checks. |
| 1879 // TOS + 0: return address |
| 1880 // Result in RAX. |
| 1881 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { |
| 1882 __ leaq(RAX, Address(RSP, kWordSize)); |
| 1883 __ ret(); |
| 1884 } |
| 1885 |
| 1886 |
| 1887 // Jump to the exception handler. |
| 1888 // TOS + 0: return address |
| 1889 // RDI: program counter |
| 1890 // RSI: stack pointer |
| 1891 // RDX: frame_pointer |
| 1892 // RCX: exception object |
| 1893 // R8: stacktrace object |
| 1894 // No Result. |
| 1895 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
| 1896 ASSERT(kExceptionObjectReg == RAX); |
| 1897 ASSERT(kStackTraceObjectReg == RDX); |
| 1898 __ movq(RBP, RDX); // target frame pointer. |
| 1899 __ movq(kStackTraceObjectReg, R8); // stacktrace object. |
| 1900 __ movq(kExceptionObjectReg, RCX); // exception object. |
| 1901 __ movq(RSP, RSI); // target stack_pointer. |
| 1902 __ jmp(RDI); // Jump to the exception handler code. |
| 1903 } |
| 1904 |
| 1905 |
| 1906 // Jump to the error handler. |
| 1907 // TOS + 0: return address |
| 1908 // RDI: program_counter |
| 1909 // RSI: stack_pointer |
| 1910 // RDX: frame_pointer |
| 1911 // RCX: error object |
| 1912 // No Result. |
| 1913 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { |
| 1914 __ movq(RAX, RCX); // error object. |
| 1915 __ movq(RBP, RDX); // target frame_pointer. |
| 1916 __ movq(RSP, RSI); // target stack_pointer. |
| 1917 __ jmp(RDI); // Jump to the exception handler code. |
| 1918 } |
| 1919 |
1876 } // namespace dart | 1920 } // namespace dart |
1877 | 1921 |
1878 #endif // defined TARGET_ARCH_X64 | 1922 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |