Index: src/crankshaft/ia32/lithium-codegen-ia32.cc |
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc |
index 5424dd9204cf5159fd54669cc349f8f08d7c65e9..ec885682ff4dc1f23796060e7c16f95fdf270a75 100644 |
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc |
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc |
@@ -4308,34 +4308,18 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) { |
__ lea(input_reg, Operand(input_reg, times_2, kHeapObjectTag)); |
if (instr->truncating()) { |
- Label no_heap_number, check_bools, check_false; |
- |
- // Heap number map check. |
+ Label truncate; |
+ Label::Distance truncate_distance = |
+ DeoptEveryNTimes() ? Label::kFar : Label::kNear; |
__ cmp(FieldOperand(input_reg, HeapObject::kMapOffset), |
factory()->heap_number_map()); |
- __ j(not_equal, &no_heap_number, Label::kNear); |
+ __ j(equal, &truncate, truncate_distance); |
+ __ push(input_reg); |
+ __ CmpObjectType(input_reg, ODDBALL_TYPE, input_reg); |
+ __ pop(input_reg); |
+ DeoptimizeIf(not_equal, instr, DeoptimizeReason::kNotANumberOrOddball); |
+ __ bind(&truncate); |
__ TruncateHeapNumberToI(input_reg, input_reg); |
- __ jmp(done); |
- |
- __ bind(&no_heap_number); |
- // Check for Oddballs. Undefined/False is converted to zero and True to one |
- // for truncating conversions. |
- __ cmp(input_reg, factory()->undefined_value()); |
- __ j(not_equal, &check_bools, Label::kNear); |
- __ Move(input_reg, Immediate(0)); |
- __ jmp(done); |
- |
- __ bind(&check_bools); |
- __ cmp(input_reg, factory()->true_value()); |
- __ j(not_equal, &check_false, Label::kNear); |
- __ Move(input_reg, Immediate(1)); |
- __ jmp(done); |
- |
- __ bind(&check_false); |
- __ cmp(input_reg, factory()->false_value()); |
- DeoptimizeIf(not_equal, instr, |
- DeoptimizeReason::kNotAHeapNumberUndefinedBoolean); |
- __ Move(input_reg, Immediate(0)); |
} else { |
XMMRegister scratch = ToDoubleRegister(instr->temp()); |
DCHECK(!scratch.is(xmm0)); |