Bug 867820 - Box boolean inputs to double comparisons when a double conversion isn't possible, r=jandem.

This commit is contained in:
Brian Hackett 2013-05-28 07:27:37 -06:00
parent fa7778cfc5
commit 41a2d16cb7
2 changed files with 20 additions and 0 deletions

View File

@ -191,6 +191,8 @@ ComparePolicy::adjustInputs(MInstruction *def)
convert = MToDouble::NonNullNonStringPrimitives;
else if (compare->compareType() == MCompare::Compare_DoubleMaybeCoerceRHS && i == 1)
convert = MToDouble::NonNullNonStringPrimitives;
if (convert == MToDouble::NumbersOnly && in->type() == MIRType_Boolean)
in = boxAt(def, in);
replace = MToDouble::New(in, convert);
break;
}

View File

@ -0,0 +1,18 @@
function AddTestCase(expect, actual) {
new TestCase(expect, actual);
}
function TestCase(e, a) {
this.expect = e;
getTestCaseResult(e, a);
}
function getTestCaseResult(expected, actual) {
if (actual != expected) {}
}
AddRegExpCases(false, Math.pow(2,31));
AddRegExpCases("", Math.pow(2,30) - 1);
function AddRegExpCases(m, l) {
AddTestCase("");
AddTestCase(m, true);
AddTestCase(l, 0);
}