| Index: runtime/vm/object.cc
|
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
|
| index 69810fdf5e52e4f1c0a9d0174e5082ef65af3f60..2fe3131c536a90f43f49b42b8f6d5128ef2839ef 100644
|
| --- a/runtime/vm/object.cc
|
| +++ b/runtime/vm/object.cc
|
| @@ -13465,7 +13465,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;
|
| }
|
|
|
|
|
|
|