forked from mirrors/gecko-dev
Bug 1894456: Handle Float32 for null and undefined comparisons r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D209176
This commit is contained in:
parent
e024c86bb9
commit
077138cc3d
3 changed files with 22 additions and 1 deletions
6
js/src/jit-test/tests/ion/bug1894456-1.js
Normal file
6
js/src/jit-test/tests/ion/bug1894456-1.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var f32 = new Float32Array(1);
|
||||
for (var i = 0; i < 50; i++) {
|
||||
if (f32[0] != null) {
|
||||
}
|
||||
try {} catch {}
|
||||
}
|
||||
6
js/src/jit-test/tests/ion/bug1894456-2.js
Normal file
6
js/src/jit-test/tests/ion/bug1894456-2.js
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var f32 = new Float32Array(1);
|
||||
for (var i = 0; i < 50; i++) {
|
||||
if (f32[0] != undefined) {
|
||||
}
|
||||
try {} catch {}
|
||||
}
|
||||
|
|
@ -229,7 +229,16 @@ bool ComparePolicy::adjustInputs(TempAllocator& alloc,
|
|||
switch (compare->compareType()) {
|
||||
case MCompare::Compare_Undefined:
|
||||
case MCompare::Compare_Null:
|
||||
// Nothing to do for undefined and null, lowering handles all types.
|
||||
MOZ_ASSERT(compare->rhs()->type() == MIRType::Undefined ||
|
||||
compare->rhs()->type() == MIRType::Null);
|
||||
// IF the operand is float32, we must convert it to a double.
|
||||
if (compare->lhs()->type() == MIRType::Float32) {
|
||||
MInstruction* replace = MToDouble::New(alloc, compare->lhs());
|
||||
def->block()->insertBefore(def, replace);
|
||||
def->replaceOperand(0, replace);
|
||||
return replace->typePolicy()->adjustInputs(alloc, replace);
|
||||
}
|
||||
// GVN and lowering handle all other types.
|
||||
return true;
|
||||
case MCompare::Compare_Int32:
|
||||
return convertOperand(0, MIRType::Int32) &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue