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/runtime_entry.h" | 9 #include "vm/runtime_entry.h" |
10 #include "vm/simulator.h" | 10 #include "vm/simulator.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 addu(result, result, TMP1); | 324 addu(result, result, TMP1); |
325 lw(result, Address(result)); | 325 lw(result, Address(result)); |
326 } | 326 } |
327 | 327 |
328 | 328 |
329 void Assembler::EnterStubFrame(bool uses_pp) { | 329 void Assembler::EnterStubFrame(bool uses_pp) { |
330 if (uses_pp) { | 330 if (uses_pp) { |
331 addiu(SP, SP, Immediate(-4 * kWordSize)); | 331 addiu(SP, SP, Immediate(-4 * kWordSize)); |
332 sw(ZR, Address(SP, 3 * kWordSize)); // PC marker is 0 in stubs. | 332 sw(ZR, Address(SP, 3 * kWordSize)); // PC marker is 0 in stubs. |
333 sw(RA, Address(SP, 2 * kWordSize)); | 333 sw(RA, Address(SP, 2 * kWordSize)); |
334 sw(PP, Address(SP, 1 * kWordSize)); | 334 sw(FP, Address(SP, 1 * kWordSize)); |
335 sw(FP, Address(SP, 0 * kWordSize)); | 335 sw(PP, Address(SP, 0 * kWordSize)); |
336 mov(FP, SP); | 336 addiu(FP, SP, Immediate(1 * kWordSize)); |
337 // Setup pool pointer for this stub. | 337 // Setup pool pointer for this stub. |
338 Label next; | 338 Label next; |
339 bal(&next); | 339 bal(&next); |
340 delay_slot()->mov(T0, RA); | 340 delay_slot()->mov(T0, RA); |
341 | 341 |
342 const intptr_t object_pool_pc_dist = | 342 const intptr_t object_pool_pc_dist = |
343 Instructions::HeaderSize() - Instructions::object_pool_offset() + | 343 Instructions::HeaderSize() - Instructions::object_pool_offset() + |
344 CodeSize(); | 344 CodeSize(); |
345 | 345 |
346 Bind(&next); | 346 Bind(&next); |
347 lw(PP, Address(T0, -object_pool_pc_dist)); | 347 lw(PP, Address(T0, -object_pool_pc_dist)); |
348 } else { | 348 } else { |
349 addiu(SP, SP, Immediate(-3 * kWordSize)); | 349 addiu(SP, SP, Immediate(-3 * kWordSize)); |
350 sw(ZR, Address(SP, 2 * kWordSize)); // PC marker is 0 in stubs. | 350 sw(ZR, Address(SP, 2 * kWordSize)); // PC marker is 0 in stubs. |
351 sw(RA, Address(SP, 1 * kWordSize)); | 351 sw(RA, Address(SP, 1 * kWordSize)); |
352 sw(FP, Address(SP, 0 * kWordSize)); | 352 sw(FP, Address(SP, 0 * kWordSize)); |
353 mov(FP, SP); | 353 mov(FP, SP); |
354 } | 354 } |
355 } | 355 } |
356 | 356 |
357 | 357 |
358 void Assembler::LeaveStubFrame(bool uses_pp) { | 358 void Assembler::LeaveStubFrame(bool uses_pp) { |
359 mov(SP, FP); | |
360 if (uses_pp) { | 359 if (uses_pp) { |
| 360 addiu(SP, FP, Immediate(-1 * kWordSize)); |
361 lw(RA, Address(SP, 2 * kWordSize)); | 361 lw(RA, Address(SP, 2 * kWordSize)); |
362 lw(PP, Address(SP, 1 * kWordSize)); | 362 lw(FP, Address(SP, 1 * kWordSize)); |
363 lw(FP, Address(SP, 0 * kWordSize)); | 363 lw(PP, Address(SP, 0 * kWordSize)); |
364 addiu(SP, SP, Immediate(4 * kWordSize)); | 364 addiu(SP, SP, Immediate(4 * kWordSize)); |
365 } else { | 365 } else { |
| 366 mov(SP, FP); |
366 lw(RA, Address(SP, 1 * kWordSize)); | 367 lw(RA, Address(SP, 1 * kWordSize)); |
367 lw(FP, Address(SP, 0 * kWordSize)); | 368 lw(FP, Address(SP, 0 * kWordSize)); |
368 addiu(SP, SP, Immediate(3 * kWordSize)); | 369 addiu(SP, SP, Immediate(3 * kWordSize)); |
369 } | 370 } |
370 } | 371 } |
371 | 372 |
372 | 373 |
373 void Assembler::CallRuntime(const RuntimeEntry& entry) { | 374 void Assembler::CallRuntime(const RuntimeEntry& entry) { |
374 entry.Call(this); | 375 entry.Call(this); |
375 } | 376 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 443 } |
443 } | 444 } |
444 | 445 |
445 | 446 |
446 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { | 447 void Assembler::EnterCallRuntimeFrame(intptr_t frame_space) { |
447 const intptr_t kPushedRegistersSize = | 448 const intptr_t kPushedRegistersSize = |
448 kDartVolatileCpuRegCount * kWordSize + | 449 kDartVolatileCpuRegCount * kWordSize + |
449 2 * kWordSize + // FP and RA. | 450 2 * kWordSize + // FP and RA. |
450 kDartVolatileFpuRegCount * kWordSize; | 451 kDartVolatileFpuRegCount * kWordSize; |
451 | 452 |
| 453 TraceSimMsg("EnterCallRuntimeFrame"); |
| 454 |
452 if (prologue_offset_ == -1) { | 455 if (prologue_offset_ == -1) { |
453 prologue_offset_ = CodeSize(); | 456 prologue_offset_ = CodeSize(); |
454 } | 457 } |
455 | 458 |
456 // Save volatile CPU and FPU registers on the stack: | 459 // Save volatile CPU and FPU registers on the stack: |
457 // ------------- | 460 // ------------- |
458 // FPU Registers | 461 // FPU Registers |
459 // CPU Registers | 462 // CPU Registers |
460 // RA | 463 // RA |
461 // FP | 464 // FP |
(...skipping 22 matching lines...) Expand all Loading... |
484 ReserveAlignedFrameSpace(frame_space); | 487 ReserveAlignedFrameSpace(frame_space); |
485 } | 488 } |
486 | 489 |
487 | 490 |
488 void Assembler::LeaveCallRuntimeFrame() { | 491 void Assembler::LeaveCallRuntimeFrame() { |
489 const intptr_t kPushedRegistersSize = | 492 const intptr_t kPushedRegistersSize = |
490 kDartVolatileCpuRegCount * kWordSize + | 493 kDartVolatileCpuRegCount * kWordSize + |
491 2 * kWordSize + // FP and RA. | 494 2 * kWordSize + // FP and RA. |
492 kDartVolatileFpuRegCount * kWordSize; | 495 kDartVolatileFpuRegCount * kWordSize; |
493 | 496 |
| 497 TraceSimMsg("LeaveCallRuntimeFrame"); |
| 498 |
494 // SP might have been modified to reserve space for arguments | 499 // SP might have been modified to reserve space for arguments |
495 // and ensure proper alignment of the stack frame. | 500 // and ensure proper alignment of the stack frame. |
496 // We need to restore it before restoring registers. | 501 // We need to restore it before restoring registers. |
497 mov(SP, FP); | 502 mov(SP, FP); |
498 | 503 |
499 // Restore volatile CPU and FPU registers from the stack. | 504 // Restore volatile CPU and FPU registers from the stack. |
500 lw(FP, Address(SP, 0 * kWordSize)); | 505 lw(FP, Address(SP, 0 * kWordSize)); |
501 lw(RA, Address(SP, 1 * kWordSize)); | 506 lw(RA, Address(SP, 1 * kWordSize)); |
502 for (int i = kDartFirstVolatileCpuReg; i <= kDartLastVolatileCpuReg; i++) { | 507 for (int i = kDartFirstVolatileCpuReg; i <= kDartLastVolatileCpuReg; i++) { |
503 // + 2 because FP goes in slot 0. | 508 // + 2 because FP goes in slot 0. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 Emit(reinterpret_cast<int32_t>(message)); | 558 Emit(reinterpret_cast<int32_t>(message)); |
554 Bind(&msg); | 559 Bind(&msg); |
555 break_(Instr::kMsgMessageCode); | 560 break_(Instr::kMsgMessageCode); |
556 } | 561 } |
557 } | 562 } |
558 | 563 |
559 } // namespace dart | 564 } // namespace dart |
560 | 565 |
561 #endif // defined TARGET_ARCH_MIPS | 566 #endif // defined TARGET_ARCH_MIPS |
562 | 567 |
OLD | NEW |