OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 GenerateSubtypeNTestCacheStub(assembler, 3); | 1895 GenerateSubtypeNTestCacheStub(assembler, 3); |
1896 } | 1896 } |
1897 | 1897 |
1898 | 1898 |
1899 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { | 1899 void StubCode::GenerateGetStackPointerStub(Assembler* assembler) { |
1900 __ mov(R0, SP); | 1900 __ mov(R0, SP); |
1901 __ ret(); | 1901 __ ret(); |
1902 } | 1902 } |
1903 | 1903 |
1904 | 1904 |
1905 // Jump to the exception or error handler. | 1905 // Jump to a frame on the call stack. |
1906 // LR: return address. | 1906 // LR: return address. |
1907 // R0: program_counter. | 1907 // R0: program_counter. |
1908 // R1: stack_pointer. | 1908 // R1: stack_pointer. |
1909 // R2: frame_pointer. | 1909 // R2: frame_pointer. |
1910 // R3: error object. | 1910 // R3: thread. |
1911 // R4: address of stacktrace object. | |
1912 // R5: thread. | |
1913 // Does not return. | 1911 // Does not return. |
1914 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1912 void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { |
1915 ASSERT(kExceptionObjectReg == R0); | 1913 ASSERT(kExceptionObjectReg == R0); |
1916 ASSERT(kStackTraceObjectReg == R1); | 1914 ASSERT(kStackTraceObjectReg == R1); |
1917 __ mov(LR, R0); // Program counter. | 1915 __ mov(LR, R0); // Program counter. |
1918 __ mov(SP, R1); // Stack pointer. | 1916 __ mov(SP, R1); // Stack pointer. |
1919 __ mov(FP, R2); // Frame_pointer. | 1917 __ mov(FP, R2); // Frame_pointer. |
1920 __ mov(R0, R3); // Exception object. | 1918 __ mov(THR, R3); |
1921 __ mov(R1, R4); // StackTrace object. | |
1922 __ mov(THR, R5); | |
1923 // Set the tag. | 1919 // Set the tag. |
1924 __ LoadImmediate(R2, VMTag::kDartTagId); | 1920 __ LoadImmediate(R2, VMTag::kDartTagId); |
1925 __ StoreToOffset(R2, THR, Thread::vm_tag_offset()); | 1921 __ StoreToOffset(R2, THR, Thread::vm_tag_offset()); |
1926 // Clear top exit frame. | 1922 // Clear top exit frame. |
1927 __ StoreToOffset(ZR, THR, Thread::top_exit_frame_info_offset()); | 1923 __ StoreToOffset(ZR, THR, Thread::top_exit_frame_info_offset()); |
1928 // Restore the pool pointer. | 1924 // Restore the pool pointer. |
1929 __ RestoreCodePointer(); | 1925 __ RestoreCodePointer(); |
1930 __ LoadPoolPointer(); | 1926 __ LoadPoolPointer(); |
| 1927 __ ret(); // Jump to continuation point. |
| 1928 } |
| 1929 |
| 1930 |
| 1931 // Run an exception handler. Execution comes from JumpToFrame |
| 1932 // stub or from the simulator. |
| 1933 // |
| 1934 // The arguments are stored in the Thread object. |
| 1935 // Does not return. |
| 1936 void StubCode::GenerateRunExceptionHandlerStub(Assembler* assembler) { |
| 1937 __ LoadFromOffset(LR, THR, Thread::resume_pc_offset()); |
| 1938 __ LoadImmediate(R2, 0); |
| 1939 |
| 1940 // Exception object. |
| 1941 __ LoadFromOffset(R0, THR, Thread::active_exception_offset()); |
| 1942 __ StoreToOffset(R2, THR, Thread::active_exception_offset()); |
| 1943 |
| 1944 // Stacktrace object. |
| 1945 __ LoadFromOffset(R1, THR, Thread::active_stacktrace_offset()); |
| 1946 __ StoreToOffset(R2, THR, Thread::active_stacktrace_offset()); |
| 1947 |
1931 __ ret(); // Jump to the exception handler code. | 1948 __ ret(); // Jump to the exception handler code. |
1932 } | 1949 } |
1933 | 1950 |
1934 | 1951 |
1935 // Calls to the runtime to optimize the given function. | 1952 // Calls to the runtime to optimize the given function. |
1936 // R6: function to be re-optimized. | 1953 // R6: function to be re-optimized. |
1937 // R4: argument descriptor (preserved). | 1954 // R4: argument descriptor (preserved). |
1938 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1955 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
1939 __ EnterStubFrame(); | 1956 __ EnterStubFrame(); |
1940 __ Push(R4); | 1957 __ Push(R4); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 } | 2314 } |
2298 | 2315 |
2299 | 2316 |
2300 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2317 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2301 __ brk(0); | 2318 __ brk(0); |
2302 } | 2319 } |
2303 | 2320 |
2304 } // namespace dart | 2321 } // namespace dart |
2305 | 2322 |
2306 #endif // defined TARGET_ARCH_ARM64 | 2323 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |