Commit 448ec364 authored by dusan.milosavljevic's avatar dusan.milosavljevic Committed by Commit bot

MIPS: Fix unpredictable random failures after direct api function call.

The use of jalr ra is unpredictable if instruction in branch delay slot
is in next page.

This finally fixes random failures in JS debugger and InteruptRequest tests.

TEST=mjsunit/debug-*,
     cctest/test-api/RequestInterruptTestWithNativeAccessor
BUG=

Review URL: https://codereview.chromium.org/1220443002

Cr-Commit-Position: refs/heads/master@{#29331}
parent 6ba8455e
......@@ -1442,6 +1442,7 @@ void Assembler::jal(int32_t target) {
void Assembler::jalr(Register rs, Register rd) {
DCHECK(rs.code() != rd.code());
BlockTrampolinePoolScope block_trampoline_pool(this);
positions_recorder()->WriteRecordedPositions();
GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR);
......
......@@ -4051,8 +4051,8 @@ void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
intptr_t loc =
reinterpret_cast<intptr_t>(GetCode().location());
__ Move(t9, target);
__ li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE);
__ Call(ra);
__ li(at, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE);
__ Call(at);
}
......
......@@ -1448,6 +1448,7 @@ void Assembler::jal(int64_t target) {
void Assembler::jalr(Register rs, Register rd) {
DCHECK(rs.code() != rd.code());
BlockTrampolinePoolScope block_trampoline_pool(this);
positions_recorder()->WriteRecordedPositions();
GenInstrRegister(SPECIAL, rs, zero_reg, rd, 0, JALR);
......
......@@ -4092,8 +4092,8 @@ void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
intptr_t loc =
reinterpret_cast<intptr_t>(GetCode().location());
__ Move(t9, target);
__ li(ra, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE);
__ Call(ra);
__ li(at, Operand(loc, RelocInfo::CODE_TARGET), CONSTANT_SIZE);
__ Call(at);
}
......@@ -5356,9 +5356,9 @@ static void CallApiFunctionAndReturn(
__ li(s3, Operand(next_address));
__ ld(s0, MemOperand(s3, kNextOffset));
__ ld(s1, MemOperand(s3, kLimitOffset));
__ ld(s2, MemOperand(s3, kLevelOffset));
__ Daddu(s2, s2, Operand(1));
__ sd(s2, MemOperand(s3, kLevelOffset));
__ lw(s2, MemOperand(s3, kLevelOffset));
__ Addu(s2, s2, Operand(1));
__ sw(s2, MemOperand(s3, kLevelOffset));
if (FLAG_log_timer_events) {
FrameScope frame(masm, StackFrame::MANUAL);
......@@ -5399,11 +5399,11 @@ static void CallApiFunctionAndReturn(
// previous handle scope.
__ sd(s0, MemOperand(s3, kNextOffset));
if (__ emit_debug_code()) {
__ ld(a1, MemOperand(s3, kLevelOffset));
__ lw(a1, MemOperand(s3, kLevelOffset));
__ Check(eq, kUnexpectedLevelAfterReturnFromApiCall, a1, Operand(s2));
}
__ Dsubu(s2, s2, Operand(1));
__ sd(s2, MemOperand(s3, kLevelOffset));
__ Subu(s2, s2, Operand(1));
__ sw(s2, MemOperand(s3, kLevelOffset));
__ ld(at, MemOperand(s3, kLimitOffset));
__ Branch(&delete_allocated_handles, ne, s1, Operand(at));
......
......@@ -575,10 +575,6 @@
'math-floor-of-div-minus-zero': [SKIP],
}], # 'arch == mips64el'
['arch == mips64el and simulator_run == False', {
# Random failures on HW, need investigation.
'debug-*': [SKIP],
}],
##############################################################################
['system == windows', {
# TODO(mstarzinger): Too slow with turbo fan.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment