Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 8dd58a2ae6d26efcfa8245a3da6320b3cb5bacb3..8fcd6912279af6c1220070593caffa8cbab5bf14 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3619,7 +3619,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 && |