Bug 878435 - In asmjs mode, compare in uint32 mode only if both operands are unsigned. r=luke

This commit is contained in:
Benjamin Bouvier 2013-06-06 17:00:08 -07:00
parent e9ecd45e88
commit 9ee14f0649
2 changed files with 12 additions and 1 deletions

View File

@ -3985,7 +3985,7 @@ CheckComparison(FunctionCompiler &f, ParseNode *comp, MDefinition **def, Type *t
return false;
if ((lhsType.isSigned() && rhsType.isSigned()) || (lhsType.isUnsigned() && rhsType.isUnsigned())) {
MCompare::CompareType compareType = lhsType.isUnsigned()
MCompare::CompareType compareType = (lhsType.isUnsigned() && rhsType.isUnsigned())
? MCompare::Compare_UInt32
: MCompare::Compare_Int32;
*def = f.compare(lhsDef, rhsDef, comp->getOp(), compareType);

View File

@ -0,0 +1,11 @@
function g()
{
"use asm";
function f()
{
return (0 > (0x80000000 | 0)) | 0;
}
return f;
}
assertEq(g()(), (0 > (0x80000000 | 0)) | 0);