Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 8869a3e98d1b9d9fe89836d731b6e59ac3b94af2..1ae34a25d5718dd8926201bfad3d47d53eb59a41 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -3674,7 +3674,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())); |