Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index cf76a086720a7282487f2d59ddd09f6938c79759..a0e620bf99ec22b6bf441c035b34e3c666ce2f0f 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -4871,36 +4871,20 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
Register scratch = scratch0(); |
SwVfpRegister flt_scratch = double_scratch0().low(); |
ASSERT(!result_reg.is(double_scratch0())); |
- |
- Label load_smi, heap_number, done; |
- |
+ Label convert, load_smi, done; |
if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
// Smi check. |
__ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
- |
// Heap number map check. |
__ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
__ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
__ cmp(scratch, Operand(ip)); |
- if (!can_convert_undefined_to_nan) { |
- DeoptimizeIf(ne, env); |
+ if (can_convert_undefined_to_nan) { |
+ __ b(ne, &convert); |
} else { |
- Label heap_number, convert; |
- __ b(eq, &heap_number); |
- |
- // Convert undefined (and hole) to NaN. |
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
- __ cmp(input_reg, Operand(ip)); |
DeoptimizeIf(ne, env); |
- |
- __ bind(&convert); |
- __ LoadRoot(scratch, Heap::kNanValueRootIndex); |
- __ vldr(result_reg, scratch, HeapNumber::kValueOffset - kHeapObjectTag); |
- __ jmp(&done); |
- |
- __ bind(&heap_number); |
} |
- // Heap number to double register conversion. |
+ // load heap number |
__ vldr(result_reg, input_reg, HeapNumber::kValueOffset - kHeapObjectTag); |
if (deoptimize_on_minus_zero) { |
__ VmovLow(scratch, result_reg); |
@@ -4911,11 +4895,20 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
DeoptimizeIf(eq, env); |
} |
__ jmp(&done); |
+ if (can_convert_undefined_to_nan) { |
+ __ bind(&convert); |
+ // Convert undefined (and hole) to NaN. |
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
+ __ cmp(input_reg, Operand(ip)); |
+ DeoptimizeIf(ne, env); |
+ __ LoadRoot(scratch, Heap::kNanValueRootIndex); |
+ __ vldr(result_reg, scratch, HeapNumber::kValueOffset - kHeapObjectTag); |
+ __ jmp(&done); |
+ } |
} else { |
__ SmiUntag(scratch, input_reg); |
ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); |
} |
- |
// Smi to double register conversion |
__ bind(&load_smi); |
// scratch: untagged value of input_reg |