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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // Save current Context pointer into Isolate structure. | 56 // Save current Context pointer into Isolate structure. |
57 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); | 57 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); |
58 | 58 |
59 // Cache Isolate pointer into CTX while executing runtime code. | 59 // Cache Isolate pointer into CTX while executing runtime code. |
60 __ mov(CTX, R0); | 60 __ mov(CTX, R0); |
61 | 61 |
62 #if defined(DEBUG) | 62 #if defined(DEBUG) |
63 { Label ok; | 63 { Label ok; |
64 // Check that we are always entering from Dart code. | 64 // Check that we are always entering from Dart code. |
65 __ LoadFromOffset(R8, R0, Isolate::vm_tag_offset(), kNoPP); | 65 __ LoadFromOffset(R8, R0, Isolate::vm_tag_offset(), kNoPP); |
66 __ CompareImmediate(R8, VMTag::kScriptTagId, kNoPP); | 66 __ CompareImmediate(R8, VMTag::kDartTagId, kNoPP); |
67 __ b(&ok, EQ); | 67 __ b(&ok, EQ); |
68 __ Stop("Not coming from Dart code."); | 68 __ Stop("Not coming from Dart code."); |
69 __ Bind(&ok); | 69 __ Bind(&ok); |
70 } | 70 } |
71 #endif | 71 #endif |
72 | 72 |
73 // Mark that the isolate is executing VM code. | 73 // Mark that the isolate is executing VM code. |
74 __ StoreToOffset(R5, R0, Isolate::vm_tag_offset(), kNoPP); | 74 __ StoreToOffset(R5, R0, Isolate::vm_tag_offset(), kNoPP); |
75 | 75 |
76 // Reserve space for arguments and align frame before entering C++ world. | 76 // Reserve space for arguments and align frame before entering C++ world. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 __ blr(R5); | 116 __ blr(R5); |
117 __ Comment("CallToRuntimeStub return"); | 117 __ Comment("CallToRuntimeStub return"); |
118 | 118 |
119 // Restore SP and CSP. | 119 // Restore SP and CSP. |
120 __ mov(SP, CSP); | 120 __ mov(SP, CSP); |
121 __ mov(CSP, R26); | 121 __ mov(CSP, R26); |
122 | 122 |
123 // Retval is next to 1st argument. | 123 // Retval is next to 1st argument. |
124 // Mark that the isolate is executing Dart code. | 124 // Mark that the isolate is executing Dart code. |
125 __ LoadImmediate(R2, VMTag::kScriptTagId, kNoPP); | 125 __ LoadImmediate(R2, VMTag::kDartTagId, kNoPP); |
126 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); | 126 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); |
127 | 127 |
128 // Reset exit frame information in Isolate structure. | 128 // Reset exit frame information in Isolate structure. |
129 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); | 129 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); |
130 | 130 |
131 // Load Context pointer from Isolate structure into A2. | 131 // Load Context pointer from Isolate structure into A2. |
132 __ LoadFromOffset(R2, CTX, Isolate::top_context_offset(), kNoPP); | 132 __ LoadFromOffset(R2, CTX, Isolate::top_context_offset(), kNoPP); |
133 | 133 |
134 // Load null. | 134 // Load null. |
135 __ LoadObject(TMP, Object::null_object(), PP); | 135 __ LoadObject(TMP, Object::null_object(), PP); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Save current Context pointer into Isolate structure. | 174 // Save current Context pointer into Isolate structure. |
175 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); | 175 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); |
176 | 176 |
177 // Cache Isolate pointer into CTX while executing native code. | 177 // Cache Isolate pointer into CTX while executing native code. |
178 __ mov(CTX, R0); | 178 __ mov(CTX, R0); |
179 | 179 |
180 #if defined(DEBUG) | 180 #if defined(DEBUG) |
181 { Label ok; | 181 { Label ok; |
182 // Check that we are always entering from Dart code. | 182 // Check that we are always entering from Dart code. |
183 __ LoadFromOffset(R6, CTX, Isolate::vm_tag_offset(), kNoPP); | 183 __ LoadFromOffset(R6, CTX, Isolate::vm_tag_offset(), kNoPP); |
184 __ CompareImmediate(R6, VMTag::kScriptTagId, kNoPP); | 184 __ CompareImmediate(R6, VMTag::kDartTagId, kNoPP); |
185 __ b(&ok, EQ); | 185 __ b(&ok, EQ); |
186 __ Stop("Not coming from Dart code."); | 186 __ Stop("Not coming from Dart code."); |
187 __ Bind(&ok); | 187 __ Bind(&ok); |
188 } | 188 } |
189 #endif | 189 #endif |
190 | 190 |
191 // Mark that the isolate is executing Native code. | 191 // Mark that the isolate is executing Native code. |
192 __ StoreToOffset(R5, CTX, Isolate::vm_tag_offset(), kNoPP); | 192 __ StoreToOffset(R5, CTX, Isolate::vm_tag_offset(), kNoPP); |
193 | 193 |
194 // Reserve space for the native arguments structure passed on the stack (the | 194 // Reserve space for the native arguments structure passed on the stack (the |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 __ blr(R2); | 239 __ blr(R2); |
240 #else | 240 #else |
241 __ BranchLink(&NativeEntry::NativeCallWrapperLabel(), kNoPP); | 241 __ BranchLink(&NativeEntry::NativeCallWrapperLabel(), kNoPP); |
242 #endif | 242 #endif |
243 | 243 |
244 // Restore SP and CSP. | 244 // Restore SP and CSP. |
245 __ mov(SP, CSP); | 245 __ mov(SP, CSP); |
246 __ mov(CSP, R26); | 246 __ mov(CSP, R26); |
247 | 247 |
248 // Mark that the isolate is executing Dart code. | 248 // Mark that the isolate is executing Dart code. |
249 __ LoadImmediate(R2, VMTag::kScriptTagId, kNoPP); | 249 __ LoadImmediate(R2, VMTag::kDartTagId, kNoPP); |
250 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); | 250 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); |
251 | 251 |
252 // Reset exit frame information in Isolate structure. | 252 // Reset exit frame information in Isolate structure. |
253 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); | 253 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); |
254 | 254 |
255 // Load Context pointer from Isolate structure into R2. | 255 // Load Context pointer from Isolate structure into R2. |
256 __ LoadFromOffset(R2, CTX, Isolate::top_context_offset(), kNoPP); | 256 __ LoadFromOffset(R2, CTX, Isolate::top_context_offset(), kNoPP); |
257 | 257 |
258 // Reset Context pointer in Isolate structure. | 258 // Reset Context pointer in Isolate structure. |
259 __ LoadObject(R3, Object::null_object(), PP); | 259 __ LoadObject(R3, Object::null_object(), PP); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 // Save current Context pointer into Isolate structure. | 291 // Save current Context pointer into Isolate structure. |
292 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); | 292 __ StoreToOffset(CTX, R0, Isolate::top_context_offset(), kNoPP); |
293 | 293 |
294 // Cache Isolate pointer into CTX while executing native code. | 294 // Cache Isolate pointer into CTX while executing native code. |
295 __ mov(CTX, R0); | 295 __ mov(CTX, R0); |
296 | 296 |
297 #if defined(DEBUG) | 297 #if defined(DEBUG) |
298 { Label ok; | 298 { Label ok; |
299 // Check that we are always entering from Dart code. | 299 // Check that we are always entering from Dart code. |
300 __ LoadFromOffset(R6, CTX, Isolate::vm_tag_offset(), kNoPP); | 300 __ LoadFromOffset(R6, CTX, Isolate::vm_tag_offset(), kNoPP); |
301 __ CompareImmediate(R6, VMTag::kScriptTagId, kNoPP); | 301 __ CompareImmediate(R6, VMTag::kDartTagId, kNoPP); |
302 __ b(&ok, EQ); | 302 __ b(&ok, EQ); |
303 __ Stop("Not coming from Dart code."); | 303 __ Stop("Not coming from Dart code."); |
304 __ Bind(&ok); | 304 __ Bind(&ok); |
305 } | 305 } |
306 #endif | 306 #endif |
307 | 307 |
308 // Mark that the isolate is executing Native code. | 308 // Mark that the isolate is executing Native code. |
309 __ StoreToOffset(R5, CTX, Isolate::vm_tag_offset(), kNoPP); | 309 __ StoreToOffset(R5, CTX, Isolate::vm_tag_offset(), kNoPP); |
310 | 310 |
311 // Reserve space for the native arguments structure passed on the stack (the | 311 // Reserve space for the native arguments structure passed on the stack (the |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 __ mov(CSP, SP); | 347 __ mov(CSP, SP); |
348 | 348 |
349 // Call native function or redirection via simulator. | 349 // Call native function or redirection via simulator. |
350 __ blr(R5); | 350 __ blr(R5); |
351 | 351 |
352 // Restore SP and CSP. | 352 // Restore SP and CSP. |
353 __ mov(SP, CSP); | 353 __ mov(SP, CSP); |
354 __ mov(CSP, R26); | 354 __ mov(CSP, R26); |
355 | 355 |
356 // Mark that the isolate is executing Dart code. | 356 // Mark that the isolate is executing Dart code. |
357 __ LoadImmediate(R2, VMTag::kScriptTagId, kNoPP); | 357 __ LoadImmediate(R2, VMTag::kDartTagId, kNoPP); |
358 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); | 358 __ StoreToOffset(R2, CTX, Isolate::vm_tag_offset(), kNoPP); |
359 | 359 |
360 // Reset exit frame information in Isolate structure. | 360 // Reset exit frame information in Isolate structure. |
361 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); | 361 __ StoreToOffset(ZR, CTX, Isolate::top_exit_frame_info_offset(), kNoPP); |
362 | 362 |
363 // Load Context pointer from Isolate structure into R2. | 363 // Load Context pointer from Isolate structure into R2. |
364 __ LoadFromOffset(R2, CTX, Isolate::top_context_offset(), kNoPP); | 364 __ LoadFromOffset(R2, CTX, Isolate::top_context_offset(), kNoPP); |
365 | 365 |
366 // Reset Context pointer in Isolate structure. | 366 // Reset Context pointer in Isolate structure. |
367 __ LoadObject(R3, Object::null_object(), PP); | 367 __ LoadObject(R3, Object::null_object(), PP); |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 | 816 |
817 // Cache the new Context pointer into CTX while executing Dart code. | 817 // Cache the new Context pointer into CTX while executing Dart code. |
818 __ LoadFromOffset(CTX, R3, VMHandles::kOffsetOfRawPtrInHandle, PP); | 818 __ LoadFromOffset(CTX, R3, VMHandles::kOffsetOfRawPtrInHandle, PP); |
819 | 819 |
820 // Save the current VMTag on the stack. | 820 // Save the current VMTag on the stack. |
821 ASSERT(kSavedVMTagSlotFromEntryFp == -20); | 821 ASSERT(kSavedVMTagSlotFromEntryFp == -20); |
822 __ LoadFromOffset(R4, R5, Isolate::vm_tag_offset(), PP); | 822 __ LoadFromOffset(R4, R5, Isolate::vm_tag_offset(), PP); |
823 __ Push(R4); | 823 __ Push(R4); |
824 | 824 |
825 // Mark that the isolate is executing Dart code. | 825 // Mark that the isolate is executing Dart code. |
826 __ LoadImmediate(R6, VMTag::kScriptTagId, PP); | 826 __ LoadImmediate(R6, VMTag::kDartTagId, PP); |
827 __ StoreToOffset(R6, R5, Isolate::vm_tag_offset(), PP); | 827 __ StoreToOffset(R6, R5, Isolate::vm_tag_offset(), PP); |
828 | 828 |
829 // Save the top exit frame info. Use R6 as a temporary register. | 829 // Save the top exit frame info. Use R6 as a temporary register. |
830 // StackFrameIterator reads the top exit frame info saved in this frame. | 830 // StackFrameIterator reads the top exit frame info saved in this frame. |
831 __ LoadFromOffset(R6, R5, Isolate::top_exit_frame_info_offset(), PP); | 831 __ LoadFromOffset(R6, R5, Isolate::top_exit_frame_info_offset(), PP); |
832 __ StoreToOffset(ZR, R5, Isolate::top_exit_frame_info_offset(), PP); | 832 __ StoreToOffset(ZR, R5, Isolate::top_exit_frame_info_offset(), PP); |
833 | 833 |
834 // Save the old Context pointer. Use R4 as a temporary register. | 834 // Save the old Context pointer. Use R4 as a temporary register. |
835 // Note that VisitObjectPointers will find this saved Context pointer during | 835 // Note that VisitObjectPointers will find this saved Context pointer during |
836 // GC marking, since it traverses any information between SP and | 836 // GC marking, since it traverses any information between SP and |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 // Does not return. | 1823 // Does not return. |
1824 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1824 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
1825 ASSERT(kExceptionObjectReg == R0); | 1825 ASSERT(kExceptionObjectReg == R0); |
1826 ASSERT(kStackTraceObjectReg == R1); | 1826 ASSERT(kStackTraceObjectReg == R1); |
1827 __ mov(LR, R0); // Program counter. | 1827 __ mov(LR, R0); // Program counter. |
1828 __ mov(SP, R1); // Stack pointer. | 1828 __ mov(SP, R1); // Stack pointer. |
1829 __ mov(FP, R2); // Frame_pointer. | 1829 __ mov(FP, R2); // Frame_pointer. |
1830 __ mov(R0, R3); // Exception object. | 1830 __ mov(R0, R3); // Exception object. |
1831 __ mov(R1, R4); // StackTrace object. | 1831 __ mov(R1, R4); // StackTrace object. |
1832 // Set the tag. | 1832 // Set the tag. |
1833 __ LoadImmediate(R2, VMTag::kScriptTagId, kNoPP); | 1833 __ LoadImmediate(R2, VMTag::kDartTagId, kNoPP); |
1834 __ StoreToOffset(R2, R5, Isolate::vm_tag_offset(), kNoPP); | 1834 __ StoreToOffset(R2, R5, Isolate::vm_tag_offset(), kNoPP); |
1835 // Clear top exit frame. | 1835 // Clear top exit frame. |
1836 __ StoreToOffset(ZR, R5, Isolate::top_exit_frame_info_offset(), kNoPP); | 1836 __ StoreToOffset(ZR, R5, Isolate::top_exit_frame_info_offset(), kNoPP); |
1837 __ ret(); // Jump to the exception handler code. | 1837 __ ret(); // Jump to the exception handler code. |
1838 } | 1838 } |
1839 | 1839 |
1840 | 1840 |
1841 // Calls to the runtime to optimize the given function. | 1841 // Calls to the runtime to optimize the given function. |
1842 // R6: function to be re-optimized. | 1842 // R6: function to be re-optimized. |
1843 // R4: argument descriptor (preserved). | 1843 // R4: argument descriptor (preserved). |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 const Register right = R0; | 1967 const Register right = R0; |
1968 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); | 1968 __ LoadFromOffset(left, SP, 1 * kWordSize, kNoPP); |
1969 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); | 1969 __ LoadFromOffset(right, SP, 0 * kWordSize, kNoPP); |
1970 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); | 1970 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
1971 __ ret(); | 1971 __ ret(); |
1972 } | 1972 } |
1973 | 1973 |
1974 } // namespace dart | 1974 } // namespace dart |
1975 | 1975 |
1976 #endif // defined TARGET_ARCH_ARM64 | 1976 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |