Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 531fbffa7912c99a1f9351cd0963402b49f07e3d..161a82c243670b26e6865f6a15c513bbe8b55ee0 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -3739,7 +3739,27 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
} |
+void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
+ HValue* value, |
+ LOperand* operand) { |
+ if (value->representation().IsTagged() && !value->type().IsSmi()) { |
+ if (operand->IsRegister()) { |
+ __ test(ToRegister(operand), Immediate(kSmiTagMask)); |
+ } else { |
+ __ test(ToOperand(operand), Immediate(kSmiTagMask)); |
+ } |
+ DeoptimizeIf(not_zero, 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())); |