mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Use loadValueAsComponents() for faster loading on x64. b=587444, r=dvander.
This commit is contained in:
parent
7556886c23
commit
86f33eea9f
@ -1839,8 +1839,7 @@ mjit::Compiler::emitReturn()
|
||||
JS_STATIC_ASSERT(Registers::ReturnReg != JSReturnReg_Type);
|
||||
|
||||
Address rval(JSFrameReg, JSStackFrame::offsetOfReturnValue());
|
||||
masm.loadPayload(rval, JSReturnReg_Data);
|
||||
masm.loadTypeTag(rval, JSReturnReg_Type);
|
||||
masm.loadValueAsComponents(rval, JSReturnReg_Type, JSReturnReg_Data);
|
||||
masm.restoreReturnAddress();
|
||||
masm.move(Registers::ReturnReg, JSFrameReg);
|
||||
#ifdef DEBUG
|
||||
@ -1896,8 +1895,7 @@ mjit::Compiler::emitPrimitiveTestForNew(uint32 argc)
|
||||
stubcc.linkExitDirect(primitive, stubcc.masm.label());
|
||||
FrameEntry *fe = frame.peek(-int(argc + 1));
|
||||
Address thisv(frame.addressOf(fe));
|
||||
stubcc.masm.loadTypeTag(thisv, JSReturnReg_Type);
|
||||
stubcc.masm.loadPayload(thisv, JSReturnReg_Data);
|
||||
stubcc.masm.loadValueAsComponents(thisv, JSReturnReg_Type, JSReturnReg_Data);
|
||||
Jump primFix = stubcc.masm.jump();
|
||||
stubcc.crossJump(primFix, masm.label());
|
||||
}
|
||||
|
@ -1376,29 +1376,26 @@ mjit::Compiler::jsop_getelem_dense(FrameEntry *obj, FrameEntry *id, RegisterID o
|
||||
/* guard not a hole */
|
||||
Address slot(objReg, id->getValue().toInt32() * sizeof(Value));
|
||||
#if defined JS_NUNBOX32
|
||||
Jump notHole = masm.branch32(Assembler::Equal, masm.tagOf(slot), ImmType(JSVAL_TYPE_MAGIC));
|
||||
masm.loadTypeTag(slot, tmpReg);
|
||||
Jump notHole = masm.branchPtr(Assembler::Equal, tmpReg, ImmType(JSVAL_TYPE_MAGIC));
|
||||
masm.loadPayload(slot, objReg);
|
||||
#elif defined JS_PUNBOX64
|
||||
masm.loadTypeTag(slot, Registers::ValueReg);
|
||||
Jump notHole = masm.branchPtr(Assembler::Equal, Registers::ValueReg, ImmType(JSVAL_TYPE_MAGIC));
|
||||
masm.loadValueAsComponents(slot, tmpReg, objReg);
|
||||
Jump notHole = masm.branchPtr(Assembler::Equal, tmpReg, ImmType(JSVAL_TYPE_MAGIC));
|
||||
#endif
|
||||
stubcc.linkExit(notHole, Uses(2));
|
||||
|
||||
/* Load slot address into regs. */
|
||||
masm.loadTypeTag(slot, tmpReg);
|
||||
masm.loadPayload(slot, objReg);
|
||||
} else {
|
||||
/* guard not a hole */
|
||||
BaseIndex slot(objReg, idReg.reg(), Assembler::JSVAL_SCALE);
|
||||
#if defined JS_NUNBOX32
|
||||
Jump notHole = masm.branch32(Assembler::Equal, masm.tagOf(slot), ImmType(JSVAL_TYPE_MAGIC));
|
||||
masm.loadTypeTag(slot, tmpReg);
|
||||
Jump notHole = masm.branchPtr(Assembler::Equal, tmpReg, ImmType(JSVAL_TYPE_MAGIC));
|
||||
masm.loadPayload(slot, objReg);
|
||||
#elif defined JS_PUNBOX64
|
||||
masm.loadTypeTag(slot, Registers::ValueReg);
|
||||
Jump notHole = masm.branchPtr(Assembler::Equal, Registers::ValueReg, ImmType(JSVAL_TYPE_MAGIC));
|
||||
masm.loadValueAsComponents(slot, tmpReg, objReg);
|
||||
Jump notHole = masm.branchPtr(Assembler::Equal, tmpReg, ImmType(JSVAL_TYPE_MAGIC));
|
||||
#endif
|
||||
stubcc.linkExit(notHole, Uses(2));
|
||||
|
||||
masm.loadTypeTag(slot, tmpReg);
|
||||
masm.loadPayload(slot, objReg);
|
||||
}
|
||||
/* Postcondition: type must be in tmpReg, data must be in objReg. */
|
||||
|
||||
|
@ -452,17 +452,12 @@ FrameState::merge(Assembler &masm, Changes changes) const
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined JS_PUNBOX64
|
||||
if (fe->data.inRegister() && fe->type.inRegister()) {
|
||||
if (fe->data.inRegister() && fe->type.inRegister())
|
||||
masm.loadValueAsComponents(addressOf(fe), fe->type.reg(), fe->data.reg());
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
if (fe->data.inRegister())
|
||||
masm.loadPayload(addressOf(fe), fe->data.reg());
|
||||
if (fe->type.inRegister())
|
||||
masm.loadTypeTag(addressOf(fe), fe->type.reg());
|
||||
}
|
||||
else if (fe->data.inRegister())
|
||||
masm.loadPayload(addressOf(fe), fe->data.reg());
|
||||
else if (fe->type.inRegister())
|
||||
masm.loadTypeTag(addressOf(fe), fe->type.reg());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,6 +151,21 @@ class Assembler : public BaseAssembler
|
||||
store32(imm, payloadOf(address));
|
||||
}
|
||||
|
||||
/* Loads type first, then payload, returning label after type load. */
|
||||
Label loadValueAsComponents(Address address, RegisterID type, RegisterID payload) {
|
||||
loadTypeTag(address, type);
|
||||
Label l = label();
|
||||
loadPayload(address, payload);
|
||||
return l;
|
||||
}
|
||||
|
||||
Label loadValueAsComponents(BaseIndex address, RegisterID type, RegisterID payload) {
|
||||
loadTypeTag(address, type);
|
||||
Label l = label();
|
||||
loadPayload(address, payload);
|
||||
return l;
|
||||
}
|
||||
|
||||
/*
|
||||
* Stores type first, then payload.
|
||||
*/
|
||||
|
@ -1799,8 +1799,9 @@ class ScopeNameCompiler : public PICStubCompiler
|
||||
if (kind == VAR)
|
||||
slot += fun->nargs;
|
||||
Address dslot(pic.objReg, slot * sizeof(Value));
|
||||
masm.loadTypeTag(dslot, pic.shapeReg);
|
||||
masm.loadPayload(dslot, pic.objReg);
|
||||
|
||||
/* Safe because type is loaded first. */
|
||||
masm.loadValueAsComponents(dslot, pic.shapeReg, pic.objReg);
|
||||
}
|
||||
|
||||
skipOver.linkTo(masm.label(), &masm);
|
||||
|
@ -132,6 +132,17 @@ class Assembler : public BaseAssembler
|
||||
return l;
|
||||
}
|
||||
|
||||
Label loadValueAsComponents(BaseIndex address, RegisterID type, RegisterID payload) {
|
||||
loadValue(address, type);
|
||||
Label l = label();
|
||||
|
||||
move(Registers::PayloadMaskReg, payload);
|
||||
andPtr(type, payload);
|
||||
xorPtr(payload, type);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
void loadTypeTag(Address address, RegisterID reg) {
|
||||
loadValue(address, reg);
|
||||
convertValueToType(reg);
|
||||
|
@ -132,8 +132,7 @@ TrampolineCompiler::generateForceReturn(Assembler &masm)
|
||||
masm.storePtr(Registers::ReturnReg, FrameAddress(offsetof(VMFrame, regs.fp)));
|
||||
|
||||
Address rval(JSFrameReg, JSStackFrame::offsetOfReturnValue());
|
||||
masm.loadPayload(rval, JSReturnReg_Data);
|
||||
masm.loadTypeTag(rval, JSReturnReg_Type);
|
||||
masm.loadValueAsComponents(rval, JSReturnReg_Type, JSReturnReg_Data);
|
||||
|
||||
masm.restoreReturnAddress();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user