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); |
} |