зеркало из https://github.com/mozilla/pjs.git
Eliminate syncData() constant hack. b=601657, r=dvander.
This commit is contained in:
Родитель
349d8ae170
Коммит
5a91272b4e
|
@ -1653,10 +1653,13 @@ mjit::Compiler::jsop_stricteq(JSOp op)
|
|||
masm.set32(cond, frame.tempRegForType(test), Imm32(mask), result);
|
||||
#elif defined JS_CPU_X64
|
||||
RegisterID maskReg = frame.allocReg();
|
||||
masm.move(Imm64(known->getKnownShiftedTag()), maskReg);
|
||||
frame.pinReg(maskReg);
|
||||
|
||||
masm.move(ImmTag(known->getKnownTag()), maskReg);
|
||||
RegisterID r = frame.tempRegForType(test);
|
||||
masm.setPtr(cond, r, maskReg, result);
|
||||
|
||||
frame.unpinReg(maskReg);
|
||||
frame.freeReg(maskReg);
|
||||
#endif
|
||||
frame.popn(2);
|
||||
|
|
|
@ -82,7 +82,7 @@ class FrameEntry
|
|||
return v_.s.tag;
|
||||
}
|
||||
#elif defined JS_PUNBOX64
|
||||
JSValueShiftedTag getKnownShiftedTag() const {
|
||||
JSValueShiftedTag getKnownTag() const {
|
||||
return JSValueShiftedTag(v_.asBits & JSVAL_TAG_MASK);
|
||||
}
|
||||
#endif
|
||||
|
@ -98,12 +98,12 @@ class FrameEntry
|
|||
}
|
||||
|
||||
#if defined JS_NUNBOX32
|
||||
uint32 getPayload32() const {
|
||||
uint32 getPayload() const {
|
||||
//JS_ASSERT(!Valueify(v_.asBits).isDouble() || type.synced());
|
||||
return v_.s.payload.u32;
|
||||
}
|
||||
#elif defined JS_PUNBOX64
|
||||
uint64 getPayload64() const {
|
||||
uint64 getPayload() const {
|
||||
return v_.asBits & JSVAL_PAYLOAD_MASK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -491,12 +491,13 @@ FrameState::syncType(const FrameEntry *fe, Address to, Assembler &masm) const
|
|||
fe->isCopied() && addressOf(fe).offset != to.offset);
|
||||
JS_ASSERT(fe->type.inRegister() || fe->type.isConstant());
|
||||
|
||||
if (fe->type.isConstant()) {
|
||||
JS_ASSERT(fe->isTypeKnown());
|
||||
/* Store a double's type bits, even though !isTypeKnown(). */
|
||||
if (fe->isConstant())
|
||||
masm.storeTypeTag(ImmTag(fe->getKnownTag()), to);
|
||||
else if (fe->isTypeKnown())
|
||||
masm.storeTypeTag(ImmType(fe->getKnownType()), to);
|
||||
} else {
|
||||
else
|
||||
masm.storeTypeTag(fe->type.reg(), to);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -507,18 +508,10 @@ FrameState::syncData(const FrameEntry *fe, Address to, Assembler &masm) const
|
|||
!fe->data.synced());
|
||||
JS_ASSERT(fe->data.inRegister() || fe->data.isConstant());
|
||||
|
||||
if (fe->data.isConstant()) {
|
||||
if (!fe->type.synced())
|
||||
masm.storeValue(fe->getValue(), to);
|
||||
else
|
||||
#if defined JS_NUNBOX32
|
||||
masm.storePayload(Imm32(fe->getPayload32()), to);
|
||||
#elif defined JS_PUNBOX64
|
||||
masm.storePayload(Imm64(fe->getPayload64()), to);
|
||||
#endif
|
||||
} else {
|
||||
if (fe->data.isConstant())
|
||||
masm.storePayload(ImmPayload(fe->getPayload()), to);
|
||||
else
|
||||
masm.storePayload(fe->data.reg(), to);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
|
@ -850,18 +843,12 @@ FrameState::loadDouble(FrameEntry *fe, FPRegisterID fpReg, Assembler &masm) cons
|
|||
return;
|
||||
}
|
||||
|
||||
Address address = addressOf(fe);
|
||||
do {
|
||||
if (!fe->data.synced()) {
|
||||
syncData(fe, address, masm);
|
||||
if (fe->isConstant())
|
||||
break;
|
||||
}
|
||||
if (!fe->type.synced())
|
||||
syncType(fe, address, masm);
|
||||
} while (0);
|
||||
if (!fe->data.synced())
|
||||
syncData(fe, addressOf(fe), masm);
|
||||
if (!fe->type.synced())
|
||||
syncType(fe, addressOf(fe), masm);
|
||||
|
||||
masm.loadDouble(address, fpReg);
|
||||
masm.loadDouble(addressOf(fe), fpReg);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -870,8 +857,8 @@ FrameState::isClosedVar(uint32 slot)
|
|||
return closedVars[slot];
|
||||
}
|
||||
|
||||
} /* namspace mjit */
|
||||
} /* namspace js */
|
||||
} /* namespace mjit */
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* include */
|
||||
|
||||
|
|
|
@ -481,13 +481,10 @@ FrameState::sync(Assembler &masm, Uses uses) const
|
|||
* already been synced. Otherwise, see if a constant needs to be
|
||||
* synced.
|
||||
*/
|
||||
if (fe->data.inRegister()) {
|
||||
if (fe->data.inRegister())
|
||||
avail.putReg(fe->data.reg());
|
||||
} else if (!fe->data.synced()) {
|
||||
else if (!fe->data.synced())
|
||||
syncData(fe, address, masm);
|
||||
if (fe->isConstant())
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fe->type.inRegister())
|
||||
avail.putReg(fe->type.reg());
|
||||
|
@ -577,9 +574,7 @@ FrameState::syncAndKill(Registers kill, Uses uses, Uses ignore)
|
|||
tempRegForData(backing);
|
||||
syncData(backing, address, masm);
|
||||
fe->data.sync();
|
||||
if (fe->isConstant() && !fe->type.synced()) {
|
||||
fe->type.sync();
|
||||
} else if (fe->data.inRegister() && kill.hasReg(fe->data.reg())) {
|
||||
if (fe->data.inRegister() && kill.hasReg(fe->data.reg())) {
|
||||
forgetReg(fe->data.reg());
|
||||
fe->data.setMemory();
|
||||
}
|
||||
|
@ -790,17 +785,10 @@ FrameState::copyEntryIntoFPReg(Assembler &masm, FrameEntry *fe, FPRegisterID fpr
|
|||
fe = fe->copyOf();
|
||||
|
||||
/* The entry must be synced to memory. */
|
||||
if (fe->data.isConstant()) {
|
||||
if (!fe->data.synced())
|
||||
syncData(fe, addressOf(fe), masm);
|
||||
if (!fe->type.synced())
|
||||
syncType(fe, addressOf(fe), masm);
|
||||
} else {
|
||||
if (fe->data.inRegister() && !fe->data.synced())
|
||||
syncData(fe, addressOf(fe), masm);
|
||||
if (fe->type.inRegister() && !fe->type.synced())
|
||||
syncType(fe, addressOf(fe), masm);
|
||||
}
|
||||
if (!fe->data.synced())
|
||||
syncData(fe, addressOf(fe), masm);
|
||||
if (!fe->type.synced())
|
||||
syncType(fe, addressOf(fe), masm);
|
||||
|
||||
masm.loadDouble(addressOf(fe), fpreg);
|
||||
return fpreg;
|
||||
|
@ -1114,39 +1102,37 @@ FrameState::storeLocal(uint32 n, bool popGuaranteed, bool typeChange)
|
|||
storeTop(local, popGuaranteed, typeChange);
|
||||
|
||||
bool closed = eval || isClosedVar(n);
|
||||
if (closed || inTryBlock) {
|
||||
/* Ensure that the local variable remains synced. */
|
||||
if (local->isCopy()) {
|
||||
FrameEntry *backing = local->copyOf();
|
||||
if (!local->data.synced()) {
|
||||
if (backing->data.inMemory())
|
||||
tempRegForData(backing);
|
||||
syncData(backing, addressOf(local), masm);
|
||||
}
|
||||
if (!local->type.synced()) {
|
||||
if (backing->type.inMemory())
|
||||
tempRegForType(backing);
|
||||
syncType(backing, addressOf(local), masm);
|
||||
}
|
||||
} else if (local->isConstant()) {
|
||||
if (!local->data.synced())
|
||||
syncData(local, addressOf(local), masm);
|
||||
} else {
|
||||
if (!local->data.synced()) {
|
||||
syncData(local, addressOf(local), masm);
|
||||
local->data.sync();
|
||||
}
|
||||
if (!local->type.synced()) {
|
||||
syncType(local, addressOf(local), masm);
|
||||
local->type.sync();
|
||||
}
|
||||
if (closed)
|
||||
forgetEntry(local);
|
||||
}
|
||||
if (!closed && !inTryBlock)
|
||||
return;
|
||||
|
||||
/* Ensure that the local variable remains synced. */
|
||||
if (local->isCopy()) {
|
||||
FrameEntry *backing = local->copyOf();
|
||||
if (!local->data.synced()) {
|
||||
if (backing->data.inMemory())
|
||||
tempRegForData(backing);
|
||||
syncData(backing, addressOf(local), masm);
|
||||
}
|
||||
if (!local->type.synced()) {
|
||||
if (backing->type.inMemory())
|
||||
tempRegForType(backing);
|
||||
syncType(backing, addressOf(local), masm);
|
||||
}
|
||||
} else {
|
||||
if (!local->data.synced()) {
|
||||
syncData(local, addressOf(local), masm);
|
||||
local->data.sync();
|
||||
}
|
||||
if (!local->type.synced()) {
|
||||
syncType(local, addressOf(local), masm);
|
||||
local->type.sync();
|
||||
}
|
||||
if (closed)
|
||||
local->resetSynced();
|
||||
forgetEntry(local);
|
||||
}
|
||||
|
||||
if (closed)
|
||||
local->resetSynced();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -47,13 +47,9 @@
|
|||
namespace js {
|
||||
namespace mjit {
|
||||
|
||||
/*
|
||||
* Don't use ImmTag. Use ImmType instead.
|
||||
* TODO: ImmTag should really just be for internal use...
|
||||
*/
|
||||
class ImmTag : public JSC::MacroAssembler::Imm32
|
||||
/* Don't use ImmTag. Use ImmType instead. */
|
||||
struct ImmTag : JSC::MacroAssembler::Imm32
|
||||
{
|
||||
public:
|
||||
ImmTag(JSValueTag mask)
|
||||
: Imm32(int32(mask))
|
||||
{ }
|
||||
|
@ -66,6 +62,13 @@ struct ImmType : ImmTag
|
|||
{ }
|
||||
};
|
||||
|
||||
struct ImmPayload : JSC::MacroAssembler::Imm32
|
||||
{
|
||||
ImmPayload(uint32 payload)
|
||||
: Imm32(payload)
|
||||
{ }
|
||||
};
|
||||
|
||||
class Assembler : public BaseAssembler
|
||||
{
|
||||
static const uint32 PAYLOAD_OFFSET = 0;
|
||||
|
@ -111,7 +114,7 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void storeTypeTag(ImmType imm, T address) {
|
||||
void storeTypeTag(ImmTag imm, T address) {
|
||||
store32(imm, tagOf(address));
|
||||
}
|
||||
|
||||
|
@ -131,7 +134,7 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void storePayload(Imm32 imm, T address) {
|
||||
void storePayload(ImmPayload imm, T address) {
|
||||
store32(imm, payloadOf(address));
|
||||
}
|
||||
|
||||
|
|
|
@ -47,27 +47,32 @@
|
|||
namespace js {
|
||||
namespace mjit {
|
||||
|
||||
class Imm64 : public JSC::MacroAssembler::ImmPtr
|
||||
struct Imm64 : JSC::MacroAssembler::ImmPtr
|
||||
{
|
||||
public:
|
||||
Imm64(uint64 u)
|
||||
: ImmPtr((const void *)u)
|
||||
{ }
|
||||
};
|
||||
|
||||
class ImmShiftedTag : public JSC::MacroAssembler::ImmPtr
|
||||
/* Tag stored in shifted format. */
|
||||
struct ImmTag : JSC::MacroAssembler::ImmPtr
|
||||
{
|
||||
public:
|
||||
ImmShiftedTag(JSValueShiftedTag shtag)
|
||||
ImmTag(JSValueShiftedTag shtag)
|
||||
: ImmPtr((const void *)shtag)
|
||||
{ }
|
||||
};
|
||||
|
||||
class ImmType : public ImmShiftedTag
|
||||
struct ImmType : ImmTag
|
||||
{
|
||||
public:
|
||||
ImmType(JSValueType type)
|
||||
: ImmShiftedTag(JSValueShiftedTag(JSVAL_TYPE_TO_SHIFTED_TAG(type)))
|
||||
: ImmTag(JSValueShiftedTag(JSVAL_TYPE_TO_SHIFTED_TAG(type)))
|
||||
{ }
|
||||
};
|
||||
|
||||
struct ImmPayload : Imm64
|
||||
{
|
||||
ImmPayload(uint64 payload)
|
||||
: Imm64(payload)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -138,7 +143,7 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void storeValueFromComponents(ImmShiftedTag type, RegisterID payload, T address) {
|
||||
void storeValueFromComponents(ImmTag type, RegisterID payload, T address) {
|
||||
move(type, Registers::ValueReg);
|
||||
orPtr(payload, Registers::ValueReg);
|
||||
storeValue(Registers::ValueReg, address);
|
||||
|
@ -151,7 +156,7 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void storeTypeTag(ImmShiftedTag imm, T address) {
|
||||
void storeTypeTag(ImmTag imm, T address) {
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToPayload(Registers::ValueReg);
|
||||
orPtr(imm, Registers::ValueReg);
|
||||
|
@ -183,7 +188,7 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
void storePayload(Imm64 imm, T address) {
|
||||
void storePayload(ImmPayload imm, T address) {
|
||||
/* Not for doubles. */
|
||||
storePtr(imm, valueOf(address));
|
||||
}
|
||||
|
@ -223,7 +228,7 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
Jump testNull(Assembler::Condition cond, RegisterID reg) {
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_NULL));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_NULL));
|
||||
}
|
||||
|
||||
Jump testNull(Assembler::Condition cond, Address address) {
|
||||
|
@ -232,47 +237,47 @@ class Assembler : public BaseAssembler
|
|||
}
|
||||
|
||||
Jump testInt32(Assembler::Condition cond, RegisterID reg) {
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
}
|
||||
|
||||
Jump testInt32(Assembler::Condition cond, Address address) {
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(cond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
return branchPtr(cond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
}
|
||||
|
||||
Jump testNumber(Assembler::Condition cond, RegisterID reg) {
|
||||
cond = (cond == Assembler::Equal) ? Assembler::BelowOrEqual : Assembler::Above;
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
}
|
||||
|
||||
Jump testNumber(Assembler::Condition cond, Address address) {
|
||||
cond = (cond == Assembler::Equal) ? Assembler::BelowOrEqual : Assembler::Above;
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(cond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
return branchPtr(cond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_INT32));
|
||||
}
|
||||
|
||||
Jump testPrimitive(Assembler::Condition cond, RegisterID reg) {
|
||||
cond = (cond == Assembler::NotEqual) ? Assembler::AboveOrEqual : Assembler::Below;
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
}
|
||||
|
||||
Jump testPrimitive(Assembler::Condition cond, Address address) {
|
||||
cond = (cond == Assembler::NotEqual) ? Assembler::AboveOrEqual : Assembler::Below;
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(cond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
return branchPtr(cond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
}
|
||||
|
||||
Jump testObject(Assembler::Condition cond, RegisterID reg) {
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
}
|
||||
|
||||
Jump testObject(Assembler::Condition cond, Address address) {
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(cond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
return branchPtr(cond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_OBJECT));
|
||||
}
|
||||
|
||||
Jump testDouble(Assembler::Condition cond, RegisterID reg) {
|
||||
|
@ -281,7 +286,7 @@ class Assembler : public BaseAssembler
|
|||
opcond = Assembler::Below;
|
||||
else
|
||||
opcond = Assembler::AboveOrEqual;
|
||||
return branchPtr(opcond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_MAX_DOUBLE));
|
||||
return branchPtr(opcond, reg, ImmTag(JSVAL_SHIFTED_TAG_MAX_DOUBLE));
|
||||
}
|
||||
|
||||
Jump testDouble(Assembler::Condition cond, Address address) {
|
||||
|
@ -292,27 +297,27 @@ class Assembler : public BaseAssembler
|
|||
opcond = Assembler::AboveOrEqual;
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(opcond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_MAX_DOUBLE));
|
||||
return branchPtr(opcond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_MAX_DOUBLE));
|
||||
}
|
||||
|
||||
Jump testBoolean(Assembler::Condition cond, RegisterID reg) {
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_BOOLEAN));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_BOOLEAN));
|
||||
}
|
||||
|
||||
Jump testBoolean(Assembler::Condition cond, Address address) {
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(cond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_BOOLEAN));
|
||||
return branchPtr(cond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_BOOLEAN));
|
||||
}
|
||||
|
||||
Jump testString(Assembler::Condition cond, RegisterID reg) {
|
||||
return branchPtr(cond, reg, ImmShiftedTag(JSVAL_SHIFTED_TAG_STRING));
|
||||
return branchPtr(cond, reg, ImmTag(JSVAL_SHIFTED_TAG_STRING));
|
||||
}
|
||||
|
||||
Jump testString(Assembler::Condition cond, Address address) {
|
||||
loadValue(address, Registers::ValueReg);
|
||||
convertValueToType(Registers::ValueReg);
|
||||
return branchPtr(cond, Registers::ValueReg, ImmShiftedTag(JSVAL_SHIFTED_TAG_BOOLEAN));
|
||||
return branchPtr(cond, Registers::ValueReg, ImmTag(JSVAL_SHIFTED_TAG_BOOLEAN));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче