Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index 0ab84e412be54008c1cf154eee2c9c0a14eb480c..f8cad769d3f00080aa136cfd6766095fd454cc2b 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -164,18 +164,33 @@ class OutOfLineLoadZero final : public OutOfLineCode { |
Register const result_; |
}; |
- |
-class OutOfLineLoadNaN final : public OutOfLineCode { |
+class OutOfLineLoadFloat32NaN final : public OutOfLineCode { |
public: |
- OutOfLineLoadNaN(CodeGenerator* gen, XMMRegister result) |
+ OutOfLineLoadFloat32NaN(CodeGenerator* gen, XMMRegister result) |
: OutOfLineCode(gen), result_(result) {} |
- void Generate() final { __ Pcmpeqd(result_, result_); } |
+ void Generate() final { |
+ __ Xorps(result_, result_); |
+ __ Divss(result_, result_); |
+ } |
private: |
XMMRegister const result_; |
}; |
+class OutOfLineLoadFloat64NaN final : public OutOfLineCode { |
+ public: |
+ OutOfLineLoadFloat64NaN(CodeGenerator* gen, XMMRegister result) |
+ : OutOfLineCode(gen), result_(result) {} |
+ |
+ void Generate() final { |
+ __ Xorpd(result_, result_); |
+ __ Divsd(result_, result_); |
+ } |
+ |
+ private: |
+ XMMRegister const result_; |
+}; |
class OutOfLineTruncateDoubleToI final : public OutOfLineCode { |
public: |
@@ -381,7 +396,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
} \ |
} while (0) |
-#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr) \ |
+#define ASSEMBLE_CHECKED_LOAD_FLOAT(asm_instr, OutOfLineLoadNaN) \ |
do { \ |
auto result = i.OutputDoubleRegister(); \ |
auto buffer = i.InputRegister(0); \ |
@@ -1289,7 +1304,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
} else { |
__ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
} |
- auto ool = new (zone()) OutOfLineLoadNaN(this, i.OutputDoubleRegister()); |
+ auto ool = |
+ new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); |
__ j(parity_even, ool->entry()); |
__ j(above, &done_compare, Label::kNear); |
__ j(below, &compare_swap, Label::kNear); |
@@ -1313,7 +1329,8 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
} else { |
__ Ucomisd(i.InputDoubleRegister(0), i.InputOperand(1)); |
} |
- auto ool = new (zone()) OutOfLineLoadNaN(this, i.OutputDoubleRegister()); |
+ auto ool = |
+ new (zone()) OutOfLineLoadFloat64NaN(this, i.OutputDoubleRegister()); |
__ j(parity_even, ool->entry()); |
__ j(below, &done_compare, Label::kNear); |
__ j(above, &compare_swap, Label::kNear); |
@@ -1965,10 +1982,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
ASSEMBLE_CHECKED_LOAD_INTEGER(movq); |
break; |
case kCheckedLoadFloat32: |
- ASSEMBLE_CHECKED_LOAD_FLOAT(Movss); |
+ ASSEMBLE_CHECKED_LOAD_FLOAT(Movss, OutOfLineLoadFloat32NaN); |
break; |
case kCheckedLoadFloat64: |
- ASSEMBLE_CHECKED_LOAD_FLOAT(Movsd); |
+ ASSEMBLE_CHECKED_LOAD_FLOAT(Movsd, OutOfLineLoadFloat64NaN); |
break; |
case kCheckedStoreWord8: |
ASSEMBLE_CHECKED_STORE_INTEGER(movb); |