| 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 21 matching lines...) Expand all Loading... |
| 32 // SP : address of last argument in argument array. | 32 // SP : address of last argument in argument array. |
| 33 // SP + 4*S4 - 4 : address of first argument in argument array. | 33 // SP + 4*S4 - 4 : address of first argument in argument array. |
| 34 // SP + 4*S4 : address of return value. | 34 // SP + 4*S4 : address of return value. |
| 35 // S5 : address of the runtime function to call. | 35 // S5 : address of the runtime function to call. |
| 36 // S4 : number of arguments to the call. | 36 // S4 : number of arguments to the call. |
| 37 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { | 37 void StubCode::GenerateCallToRuntimeStub(Assembler* assembler) { |
| 38 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 38 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 39 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 39 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 40 const intptr_t argv_offset = NativeArguments::argv_offset(); | 40 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 41 const intptr_t retval_offset = NativeArguments::retval_offset(); | 41 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 42 const intptr_t exitframe_last_param_slot_from_fp = 1; |
| 42 | 43 |
| 43 __ SetPrologueOffset(); | 44 __ SetPrologueOffset(); |
| 44 __ TraceSimMsg("CallToRuntimeStub"); | 45 __ TraceSimMsg("CallToRuntimeStub"); |
| 45 __ EnterStubFrame(); | 46 __ EnterFrame(); |
| 46 | 47 |
| 47 // Load current Isolate pointer from Context structure into A0. | 48 // Load current Isolate pointer from Context structure into A0. |
| 48 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | 49 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); |
| 49 | 50 |
| 50 // Save exit frame information to enable stack walking as we are about | 51 // Save exit frame information to enable stack walking as we are about |
| 51 // to transition to Dart VM C++ code. | 52 // to transition to Dart VM C++ code. |
| 52 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 53 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
| 53 | 54 |
| 54 // Save current Context pointer into Isolate structure. | 55 // Save current Context pointer into Isolate structure. |
| 55 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 56 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 70 | 71 |
| 71 // There are no runtime calls to closures, so we do not need to set the tag | 72 // There are no runtime calls to closures, so we do not need to set the tag |
| 72 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. | 73 // bits kClosureFunctionBit and kInstanceFunctionBit in argc_tag_. |
| 73 ASSERT(argc_tag_offset == 1 * kWordSize); | 74 ASSERT(argc_tag_offset == 1 * kWordSize); |
| 74 __ mov(A1, S4); // Set argc in NativeArguments. | 75 __ mov(A1, S4); // Set argc in NativeArguments. |
| 75 | 76 |
| 76 ASSERT(argv_offset == 2 * kWordSize); | 77 ASSERT(argv_offset == 2 * kWordSize); |
| 77 __ sll(A2, S4, 2); | 78 __ sll(A2, S4, 2); |
| 78 __ addu(A2, FP, A2); // Compute argv. | 79 __ addu(A2, FP, A2); // Compute argv. |
| 79 // Set argv in NativeArguments. | 80 // Set argv in NativeArguments. |
| 80 __ addiu(A2, A2, Immediate(kParamEndSlotFromFp * kWordSize)); | 81 __ addiu(A2, A2, Immediate(exitframe_last_param_slot_from_fp * kWordSize)); |
| 81 | 82 |
| 82 ASSERT(retval_offset == 3 * kWordSize); | 83 ASSERT(retval_offset == 3 * kWordSize); |
| 83 | 84 |
| 84 // Call runtime or redirection via simulator. | 85 // Call runtime or redirection via simulator. |
| 85 __ jalr(S5); | 86 __ jalr(S5); |
| 86 // Retval is next to 1st argument. | 87 // Retval is next to 1st argument. |
| 87 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); | 88 __ delay_slot()->addiu(A3, A2, Immediate(kWordSize)); |
| 88 __ TraceSimMsg("CallToRuntimeStub return"); | 89 __ TraceSimMsg("CallToRuntimeStub return"); |
| 89 | 90 |
| 90 // Reset exit frame information in Isolate structure. | 91 // Reset exit frame information in Isolate structure. |
| 91 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); | 92 __ sw(ZR, Address(CTX, Isolate::top_exit_frame_info_offset())); |
| 92 | 93 |
| 93 // Load Context pointer from Isolate structure into A2. | 94 // Load Context pointer from Isolate structure into A2. |
| 94 __ lw(A2, Address(CTX, Isolate::top_context_offset())); | 95 __ lw(A2, Address(CTX, Isolate::top_context_offset())); |
| 95 | 96 |
| 96 // Load null. | 97 // Load null. |
| 97 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 98 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 98 | 99 |
| 99 // Reset Context pointer in Isolate structure. | 100 // Reset Context pointer in Isolate structure. |
| 100 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); | 101 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); |
| 101 | 102 |
| 102 // Cache Context pointer into CTX while executing Dart code. | 103 // Cache Context pointer into CTX while executing Dart code. |
| 103 __ mov(CTX, A2); | 104 __ mov(CTX, A2); |
| 104 | 105 |
| 105 __ LeaveStubFrameAndReturn(); | 106 __ LeaveFrameAndReturn(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 | 109 |
| 109 // Print the stop message. | 110 // Print the stop message. |
| 110 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { | 111 DEFINE_LEAF_RUNTIME_ENTRY(void, PrintStopMessage, 1, const char* message) { |
| 111 OS::Print("Stop message: %s\n", message); | 112 OS::Print("Stop message: %s\n", message); |
| 112 } | 113 } |
| 113 END_LEAF_RUNTIME_ENTRY | 114 END_LEAF_RUNTIME_ENTRY |
| 114 | 115 |
| 115 | 116 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 132 // A2 : address of first argument in argument array. | 133 // A2 : address of first argument in argument array. |
| 133 // A1 : argc_tag including number of arguments and function kind. | 134 // A1 : argc_tag including number of arguments and function kind. |
| 134 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { | 135 void StubCode::GenerateCallNativeCFunctionStub(Assembler* assembler) { |
| 135 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 136 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 136 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 137 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 137 const intptr_t argv_offset = NativeArguments::argv_offset(); | 138 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 138 const intptr_t retval_offset = NativeArguments::retval_offset(); | 139 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 139 | 140 |
| 140 __ SetPrologueOffset(); | 141 __ SetPrologueOffset(); |
| 141 __ TraceSimMsg("CallNativeCFunctionStub"); | 142 __ TraceSimMsg("CallNativeCFunctionStub"); |
| 142 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 143 __ EnterFrame(); |
| 143 __ sw(RA, Address(SP, 1 * kWordSize)); | |
| 144 __ sw(FP, Address(SP, 0 * kWordSize)); | |
| 145 __ mov(FP, SP); | |
| 146 | 144 |
| 147 // Load current Isolate pointer from Context structure into A0. | 145 // Load current Isolate pointer from Context structure into A0. |
| 148 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | 146 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); |
| 149 | 147 |
| 150 // Save exit frame information to enable stack walking as we are about | 148 // Save exit frame information to enable stack walking as we are about |
| 151 // to transition to native code. | 149 // to transition to native code. |
| 152 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 150 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
| 153 | 151 |
| 154 // Save current Context pointer into Isolate structure. | 152 // Save current Context pointer into Isolate structure. |
| 155 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 153 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 205 |
| 208 // Load null. | 206 // Load null. |
| 209 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 207 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 210 | 208 |
| 211 // Reset Context pointer in Isolate structure. | 209 // Reset Context pointer in Isolate structure. |
| 212 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); | 210 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); |
| 213 | 211 |
| 214 // Cache Context pointer into CTX while executing Dart code. | 212 // Cache Context pointer into CTX while executing Dart code. |
| 215 __ mov(CTX, A2); | 213 __ mov(CTX, A2); |
| 216 | 214 |
| 217 __ mov(SP, FP); | 215 __ LeaveFrameAndReturn(); |
| 218 __ lw(RA, Address(SP, 1 * kWordSize)); | |
| 219 __ lw(FP, Address(SP, 0 * kWordSize)); | |
| 220 __ Ret(); | |
| 221 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | |
| 222 } | 216 } |
| 223 | 217 |
| 224 | 218 |
| 225 // Input parameters: | 219 // Input parameters: |
| 226 // RA : return address. | 220 // RA : return address. |
| 227 // SP : address of return value. | 221 // SP : address of return value. |
| 228 // T5 : address of the native function to call. | 222 // T5 : address of the native function to call. |
| 229 // A2 : address of first argument in argument array. | 223 // A2 : address of first argument in argument array. |
| 230 // A1 : argc_tag including number of arguments and function kind. | 224 // A1 : argc_tag including number of arguments and function kind. |
| 231 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { | 225 void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) { |
| 232 const intptr_t isolate_offset = NativeArguments::isolate_offset(); | 226 const intptr_t isolate_offset = NativeArguments::isolate_offset(); |
| 233 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); | 227 const intptr_t argc_tag_offset = NativeArguments::argc_tag_offset(); |
| 234 const intptr_t argv_offset = NativeArguments::argv_offset(); | 228 const intptr_t argv_offset = NativeArguments::argv_offset(); |
| 235 const intptr_t retval_offset = NativeArguments::retval_offset(); | 229 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 236 | 230 |
| 237 __ SetPrologueOffset(); | 231 __ SetPrologueOffset(); |
| 238 __ TraceSimMsg("CallNativeCFunctionStub"); | 232 __ TraceSimMsg("CallNativeCFunctionStub"); |
| 239 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 233 __ EnterFrame(); |
| 240 __ sw(RA, Address(SP, 1 * kWordSize)); | |
| 241 __ sw(FP, Address(SP, 0 * kWordSize)); | |
| 242 __ mov(FP, SP); | |
| 243 | 234 |
| 244 // Load current Isolate pointer from Context structure into A0. | 235 // Load current Isolate pointer from Context structure into A0. |
| 245 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | 236 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); |
| 246 | 237 |
| 247 // Save exit frame information to enable stack walking as we are about | 238 // Save exit frame information to enable stack walking as we are about |
| 248 // to transition to native code. | 239 // to transition to native code. |
| 249 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 240 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
| 250 | 241 |
| 251 // Save current Context pointer into Isolate structure. | 242 // Save current Context pointer into Isolate structure. |
| 252 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 243 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 286 |
| 296 // Load null. | 287 // Load null. |
| 297 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | 288 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); |
| 298 | 289 |
| 299 // Reset Context pointer in Isolate structure. | 290 // Reset Context pointer in Isolate structure. |
| 300 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); | 291 __ sw(TMP, Address(CTX, Isolate::top_context_offset())); |
| 301 | 292 |
| 302 // Cache Context pointer into CTX while executing Dart code. | 293 // Cache Context pointer into CTX while executing Dart code. |
| 303 __ mov(CTX, A2); | 294 __ mov(CTX, A2); |
| 304 | 295 |
| 305 __ mov(SP, FP); | 296 __ LeaveFrameAndReturn(); |
| 306 __ lw(RA, Address(SP, 1 * kWordSize)); | |
| 307 __ lw(FP, Address(SP, 0 * kWordSize)); | |
| 308 __ Ret(); | |
| 309 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | |
| 310 } | 297 } |
| 311 | 298 |
| 312 | 299 |
| 313 // Input parameters: | 300 // Input parameters: |
| 314 // S4: arguments descriptor array. | 301 // S4: arguments descriptor array. |
| 315 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { | 302 void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) { |
| 316 __ TraceSimMsg("CallStaticFunctionStub"); | 303 __ TraceSimMsg("CallStaticFunctionStub"); |
| 317 __ EnterStubFrame(); | 304 __ EnterStubFrame(); |
| 318 // Setup space on stack for return value and preserve arguments descriptor. | 305 // Setup space on stack for return value and preserve arguments descriptor. |
| 319 | 306 |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 // Called when invoking Dart code from C++ (VM code). | 881 // Called when invoking Dart code from C++ (VM code). |
| 895 // Input parameters: | 882 // Input parameters: |
| 896 // RA : points to return address. | 883 // RA : points to return address. |
| 897 // A0 : entrypoint of the Dart function to call. | 884 // A0 : entrypoint of the Dart function to call. |
| 898 // A1 : arguments descriptor array. | 885 // A1 : arguments descriptor array. |
| 899 // A2 : arguments array. | 886 // A2 : arguments array. |
| 900 // A3 : new context containing the current isolate pointer. | 887 // A3 : new context containing the current isolate pointer. |
| 901 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { | 888 void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) { |
| 902 // Save frame pointer coming in. | 889 // Save frame pointer coming in. |
| 903 __ TraceSimMsg("InvokeDartCodeStub"); | 890 __ TraceSimMsg("InvokeDartCodeStub"); |
| 904 __ EnterStubFrame(); | 891 __ EnterFrame(); |
| 905 | 892 |
| 906 // Save new context and C++ ABI callee-saved registers. | 893 // Save new context and C++ ABI callee-saved registers. |
| 907 | 894 |
| 908 // The new context, the top exit frame, and the old context. | 895 // The new context, the top exit frame, and the old context. |
| 909 const intptr_t kPreservedContextSlots = 3; | 896 const intptr_t kPreservedContextSlots = 3; |
| 910 const intptr_t kNewContextOffsetFromFp = | 897 const intptr_t kNewContextOffsetFromFp = |
| 911 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; | 898 -(1 + kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount) * kWordSize; |
| 912 const intptr_t kPreservedRegSpace = | 899 const intptr_t kPreservedRegSpace = |
| 913 kWordSize * (kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount + | 900 kWordSize * (kAbiPreservedCpuRegCount + kAbiPreservedFpuRegCount + |
| 914 kPreservedContextSlots); | 901 kPreservedContextSlots); |
| 915 | 902 |
| 916 __ addiu(SP, SP, Immediate(-kPreservedRegSpace)); | 903 __ addiu(SP, SP, Immediate(-kPreservedRegSpace)); |
| 917 for (int i = S0; i <= S7; i++) { | 904 for (int i = S0; i <= S7; i++) { |
| 918 Register r = static_cast<Register>(i); | 905 Register r = static_cast<Register>(i); |
| 919 const intptr_t slot = i - S0 + kPreservedContextSlots; | 906 const intptr_t slot = i - S0 + kPreservedContextSlots; |
| 920 __ sw(r, Address(SP, slot * kWordSize)); | 907 __ sw(r, Address(SP, slot * kWordSize)); |
| 921 } | 908 } |
| 922 | 909 |
| 923 for (intptr_t i = kAbiFirstPreservedFpuReg; | 910 for (intptr_t i = kAbiFirstPreservedFpuReg; |
| 924 i <= kAbiLastPreservedFpuReg; i++) { | 911 i <= kAbiLastPreservedFpuReg; i++) { |
| 925 FRegister r = static_cast<FRegister>(i); | 912 FRegister r = static_cast<FRegister>(i); |
| 926 const intptr_t slot = | 913 const intptr_t slot = |
| 927 kAbiPreservedCpuRegCount + kPreservedContextSlots + i - | 914 kAbiPreservedCpuRegCount + kPreservedContextSlots + i - |
| 928 kAbiFirstPreservedFpuReg; | 915 kAbiFirstPreservedFpuReg; |
| 929 __ swc1(r, Address(SP, slot * kWordSize)); | 916 __ swc1(r, Address(SP, slot * kWordSize)); |
| 930 } | 917 } |
| 931 | 918 |
| 932 __ sw(A3, Address(SP, 2 * kWordSize)); | 919 __ sw(A3, Address(SP, 2 * kWordSize)); |
| 933 | 920 |
| 921 // We now load the pool pointer(PP) as we are about to invoke dart code and we |
| 922 // could potentially invoke some intrinsic functions which need the PP to be |
| 923 // set up. |
| 924 __ LoadPoolPointer(); |
| 925 |
| 934 // The new Context structure contains a pointer to the current Isolate | 926 // The new Context structure contains a pointer to the current Isolate |
| 935 // structure. Cache the Context pointer in the CTX register so that it is | 927 // structure. Cache the Context pointer in the CTX register so that it is |
| 936 // available in generated code and calls to Isolate::Current() need not be | 928 // available in generated code and calls to Isolate::Current() need not be |
| 937 // done. The assumption is that this register will never be clobbered by | 929 // done. The assumption is that this register will never be clobbered by |
| 938 // compiled or runtime stub code. | 930 // compiled or runtime stub code. |
| 939 | 931 |
| 940 // Cache the new Context pointer into CTX while executing Dart code. | 932 // Cache the new Context pointer into CTX while executing Dart code. |
| 941 __ lw(CTX, Address(A3, VMHandles::kOffsetOfRawPtrInHandle)); | 933 __ lw(CTX, Address(A3, VMHandles::kOffsetOfRawPtrInHandle)); |
| 942 | 934 |
| 943 // Load Isolate pointer from Context structure into temporary register R8. | 935 // Load Isolate pointer from Context structure into temporary register R8. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 const intptr_t slot = | 1019 const intptr_t slot = |
| 1028 kAbiPreservedCpuRegCount + kPreservedContextSlots + i - | 1020 kAbiPreservedCpuRegCount + kPreservedContextSlots + i - |
| 1029 kAbiFirstPreservedFpuReg; | 1021 kAbiFirstPreservedFpuReg; |
| 1030 __ lwc1(r, Address(SP, slot * kWordSize)); | 1022 __ lwc1(r, Address(SP, slot * kWordSize)); |
| 1031 } | 1023 } |
| 1032 | 1024 |
| 1033 __ lw(A3, Address(SP, 2 * kWordSize)); | 1025 __ lw(A3, Address(SP, 2 * kWordSize)); |
| 1034 __ addiu(SP, SP, Immediate(kPreservedRegSpace)); | 1026 __ addiu(SP, SP, Immediate(kPreservedRegSpace)); |
| 1035 | 1027 |
| 1036 // Restore the frame pointer and return. | 1028 // Restore the frame pointer and return. |
| 1037 __ LeaveStubFrameAndReturn(); | 1029 __ LeaveFrameAndReturn(); |
| 1038 } | 1030 } |
| 1039 | 1031 |
| 1040 | 1032 |
| 1041 // Called for inline allocation of contexts. | 1033 // Called for inline allocation of contexts. |
| 1042 // Input: | 1034 // Input: |
| 1043 // T1: number of context variables. | 1035 // T1: number of context variables. |
| 1044 // Output: | 1036 // Output: |
| 1045 // V0: new allocated RawContext object. | 1037 // V0: new allocated RawContext object. |
| 1046 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { | 1038 void StubCode::GenerateAllocateContextStub(Assembler* assembler) { |
| 1047 __ TraceSimMsg("AllocateContext"); | 1039 __ TraceSimMsg("AllocateContext"); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 __ sw(T7, Address(SP, 1 * kWordSize)); | 1393 __ sw(T7, Address(SP, 1 * kWordSize)); |
| 1402 __ sw(T1, Address(SP, 0 * kWordSize)); | 1394 __ sw(T1, Address(SP, 0 * kWordSize)); |
| 1403 } | 1395 } |
| 1404 __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object. | 1396 __ CallRuntime(kAllocateObjectRuntimeEntry, 3); // Allocate object. |
| 1405 __ TraceSimMsg("AllocationStubForClass return"); | 1397 __ TraceSimMsg("AllocationStubForClass return"); |
| 1406 // Pop result (newly allocated object). | 1398 // Pop result (newly allocated object). |
| 1407 __ lw(V0, Address(SP, 3 * kWordSize)); | 1399 __ lw(V0, Address(SP, 3 * kWordSize)); |
| 1408 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Pop arguments. | 1400 __ addiu(SP, SP, Immediate(4 * kWordSize)); // Pop arguments. |
| 1409 // V0: new object | 1401 // V0: new object |
| 1410 // Restore the frame pointer and return. | 1402 // Restore the frame pointer and return. |
| 1411 __ LeaveStubFrameAndReturn(RA, true); | 1403 __ LeaveStubFrameAndReturn(RA); |
| 1412 } | 1404 } |
| 1413 | 1405 |
| 1414 | 1406 |
| 1415 // Called for inline allocation of closures. | 1407 // Called for inline allocation of closures. |
| 1416 // Input parameters: | 1408 // Input parameters: |
| 1417 // RA: return address. | 1409 // RA: return address. |
| 1418 // SP + 4 : receiver (null if not an implicit instance closure). | 1410 // SP + 4 : receiver (null if not an implicit instance closure). |
| 1419 // SP + 0 : type arguments object (null if class is no parameterized). | 1411 // SP + 0 : type arguments object (null if class is no parameterized). |
| 1420 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, | 1412 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, |
| 1421 const Function& func) { | 1413 const Function& func) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 } | 1501 } |
| 1510 | 1502 |
| 1511 // Set the type arguments field in the newly allocated closure. | 1503 // Set the type arguments field in the newly allocated closure. |
| 1512 __ lw(T0, Address(FP, kTypeArgumentsFPOffset)); | 1504 __ lw(T0, Address(FP, kTypeArgumentsFPOffset)); |
| 1513 __ sw(T0, Address(T2, Closure::type_arguments_offset())); | 1505 __ sw(T0, Address(T2, Closure::type_arguments_offset())); |
| 1514 | 1506 |
| 1515 // Done allocating and initializing the instance. | 1507 // Done allocating and initializing the instance. |
| 1516 // V0: new object. | 1508 // V0: new object. |
| 1517 __ addiu(V0, T2, Immediate(kHeapObjectTag)); | 1509 __ addiu(V0, T2, Immediate(kHeapObjectTag)); |
| 1518 | 1510 |
| 1519 __ LeaveStubFrameAndReturn(RA, true); | 1511 __ LeaveStubFrameAndReturn(RA); |
| 1520 | 1512 |
| 1521 __ Bind(&slow_case); | 1513 __ Bind(&slow_case); |
| 1522 } | 1514 } |
| 1523 | 1515 |
| 1524 // If it's an implicit instance closure we need 4 stack slots, o/w only 3. | 1516 // If it's an implicit instance closure we need 4 stack slots, o/w only 3. |
| 1525 intptr_t num_slots = is_implicit_instance_closure ? 4 : 3; | 1517 intptr_t num_slots = is_implicit_instance_closure ? 4 : 3; |
| 1526 __ addiu(SP, SP, Immediate(-num_slots * kWordSize)); | 1518 __ addiu(SP, SP, Immediate(-num_slots * kWordSize)); |
| 1527 // Setup space on stack for return value. | 1519 // Setup space on stack for return value. |
| 1528 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null())); | 1520 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null())); |
| 1529 __ sw(T7, Address(SP, (num_slots - 1) * kWordSize)); | 1521 __ sw(T7, Address(SP, (num_slots - 1) * kWordSize)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1545 } else { | 1537 } else { |
| 1546 ASSERT(func.IsNonImplicitClosureFunction()); | 1538 ASSERT(func.IsNonImplicitClosureFunction()); |
| 1547 __ CallRuntime(kAllocateClosureRuntimeEntry, 2); | 1539 __ CallRuntime(kAllocateClosureRuntimeEntry, 2); |
| 1548 __ TraceSimMsg("AllocationStubForClosure return"); | 1540 __ TraceSimMsg("AllocationStubForClosure return"); |
| 1549 } | 1541 } |
| 1550 __ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object. | 1542 __ lw(V0, Address(SP, (num_slots - 1) * kWordSize)); // Pop function object. |
| 1551 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); | 1543 __ addiu(SP, SP, Immediate(num_slots * kWordSize)); |
| 1552 | 1544 |
| 1553 // V0: new object | 1545 // V0: new object |
| 1554 // Restore the frame pointer. | 1546 // Restore the frame pointer. |
| 1555 __ LeaveStubFrameAndReturn(RA, true); | 1547 __ LeaveStubFrameAndReturn(RA); |
| 1556 } | 1548 } |
| 1557 | 1549 |
| 1558 | 1550 |
| 1559 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1551 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1560 // from the entry code of a dart function after an error in passed argument | 1552 // from the entry code of a dart function after an error in passed argument |
| 1561 // name or number is detected. | 1553 // name or number is detected. |
| 1562 // Input parameters: | 1554 // Input parameters: |
| 1563 // RA : return address. | 1555 // RA : return address. |
| 1564 // SP : address of last argument. | 1556 // SP : address of last argument. |
| 1565 // S5: inline cache data object. | 1557 // S5: inline cache data object. |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 const Register right = T0; | 2411 const Register right = T0; |
| 2420 __ lw(left, Address(SP, 1 * kWordSize)); | 2412 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2421 __ lw(right, Address(SP, 0 * kWordSize)); | 2413 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2422 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2414 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2423 __ Ret(); | 2415 __ Ret(); |
| 2424 } | 2416 } |
| 2425 | 2417 |
| 2426 } // namespace dart | 2418 } // namespace dart |
| 2427 | 2419 |
| 2428 #endif // defined TARGET_ARCH_MIPS | 2420 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |