Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index a0b88494bbdfc5b8215e1fb097e5084c85fb50ec..e04412ee321a78c3fec5ae5b3a7a91f1f2753bb9 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -6132,9 +6132,12 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) { |
void DirectCEntryStub::Generate(MacroAssembler* masm) { |
- // No need to pop or drop anything, LeaveExitFrame will restore the old |
- // stack, thus dropping the allocated space for the return value. |
- // The saved ra is after the reserved stack space for the 4 args. |
+ // Make place for arguments to fit C calling convention. |
+ __ Subu(sp, sp, Operand(kCArgsSlotsSize)); |
+ // Place the return address on the stack, making the call |
+ // GC safe. The RegExp backend also relies on this. |
+ __ sw(ra, MemOperand(sp, kCArgsSlotsSize)); |
+ __ Call(t9); // Call the C++ function. |
__ lw(t9, MemOperand(sp, kCArgsSlotsSize)); |
if (FLAG_debug_code && FLAG_enable_slow_asserts) { |
@@ -6151,33 +6154,11 @@ void DirectCEntryStub::Generate(MacroAssembler* masm) { |
void DirectCEntryStub::GenerateCall(MacroAssembler* masm, |
Register target) { |
- __ Move(t9, target); |
- __ AssertStackIsAligned(); |
- // Allocate space for arg slots. |
- __ Subu(sp, sp, kCArgsSlotsSize); |
- |
- // Block the trampoline pool through the whole function to make sure the |
- // number of generated instructions is constant. |
- Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm); |
- |
- // We need to get the current 'pc' value, which is not available on MIPS. |
- Label find_ra; |
- masm->bal(&find_ra); // ra = pc + 8. |
- masm->nop(); // Branch delay slot nop. |
- masm->bind(&find_ra); |
- |
- const int kNumInstructionsToJump = 6; |
- masm->addiu(ra, ra, kNumInstructionsToJump * kPointerSize); |
- // Push return address (accessible to GC through exit frame pc). |
- // This spot for ra was reserved in EnterExitFrame. |
- masm->sw(ra, MemOperand(sp, kCArgsSlotsSize)); |
intptr_t loc = |
reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); |
- masm->li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE); |
- // Call the function. |
- masm->Jump(t9); |
- // Make sure the stored 'ra' points to this position. |
- ASSERT_EQ(kNumInstructionsToJump, masm->InstructionsGeneratedSince(&find_ra)); |
+ __ Move(t9, target); |
+ __ li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE); |
+ __ Call(ra); |
} |