Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 6c57c5379bdbdfaa2e88e929d3cceedfb18db5f9..ab6cd028cd48cedc91a82f14ceac1af7b6a56256 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3836,6 +3836,7 @@ void LCodeGen::DoSmiUntag(LSmiUntag* instr) { |
void LCodeGen::EmitNumberUntagD(Register input_reg, |
DoubleRegister result_reg, |
+ bool deoptimize_on_undefined, |
LEnvironment* env) { |
Register scratch = scratch0(); |
SwVfpRegister flt_scratch = s0; |
@@ -3851,20 +3852,25 @@ void LCodeGen::EmitNumberUntagD(Register input_reg, |
__ ldr(scratch, FieldMemOperand(input_reg, HeapObject::kMapOffset)); |
__ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
__ cmp(scratch, Operand(ip)); |
- __ b(eq, &heap_number); |
+ if (deoptimize_on_undefined) { |
+ DeoptimizeIf(ne, env); |
+ } else { |
+ Label heap_number; |
+ __ b(eq, &heap_number); |
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
- __ cmp(input_reg, Operand(ip)); |
- DeoptimizeIf(ne, env); |
+ __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
+ __ cmp(input_reg, Operand(ip)); |
+ DeoptimizeIf(ne, env); |
- // Convert undefined to NaN. |
- __ LoadRoot(ip, Heap::kNanValueRootIndex); |
- __ sub(ip, ip, Operand(kHeapObjectTag)); |
- __ vldr(result_reg, ip, HeapNumber::kValueOffset); |
- __ jmp(&done); |
+ // Convert undefined to NaN. |
+ __ LoadRoot(ip, Heap::kNanValueRootIndex); |
+ __ sub(ip, ip, Operand(kHeapObjectTag)); |
+ __ vldr(result_reg, ip, HeapNumber::kValueOffset); |
+ __ jmp(&done); |
+ __ bind(&heap_number); |
+ } |
// Heap number to double register conversion. |
- __ bind(&heap_number); |
__ sub(ip, input_reg, Operand(kHeapObjectTag)); |
__ vldr(result_reg, ip, HeapNumber::kValueOffset); |
__ jmp(&done); |
@@ -3998,7 +4004,9 @@ void LCodeGen::DoNumberUntagD(LNumberUntagD* instr) { |
Register input_reg = ToRegister(input); |
DoubleRegister result_reg = ToDoubleRegister(result); |
- EmitNumberUntagD(input_reg, result_reg, instr->environment()); |
+ EmitNumberUntagD(input_reg, result_reg, |
+ instr->hydrogen()->deoptimize_on_undefined(), |
+ instr->environment()); |
} |