Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10648,6 +10648,11 @@ GlobOpt::TypeSpecializeFloatBinary(IR::Instr *instr, Value *src1Val, Value *src2
case Js::OpCode::CmGe_A:
case Js::OpCode::CmGt_A:
{
if (src1Val->GetValueInfo()->IsNotNumber() || src2Val->GetValueInfo()->IsNotNumber())
{
return false;
}

convertDstToBool = true;
break;
}
Expand Down
17 changes: 17 additions & 0 deletions test/Basics/FloatComparison.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,23 @@ var tests = [
assert.isFalse({} < 0.5);
assert.isFalse({} <= 0.5);
}
},
{
name: "No float type specialization when operands are not number",
body: function() {
function test0() {
var func2 = function () {
return f32[1];
};
var f32 = new Float32Array();
var f = 100;
for (let i = 0; i < f; i++) {
var id41 = 'caller';
({ 18: func2() === 'caller' });
}
}
test0();
}
}
];

Expand Down