[JAEGER] Fixed bug in JSOP_POS.

This commit is contained in:
David Anderson 2010-07-03 13:13:20 -07:00
parent bcde0f1fc6
commit 3487c67a9d
4 changed files with 41 additions and 2 deletions

View File

@ -686,6 +686,27 @@ FrameState::dataRematInfo(const FrameEntry *fe) const
return remat;
}
inline void
FrameState::giveOwnRegs(FrameEntry *fe)
{
JS_ASSERT(!fe->isConstant());
JS_ASSERT(fe == peek(-1));
if (!fe->isCopy())
return;
RegisterID data = copyDataIntoReg(fe);
if (fe->isTypeKnown()) {
JSValueType type = fe->getKnownType();
pop();
pushTypedPayload(type, data);
} else {
RegisterID type = copyTypeIntoReg(fe);
pop();
pushRegs(type, data);
}
}
} /* namspace mjit */
} /* namspace js */

View File

@ -489,6 +489,12 @@ class FrameState
*/
inline void dupAt(int32 n);
/*
* If the frameentry is a copy, give it its own registers.
* This may only be called on the topmost fe.
*/
inline void giveOwnRegs(FrameEntry *fe);
/*
* Returns the current stack depth of the frame.
*/

View File

@ -178,6 +178,16 @@ class Assembler : public BaseAssembler
return branch32(cond, tagOf(address), ImmTag(JSVAL_TAG_INT32));
}
Jump testNumber(Assembler::Condition cond, RegisterID reg) {
cond = (cond == Assembler::Equal) ? Assembler::BelowOrEqual : Assembler::Above;
return branch32(cond, reg, ImmTag(JSVAL_TAG_INT32));
}
Jump testNumber(Assembler::Condition cond, Address address) {
cond = (cond == Assembler::Equal) ? Assembler::BelowOrEqual : Assembler::Above;
return branch32(cond, tagOf(address), ImmTag(JSVAL_TAG_INT32));
}
Jump testPrimitive(Assembler::Condition cond, RegisterID reg) {
cond = (cond == Assembler::NotEqual) ? Assembler::AboveOrEqual : Assembler::Below;
return branch32(cond, reg, ImmTag(JSVAL_TAG_OBJECT));

View File

@ -1215,11 +1215,13 @@ mjit::Compiler::jsop_pos()
return;
}
frame.giveOwnRegs(top);
Jump j;
if (frame.shouldAvoidTypeRemat(top))
j = masm.branch32(Assembler::GreaterThan, frame.addressOf(top), ImmTag(JSVAL_TAG_INT32));
j = masm.testNumber(Assembler::NotEqual, frame.addressOf(top));
else
j = masm.branch32(Assembler::GreaterThan, frame.tempRegForType(top), ImmTag(JSVAL_TAG_INT32));
j = masm.testNumber(Assembler::NotEqual, frame.tempRegForType(top));
stubcc.linkExit(j);
stubcc.leave();