| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 77 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 78 ASSERT(argc_tag_offset == 1 * kWordSize); | 78 ASSERT(argc_tag_offset == 1 * kWordSize); |
| 79 __ mov(A1, S4); // Set argc in NativeArguments. | 79 __ mov(A1, S4); // Set argc in NativeArguments. |
| 80 | 80 |
| 81 ASSERT(argv_offset == 2 * kWordSize); | 81 ASSERT(argv_offset == 2 * kWordSize); |
| 82 __ sll(A2, S4, 2); | 82 __ sll(A2, S4, 2); |
| 83 __ addu(A2, FP, A2); // Compute argv. | 83 __ addu(A2, FP, A2); // Compute argv. |
| 84 // Set argv in NativeArguments. | 84 // Set argv in NativeArguments. |
| 85 __ addiu(A2, A2, Immediate(exitframe_last_param_slot_from_fp * kWordSize)); | 85 __ addiu(A2, A2, Immediate(exitframe_last_param_slot_from_fp * kWordSize)); |
| 86 | 86 |
| 87 |
| 87 // Call runtime or redirection via simulator. | 88 // Call runtime or redirection via simulator. |
| 88 __ jalr(S5); | 89 // We defensively always jalr through T9 because it is sometimes required by |
| 90 // the MIPS ABI. |
| 91 __ mov(T9, S5); |
| 92 __ jalr(T9); |
| 93 |
| 89 ASSERT(retval_offset == 3 * kWordSize); | 94 ASSERT(retval_offset == 3 * kWordSize); |
| 90 // Retval is next to 1st argument. | 95 // Retval is next to 1st argument. |
| 91 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); | 96 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); |
| 92 __ TraceSimMsg("CallToRuntimeStub return"); | 97 __ TraceSimMsg("CallToRuntimeStub return"); |
| 93 | 98 |
| 94 // Reset exit frame information in Isolate structure. | 99 // Reset exit frame information in Isolate structure. |
| 95 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 100 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
| 96 | 101 |
| 97 // Load Context pointer from Isolate structure into A2. | 102 // Load Context pointer from Isolate structure into A2. |
| 98 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 103 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 __ AndImmediate(CMPRES1, A1, NativeArguments::AutoSetupScopeMask()); | 204 __ AndImmediate(CMPRES1, A1, NativeArguments::AutoSetupScopeMask()); |
| 200 __ beq(CMPRES1, ZR, &leaf_call); | 205 __ beq(CMPRES1, ZR, &leaf_call); |
| 201 | 206 |
| 202 __ mov(A1, T5); // Pass the function entrypoint. | 207 __ mov(A1, T5); // Pass the function entrypoint. |
| 203 __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1. | 208 __ ReserveAlignedFrameSpace(2 * kWordSize); // Just passing A0, A1. |
| 204 // Call native wrapper function or redirection via simulator. | 209 // Call native wrapper function or redirection via simulator. |
| 205 #if defined(USING_SIMULATOR) | 210 #if defined(USING_SIMULATOR) |
| 206 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); | 211 uword entry = reinterpret_cast<uword>(NativeEntry::NativeCallWrapper); |
| 207 entry = Simulator::RedirectExternalReference( | 212 entry = Simulator::RedirectExternalReference( |
| 208 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); | 213 entry, Simulator::kNativeCall, NativeEntry::kNumCallWrapperArguments); |
| 209 __ LoadImmediate(T5, entry); | 214 __ LoadImmediate(T9, entry); |
| 210 __ jalr(T5); | 215 __ jalr(T9); |
| 211 #else | 216 #else |
| 212 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); | 217 __ BranchLink(&NativeEntry::NativeCallWrapperLabel()); |
| 213 #endif | 218 #endif |
| 214 __ TraceSimMsg("CallNativeCFunctionStub return"); | 219 __ TraceSimMsg("CallNativeCFunctionStub return"); |
| 215 __ b(&done); | 220 __ b(&done); |
| 216 | 221 |
| 217 __ Bind(&leaf_call); | 222 __ Bind(&leaf_call); |
| 218 // Call native function or redirection via simulator. | 223 // Call native function or redirection via simulator. |
| 219 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. | 224 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. |
| 220 __ jalr(T5); | 225 |
| 226 |
| 227 // We defensively always jalr through T9 because it is sometimes required by |
| 228 // the MIPS ABI. |
| 229 __ mov(T9, T5); |
| 230 __ jalr(T9); |
| 221 | 231 |
| 222 __ Bind(&done); | 232 __ Bind(&done); |
| 223 | 233 |
| 224 // Reset exit frame information in Isolate structure. | 234 // Reset exit frame information in Isolate structure. |
| 225 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 235 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
| 226 | 236 |
| 227 // Load Context pointer from Isolate structure into A2. | 237 // Load Context pointer from Isolate structure into A2. |
| 228 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 238 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
| 229 | 239 |
| 230 // Load null. | 240 // Load null. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 310 __ addiu(SP, SP, Immediate(-4 * kWordSize)); |
| 301 __ sw(A3, Address(SP, 3 * kWordSize)); | 311 __ sw(A3, Address(SP, 3 * kWordSize)); |
| 302 __ sw(A2, Address(SP, 2 * kWordSize)); | 312 __ sw(A2, Address(SP, 2 * kWordSize)); |
| 303 __ sw(A1, Address(SP, 1 * kWordSize)); | 313 __ sw(A1, Address(SP, 1 * kWordSize)); |
| 304 __ sw(A0, Address(SP, 0 * kWordSize)); | 314 __ sw(A0, Address(SP, 0 * kWordSize)); |
| 305 __ mov(A0, SP); // Pass the pointer to the NativeArguments. | 315 __ mov(A0, SP); // Pass the pointer to the NativeArguments. |
| 306 | 316 |
| 307 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. | 317 __ ReserveAlignedFrameSpace(kWordSize); // Just passing A0. |
| 308 | 318 |
| 309 // Call native function or redirection via simulator. | 319 // Call native function or redirection via simulator. |
| 310 __ jalr(T5); | 320 |
| 321 // We defensively always jalr through T9 because it is sometimes required by |
| 322 // the MIPS ABI. |
| 323 __ mov(T9, T5); |
| 324 __ jalr(T9); |
| 311 __ TraceSimMsg("CallNativeCFunctionStub return"); | 325 __ TraceSimMsg("CallNativeCFunctionStub return"); |
| 312 | 326 |
| 313 // Reset exit frame information in Isolate structure. | 327 // Reset exit frame information in Isolate structure. |
| 314 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 328 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
| 315 | 329 |
| 316 // Load Context pointer from Isolate structure into A2. | 330 // Load Context pointer from Isolate structure into A2. |
| 317 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 331 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
| 318 | 332 |
| 319 // Load null. | 333 // Load null. |
| 320 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 334 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 __ Bind(&push_arguments); | 1030 __ Bind(&push_arguments); |
| 1017 __ lw(A3, Address(A2)); | 1031 __ lw(A3, Address(A2)); |
| 1018 __ Push(A3); | 1032 __ Push(A3); |
| 1019 __ addiu(A1, A1, Immediate(1)); | 1033 __ addiu(A1, A1, Immediate(1)); |
| 1020 __ BranchSignedLess(A1, T1, &push_arguments); | 1034 __ BranchSignedLess(A1, T1, &push_arguments); |
| 1021 __ delay_slot()->addiu(A2, A2, Immediate(kWordSize)); | 1035 __ delay_slot()->addiu(A2, A2, Immediate(kWordSize)); |
| 1022 | 1036 |
| 1023 __ Bind(&done_push_arguments); | 1037 __ Bind(&done_push_arguments); |
| 1024 | 1038 |
| 1025 // Call the Dart code entrypoint. | 1039 // Call the Dart code entrypoint. |
| 1040 // We are calling into Dart code, here, so there is no need to call through |
| 1041 // T9 to match the ABI. |
| 1026 __ jalr(A0); // S4 is the arguments descriptor array. | 1042 __ jalr(A0); // S4 is the arguments descriptor array. |
| 1027 __ TraceSimMsg("InvokeDartCodeStub return"); | 1043 __ TraceSimMsg("InvokeDartCodeStub return"); |
| 1028 | 1044 |
| 1029 // Read the saved new Context pointer. | 1045 // Read the saved new Context pointer. |
| 1030 __ lw(CTX, Address(FP, kNewContextOffsetFromFp)); | 1046 __ lw(CTX, Address(FP, kNewContextOffsetFromFp)); |
| 1031 __ lw(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); | 1047 __ lw(CTX, Address(CTX, VMHandles::kOffsetOfRawPtrInHandle)); |
| 1032 | 1048 |
| 1033 // Get rid of arguments pushed on the stack. | 1049 // Get rid of arguments pushed on the stack. |
| 1034 __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize); | 1050 __ AddImmediate(SP, FP, kSavedContextSlotFromEntryFp * kWordSize); |
| 1035 | 1051 |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2412 const Register right = T0; | 2428 const Register right = T0; |
| 2413 __ lw(left, Address(SP, 1 * kWordSize)); | 2429 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2414 __ lw(right, Address(SP, 0 * kWordSize)); | 2430 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2415 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2431 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2416 __ Ret(); | 2432 __ Ret(); |
| 2417 } | 2433 } |
| 2418 | 2434 |
| 2419 } // namespace dart | 2435 } // namespace dart |
| 2420 | 2436 |
| 2421 #endif // defined TARGET_ARCH_MIPS | 2437 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |