Index: runtime/vm/intermediate_language_dbc.cc |
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc |
index 91b96a7770dcea3e255de54124dee999907f86fb..5d35aa1b067aa5c46c5ab4940bdbf7bd724c7a94 100644 |
--- a/runtime/vm/intermediate_language_dbc.cc |
+++ b/runtime/vm/intermediate_language_dbc.cc |
@@ -65,6 +65,7 @@ DECLARE_FLAG(int, optimization_counter_threshold); |
// - Precompilation. |
#define FOR_EACH_UNREACHABLE_INSTRUCTION(M) \ |
M(CaseInsensitiveCompareUC16) \ |
+ M(GenericCheckBound) \ |
M(GrowRegExpStack) \ |
M(IndirectGoto) \ |
M(MintToDouble) \ |
@@ -1435,6 +1436,14 @@ void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
EMIT_NATIVE_CODE(CheckArrayBound, 2) { |
const Register length = locs()->in(kLengthPos).reg(); |
const Register index = locs()->in(kIndexPos).reg(); |
+ const intptr_t index_cid = this->index()->Type()->ToCid(); |
+ if (index_cid != kSmiCid) { |
+ __ CheckSmi(index); |
+ compiler->EmitDeopt(deopt_id(), |
+ ICData::kDeoptCheckArrayBound, |
+ (generalized_ ? ICData::kGeneralized : 0) | |
+ (licm_hoisted_ ? ICData::kHoisted : 0)); |
+ } |
__ IfULe(length, index); |
compiler->EmitDeopt(deopt_id(), |
ICData::kDeoptCheckArrayBound, |