mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout 5059a4152b84.
This commit is contained in:
parent
e56ce78576
commit
aa7b1c5a1c
@ -160,8 +160,12 @@ CodeGeneratorX64::loadUnboxedValue(Operand source, MIRType type, const LDefiniti
|
||||
|
||||
case MIRType_Object:
|
||||
case MIRType_String:
|
||||
masm.unboxObject(source, ToRegister(dest));
|
||||
{
|
||||
Register out = ToRegister(dest);
|
||||
masm.movq(source, out);
|
||||
masm.unboxObject(ValueOperand(out), out);
|
||||
break;
|
||||
}
|
||||
|
||||
case MIRType_Int32:
|
||||
case MIRType_Boolean:
|
||||
@ -195,7 +199,8 @@ CodeGeneratorX64::storeUnboxedValue(const LAllocation *value, MIRType valueType,
|
||||
|
||||
// For known integers and booleans, we can just store the unboxed value if
|
||||
// the slot has the same type.
|
||||
if ((valueType == MIRType_Int32 || valueType == MIRType_Boolean) && slotType == valueType) {
|
||||
if ((valueType == MIRType_Int32 || valueType == MIRType_Boolean) &&
|
||||
slotType == valueType) {
|
||||
if (value->isConstant()) {
|
||||
Value val = *value->toConstant();
|
||||
if (valueType == MIRType_Int32)
|
||||
@ -212,7 +217,9 @@ CodeGeneratorX64::storeUnboxedValue(const LAllocation *value, MIRType valueType,
|
||||
masm.moveValue(*value->toConstant(), ScratchReg);
|
||||
masm.movq(ScratchReg, dest);
|
||||
} else {
|
||||
masm.storeValue(ValueTypeFromMIRType(valueType), ToRegister(value), dest);
|
||||
JSValueType type = ValueTypeFromMIRType(valueType);
|
||||
masm.boxValue(type, ToRegister(value), ScratchReg);
|
||||
masm.movq(ScratchReg, dest);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,31 +82,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
call(rax);
|
||||
}
|
||||
|
||||
// Refers to the upper 32 bits of a 64-bit Value operand.
|
||||
// On x86_64, the upper 32 bits do not necessarily only contain the type.
|
||||
static inline Operand ToUpper32(Operand base) {
|
||||
switch (base.kind()) {
|
||||
case Operand::REG_DISP:
|
||||
return Operand(Register::FromCode(base.base()), base.disp() + 4);
|
||||
|
||||
case Operand::SCALE:
|
||||
return Operand(Register::FromCode(base.base()), Register::FromCode(base.index()),
|
||||
base.scale(), base.disp() + 4);
|
||||
|
||||
default:
|
||||
JS_NOT_REACHED("unexpected operand kind");
|
||||
return base; // Silence GCC warning.
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t Upper32Of(JSValueShiftedTag tag) {
|
||||
return (uint32_t)(tag >> 32);
|
||||
}
|
||||
|
||||
static inline JSValueShiftedTag GetShiftedTag(JSValueType type) {
|
||||
return (JSValueShiftedTag)JSVAL_TYPE_TO_SHIFTED_TAG(type);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
// X86/X64-common interface.
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@ -118,15 +93,9 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
}
|
||||
template <typename T>
|
||||
void storeValue(JSValueType type, Register reg, const T &dest) {
|
||||
// Value types with 32-bit payloads can be emitted as two 32-bit moves.
|
||||
if (type == JSVAL_TYPE_INT32 || type == JSVAL_TYPE_BOOLEAN) {
|
||||
movl(reg, Operand(dest));
|
||||
movl(Imm32(Upper32Of(GetShiftedTag(type))), ToUpper32(Operand(dest)));
|
||||
} else {
|
||||
boxValue(type, reg, ScratchReg);
|
||||
movq(ScratchReg, Operand(dest));
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
void storeValue(const Value &val, const T &dest) {
|
||||
jsval_layout jv = JSVAL_TO_IMPL(val);
|
||||
@ -541,32 +510,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
// x64 can test for certain types directly from memory when the payload
|
||||
// of the type is limited to 32 bits. This avoids loading into a register,
|
||||
// accesses half as much memory, and removes a right-shift.
|
||||
void branchTestUndefined(Condition cond, const Operand &operand, Label *label) {
|
||||
JS_ASSERT(cond == Equal || cond == NotEqual);
|
||||
cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_UNDEFINED))));
|
||||
j(cond, label);
|
||||
}
|
||||
void branchTestInt32(Condition cond, const Operand &operand, Label *label) {
|
||||
JS_ASSERT(cond == Equal || cond == NotEqual);
|
||||
cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_INT32))));
|
||||
j(cond, label);
|
||||
}
|
||||
void branchTestBoolean(Condition cond, const Operand &operand, Label *label) {
|
||||
JS_ASSERT(cond == Equal || cond == NotEqual);
|
||||
cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_BOOLEAN))));
|
||||
j(cond, label);
|
||||
}
|
||||
void branchTestNull(Condition cond, const Operand &operand, Label *label) {
|
||||
JS_ASSERT(cond == Equal || cond == NotEqual);
|
||||
cmpl(ToUpper32(operand), Imm32(Upper32Of(GetShiftedTag(JSVAL_TYPE_NULL))));
|
||||
j(cond, label);
|
||||
}
|
||||
|
||||
// Perform a type-test on a full Value loaded into a register.
|
||||
// Clobbers the ScratchReg.
|
||||
// Type-testing instructions on x64 will clobber ScratchReg, when used on
|
||||
// ValueOperands.
|
||||
void branchTestUndefined(Condition cond, const ValueOperand &src, Label *label) {
|
||||
cond = testUndefined(cond, src);
|
||||
j(cond, label);
|
||||
@ -782,7 +727,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
||||
|
||||
void loadInt32OrDouble(const Operand &operand, const FloatRegister &dest) {
|
||||
Label notInt32, end;
|
||||
branchTestInt32(Assembler::NotEqual, operand, ¬Int32);
|
||||
movq(operand, ScratchReg);
|
||||
branchTestInt32(Assembler::NotEqual, ValueOperand(ScratchReg), ¬Int32);
|
||||
cvtsi2sd(operand, dest);
|
||||
jump(&end);
|
||||
bind(¬Int32);
|
||||
|
Loading…
Reference in New Issue
Block a user