Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index e0c3ae3d1df9c388f7b4e5cffd4526a9be943d14..91baa229c6034a1cfe12fe055884ed1bce6e02e6 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -3617,8 +3617,9 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
void LCodeGen::EmitNumberUntagD(Register input_reg, |
XMMRegister result_reg, |
+ bool deoptimize_on_undefined, |
LEnvironment* env) { |
- Label load_smi, heap_number, done; |
+ Label load_smi, done; |
// Smi check. |
__ test(input_reg, Immediate(kSmiTagMask)); |
@@ -3627,18 +3628,23 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
// Heap number map check. |
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
factory()->heap_number_map()); |
- __ j(equal, &heap_number, Label::kNear); |
+ if (deoptimize_on_undefined) { |
+ DeoptimizeIf(not_equal, env); |
+ } else { |
+ Label heap_number; |
+ __ j(equal, &heap_number, Label::kNear); |
- __ cmp(input_reg, factory()->undefined_value()); |
- DeoptimizeIf(not_equal, env); |
+ __ cmp(input_reg, factory()->undefined_value()); |
+ DeoptimizeIf(not_equal, env); |
- // Convert undefined to NaN. |
- ExternalReference nan = ExternalReference::address_of_nan(); |
- __ movdbl(result_reg, Operand::StaticVariable(nan)); |
- __ jmp(&done, Label::kNear); |
+ // Convert undefined to NaN. |
+ ExternalReference nan = ExternalReference::address_of_nan(); |
+ __ movdbl(result_reg, Operand::StaticVariable(nan)); |
+ __ jmp(&done, Label::kNear); |
+ __ bind(&heap_number); |
+ } |
// Heap number to XMM conversion. |
- __ bind(&heap_number); |
__ movdbl(result_reg, FieldOperand(input_reg, HeapNumber::kValueOffset)); |
__ jmp(&done, Label::kNear); |
@@ -3770,7 +3776,9 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
Register input_reg = ToRegister(input); |
XMMRegister result_reg = ToDoubleRegister(result); |
- EmitNumberUntagD(input_reg, result_reg, instr->environment()); |
+ EmitNumberUntagD(input_reg, result_reg, |
+ instr->hydrogen()->deoptimize_on_undefined(), |
+ instr->environment()); |
} |