| 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 30 matching lines...) Expand all Loading... |
| 41 const intptr_t exitframe_last_param_slot_from_fp = 2; | 41 const intptr_t exitframe_last_param_slot_from_fp = 2; |
| 42 | 42 |
| 43 __ SetPrologueOffset(); | 43 __ SetPrologueOffset(); |
| 44 __ TraceSimMsg("CallToRuntimeStub"); | 44 __ TraceSimMsg("CallToRuntimeStub"); |
| 45 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 45 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 46 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker | 46 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker |
| 47 __ sw(RA, Address(SP, 1 * kWordSize)); | 47 __ sw(RA, Address(SP, 1 * kWordSize)); |
| 48 __ sw(FP, Address(SP, 0 * kWordSize)); | 48 __ sw(FP, Address(SP, 0 * kWordSize)); |
| 49 __ mov(FP, SP); | 49 __ mov(FP, SP); |
| 50 | 50 |
| 51 // Load current Isolate pointer from Context structure into A0. | 51 __ LoadIsolate(A0); |
| 52 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | |
| 53 | 52 |
| 54 // Save exit frame information to enable stack walking as we are about | 53 // Save exit frame information to enable stack walking as we are about |
| 55 // to transition to Dart VM C++ code. | 54 // to transition to Dart VM C++ code. |
| 56 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 55 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
| 57 | 56 |
| 58 // Save current Context pointer into Isolate structure. | 57 // Save current Context pointer into Isolate structure. |
| 59 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 58 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
| 60 | 59 |
| 61 // Cache Isolate pointer into CTX while executing runtime code. | 60 // Cache Isolate pointer into CTX while executing runtime code. |
| 62 __ mov(CTX, A0); | 61 __ mov(CTX, A0); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const intptr_t retval_offset = NativeArguments::retval_offset(); | 166 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 168 | 167 |
| 169 __ SetPrologueOffset(); | 168 __ SetPrologueOffset(); |
| 170 __ TraceSimMsg("CallNativeCFunctionStub"); | 169 __ TraceSimMsg("CallNativeCFunctionStub"); |
| 171 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 170 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 172 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker | 171 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker |
| 173 __ sw(RA, Address(SP, 1 * kWordSize)); | 172 __ sw(RA, Address(SP, 1 * kWordSize)); |
| 174 __ sw(FP, Address(SP, 0 * kWordSize)); | 173 __ sw(FP, Address(SP, 0 * kWordSize)); |
| 175 __ mov(FP, SP); | 174 __ mov(FP, SP); |
| 176 | 175 |
| 177 // Load current Isolate pointer from Context structure into A0. | 176 __ LoadIsolate(A0); |
| 178 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | |
| 179 | 177 |
| 180 // Save exit frame information to enable stack walking as we are about | 178 // Save exit frame information to enable stack walking as we are about |
| 181 // to transition to native code. | 179 // to transition to native code. |
| 182 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 180 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
| 183 | 181 |
| 184 // Save current Context pointer into Isolate structure. | 182 // Save current Context pointer into Isolate structure. |
| 185 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 183 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
| 186 | 184 |
| 187 // Cache Isolate pointer into CTX while executing native code. | 185 // Cache Isolate pointer into CTX while executing native code. |
| 188 __ mov(CTX, A0); | 186 __ mov(CTX, A0); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 const intptr_t retval_offset = NativeArguments::retval_offset(); | 280 const intptr_t retval_offset = NativeArguments::retval_offset(); |
| 283 | 281 |
| 284 __ SetPrologueOffset(); | 282 __ SetPrologueOffset(); |
| 285 __ TraceSimMsg("CallNativeCFunctionStub"); | 283 __ TraceSimMsg("CallNativeCFunctionStub"); |
| 286 __ addiu(SP, SP, Immediate(-3 * kWordSize)); | 284 __ addiu(SP, SP, Immediate(-3 * kWordSize)); |
| 287 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker | 285 __ sw(ZR, Address(SP, 2 * kWordSize)); // Push 0 for the PC marker |
| 288 __ sw(RA, Address(SP, 1 * kWordSize)); | 286 __ sw(RA, Address(SP, 1 * kWordSize)); |
| 289 __ sw(FP, Address(SP, 0 * kWordSize)); | 287 __ sw(FP, Address(SP, 0 * kWordSize)); |
| 290 __ mov(FP, SP); | 288 __ mov(FP, SP); |
| 291 | 289 |
| 292 // Load current Isolate pointer from Context structure into A0. | 290 __ LoadIsolate(A0); |
| 293 __ lw(A0, FieldAddress(CTX, Context::isolate_offset())); | |
| 294 | 291 |
| 295 // Save exit frame information to enable stack walking as we are about | 292 // Save exit frame information to enable stack walking as we are about |
| 296 // to transition to native code. | 293 // to transition to native code. |
| 297 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); | 294 __ sw(SP, Address(A0, Isolate::top_exit_frame_info_offset())); |
| 298 | 295 |
| 299 // Save current Context pointer into Isolate structure. | 296 // Save current Context pointer into Isolate structure. |
| 300 __ sw(CTX, Address(A0, Isolate::top_context_offset())); | 297 __ sw(CTX, Address(A0, Isolate::top_context_offset())); |
| 301 | 298 |
| 302 // Cache Isolate pointer into CTX while executing native code. | 299 // Cache Isolate pointer into CTX while executing native code. |
| 303 __ mov(CTX, A0); | 300 __ mov(CTX, A0); |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 // T2: size and bit tags. | 1087 // T2: size and bit tags. |
| 1091 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); | 1088 __ LoadImmediate(TMP, RawObject::ClassIdTag::encode(cid)); |
| 1092 __ or_(T2, T2, TMP); | 1089 __ or_(T2, T2, TMP); |
| 1093 __ sw(T2, FieldAddress(V0, Context::tags_offset())); | 1090 __ sw(T2, FieldAddress(V0, Context::tags_offset())); |
| 1094 | 1091 |
| 1095 // Setup up number of context variables field. | 1092 // Setup up number of context variables field. |
| 1096 // V0: new object. | 1093 // V0: new object. |
| 1097 // T1: number of context variables as integer value (not object). | 1094 // T1: number of context variables as integer value (not object). |
| 1098 __ sw(T1, FieldAddress(V0, Context::num_variables_offset())); | 1095 __ sw(T1, FieldAddress(V0, Context::num_variables_offset())); |
| 1099 | 1096 |
| 1100 // Setup isolate field. | |
| 1101 // V0: new object. | |
| 1102 // T1: number of context variables. | |
| 1103 // T2: isolate, not an object. | |
| 1104 __ LoadIsolate(T2); | |
| 1105 __ sw(T2, FieldAddress(V0, Context::isolate_offset())); | |
| 1106 | |
| 1107 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null())); | 1097 __ LoadImmediate(T7, reinterpret_cast<intptr_t>(Object::null())); |
| 1108 | 1098 |
| 1109 // Initialize the context variables. | 1099 // Initialize the context variables. |
| 1110 // V0: new object. | 1100 // V0: new object. |
| 1111 // T1: number of context variables. | 1101 // T1: number of context variables. |
| 1112 Label loop, loop_exit; | 1102 Label loop, loop_exit; |
| 1113 __ blez(T1, &loop_exit); | 1103 __ blez(T1, &loop_exit); |
| 1114 // Setup the parent field. | 1104 // Setup the parent field. |
| 1115 __ delay_slot()->sw(T7, FieldAddress(V0, Context::parent_offset())); | 1105 __ delay_slot()->sw(T7, FieldAddress(V0, Context::parent_offset())); |
| 1116 __ AddImmediate(T3, V0, Context::variable_offset(0) - kHeapObjectTag); | 1106 __ AddImmediate(T3, V0, Context::variable_offset(0) - kHeapObjectTag); |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 __ LeaveStubFrame(); | 1922 __ LeaveStubFrame(); |
| 1933 __ jr(T0); | 1923 __ jr(T0); |
| 1934 } | 1924 } |
| 1935 | 1925 |
| 1936 | 1926 |
| 1937 // Called only from unoptimized code. All relevant registers have been saved. | 1927 // Called only from unoptimized code. All relevant registers have been saved. |
| 1938 // RA: return address. | 1928 // RA: return address. |
| 1939 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { | 1929 void StubCode::GenerateDebugStepCheckStub(Assembler* assembler) { |
| 1940 // Check single stepping. | 1930 // Check single stepping. |
| 1941 Label stepping, done_stepping; | 1931 Label stepping, done_stepping; |
| 1942 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); | 1932 __ LoadIsolate(T0); |
| 1943 __ lbu(T0, Address(T0, Isolate::single_step_offset())); | 1933 __ lbu(T0, Address(T0, Isolate::single_step_offset())); |
| 1944 __ BranchNotEqual(T0, Immediate(0), &stepping); | 1934 __ BranchNotEqual(T0, Immediate(0), &stepping); |
| 1945 __ Bind(&done_stepping); | 1935 __ Bind(&done_stepping); |
| 1946 | 1936 |
| 1947 __ Ret(); | 1937 __ Ret(); |
| 1948 | 1938 |
| 1949 // Call single step callback in debugger. | 1939 // Call single step callback in debugger. |
| 1950 __ Bind(&stepping); | 1940 __ Bind(&stepping); |
| 1951 __ EnterStubFrame(); | 1941 __ EnterStubFrame(); |
| 1952 __ addiu(SP, SP, Immediate(-1 * kWordSize)); | 1942 __ addiu(SP, SP, Immediate(-1 * kWordSize)); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2221 | 2211 |
| 2222 // Called only from unoptimized code. All relevant registers have been saved. | 2212 // Called only from unoptimized code. All relevant registers have been saved. |
| 2223 // RA: return address. | 2213 // RA: return address. |
| 2224 // SP + 4: left operand. | 2214 // SP + 4: left operand. |
| 2225 // SP + 0: right operand. | 2215 // SP + 0: right operand. |
| 2226 // Returns: CMPRES1 is zero if equal, non-zero otherwise. | 2216 // Returns: CMPRES1 is zero if equal, non-zero otherwise. |
| 2227 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( | 2217 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
| 2228 Assembler* assembler) { | 2218 Assembler* assembler) { |
| 2229 // Check single stepping. | 2219 // Check single stepping. |
| 2230 Label stepping, done_stepping; | 2220 Label stepping, done_stepping; |
| 2231 __ lw(T0, FieldAddress(CTX, Context::isolate_offset())); | 2221 __ LoadIsolate(T0); |
| 2232 __ lbu(T0, Address(T0, Isolate::single_step_offset())); | 2222 __ lbu(T0, Address(T0, Isolate::single_step_offset())); |
| 2233 __ BranchNotEqual(T0, Immediate(0), &stepping); | 2223 __ BranchNotEqual(T0, Immediate(0), &stepping); |
| 2234 __ Bind(&done_stepping); | 2224 __ Bind(&done_stepping); |
| 2235 | 2225 |
| 2236 const Register temp1 = T2; | 2226 const Register temp1 = T2; |
| 2237 const Register temp2 = T3; | 2227 const Register temp2 = T3; |
| 2238 const Register left = T1; | 2228 const Register left = T1; |
| 2239 const Register right = T0; | 2229 const Register right = T0; |
| 2240 __ lw(left, Address(SP, 1 * kWordSize)); | 2230 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2241 __ lw(right, Address(SP, 0 * kWordSize)); | 2231 __ lw(right, Address(SP, 0 * kWordSize)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2267 const Register right = T0; | 2257 const Register right = T0; |
| 2268 __ lw(left, Address(SP, 1 * kWordSize)); | 2258 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2269 __ lw(right, Address(SP, 0 * kWordSize)); | 2259 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2270 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2260 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2271 __ Ret(); | 2261 __ Ret(); |
| 2272 } | 2262 } |
| 2273 | 2263 |
| 2274 } // namespace dart | 2264 } // namespace dart |
| 2275 | 2265 |
| 2276 #endif // defined TARGET_ARCH_MIPS | 2266 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |