Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2149023002: VM: Array bounds checks that don't deoptimize for precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix dbc build Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index 7b9dfc311a2778214c3a17e775b862f035c3ea1e..7ada86f52d5e67ebf605a604f2210bab2ba2de24 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -101,6 +101,7 @@ DECLARE_FLAG(int, optimization_counter_threshold);
// List of instructions that are not used by DBC.
#define FOR_EACH_UNREACHABLE_INSTRUCTION(M) \
M(CaseInsensitiveCompareUC16) \
+ M(GenericCheckBound) \
M(GrowRegExpStack) \
M(IndirectGoto)
@@ -1350,6 +1351,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,

Powered by Google App Engine
This is Rietveld 408576698