Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 1170e890d4e77a934ac9bc9258936b116b83027a..c9db6875d6a7e2c8a8b3692e9aa4229bac1adc84 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3547,6 +3547,7 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
void LCodeGen::EmitNumberUntagD(Register input_reg, |
XMMRegister result_reg, |
bool deoptimize_on_undefined, |
+ bool deoptimize_on_minus_zero, |
LEnvironment* env) { |
Label load_smi, done; |
@@ -3574,6 +3575,15 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
} |
// Heap number to XMM conversion. |
__ movsd(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
+ if (deoptimize_on_minus_zero) { |
+ XMMRegister xmm_scratch = xmm0; |
+ __ xorps(xmm_scratch, xmm_scratch); |
+ __ ucomisd(xmm_scratch, result_reg); |
+ __ j(not_equal, &done, Label::kNear); |
+ __ movmskpd(kScratchRegister, result_reg); |
+ __ testq(kScratchRegister, Immediate(1)); |
+ DeoptimizeIf(not_zero, env); |
+ } |
__ jmp(&done, Label::kNear); |
// Smi to XMM conversion |
@@ -3665,6 +3675,7 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
EmitNumberUntagD(input_reg, result_reg, |
instr->hydrogen()->deoptimize_on_undefined(), |
+ instr->hydrogen()->deoptimize_on_minus_zero(), |
instr->environment()); |
} |