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_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1843 } | 1843 } |
1844 | 1844 |
1845 | 1845 |
1846 // Return the current stack pointer address, used to do stack alignment checks. | 1846 // Return the current stack pointer address, used to do stack alignment checks. |
1847 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { | 1847 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { |
1848 __ mov(R0, Operand(SP)); | 1848 __ mov(R0, Operand(SP)); |
1849 __ Ret(); | 1849 __ Ret(); |
1850 } | 1850 } |
1851 | 1851 |
1852 | 1852 |
1853 // Jump to a frame on the call stack. | 1853 // Jump to the exception or error handler. |
1854 // LR: return address. | 1854 // LR: return address. |
1855 // R0: program_counter. | 1855 // R0: program_counter. |
1856 // R1: stack_pointer. | 1856 // R1: stack_pointer. |
1857 // R2: frame_pointer. | 1857 // R2: frame_pointer. |
1858 // R3: thread. | 1858 // R3: error object. |
| 1859 // SP + 0: address of stacktrace object. |
| 1860 // SP + 4: thread. |
1859 // Does not return. | 1861 // Does not return. |
1860 void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { | 1862 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
1861 ASSERT(kExceptionObjectReg == R0); | 1863 ASSERT(kExceptionObjectReg == R0); |
1862 ASSERT(kStackTraceObjectReg == R1); | 1864 ASSERT(kStackTraceObjectReg == R1); |
1863 __ mov(IP, Operand(R1)); // Copy Stack pointer into IP. | 1865 __ mov(IP, Operand(R1)); // Copy Stack pointer into IP. |
1864 __ mov(LR, Operand(R0)); // Program counter. | 1866 __ mov(LR, Operand(R0)); // Program counter. |
1865 __ mov(THR, Operand(R3)); // Thread. | 1867 __ mov(R0, Operand(R3)); // Exception object. |
| 1868 __ ldr(R1, Address(SP, 0)); // StackTrace object. |
| 1869 __ ldr(THR, Address(SP, 4)); // Thread. |
1866 __ mov(FP, Operand(R2)); // Frame_pointer. | 1870 __ mov(FP, Operand(R2)); // Frame_pointer. |
1867 __ mov(SP, Operand(IP)); // Set Stack pointer. | 1871 __ mov(SP, Operand(IP)); // Set Stack pointer. |
1868 // Set the tag. | 1872 // Set the tag. |
1869 __ LoadImmediate(R2, VMTag::kDartTagId); | 1873 __ LoadImmediate(R2, VMTag::kDartTagId); |
1870 __ StoreToOffset(kWord, R2, THR, Thread::vm_tag_offset()); | 1874 __ StoreToOffset(kWord, R2, THR, Thread::vm_tag_offset()); |
1871 // Clear top exit frame. | 1875 // Clear top exit frame. |
1872 __ LoadImmediate(R2, 0); | 1876 __ LoadImmediate(R2, 0); |
1873 __ StoreToOffset(kWord, R2, THR, Thread::top_exit_frame_info_offset()); | 1877 __ StoreToOffset(kWord, R2, THR, Thread::top_exit_frame_info_offset()); |
1874 // Restore the pool pointer. | 1878 // Restore the pool pointer. |
1875 __ RestoreCodePointer(); | 1879 __ RestoreCodePointer(); |
1876 __ LoadPoolPointer(); | 1880 __ LoadPoolPointer(); |
1877 __ bx(LR); // Jump to continuation point. | |
1878 } | |
1879 | |
1880 | |
1881 // Run an exception handler. Execution comes from JumpToFrame | |
1882 // stub or from the simulator. | |
1883 // | |
1884 // The arguments are stored in the Thread object. | |
1885 // Does not return. | |
1886 void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { | |
1887 __ LoadFromOffset(kWord, LR, THR, Thread::resume_pc_offset()); | |
1888 __ LoadImmediate(R2, 0); | |
1889 | |
1890 // Exception object. | |
1891 __ LoadFromOffset(kWord, R0, THR, Thread::active_exception_offset()); | |
1892 __ StoreToOffset(kWord, R2, THR, Thread::active_exception_offset()); | |
1893 | |
1894 // Stacktrace object. | |
1895 __ LoadFromOffset(kWord, R1, THR, Thread::active_stacktrace_offset()); | |
1896 __ StoreToOffset(kWord, R2, THR, Thread::active_stacktrace_offset()); | |
1897 | |
1898 __ bx(LR); // Jump to the exception handler code. | 1881 __ bx(LR); // Jump to the exception handler code. |
1899 } | 1882 } |
1900 | 1883 |
1901 | 1884 |
1902 // Calls to the runtime to optimize the given function. | 1885 // Calls to the runtime to optimize the given function. |
1903 // R8: function to be reoptimized. | 1886 // R8: function to be reoptimized. |
1904 // R4: argument descriptor (preserved). | 1887 // R4: argument descriptor (preserved). |
1905 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1888 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
1906 __ EnterStubFrame(); | 1889 __ EnterStubFrame(); |
1907 __ Push(R4); | 1890 __ Push(R4); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2258 } | 2241 } |
2259 | 2242 |
2260 | 2243 |
2261 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2244 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2262 __ bkpt(0); | 2245 __ bkpt(0); |
2263 } | 2246 } |
2264 | 2247 |
2265 } // namespace dart | 2248 } // namespace dart |
2266 | 2249 |
2267 #endif // defined TARGET_ARCH_ARM | 2250 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |