Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 8e1f65c771800d5e501d0e8989dc9af8b9741ca2..b4786743b8844a3615e951746e388a39b1340845 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3963,10 +3963,13 @@ void LCodeGen::DoMathLog(LMathLog* instr) { |
__ ucomisd(input_reg, xmm_scratch); |
__ j(above, &positive, Label::kNear); |
__ j(not_carry, &zero, Label::kNear); |
- ExternalReference nan = |
- ExternalReference::address_of_canonical_non_hole_nan(); |
- Operand nan_operand = masm()->ExternalOperand(nan); |
- __ movsd(input_reg, nan_operand); |
+ if (CpuFeatures::IsSupported(AVX)) { |
+ CpuFeatureScope scope2(masm(), AVX); |
+ __ vdivsd(input_reg, xmm_scratch, xmm_scratch); |
+ } else { |
+ __ divsd(xmm_scratch, xmm_scratch); |
+ __ movsd(input_reg, xmm_scratch); |
+ } |
__ jmp(&done, Label::kNear); |
__ bind(&zero); |
ExternalReference ninf = |
@@ -4390,17 +4393,10 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { |
__ movsxlq(ToRegister(key), ToRegister(key)); |
} |
if (instr->NeedsCanonicalization()) { |
- Label have_value; |
- |
- __ ucomisd(value, value); |
- __ j(parity_odd, &have_value, Label::kNear); // NaN. |
- |
- __ Set(kScratchRegister, |
- bit_cast<uint64_t>( |
- FixedDoubleArray::canonical_not_the_hole_nan_as_double())); |
- __ movq(value, kScratchRegister); |
- |
- __ bind(&have_value); |
+ XMMRegister xmm_scratch = double_scratch0(); |
+ // Turn potential sNaN value into qNaN. |
+ __ xorps(xmm_scratch, xmm_scratch); |
+ __ subsd(value, xmm_scratch); |
} |
Operand double_store_operand = BuildFastArrayOperand( |