Version 3.0.0.
Improved performance by (partially) addressing issue 957 on IA-32. Still needs more work for the other architectures.
git-svn-id: http://v8.googlecode.com/svn/trunk@5932 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/list.h b/src/list.h
index 24f3494..9a2e698 100644
--- a/src/list.h
+++ b/src/list.h
@@ -91,6 +91,9 @@
// Add all the elements from the argument list to this list.
void AddAll(const List<T, P>& other);
+ // Inserts the element at the specific index.
+ void InsertAt(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.
@@ -102,6 +105,10 @@
// size of the list.
T Remove(int i);
+ // Remove the given element from the list. Returns whether or not
+ // the input is included in the list in the first place.
+ bool RemoveElement(const T& elm);
+
// Removes the last element without deleting it even if T is a
// pointer type. Returns the removed element.
INLINE(T RemoveLast()) { return Remove(length_ - 1); }
@@ -113,7 +120,11 @@
// Drops all but the first 'pos' elements from the list.
INLINE(void Rewind(int pos));
- bool Contains(const T& elm);
+ // Drop the last 'count' elements from the list.
+ INLINE(void RewindBy(int count)) { Rewind(length_ - count); }
+
+ bool Contains(const T& elm) const;
+ int CountOccurrences(const T& elm, int start, int end) const;
// Iterate through all list entries, starting at index 0.
void Iterate(void (*callback)(T* x));