| 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 a frame on the call stack. | 1905 // Jump to the exception or error handler. |
| 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: thread. | 1910 // R3: error object. |
| 1911 // R4: address of stacktrace object. |
| 1912 // R5: thread. |
| 1911 // Does not return. | 1913 // Does not return. |
| 1912 void StubCode::GenerateJumpToFrameStub(Assembler* assembler) { | 1914 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
| 1913 ASSERT(kExceptionObjectReg == R0); | 1915 ASSERT(kExceptionObjectReg == R0); |
| 1914 ASSERT(kStackTraceObjectReg == R1); | 1916 ASSERT(kStackTraceObjectReg == R1); |
| 1915 __ mov(LR, R0); // Program counter. | 1917 __ mov(LR, R0); // Program counter. |
| 1916 __ mov(SP, R1); // Stack pointer. | 1918 __ mov(SP, R1); // Stack pointer. |
| 1917 __ mov(FP, R2); // Frame_pointer. | 1919 __ mov(FP, R2); // Frame_pointer. |
| 1918 __ mov(THR, R3); | 1920 __ mov(R0, R3); // Exception object. |
| 1921 __ mov(R1, R4); // StackTrace object. |
| 1922 __ mov(THR, R5); |
| 1919 // Set the tag. | 1923 // Set the tag. |
| 1920 __ LoadImmediate(R2, VMTag::kDartTagId); | 1924 __ LoadImmediate(R2, VMTag::kDartTagId); |
| 1921 __ StoreToOffset(R2, THR, Thread::vm_tag_offset()); | 1925 __ StoreToOffset(R2, THR, Thread::vm_tag_offset()); |
| 1922 // Clear top exit frame. | 1926 // Clear top exit frame. |
| 1923 __ StoreToOffset(ZR, THR, Thread::top_exit_frame_info_offset()); | 1927 __ StoreToOffset(ZR, THR, Thread::top_exit_frame_info_offset()); |
| 1924 // Restore the pool pointer. | 1928 // Restore the pool pointer. |
| 1925 __ RestoreCodePointer(); | 1929 __ RestoreCodePointer(); |
| 1926 __ LoadPoolPointer(); | 1930 __ 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 | |
| 1948 __ ret(); // Jump to the exception handler code. | 1931 __ ret(); // Jump to the exception handler code. |
| 1949 } | 1932 } |
| 1950 | 1933 |
| 1951 | 1934 |
| 1952 // Calls to the runtime to optimize the given function. | 1935 // Calls to the runtime to optimize the given function. |
| 1953 // R6: function to be re-optimized. | 1936 // R6: function to be re-optimized. |
| 1954 // R4: argument descriptor (preserved). | 1937 // R4: argument descriptor (preserved). |
| 1955 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { | 1938 void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) { |
| 1956 __ EnterStubFrame(); | 1939 __ EnterStubFrame(); |
| 1957 __ Push(R4); | 1940 __ Push(R4); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2314 } | 2297 } |
| 2315 | 2298 |
| 2316 | 2299 |
| 2317 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2300 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
| 2318 __ brk(0); | 2301 __ brk(0); |
| 2319 } | 2302 } |
| 2320 | 2303 |
| 2321 } // namespace dart | 2304 } // namespace dart |
| 2322 | 2305 |
| 2323 #endif // defined TARGET_ARCH_ARM64 | 2306 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |