Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 160db3bd91959475457aae6c7d19245d191333b0..f2cf9cf762012c339b882813a5ac4ae4ea921dca 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -2862,7 +2862,10 @@ void LCodeGen::DoMathPowHalf(LUnaryMathOperation* instr) { |
__ movq(kScratchRegister, V8_INT64_C(0xFFF0000000000000), RelocInfo::NONE); |
__ movq(xmm_scratch, kScratchRegister); |
__ ucomisd(xmm_scratch, input_reg); |
+ // Comparing -Infinity with NaN results in "unordered", which sets the |
+ // zero flag as if both were equal. However, it also sets the carry flag. |
__ j(not_equal, &sqrt, Label::kNear); |
+ __ j(carry, &sqrt, Label::kNear); |
// If input is -Infinity, return Infinity. |
__ xorps(input_reg, input_reg); |
__ subsd(input_reg, xmm_scratch); |