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

Unified Diff: runtime/vm/intermediate_language_ia32.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_dbc.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_ia32.cc
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index 34555dc6410020d71ea407e3828af4c95d13ddbe..3ccb078f787cb6b9f0abd67d2ebcabf6395e1c20 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -5847,8 +5847,7 @@ void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
Label* deopt = compiler->AddDeoptStub(deopt_id(),
ICData::kDeoptCheckSmi,
licm_hoisted_ ? ICData::kHoisted : 0);
- __ testl(value, Immediate(kSmiTagMask));
- __ j(NOT_ZERO, deopt);
+ __ BranchIfNotSmi(value, deopt);
}
@@ -5871,6 +5870,20 @@ void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
}
+LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone,
+ bool opt) const {
+ // Only needed for AOT.
+ UNIMPLEMENTED();
+ return NULL;
+}
+
+
+void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
+ // Only needed for AOT.
+ UNIMPLEMENTED();
+}
+
+
// Length: register or constant.
// Index: register, constant or stack slot.
LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone,
@@ -5910,8 +5923,12 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
return;
}
+ const intptr_t index_cid = index()->Type()->ToCid();
if (length_loc.IsConstant()) {
Register index = index_loc.reg();
+ if (index_cid != kSmiCid) {
+ __ BranchIfNotSmi(index, deopt);
+ }
const Smi& length = Smi::Cast(length_loc.constant());
if (length.Value() == Smi::kMaxValue) {
__ testl(index, index);
@@ -5933,11 +5950,17 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else if (length_loc.IsStackSlot()) {
Register index = index_loc.reg();
const Address& length = length_loc.ToStackSlotAddress();
+ if (index_cid != kSmiCid) {
+ __ BranchIfNotSmi(index, deopt);
+ }
__ cmpl(index, length);
__ j(ABOVE_EQUAL, deopt);
} else {
Register index = index_loc.reg();
Register length = length_loc.reg();
+ if (index_cid != kSmiCid) {
+ __ BranchIfNotSmi(index, deopt);
+ }
__ cmpl(length, index);
__ j(BELOW_EQUAL, deopt);
}
« no previous file with comments | « runtime/vm/intermediate_language_dbc.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698