Chromium Code Reviews| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 | 428 |
| 429 // Jump to the dart function. | 429 // Jump to the dart function. |
| 430 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | 430 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); |
| 431 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); | 431 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 432 | 432 |
| 433 // Remove the stub frame. | 433 // Remove the stub frame. |
| 434 __ LeaveStubFrameAndReturn(T0); | 434 __ LeaveStubFrameAndReturn(T0); |
| 435 } | 435 } |
| 436 | 436 |
| 437 | 437 |
| 438 // Called from object allocate instruction when the allocation stub has been | |
| 439 // disabled. | |
| 440 void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) { | |
| 441 __ TraceSimMsg("FixCallersTarget"); | |
|
zra
2014/09/10 16:07:39
"FixAllocationStubTarget"
srdjan
2014/09/11 16:22:36
Done.
| |
| 442 __ EnterStubFrame(); | |
| 443 // Setup space on stack for return value. | |
| 444 __ addiu(SP, SP, Immediate(-1 * kWordSize)); | |
| 445 __ LoadImmediate(TMP, reinterpret_cast<intptr_t>(Object::null())); | |
| 446 __ sw(TMP, Address(SP, 0 * kWordSize)); | |
| 447 __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0); | |
| 448 // Get Code object result. | |
| 449 __ lw(T0, Address(SP, 0 * kWordSize)); | |
| 450 __ addiu(SP, SP, Immediate(1 * kWordSize)); | |
| 451 | |
| 452 // Jump to the dart function. | |
| 453 __ lw(T0, FieldAddress(T0, Code::instructions_offset())); | |
| 454 __ AddImmediate(T0, T0, Instructions::HeaderSize() - kHeapObjectTag); | |
| 455 | |
| 456 // Remove the stub frame. | |
| 457 __ LeaveStubFrameAndReturn(T0); | |
| 458 } | |
| 459 | |
| 460 | |
| 438 // Input parameters: | 461 // Input parameters: |
| 439 // A1: Smi-tagged argument count, may be zero. | 462 // A1: Smi-tagged argument count, may be zero. |
| 440 // FP[kParamEndSlotFromFp + 1]: Last argument. | 463 // FP[kParamEndSlotFromFp + 1]: Last argument. |
| 441 static void PushArgumentsArray(Assembler* assembler) { | 464 static void PushArgumentsArray(Assembler* assembler) { |
| 442 StubCode* stub_code = Isolate::Current()->stub_code(); | 465 StubCode* stub_code = Isolate::Current()->stub_code(); |
| 443 __ TraceSimMsg("PushArgumentsArray"); | 466 __ TraceSimMsg("PushArgumentsArray"); |
| 444 // Allocate array to store arguments of caller. | 467 // Allocate array to store arguments of caller. |
| 445 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); | 468 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); |
| 446 // A0: Null element type for raw Array. | 469 // A0: Null element type for raw Array. |
| 447 // A1: Smi-tagged argument count, may be zero. | 470 // A1: Smi-tagged argument count, may be zero. |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1160 // Restore callee-saved registers, tear down frame. | 1183 // Restore callee-saved registers, tear down frame. |
| 1161 __ LeaveCallRuntimeFrame(); | 1184 __ LeaveCallRuntimeFrame(); |
| 1162 __ Ret(); | 1185 __ Ret(); |
| 1163 } | 1186 } |
| 1164 | 1187 |
| 1165 | 1188 |
| 1166 // Called for inline allocation of objects. | 1189 // Called for inline allocation of objects. |
| 1167 // Input parameters: | 1190 // Input parameters: |
| 1168 // RA : return address. | 1191 // RA : return address. |
| 1169 // SP + 0 : type arguments object (only if class is parameterized). | 1192 // SP + 0 : type arguments object (only if class is parameterized). |
| 1170 void StubCode::GenerateAllocationStubForClass(Assembler* assembler, | 1193 // Returns patch_code_pc offset where patching code for disabling the stub |
| 1194 // has been generated (similar to regularly generated Dart code). | |
| 1195 uword StubCode::GenerateAllocationStubForClass(Assembler* assembler, | |
| 1171 const Class& cls) { | 1196 const Class& cls) { |
| 1172 __ TraceSimMsg("AllocationStubForClass"); | 1197 __ TraceSimMsg("AllocationStubForClass"); |
| 1173 // The generated code is different if the class is parameterized. | 1198 // The generated code is different if the class is parameterized. |
| 1174 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; | 1199 const bool is_cls_parameterized = cls.NumTypeArguments() > 0; |
| 1175 ASSERT(!is_cls_parameterized || | 1200 ASSERT(!is_cls_parameterized || |
| 1176 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); | 1201 (cls.type_arguments_field_offset() != Class::kNoTypeArguments)); |
| 1177 // kInlineInstanceSize is a constant used as a threshold for determining | 1202 // kInlineInstanceSize is a constant used as a threshold for determining |
| 1178 // when the object initialization should be done as a loop or as | 1203 // when the object initialization should be done as a loop or as |
| 1179 // straight line code. | 1204 // straight line code. |
| 1180 const int kInlineInstanceSize = 12; | 1205 const int kInlineInstanceSize = 12; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1283 __ sw(T7, Address(SP, 0 * kWordSize)); | 1308 __ sw(T7, Address(SP, 0 * kWordSize)); |
| 1284 } | 1309 } |
| 1285 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. | 1310 __ CallRuntime(kAllocateObjectRuntimeEntry, 2); // Allocate object. |
| 1286 __ TraceSimMsg("AllocationStubForClass return"); | 1311 __ TraceSimMsg("AllocationStubForClass return"); |
| 1287 // Pop result (newly allocated object). | 1312 // Pop result (newly allocated object). |
| 1288 __ lw(V0, Address(SP, 2 * kWordSize)); | 1313 __ lw(V0, Address(SP, 2 * kWordSize)); |
| 1289 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Pop arguments. | 1314 __ addiu(SP, SP, Immediate(3 * kWordSize)); // Pop arguments. |
| 1290 // V0: new object | 1315 // V0: new object |
| 1291 // Restore the frame pointer and return. | 1316 // Restore the frame pointer and return. |
| 1292 __ LeaveStubFrameAndReturn(RA); | 1317 __ LeaveStubFrameAndReturn(RA); |
| 1318 uword patch_code_pc_offset = assembler->CodeSize(); | |
| 1319 StubCode* stub_code = Isolate::Current()->stub_code(); | |
| 1320 __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel()); | |
| 1321 return patch_code_pc_offset; | |
| 1293 } | 1322 } |
| 1294 | 1323 |
| 1295 | 1324 |
| 1296 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function | 1325 // Called for invoking "dynamic noSuchMethod(Invocation invocation)" function |
| 1297 // from the entry code of a dart function after an error in passed argument | 1326 // from the entry code of a dart function after an error in passed argument |
| 1298 // name or number is detected. | 1327 // name or number is detected. |
| 1299 // Input parameters: | 1328 // Input parameters: |
| 1300 // RA : return address. | 1329 // RA : return address. |
| 1301 // SP : address of last argument. | 1330 // SP : address of last argument. |
| 1302 // S4: arguments descriptor array. | 1331 // S4: arguments descriptor array. |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2199 const Register right = T0; | 2228 const Register right = T0; |
| 2200 __ lw(left, Address(SP, 1 * kWordSize)); | 2229 __ lw(left, Address(SP, 1 * kWordSize)); |
| 2201 __ lw(right, Address(SP, 0 * kWordSize)); | 2230 __ lw(right, Address(SP, 0 * kWordSize)); |
| 2202 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); | 2231 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp1, temp2); |
| 2203 __ Ret(); | 2232 __ Ret(); |
| 2204 } | 2233 } |
| 2205 | 2234 |
| 2206 } // namespace dart | 2235 } // namespace dart |
| 2207 | 2236 |
| 2208 #endif // defined TARGET_ARCH_MIPS | 2237 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |