| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 36d5143d06c66669891fda3846fc5d837cfb285e..217063ac6a905af39516379e4251c4f2bf158b30 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -13485,7 +13485,13 @@ intptr_t ICData::GetCountAt(intptr_t index) const {
|
| const Array& data = Array::Handle(ic_data());
|
| const intptr_t data_pos =
|
| index * TestEntryLength() + CountIndexFor(NumArgsTested());
|
| - return Smi::Value(Smi::RawCast(data.At(data_pos)));
|
| + intptr_t value = Smi::Value(Smi::RawCast(data.At(data_pos)));
|
| + if (value >= 0) return value;
|
| +
|
| + // The counter very rarely overflows to a negative value, but if it does, we
|
| + // would rather just reset it to zero.
|
| + SetCountAt(index, 0);
|
| + return 0;
|
| }
|
|
|
|
|
|
|