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

Unified Diff: runtime/vm/intermediate_language_mips.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_mips.cc
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index ccd135852723baae64889b375680cb106ebbb10c..737f5f56cbd12db5fa8f3366c69a2acc289e6d5e 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -4319,10 +4319,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);
__ BranchEqual(locs()->in(0).reg(),
reinterpret_cast<int32_t>(Object::null()), deopt);
return;
@@ -4332,7 +4332,6 @@ void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
(unary_checks().NumberOfChecks() > 1));
Register value = locs()->in(0).reg();
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) {
@@ -4430,8 +4429,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);
@@ -4454,8 +4455,12 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
} else if (length_loc.IsConstant()) {
const Smi& length = Smi::Cast(length_loc.constant());
Register index = index_loc.reg();
- __ BranchUnsignedGreaterEqual(
- index, reinterpret_cast<int32_t>(length.raw()), deopt);
+ if (length.Value() == Smi::kMaxValue) {
+ __ BranchSignedLess(index, 0, deopt);
+ } else {
+ __ BranchUnsignedGreaterEqual(
+ index, reinterpret_cast<int32_t>(length.raw()), deopt);
+ }
} else {
Register length = length_loc.reg();
Register index = index_loc.reg();

Powered by Google App Engine
This is Rietveld 408576698