diff --git a/src/ic.cc b/src/ic.cc index 83677bdbcc..0bfb755d95 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -1022,7 +1022,7 @@ bool IC::UpdatePolymorphicIC(State state, number_of_valid_maps++; if (handler_to_overwrite >= 0) { - handlers.InsertAt(handler_to_overwrite, code); + handlers.Set(handler_to_overwrite, code); } else { receiver_maps.Add(new_receiver_map); handlers.Add(code); diff --git a/src/list-inl.h b/src/list-inl.h index d815a7e227..143c830ee9 100644 --- a/src/list-inl.h +++ b/src/list-inl.h @@ -103,6 +103,13 @@ Vector List::AddBlock(T value, int count, P alloc) { } +template +void List::Set(int index, const T& elm) { + ASSERT(index >= 0 && index <= length_); + data_[index] = elm; +} + + template void List::InsertAt(int index, const T& elm, P alloc) { ASSERT(index >= 0 && index <= length_); diff --git a/src/list.h b/src/list.h index 43d982f687..0e4e35bb41 100644 --- a/src/list.h +++ b/src/list.h @@ -115,6 +115,9 @@ class List { void InsertAt(int index, const T& element, AllocationPolicy allocator = AllocationPolicy()); + // Overwrites the element at the specific index. + void Set(int index, const T& element); + // Added 'count' elements with the value 'value' and returns a // vector that allows access to the elements. The vector is valid // until the next change is made to this list.