Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 9fe519e3d2203ff41bcccd1a97852c36f25b6692..ec454f409b6d4ece2d2f78213328f333eae6eec0 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -3892,7 +3892,28 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
} |
+void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
+ HValue* value, |
+ LOperand* operand) { |
+ if (value->representation().IsTagged() && !value->type().IsSmi()) { |
+ if (operand->IsRegister()) { |
+ __ tst(ToRegister(operand), Operand(kSmiTagMask)); |
+ } else { |
+ __ mov(ip, ToOperand(operand)); |
+ __ tst(ip, Operand(kSmiTagMask)); |
+ } |
+ DeoptimizeIf(ne, environment); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
+ DeoptIfTaggedButNotSmi(instr->environment(), |
+ instr->hydrogen()->length(), |
+ instr->length()); |
+ DeoptIfTaggedButNotSmi(instr->environment(), |
+ instr->hydrogen()->index(), |
+ instr->index()); |
if (instr->index()->IsConstantOperand()) { |
int constant_index = |
ToInteger32(LConstantOperand::cast(instr->index())); |