Bug 1046161 - IonMonkey MIPS: Port latest changes in AsmJSFrameIterator to MIPS. r=luke

This commit is contained in:
Branislav Rankov 2014-07-30 18:59:32 +02:00
parent 927e5632a1
commit 51a330c4bb
4 changed files with 46 additions and 10 deletions

View File

@ -109,6 +109,10 @@ static const unsigned StoredFP = 11;
static const unsigned PushedRetAddr = 4;
static const unsigned PushedFP = 16;
static const unsigned StoredFP = 20;
#elif defined(JS_CODEGEN_MIPS)
static const unsigned PushedRetAddr = 8;
static const unsigned PushedFP = 24;
static const unsigned StoredFP = 28;
#elif defined(JS_CODEGEN_NONE)
static const unsigned PushedRetAddr = 0;
static const unsigned PushedFP = 1;
@ -294,7 +298,12 @@ js::GenerateAsmJSFunctionEpilogue(MacroAssembler &masm, unsigned framePushed,
masm.bind(&labels->profilingJump);
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
masm.twoByteNop();
#elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS)
#elif defined(JS_CODEGEN_ARM)
masm.nop();
#elif defined(JS_CODEGEN_MIPS)
masm.nop();
masm.nop();
masm.nop();
masm.nop();
#endif
}

View File

@ -1583,6 +1583,9 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx)
BOffImm calleeOffset;
callerInsn->as<InstBLImm>()->extractImm(&calleeOffset);
void *callee = calleeOffset.getDest(callerInsn);
#elif defined(JS_CODEGEN_MIPS)
Instruction *instr = (Instruction *)(callerRetAddr - 4 * sizeof(uint32_t));
void *callee = (void *)Assembler::ExtractLuiOriValue(instr, instr->next());
#elif defined(JS_CODEGEN_NONE)
MOZ_CRASH();
void *callee = nullptr;
@ -1604,6 +1607,10 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx)
JSC::X86Assembler::setRel32(callerRetAddr, newCallee);
#elif defined(JS_CODEGEN_ARM)
new (caller) InstBLImm(BOffImm(newCallee - caller), Assembler::Always);
#elif defined(JS_CODEGEN_MIPS)
Assembler::WriteLuiOriInstructions(instr, instr->next(),
ScratchRegister, (uint32_t)newCallee);
instr[2] = InstReg(op_special, ScratchRegister, zero, ra, ff_jalr);
#elif defined(JS_CODEGEN_NONE)
MOZ_CRASH();
#else
@ -1663,6 +1670,17 @@ AsmJSModule::setProfilingEnabled(bool enabled, JSContext *cx)
JS_ASSERT(reinterpret_cast<Instruction*>(jump)->is<InstBImm>());
new (jump) InstNOP();
}
#elif defined(JS_CODEGEN_MIPS)
Instruction *instr = (Instruction *)jump;
if (enabled) {
Assembler::WriteLuiOriInstructions(instr, instr->next(),
ScratchRegister, (uint32_t)profilingEpilogue);
instr[2] = InstReg(op_special, ScratchRegister, zero, zero, ff_jr);
} else {
instr[0].makeNop();
instr[1].makeNop();
instr[2].makeNop();
}
#elif defined(JS_CODEGEN_NONE)
MOZ_CRASH();
#else

View File

@ -939,6 +939,18 @@ MacroAssemblerMIPS::branchWithCode(InstImm code, Label *label, JumpKind jumpKind
if (label->bound()) {
int32_t offset = label->offset() - m_buffer.nextOffset().getOffset();
// Generate the long jump for calls because return address has to be
// the address after the reserved block.
if (code.encode() == inst_bgezal.encode()) {
MOZ_ASSERT(jumpKind != ShortJump);
// Handle long call
addLongJump(nextOffset());
ma_liPatchable(ScratchRegister, Imm32(label->offset()));
as_jalr(ScratchRegister);
as_nop();
return;
}
if (BOffImm16::IsInRange(offset))
jumpKind = ShortJump;
@ -950,15 +962,6 @@ MacroAssemblerMIPS::branchWithCode(InstImm code, Label *label, JumpKind jumpKind
return;
}
// Generate long jump because target is out of range of short jump.
if (code.encode() == inst_bgezal.encode()) {
// Handle long call
addLongJump(nextOffset());
ma_liPatchable(ScratchRegister, Imm32(label->offset()));
as_jalr(ScratchRegister);
as_nop();
return;
}
if (code.encode() == inst_beq.encode()) {
// Handle long jump
addLongJump(nextOffset());

View File

@ -1092,6 +1092,12 @@ public:
void store32(Imm32 src, const Address &address);
void store32(Imm32 src, const BaseIndex &address);
// NOTE: This will use second scratch on MIPS. Only ARM needs the
// implementation without second scratch.
void store32_NoSecondScratch(Imm32 src, const Address &address) {
store32(src, address);
}
void storePtr(ImmWord imm, const Address &address);
void storePtr(ImmPtr imm, const Address &address);
void storePtr(ImmGCPtr imm, const Address &address);