| 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 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 __ Ret(); | 1185 __ Ret(); |
| 1186 } | 1186 } |
| 1187 | 1187 |
| 1188 | 1188 |
| 1189 // Called for inline allocation of objects. | 1189 // Called for inline allocation of objects. |
| 1190 // Input parameters: | 1190 // Input parameters: |
| 1191 // RA : return address. | 1191 // RA : return address. |
| 1192 // SP + 0 : type arguments object (only if class is parameterized). | 1192 // SP + 0 : type arguments object (only if class is parameterized). |
| 1193 // Returns patch_code_pc offset where patching code for disabling the stub | 1193 // Returns patch_code_pc offset where patching code for disabling the stub |
| 1194 // has been generated (similar to regularly generated Dart code). | 1194 // has been generated (similar to regularly generated Dart code). |
| 1195 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1195 void StubCode::GenerateAllocationStubForClass( |
| 1196 const Class& cls) { | 1196 Assembler* assembler, const Class& cls, |
| 1197 uword* entry_patch_offset, uword* patch_code_pc_offset) { |
| 1197 __ TraceSimMsg("AllocationStubForClass"); | 1198 __ TraceSimMsg("AllocationStubForClass"); |
| 1199 *entry_patch_offset = assembler->CodeSize(); |
| 1198 // The generated code is different if the class is parameterized. | 1200 // The generated code is different if the class is parameterized. |
| 1199 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; | 1201 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1200 ASSERT(!is_cls_parameterized || | 1202 ASSERT(!is_cls_parameterized || |
| 1201 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1203 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1202 // kInlineInstanceSize is a constant used as a threshold for determining | 1204 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1203 // when the object initialization should be done as a loop or as | 1205 // when the object initialization should be done as a loop or as |
| 1204 // straight line code. | 1206 // straight line code. |
| 1205 const int kInlineInstanceSize = 12; | 1207 const int kInlineInstanceSize = 12; |
| 1206 const intptr_t instance_size = cls.instance_size(); | 1208 const intptr_t instance_size = cls.instance_size(); |
| 1207 ASSERT(instance_size > 0); | 1209 ASSERT(instance_size > 0); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 __ sw(T7, Address(SP, 0 * kWordSize)); | 1310 __ sw(T7, Address(SP, 0 * kWordSize)); |
| 1309 } | 1311 } |
| 1310 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1312 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1311 __ TraceSimMsg("AllocationStubForClass return"); | 1313 __ TraceSimMsg("AllocationStubForClass return"); |
| 1312 // Pop result (newly allocated object). | 1314 // Pop result (newly allocated object). |
| 1313 __ lw(V0, Address(SP, 2 * kWordSize)); | 1315 __ lw(V0, Address(SP, 2 * kWordSize)); |
| 1314 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Pop arguments. | 1316 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Pop arguments. |
| 1315 // V0: new object | 1317 // V0: new object |
| 1316 // Restore the frame pointer and return. | 1318 // Restore the frame pointer and return. |
| 1317 __ LeaveStubFrameAndReturn(RA); | 1319 __ LeaveStubFrameAndReturn(RA); |
| 1318 uword patch_code_pc_offset = assembler->CodeSize(); | 1320 *patch_code_pc_offset = assembler->CodeSize(); |
| 1319 StubCode* stub_code = Isolate::Current()->stub_code(); | 1321 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 1320 __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel()); | 1322 __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel()); |
| 1321 return patch_code_pc_offset; | |
| 1322 } | 1323 } |
| 1323 | 1324 |
| 1324 | 1325 |
| 1325 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1326 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1326 // from the entry code of a dart function after an error in passed argument | 1327 // from the entry code of a dart function after an error in passed argument |
| 1327 // name or number is detected. | 1328 // name or number is detected. |
| 1328 // Input parameters: | 1329 // Input parameters: |
| 1329 // RA : return address. | 1330 // RA : return address. |
| 1330 // SP : address of last argument. | 1331 // SP : address of last argument. |
| 1331 // S4: arguments descriptor array. | 1332 // S4: arguments descriptor array. |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2228 const Register right = T0; | 2229 const Register right = T0; |
| 2229 __ lw(left, Address(SP, 1 * kWordSize)); | 2230 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2230 __ lw(right, Address(SP, 0 * kWordSize)); | 2231 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2231 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2232 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2232 __ Ret(); | 2233 __ Ret(); |
| 2233 } | 2234 } |
| 2234 | 2235 |
| 2235 } // namespace dart | 2236 } // namespace dart |
| 2236 | 2237 |
| 2237 #endif // defined TARGET_ARCH_MIPS | 2238 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |