Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index aed649291e15b350dfdab040dc1966c245812bc3..d15fe7ae2828a7c51271b6fc6a59f4d77f2b4a47 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -4963,7 +4963,9 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
Label load_smi, heap_number, done; |
- if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
+ STATIC_ASSERT(NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE > |
+ NUMBER_CANDIDATE_IS_ANY_TAGGED); |
+ if (mode >= NUMBER_CANDIDATE_IS_ANY_TAGGED) { |
// Smi check. |
__ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
@@ -4974,14 +4976,20 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
if (deoptimize_on_undefined) { |
DeoptimizeIf(ne, env); |
} else { |
- Label heap_number; |
+ Label heap_number, convert; |
__ b(eq, &heap_number); |
+ // Convert undefined (and hole) to NaN. |
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
__ cmp(input_reg, Operand(ip)); |
+ if (mode == NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE) { |
+ __ b(eq, &convert); |
+ __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
+ __ cmp(input_reg, Operand(ip)); |
+ } |
DeoptimizeIf(ne, env); |
- // Convert undefined to NaN. |
+ __ bind(&convert); |
__ LoadRoot(ip, Heap::kNanValueRootIndex); |
__ sub(ip, ip, Operand(kHeapObjectTag)); |
__ vldr(result_reg, ip, HeapNumber::kValueOffset); |
@@ -5001,15 +5009,6 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
DeoptimizeIf(eq, env); |
} |
__ jmp(&done); |
- } else if (mode == NUMBER_CANDIDATE_IS_SMI_OR_HOLE) { |
- __ SmiUntag(scratch, input_reg, SetCC); |
- DeoptimizeIf(cs, env); |
- } else if (mode == NUMBER_CANDIDATE_IS_SMI_CONVERT_HOLE) { |
- __ UntagAndJumpIfSmi(scratch, input_reg, &load_smi); |
- __ Vmov(result_reg, |
- FixedDoubleArray::hole_nan_as_double(), |
- no_reg); |
- __ b(&done); |
} else { |
__ SmiUntag(scratch, input_reg); |
ASSERT(mode == NUMBER_CANDIDATE_IS_SMI); |
@@ -5133,19 +5132,13 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
NumberUntagDMode mode = NUMBER_CANDIDATE_IS_ANY_TAGGED; |
HValue* value = instr->hydrogen()->value(); |
if (value->type().IsSmi()) { |
- if (value->IsLoadKeyed()) { |
- HLoadKeyed* load = HLoadKeyed::cast(value); |
- if (load->UsesMustHandleHole()) { |
- if (load->hole_mode() == ALLOW_RETURN_HOLE) { |
- mode = NUMBER_CANDIDATE_IS_SMI_CONVERT_HOLE; |
- } else { |
- mode = NUMBER_CANDIDATE_IS_SMI_OR_HOLE; |
- } |
- } else { |
- mode = NUMBER_CANDIDATE_IS_SMI; |
+ mode = NUMBER_CANDIDATE_IS_SMI; |
+ } else if (value->IsLoadKeyed()) { |
+ HLoadKeyed* load = HLoadKeyed::cast(value); |
+ if (load->UsesMustHandleHole()) { |
+ if (load->hole_mode() == ALLOW_RETURN_HOLE) { |
+ mode = NUMBER_CANDIDATE_IS_ANY_TAGGED_CONVERT_HOLE; |
} |
- } else { |
- mode = NUMBER_CANDIDATE_IS_SMI; |
} |
} |