mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 930437 - Remove unnecessary compilation aborts from Lowering::visitToInt32. r=bhackett
This commit is contained in:
parent
88bbf03777
commit
7ad599e14d
@ -1732,17 +1732,10 @@ LIRGenerator::visitToInt32(MToInt32 *convert)
|
||||
}
|
||||
|
||||
case MIRType_String:
|
||||
// Strings are complicated - we don't handle them yet.
|
||||
IonSpew(IonSpew_Abort, "String to Int32 not supported yet.");
|
||||
return false;
|
||||
|
||||
case MIRType_Object:
|
||||
// Objects might be effectful.
|
||||
IonSpew(IonSpew_Abort, "Object to Int32 not supported yet.");
|
||||
return false;
|
||||
|
||||
case MIRType_Undefined:
|
||||
IonSpew(IonSpew_Abort, "Undefined coerces to NaN, not int32_t.");
|
||||
// Objects might be effectful. Undefined coerces to NaN, not int32.
|
||||
MOZ_ASSUME_UNREACHABLE("ToInt32 invalid input type");
|
||||
return false;
|
||||
|
||||
default:
|
||||
|
@ -2919,7 +2919,9 @@ class MAsmJSUnsignedToFloat32
|
||||
// Converts a primitive (either typed or untyped) to an int32. If the input is
|
||||
// not primitive at runtime, a bailout occurs. If the input cannot be converted
|
||||
// to an int32 without loss (i.e. "5.5" or undefined) then a bailout occurs.
|
||||
class MToInt32 : public MUnaryInstruction
|
||||
class MToInt32
|
||||
: public MUnaryInstruction,
|
||||
public ToInt32Policy
|
||||
{
|
||||
bool canBeNegativeZero_;
|
||||
|
||||
@ -2950,6 +2952,10 @@ class MToInt32 : public MUnaryInstruction
|
||||
canBeNegativeZero_ = negativeZero;
|
||||
}
|
||||
|
||||
TypePolicy *typePolicy() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool congruentTo(MDefinition *ins) const {
|
||||
return congruentIfOperandsEqual(ins);
|
||||
}
|
||||
|
@ -536,6 +536,27 @@ ToDoublePolicy::staticAdjustInputs(MInstruction *ins)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ToInt32Policy::staticAdjustInputs(MInstruction *ins)
|
||||
{
|
||||
JS_ASSERT(ins->isToInt32());
|
||||
|
||||
MDefinition *in = ins->getOperand(0);
|
||||
switch (in->type()) {
|
||||
case MIRType_Object:
|
||||
case MIRType_String:
|
||||
case MIRType_Undefined:
|
||||
// Objects might be effectful. Undefined coerces to NaN, not int32.
|
||||
in = boxAt(ins, in);
|
||||
ins->replaceOperand(0, in);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <unsigned Op>
|
||||
bool
|
||||
ObjectPolicy<Op>::staticAdjustInputs(MInstruction *ins)
|
||||
|
@ -194,6 +194,16 @@ class ToDoublePolicy : public BoxInputsPolicy
|
||||
}
|
||||
};
|
||||
|
||||
// Box objects, strings and undefined as input to a ToInt32 instruction.
|
||||
class ToInt32Policy : public BoxInputsPolicy
|
||||
{
|
||||
public:
|
||||
static bool staticAdjustInputs(MInstruction *def);
|
||||
bool adjustInputs(MInstruction *def) {
|
||||
return staticAdjustInputs(def);
|
||||
}
|
||||
};
|
||||
|
||||
template <unsigned Op>
|
||||
class ObjectPolicy : public BoxInputsPolicy
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user