Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index c5f1cf2a0f038f6c401beeba959a342abe3ec57c..54e3cac02ccae3457859156f816478ec56ff1346 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3683,7 +3683,28 @@ void LCodeGen::DoStoreKeyedSpecializedArrayElement( |
} |
+void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
+ HValue* value, |
+ LOperand* operand) { |
+ if (value->representation().IsTagged() && !value->type().IsSmi()) { |
+ Condition cc; |
+ if (operand->IsRegister()) { |
+ cc = masm()->CheckSmi(ToRegister(operand)); |
+ } else { |
+ cc = masm()->CheckSmi(ToOperand(operand)); |
+ } |
+ DeoptimizeIf(NegateCondition(cc), environment); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
+ DeoptIfTaggedButNotSmi(instr->environment(), |
+ instr->hydrogen()->length(), |
+ instr->length()); |
+ DeoptIfTaggedButNotSmi(instr->environment(), |
+ instr->hydrogen()->index(), |
+ instr->index()); |
if (instr->length()->IsRegister()) { |
Register reg = ToRegister(instr->length()); |
if (FLAG_debug_code && |