Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 71c1f86d97a2d3a428450c68840522020ee33909..801c30bbdf606a466758fae3c54d8ec35c003e05 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -4970,18 +4970,33 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr) { |
if (instr->truncating()) { |
// Performs a truncating conversion of a floating point number as used by |
// the JS bitwise operations. |
- Label heap_number; |
- __ b(eq, &heap_number); |
- // Check for undefined. Undefined is converted to zero for truncating |
- // conversions. |
+ Label no_heap_number, check_bools, check_false; |
+ __ b(ne, &no_heap_number); |
+ __ TruncateHeapNumberToI(input_reg, scratch2); |
+ __ b(&done); |
+ |
+ // Check for Oddballs. Undefined/False is converted to zero and True to one |
+ // for truncating conversions. |
+ __ bind(&no_heap_number); |
__ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
__ cmp(scratch2, Operand(ip)); |
- DeoptimizeIf(ne, instr->environment()); |
+ __ b(ne, &check_bools); |
__ mov(input_reg, Operand::Zero()); |
__ b(&done); |
- __ bind(&heap_number); |
- __ TruncateHeapNumberToI(input_reg, scratch2); |
+ __ bind(&check_bools); |
+ __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
+ __ cmp(scratch2, Operand(ip)); |
+ __ b(ne, &check_false); |
+ __ mov(input_reg, Operand(1)); |
+ __ b(&done); |
+ |
+ __ bind(&check_false); |
+ __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
+ __ cmp(scratch2, Operand(ip)); |
+ DeoptimizeIf(ne, instr->environment()); |
+ __ mov(input_reg, Operand::Zero()); |
+ __ b(&done); |
} else { |
// Deoptimize if we don't have a heap number. |
DeoptimizeIf(ne, instr->environment()); |