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

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: merge 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
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698