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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Save current Context pointer into Isolate structure. | 60 // Save current Context pointer into Isolate structure. |
61 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 61 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
62 | 62 |
63 // Cache Isolate pointer into CTX while executing runtime code. | 63 // Cache Isolate pointer into CTX while executing runtime code. |
64 __ mov(CTX, A0); | 64 __ mov(CTX, A0); |
65 | 65 |
66 #if defined(DEBUG) | 66 #if defined(DEBUG) |
67 { Label ok; | 67 { Label ok; |
68 // Check that we are always entering from Dart code. | 68 // Check that we are always entering from Dart code. |
69 __ lw(T0, Address(A0, Isolate::vm_tag_offset())); | 69 __ lw(T0, Address(A0, Isolate::vm_tag_offset())); |
70 __ BranchEqual(T0, VMTag::kScriptTagId, &ok); | 70 __ BranchEqual(T0, VMTag::kDartTagId, &ok); |
71 __ Stop("Not coming from Dart code."); | 71 __ Stop("Not coming from Dart code."); |
72 __ Bind(&ok); | 72 __ Bind(&ok); |
73 } | 73 } |
74 #endif | 74 #endif |
75 | 75 |
76 // Mark that the isolate is executing VM code. | 76 // Mark that the isolate is executing VM code. |
77 __ sw(S5, Address(A0, Isolate::vm_tag_offset())); | 77 __ sw(S5, Address(A0, Isolate::vm_tag_offset())); |
78 | 78 |
79 // Reserve space for arguments and align frame before entering C++ world. | 79 // Reserve space for arguments and align frame before entering C++ world. |
80 // NativeArguments are passed in registers. | 80 // NativeArguments are passed in registers. |
(...skipping 23 matching lines...) Expand all Loading... |
104 // the MIPS ABI. | 104 // the MIPS ABI. |
105 __ mov(T9, S5); | 105 __ mov(T9, S5); |
106 __ jalr(T9); | 106 __ jalr(T9); |
107 | 107 |
108 ASSERT(retval_offset == 3 * kWordSize); | 108 ASSERT(retval_offset == 3 * kWordSize); |
109 // Retval is next to 1st argument. | 109 // Retval is next to 1st argument. |
110 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); | 110 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); |
111 __ TraceSimMsg("CallToRuntimeStub return"); | 111 __ TraceSimMsg("CallToRuntimeStub return"); |
112 | 112 |
113 // Mark that the isolate is executing Dart code. | 113 // Mark that the isolate is executing Dart code. |
114 __ LoadImmediate(A2, VMTag::kScriptTagId); | 114 __ LoadImmediate(A2, VMTag::kDartTagId); |
115 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); | 115 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); |
116 | 116 |
117 // Reset exit frame information in Isolate structure. | 117 // Reset exit frame information in Isolate structure. |
118 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 118 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
119 | 119 |
120 // Load Context pointer from Isolate structure into A2. | 120 // Load Context pointer from Isolate structure into A2. |
121 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 121 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
122 | 122 |
123 // Load null. | 123 // Load null. |
124 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 124 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // Save current Context pointer into Isolate structure. | 186 // Save current Context pointer into Isolate structure. |
187 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 187 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
188 | 188 |
189 // Cache Isolate pointer into CTX while executing native code. | 189 // Cache Isolate pointer into CTX while executing native code. |
190 __ mov(CTX, A0); | 190 __ mov(CTX, A0); |
191 | 191 |
192 #if defined(DEBUG) | 192 #if defined(DEBUG) |
193 { Label ok; | 193 { Label ok; |
194 // Check that we are always entering from Dart code. | 194 // Check that we are always entering from Dart code. |
195 __ lw(T0, Address(A0, Isolate::vm_tag_offset())); | 195 __ lw(T0, Address(A0, Isolate::vm_tag_offset())); |
196 __ BranchEqual(T0, VMTag::kScriptTagId, &ok); | 196 __ BranchEqual(T0, VMTag::kDartTagId, &ok); |
197 __ Stop("Not coming from Dart code."); | 197 __ Stop("Not coming from Dart code."); |
198 __ Bind(&ok); | 198 __ Bind(&ok); |
199 } | 199 } |
200 #endif | 200 #endif |
201 | 201 |
202 // Mark that the isolate is executing Native code. | 202 // Mark that the isolate is executing Native code. |
203 __ sw(T5, Address(A0, Isolate::vm_tag_offset())); | 203 __ sw(T5, Address(A0, Isolate::vm_tag_offset())); |
204 | 204 |
205 // Initialize NativeArguments structure and call native function. | 205 // Initialize NativeArguments structure and call native function. |
206 // Registers A0, A1, A2, and A3 are used. | 206 // Registers A0, A1, A2, and A3 are used. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 entry = Simulator::RedirectExternalReference( | 238 entry = Simulator::RedirectExternalReference( |
239 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); | 239 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); |
240 __ LoadImmediate(T9, entry); | 240 __ LoadImmediate(T9, entry); |
241 __ jalr(T9); | 241 __ jalr(T9); |
242 #else | 242 #else |
243 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); | 243 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); |
244 #endif | 244 #endif |
245 __ TraceSimMsg("CallNativeCFunctionStub return"); | 245 __ TraceSimMsg("CallNativeCFunctionStub return"); |
246 | 246 |
247 // Mark that the isolate is executing Dart code. | 247 // Mark that the isolate is executing Dart code. |
248 __ LoadImmediate(A2, VMTag::kScriptTagId); | 248 __ LoadImmediate(A2, VMTag::kDartTagId); |
249 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); | 249 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); |
250 | 250 |
251 // Reset exit frame information in Isolate structure. | 251 // Reset exit frame information in Isolate structure. |
252 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 252 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
253 | 253 |
254 // Load Context pointer from Isolate structure into A2. | 254 // Load Context pointer from Isolate structure into A2. |
255 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 255 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
256 | 256 |
257 // Load null. | 257 // Load null. |
258 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 258 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // Save current Context pointer into Isolate structure. | 301 // Save current Context pointer into Isolate structure. |
302 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 302 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
303 | 303 |
304 // Cache Isolate pointer into CTX while executing native code. | 304 // Cache Isolate pointer into CTX while executing native code. |
305 __ mov(CTX, A0); | 305 __ mov(CTX, A0); |
306 | 306 |
307 #if defined(DEBUG) | 307 #if defined(DEBUG) |
308 { Label ok; | 308 { Label ok; |
309 // Check that we are always entering from Dart code. | 309 // Check that we are always entering from Dart code. |
310 __ lw(T0, Address(A0, Isolate::vm_tag_offset())); | 310 __ lw(T0, Address(A0, Isolate::vm_tag_offset())); |
311 __ BranchEqual(T0, VMTag::kScriptTagId, &ok); | 311 __ BranchEqual(T0, VMTag::kDartTagId, &ok); |
312 __ Stop("Not coming from Dart code."); | 312 __ Stop("Not coming from Dart code."); |
313 __ Bind(&ok); | 313 __ Bind(&ok); |
314 } | 314 } |
315 #endif | 315 #endif |
316 | 316 |
317 // Mark that the isolate is executing Native code. | 317 // Mark that the isolate is executing Native code. |
318 __ sw(T5, Address(A0, Isolate::vm_tag_offset())); | 318 __ sw(T5, Address(A0, Isolate::vm_tag_offset())); |
319 | 319 |
320 // Initialize NativeArguments structure and call native function. | 320 // Initialize NativeArguments structure and call native function. |
321 // Registers A0, A1, A2, and A3 are used. | 321 // Registers A0, A1, A2, and A3 are used. |
(...skipping 26 matching lines...) Expand all Loading... |
348 | 348 |
349 // Call native function or redirection via simulator. | 349 // Call native function or redirection via simulator. |
350 | 350 |
351 // We defensively always jalr through T9 because it is sometimes required by | 351 // We defensively always jalr through T9 because it is sometimes required by |
352 // the MIPS ABI. | 352 // the MIPS ABI. |
353 __ mov(T9, T5); | 353 __ mov(T9, T5); |
354 __ jalr(T9); | 354 __ jalr(T9); |
355 __ TraceSimMsg("CallNativeCFunctionStub return"); | 355 __ TraceSimMsg("CallNativeCFunctionStub return"); |
356 | 356 |
357 // Mark that the isolate is executing Dart code. | 357 // Mark that the isolate is executing Dart code. |
358 __ LoadImmediate(A2, VMTag::kScriptTagId); | 358 __ LoadImmediate(A2, VMTag::kDartTagId); |
359 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); | 359 __ sw(A2, Address(CTX, Isolate::vm_tag_offset())); |
360 | 360 |
361 // Reset exit frame information in Isolate structure. | 361 // Reset exit frame information in Isolate structure. |
362 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 362 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
363 | 363 |
364 // Load Context pointer from Isolate structure into A2. | 364 // Load Context pointer from Isolate structure into A2. |
365 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 365 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
366 | 366 |
367 // Load null. | 367 // Load null. |
368 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 368 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 | 855 |
856 // Load Isolate pointer from Context structure into temporary register R8. | 856 // Load Isolate pointer from Context structure into temporary register R8. |
857 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); | 857 __ lw(T2, FieldAddress(CTX, Context::isolate_offset())); |
858 | 858 |
859 // Save the current VMTag on the stack. | 859 // Save the current VMTag on the stack. |
860 ASSERT(kSavedVMTagSlotFromEntryFp == -22); | 860 ASSERT(kSavedVMTagSlotFromEntryFp == -22); |
861 __ lw(T1, Address(T2, Isolate::vm_tag_offset())); | 861 __ lw(T1, Address(T2, Isolate::vm_tag_offset())); |
862 __ sw(T1, Address(SP, 2 * kWordSize)); | 862 __ sw(T1, Address(SP, 2 * kWordSize)); |
863 | 863 |
864 // Mark that the isolate is executing Dart code. | 864 // Mark that the isolate is executing Dart code. |
865 __ LoadImmediate(T0, VMTag::kScriptTagId); | 865 __ LoadImmediate(T0, VMTag::kDartTagId); |
866 __ sw(T0, Address(T2, Isolate::vm_tag_offset())); | 866 __ sw(T0, Address(T2, Isolate::vm_tag_offset())); |
867 | 867 |
868 // Save the top exit frame info. Use T0 as a temporary register. | 868 // Save the top exit frame info. Use T0 as a temporary register. |
869 // StackFrameIterator reads the top exit frame info saved in this frame. | 869 // StackFrameIterator reads the top exit frame info saved in this frame. |
870 __ lw(T0, Address(T2, Isolate::top_exit_frame_info_offset())); | 870 __ lw(T0, Address(T2, Isolate::top_exit_frame_info_offset())); |
871 __ sw(ZR, Address(T2, Isolate::top_exit_frame_info_offset())); | 871 __ sw(ZR, Address(T2, Isolate::top_exit_frame_info_offset())); |
872 | 872 |
873 // Save the old Context pointer. Use T1 as a temporary register. | 873 // Save the old Context pointer. Use T1 as a temporary register. |
874 // Note that VisitObjectPointers will find this saved Context pointer during | 874 // Note that VisitObjectPointers will find this saved Context pointer during |
875 // GC marking, since it traverses any information between SP and | 875 // GC marking, since it traverses any information between SP and |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1934 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
1935 ASSERT(kExceptionObjectReg == V0); | 1935 ASSERT(kExceptionObjectReg == V0); |
1936 ASSERT(kStackTraceObjectReg == V1); | 1936 ASSERT(kStackTraceObjectReg == V1); |
1937 __ mov(V0, A3); // Exception object. | 1937 __ mov(V0, A3); // Exception object. |
1938 // MIPS ABI reserves stack space for all arguments. The StackTrace object is | 1938 // MIPS ABI reserves stack space for all arguments. The StackTrace object is |
1939 // the last of five arguments, so it is first pushed on the stack. | 1939 // the last of five arguments, so it is first pushed on the stack. |
1940 __ lw(V1, Address(SP, 4 * kWordSize)); // StackTrace object. | 1940 __ lw(V1, Address(SP, 4 * kWordSize)); // StackTrace object. |
1941 __ mov(FP, A2); // Frame_pointer. | 1941 __ mov(FP, A2); // Frame_pointer. |
1942 __ lw(A3, Address(SP, 5 * kWordSize)); // Isolate. | 1942 __ lw(A3, Address(SP, 5 * kWordSize)); // Isolate. |
1943 // Set tag. | 1943 // Set tag. |
1944 __ LoadImmediate(A2, VMTag::kScriptTagId); | 1944 __ LoadImmediate(A2, VMTag::kDartTagId); |
1945 __ sw(A2, Address(A3, Isolate::vm_tag_offset())); | 1945 __ sw(A2, Address(A3, Isolate::vm_tag_offset())); |
1946 // Clear top exit frame. | 1946 // Clear top exit frame. |
1947 __ sw(ZR, Address(A3, Isolate::top_exit_frame_info_offset())); | 1947 __ sw(ZR, Address(A3, Isolate::top_exit_frame_info_offset())); |
1948 | 1948 |
1949 __ jr(A0); // Jump to the exception handler code. | 1949 __ jr(A0); // Jump to the exception handler code. |
1950 __ delay_slot()->mov(SP, A1); // Stack pointer. | 1950 __ delay_slot()->mov(SP, A1); // Stack pointer. |
1951 } | 1951 } |
1952 | 1952 |
1953 | 1953 |
1954 // Calls to the runtime to optimize the given function. | 1954 // Calls to the runtime to optimize the given function. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 const Register right = T0; | 2112 const Register right = T0; |
2113 __ lw(left, Address(SP, 1 * kWordSize)); | 2113 __ lw(left, Address(SP, 1 * kWordSize)); |
2114 __ lw(right, Address(SP, 0 * kWordSize)); | 2114 __ lw(right, Address(SP, 0 * kWordSize)); |
2115 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2115 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
2116 __ Ret(); | 2116 __ Ret(); |
2117 } | 2117 } |
2118 | 2118 |
2119 } // namespace dart | 2119 } // namespace dart |
2120 | 2120 |
2121 #endif // defined TARGET_ARCH_MIPS | 2121 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |