Index: src/x64/codegen-x64.cc |
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc |
index 5851fb1a93f3fbd26404d27d2fa9b8c67bd81de6..572fa623eec145417e2c2ddd8c8cf4117100d176 100644 |
--- a/src/x64/codegen-x64.cc |
+++ b/src/x64/codegen-x64.cc |
@@ -5336,9 +5336,8 @@ void CodeGenerator::ToBoolean(ControlDestination* dest) { |
dest->false_target()->Branch(equal); |
Condition is_smi = masm_->CheckSmi(value.reg()); |
dest->true_target()->Branch(is_smi); |
- __ fldz(); |
- __ fld_d(FieldOperand(value.reg(), HeapNumber::kValueOffset)); |
- __ FCmp(); |
+ __ xorpd(xmm0, xmm0); |
+ __ ucomisd(xmm0, FieldOperand(value.reg(), HeapNumber::kValueOffset)); |
value.Unuse(); |
dest->Split(not_zero); |
} else { |
@@ -8000,14 +7999,12 @@ void ToBooleanStub::Generate(MacroAssembler* masm) { |
__ jmp(&true_result); |
__ bind(¬_string); |
- // HeapNumber => false iff +0, -0, or NaN. |
- // These three cases set C3 when compared to zero in the FPU. |
__ CompareRoot(rdx, Heap::kHeapNumberMapRootIndex); |
__ j(not_equal, &true_result); |
- __ fldz(); // Load zero onto fp stack |
- // Load heap-number double value onto fp stack |
- __ fld_d(FieldOperand(rax, HeapNumber::kValueOffset)); |
- __ FCmp(); |
+ // HeapNumber => false iff +0, -0, or NaN. |
+ // These three cases set the zero flag when compared to zero using ucomisd. |
+ __ xorpd(xmm0, xmm0); |
+ __ ucomisd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset)); |
__ j(zero, &false_result); |
// Fall through to |true_result|. |