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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 228 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 229 __ jr(T0); | 229 __ jr(T0); |
| 230 } | 230 } |
| 231 | 231 |
| 232 | 232 |
| 233 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { | 233 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) { |
| 234 __ Unimplemented("FixCallersTarget stub"); | 234 __ Unimplemented("FixCallersTarget stub"); |
| 235 } | 235 } |
| 236 | 236 |
| 237 | 237 |
| 238 void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { | 238 // Input parameters: |
| 239 __ Unimplemented("InstanceFunctionLookup stub"); | 239 // A1: Smi-tagged argument count, may be zero. |
| 240 // FP[kLastParamSlotIndex]: Last argument. | |
| 241 static void PushArgumentsArray(Assembler* assembler) { | |
| 242 __ TraceSimMsg("PushArgumentsArray"); | |
| 243 // Allocate array to store arguments of caller. | |
| 244 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); | |
| 245 // A0: Null element type for raw Array. | |
| 246 // A1: Smi-tagged argument count, may be zero. | |
| 247 __ BranchLink(&StubCode::AllocateArrayLabel()); | |
| 248 __ TraceSimMsg("PushArgumentsArray return"); | |
| 249 // V0: newly allocated array. | |
| 250 // A1: Smi-tagged argument count, may be zero (was preserved by the stub). | |
| 251 __ Push(V0); // Array is in V0 and on top of stack. | |
| 252 __ sll(T1, A1, 1); | |
| 253 __ addu(T1, FP, T1); | |
| 254 __ AddImmediate(T1, (kLastParamSlotIndex - 1) * kWordSize); | |
| 255 __ AddImmediate(T2, V0, Array::data_offset() - kHeapObjectTag); | |
| 256 // T1: address of first argument on stack. | |
| 257 // T2: address of first argument in array. | |
| 258 Label loop, loop_condition; | |
| 259 __ b(&loop_condition); | |
| 260 __ Bind(&loop); | |
| 261 __ lw(TMP, Address(T1)); | |
| 262 __ sw(TMP, Address(T2)); | |
| 263 __ AddImmediate(T1, -kWordSize); | |
| 264 __ AddImmediate(T2, kWordSize); | |
| 265 __ Bind(&loop_condition); | |
| 266 __ AddImmediate(A1, -Smi::RawValue(1)); // A1 is Smi. | |
| 267 __ BranchGreaterEqual(A1, ZR, &loop); | |
| 240 } | 268 } |
| 241 | 269 |
| 242 | 270 |
| 271 // Input parameters: | |
| 272 // S5: ic-data. | |
| 273 // S4: arguments descriptor array. | |
| 274 // Note: The receiver object is the first argument to the function being | |
| 275 // called, the stub accesses the receiver from this location directly | |
| 276 // when trying to resolve the call. | |
| 277 void StubCode::GenerateInstanceFunctionLookupStub(Assembler* assembler) { | |
| 278 __ TraceSimMsg("InstanceFunctionLookupStub"); | |
| 279 __ EnterStubFrame(); | |
| 280 | |
| 281 // Load the receiver. | |
| 282 __ lw(A1, FieldAddress(S4, ArgumentsDescriptor::count_offset())); | |
| 283 __ sll(TMP1, A1, 1); // A1 is Smi. | |
| 284 __ addu(TMP1, FP, TMP1); | |
| 285 __ lw(T1, Address(TMP1, (kLastParamSlotIndex - 1) * kWordSize)); | |
| 286 | |
| 287 // Push space for the return value. | |
| 288 // Push the receiver. | |
| 289 // Push TMP1 data object. | |
| 290 // Push arguments descriptor array. | |
| 291 __ LoadImmediate(TMP1, reinterpret_cast<intptr_t>(Object::null())); | |
| 292 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | |
| 293 __ sw(TMP1, Address(SP, 3 * kWordSize)); | |
| 294 __ sw(T1, Address(SP, 2 * kWordSize)); | |
| 295 __ sw(S5, Address(SP, 1 * kWordSize)); | |
| 296 __ sw(S4, Address(SP, 0 * kWordSize)); | |
| 297 | |
| 298 // A1: Smi-tagged arguments array length. | |
| 299 PushArgumentsArray(assembler); | |
| 300 __ TraceSimMsg("InstanceFunctionLookupStub return"); | |
| 301 | |
| 302 // Stack: | |
| 303 // TOS + 0: argument array. | |
| 304 // TOS + 1: arguments descriptor array. | |
| 305 // TOS + 2: IC data object. | |
| 306 // TOS + 3: Receiver. | |
| 307 // TOS + 4: place for result from the call. | |
| 308 // TOS + 5: saved FP of previous frame. | |
| 309 // TOS + 6: dart code return address | |
| 310 // TOS + 7: pc marker (0 for stub). | |
| 311 // TOS + 8: last argument of caller. | |
| 312 // .... | |
| 313 __ CallRuntime(kInstanceFunctionLookupRuntimeEntry); | |
| 314 // Remove arguments. | |
| 315 __ lw(V0, Address(SP, 4 * kWordSize)); | |
| 316 __ addiu(SP, SP, Immediate(5 * kWordSize)); // Get result into V0. | |
| 317 __ LeaveStubFrame(); | |
| 318 __ Ret(); | |
| 319 } | |
| 320 | |
| 321 | |
| 243 void StubCode::GenerateDeoptimizeLazyStub(Assembler* assembler) { | 322 void StubCode::GenerateDeoptimizeLazyStub(Assembler* assembler) { |
| 244 __ Unimplemented("DeoptimizeLazy stub"); | 323 __ Unimplemented("DeoptimizeLazy stub"); |
| 245 } | 324 } |
| 246 | 325 |
| 247 | 326 |
| 248 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 327 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
| 249 __ Unimplemented("Deoptimize stub"); | 328 __ Unimplemented("Deoptimize stub"); |
| 250 } | 329 } |
| 251 | 330 |
| 252 | 331 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 __ lw(A1, Address(SP, 1 * kWordSize)); | 470 __ lw(A1, Address(SP, 1 * kWordSize)); |
| 392 __ lw(T3, Address(SP, 0 * kWordSize)); | 471 __ lw(T3, Address(SP, 0 * kWordSize)); |
| 393 __ addiu(SP, SP, Immediate(3 * kWordSize)); | 472 __ addiu(SP, SP, Immediate(3 * kWordSize)); |
| 394 __ mov(V0, TMP1); | 473 __ mov(V0, TMP1); |
| 395 __ LeaveStubFrame(); | 474 __ LeaveStubFrame(); |
| 396 __ Ret(); | 475 __ Ret(); |
| 397 } | 476 } |
| 398 | 477 |
| 399 | 478 |
| 400 // Input parameters: | 479 // Input parameters: |
| 401 // A1: Smi-tagged argument count, may be zero. | |
| 402 // FP[kLastParamSlotIndex]: Last argument. | |
| 403 static void PushArgumentsArray(Assembler* assembler) { | |
| 404 // Allocate array to store arguments of caller. | |
| 405 __ LoadImmediate(A0, reinterpret_cast<intptr_t>(Object::null())); | |
| 406 // A0: Null element type for raw Array. | |
| 407 // A1: Smi-tagged argument count, may be zero. | |
| 408 __ BranchLink(&StubCode::AllocateArrayLabel()); | |
| 409 // V0: newly allocated array. | |
| 410 // A1: Smi-tagged argument count, may be zero (was preserved by the stub). | |
| 411 __ Push(V0); // Array is in V0 and on top of stack. | |
| 412 __ sll(T1, A1, 1); | |
| 413 __ addu(T1, FP, T1); | |
| 414 __ AddImmediate(T1, (kLastParamSlotIndex - 1) * kWordSize); | |
| 415 __ AddImmediate(T2, V0, Array::data_offset() - kHeapObjectTag); | |
| 416 | |
| 417 Label loop, loop_condition; | |
| 418 __ b(&loop_condition); | |
| 419 __ Bind(&loop); | |
| 420 __ lw(TMP, Address(T1)); | |
| 421 __ sw(TMP, Address(T2)); | |
| 422 __ AddImmediate(T1, -kWordSize); | |
| 423 __ AddImmediate(T3, kWordSize); | |
| 424 __ Bind(&loop_condition); | |
| 425 __ AddImmediate(A1, -Smi::RawValue(1)); // A1 is Smi. | |
| 426 __ BranchGreaterEqual(A1, ZR, &loop); | |
| 427 } | |
| 428 | |
| 429 | |
| 430 // Input parameters: | |
| 431 // RA: return address. | 480 // RA: return address. |
| 432 // SP: address of last argument. | 481 // SP: address of last argument. |
| 433 // S4: Arguments descriptor array. | 482 // S4: Arguments descriptor array. |
| 434 // Return: V0. | 483 // Return: V0. |
| 435 // Note: The closure object is the first argument to the function being | 484 // Note: The closure object is the first argument to the function being |
| 436 // called, the stub accesses the closure from this location directly | 485 // called, the stub accesses the closure from this location directly |
| 437 // when trying to resolve the call. | 486 // when trying to resolve the call. |
| 438 void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) { | 487 void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) { |
| 439 // Load num_args. | 488 // Load num_args. |
| 440 __ TraceSimMsg("GenerateCallClosureFunctionStub"); | 489 __ TraceSimMsg("GenerateCallClosureFunctionStub"); |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 // RA: return address. | 1647 // RA: return address. |
| 1599 // A0: program_counter. | 1648 // A0: program_counter. |
| 1600 // A1: stack_pointer. | 1649 // A1: stack_pointer. |
| 1601 // A2: frame_pointer. | 1650 // A2: frame_pointer. |
| 1602 // A3: error object. | 1651 // A3: error object. |
| 1603 // SP: address of stacktrace object. | 1652 // SP: address of stacktrace object. |
| 1604 // Does not return. | 1653 // Does not return. |
| 1605 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { | 1654 void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) { |
| 1606 ASSERT(kExceptionObjectReg == V0); | 1655 ASSERT(kExceptionObjectReg == V0); |
| 1607 ASSERT(kStackTraceObjectReg == V1); | 1656 ASSERT(kStackTraceObjectReg == V1); |
| 1608 __ mov(TMP1, A1); // Stack pointer. | |
| 1609 __ mov(RA, A0); // Program counter. | 1657 __ mov(RA, A0); // Program counter. |
|
regis
2013/04/23 21:26:06
Can't you remove this mov as well and jr(A0)?
zra
2013/04/23 21:42:09
Done.
| |
| 1610 __ mov(V0, A3); // Exception object. | 1658 __ mov(V0, A3); // Exception object. |
| 1611 __ lw(V1, Address(SP, 0)); // StackTrace object. | 1659 __ lw(V1, Address(SP, 0)); // StackTrace object. |
| 1612 __ mov(FP, A2); // Frame_pointer. | 1660 __ mov(FP, A2); // Frame_pointer. |
| 1613 __ mov(SP, TMP1); // Stack pointer. | 1661 __ mov(SP, A1); // Stack pointer. |
| 1614 __ jr(RA); // Jump to the exception handler code. | 1662 __ jr(RA); // Jump to the exception handler code. |
| 1615 } | 1663 } |
| 1616 | 1664 |
| 1617 | 1665 |
| 1618 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { | 1666 void StubCode::GenerateEqualityWithNullArgStub(Assembler* assembler) { |
| 1619 __ Unimplemented("EqualityWithNullArg Stub"); | 1667 __ Unimplemented("EqualityWithNullArg Stub"); |
| 1620 } | 1668 } |
| 1621 | 1669 |
| 1622 | 1670 |
| 1623 // Calls to the runtime to optimize the given function. | 1671 // Calls to the runtime to optimize the given function. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1743 __ Bind(&done); | 1791 __ Bind(&done); |
| 1744 __ lw(T0, Address(SP, 0 * kWordSize)); | 1792 __ lw(T0, Address(SP, 0 * kWordSize)); |
| 1745 __ lw(T1, Address(SP, 1 * kWordSize)); | 1793 __ lw(T1, Address(SP, 1 * kWordSize)); |
| 1746 __ Ret(); | 1794 __ Ret(); |
| 1747 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); | 1795 __ delay_slot()->addiu(SP, SP, Immediate(2 * kWordSize)); |
| 1748 } | 1796 } |
| 1749 | 1797 |
| 1750 } // namespace dart | 1798 } // namespace dart |
| 1751 | 1799 |
| 1752 #endif // defined TARGET_ARCH_MIPS | 1800 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |