Index: runtime/vm/intermediate_language_x64.cc |
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc |
index c497bd487821120985f0aa70e5e322de70682783..b8865ec2d5723b1d2291020c43618d33542a5ade 100644 |
--- a/runtime/vm/intermediate_language_x64.cc |
+++ b/runtime/vm/intermediate_language_x64.cc |
@@ -5287,10 +5287,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); |
__ CompareObject(locs()->in(0).reg(), |
Object::null_object(), PP); |
__ j(EQUAL, deopt); |
@@ -5301,7 +5301,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) { |
@@ -5401,8 +5400,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); |
@@ -5426,9 +5427,14 @@ void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
} else if (length_loc.IsConstant()) { |
const Smi& length = Smi::Cast(length_loc.constant()); |
Register index = index_loc.reg(); |
- __ CompareImmediate( |
- index, Immediate(reinterpret_cast<int64_t>(length.raw())), PP); |
- __ j(ABOVE_EQUAL, deopt); |
+ if (length.Value() == Smi::kMaxValue) { |
+ __ testq(index, index); |
+ __ j(NEGATIVE, deopt); |
+ } else { |
+ __ CompareImmediate( |
+ index, Immediate(reinterpret_cast<int64_t>(length.raw())), PP); |
+ __ j(ABOVE_EQUAL, deopt); |
+ } |
} else { |
Register length = length_loc.reg(); |
Register index = index_loc.reg(); |