Commit 984122a7 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Overwrite the handler using Set.

InsertAt apparently inserts by moving the other elements... that does not work.

Review URL: https://chromiumcodereview.appspot.com/14566007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14535 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 915f9ea5
...@@ -1022,7 +1022,7 @@ bool IC::UpdatePolymorphicIC(State state, ...@@ -1022,7 +1022,7 @@ bool IC::UpdatePolymorphicIC(State state,
number_of_valid_maps++; number_of_valid_maps++;
if (handler_to_overwrite >= 0) { if (handler_to_overwrite >= 0) {
handlers.InsertAt(handler_to_overwrite, code); handlers.Set(handler_to_overwrite, code);
} else { } else {
receiver_maps.Add(new_receiver_map); receiver_maps.Add(new_receiver_map);
handlers.Add(code); handlers.Add(code);
......
...@@ -103,6 +103,13 @@ Vector<T> List<T, P>::AddBlock(T value, int count, P alloc) { ...@@ -103,6 +103,13 @@ Vector<T> List<T, P>::AddBlock(T value, int count, P alloc) {
} }
template<typename T, class P>
void List<T, P>::Set(int index, const T& elm) {
ASSERT(index >= 0 && index <= length_);
data_[index] = elm;
}
template<typename T, class P> template<typename T, class P>
void List<T, P>::InsertAt(int index, const T& elm, P alloc) { void List<T, P>::InsertAt(int index, const T& elm, P alloc) {
ASSERT(index >= 0 && index <= length_); ASSERT(index >= 0 && index <= length_);
......
...@@ -115,6 +115,9 @@ class List { ...@@ -115,6 +115,9 @@ class List {
void InsertAt(int index, const T& element, void InsertAt(int index, const T& element,
AllocationPolicy allocator = AllocationPolicy()); 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 // Added 'count' elements with the value 'value' and returns a
// vector that allows access to the elements. The vector is valid // vector that allows access to the elements. The vector is valid
// until the next change is made to this list. // until the next change is made to this list.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment