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

Unified Diff: runtime/vm/intermediate_language_arm.cc

Issue 619903002: Generalize bounds checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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_arm.cc
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index f3212d12ecfacd02bc187e2b5f28ae2dec5b98d2..352a6e1eb726992060628aaee8d2f56d8a2b5f22 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -5824,10 +5824,10 @@ LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate,
void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ?
- ICData::kDeoptHoistedCheckClass : ICData::kDeoptCheckClass;
+ Label* deopt = compiler->AddDeoptStub(deopt_id(),
+ ICData::kDeoptCheckClass,
+ licm_hoisted_ ? ICData::kHoisted : 0);
if (IsNullCheck()) {
- Label* deopt = compiler->AddDeoptStub(deopt_id(), deopt_reason);
__ CompareImmediate(locs()->in(0).reg(),
reinterpret_cast<intptr_t>(Object::null()));
__ b(deopt, EQ);
@@ -5838,7 +5838,6 @@ void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(unary_checks().NumberOfChecks() > 1));
const Register value = locs()->in(0).reg();
const Register temp = locs()->temp(0).reg();
- Label* deopt = compiler->AddDeoptStub(deopt_id(), deopt_reason);
Label is_ok;
intptr_t cix = 0;
if (unary_checks().GetReceiverClassIdAt(cix) == kSmiCid) {
@@ -5934,8 +5933,10 @@ LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate,
void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
- Label* deopt = compiler->AddDeoptStub(deopt_id(),
- ICData::kDeoptCheckArrayBound);
+ Label* deopt = compiler->AddDeoptStub(
+ deopt_id(),
+ ICData::kDeoptCheckArrayBound,
+ generalized_ ? ICData::kGeneralized : 0);
Location length_loc = locs()->in(kLengthPos);
Location index_loc = locs()->in(kIndexPos);
@@ -5958,8 +5959,13 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else if (length_loc.IsConstant()) {
const Smi& length = Smi::Cast(length_loc.constant());
const Register index = index_loc.reg();
- __ CompareImmediate(index, reinterpret_cast<int32_t>(length.raw()));
- __ b(deopt, CS);
+ if (length.Value() == Smi::kMaxValue) {
+ __ tst(index, Operand(index));
+ __ b(deopt, MI);
+ } else {
+ __ CompareImmediate(index, reinterpret_cast<int32_t>(length.raw()));
+ __ b(deopt, CS);
+ }
} else {
const Register length = length_loc.reg();
const Register index = index_loc.reg();

Powered by Google App Engine
This is Rietveld 408576698