Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index c47fc11de94662cc5694d214e56b9e84702b7962..b1412ae896988e0d8e17a537134770d05c486c9b 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3869,22 +3869,41 @@ void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
Register input = ToRegister(instr->InputAt(0)); |
Register scratch = scratch0(); |
- InstanceType first = instr->hydrogen()->first(); |
- InstanceType last = instr->hydrogen()->last(); |
__ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
__ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
- __ cmp(scratch, Operand(first)); |
- // If there is only one type in the interval check for equality. |
- if (first == last) { |
- DeoptimizeIf(ne, instr->environment()); |
+ if (instr->hydrogen()->is_interval_check()) { |
+ InstanceType first; |
+ InstanceType last; |
+ instr->hydrogen()->GetCheckInterval(&first, &last); |
+ |
+ __ cmp(scratch, Operand(first)); |
+ |
+ // If there is only one type in the interval check for equality. |
+ if (first == last) { |
+ DeoptimizeIf(ne, instr->environment()); |
+ } else { |
+ DeoptimizeIf(lo, instr->environment()); |
+ // Omit check for the last type. |
+ if (last != LAST_TYPE) { |
+ __ cmp(scratch, Operand(last)); |
+ DeoptimizeIf(hi, instr->environment()); |
+ } |
+ } |
} else { |
- DeoptimizeIf(lo, instr->environment()); |
- // Omit check for the last type. |
- if (last != LAST_TYPE) { |
- __ cmp(scratch, Operand(last)); |
- DeoptimizeIf(hi, instr->environment()); |
+ uint8_t mask; |
+ uint8_t tag; |
+ instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); |
+ |
+ if (IsPowerOf2(mask)) { |
+ ASSERT(tag == 0 || IsPowerOf2(tag)); |
+ __ tst(scratch, Operand(mask)); |
+ DeoptimizeIf(tag == 0 ? ne : eq, instr->environment()); |
+ } else { |
+ __ and_(scratch, scratch, Operand(mask)); |
+ __ cmp(scratch, Operand(tag)); |
+ DeoptimizeIf(ne, instr->environment()); |
} |
} |
} |