Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: src/list-inl.h

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/list.h ('k') | src/lithium-allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/list-inl.h
diff --git a/src/list-inl.h b/src/list-inl.h
index e277bc87234434480bd49430b3ce70756f612199..eeaea65f80b61343c91f06b5299b69201c784265 100644
--- a/src/list-inl.h
+++ b/src/list-inl.h
@@ -96,6 +96,17 @@ Vector<T> List<T, P>::AddBlock(T value, int count) {
template<typename T, class P>
+void List<T, P>::InsertAt(int index, const T& elm) {
+ ASSERT(index >= 0 && index <= length_);
+ Add(elm);
+ for (int i = length_ - 1; i > index; --i) {
+ data_[i] = data_[i - 1];
+ }
+ data_[index] = elm;
+}
+
+
+template<typename T, class P>
T List<T, P>::Remove(int i) {
T element = at(i);
length_--;
@@ -108,6 +119,18 @@ T List<T, P>::Remove(int i) {
template<typename T, class P>
+bool List<T, P>::RemoveElement(const T& elm) {
+ for (int i = 0; i < length_; i++) {
+ if (data_[i] == elm) {
+ Remove(i);
+ return true;
+ }
+ }
+ return false;
+}
+
+
+template<typename T, class P>
void List<T, P>::Clear() {
DeleteData(data_);
Initialize(0);
@@ -134,7 +157,7 @@ void List<T, P>::Iterate(Visitor* visitor) {
template<typename T, class P>
-bool List<T, P>::Contains(const T& elm) {
+bool List<T, P>::Contains(const T& elm) const {
for (int i = 0; i < length_; i++) {
if (data_[i] == elm)
return true;
@@ -144,6 +167,16 @@ bool List<T, P>::Contains(const T& elm) {
template<typename T, class P>
+int List<T, P>::CountOccurrences(const T& elm, int start, int end) const {
+ int result = 0;
+ for (int i = start; i <= end; i++) {
+ if (data_[i] == elm) ++result;
+ }
+ return result;
+}
+
+
+template<typename T, class P>
void List<T, P>::Sort(int (*cmp)(const T* x, const T* y)) {
ToVector().Sort(cmp);
#ifdef DEBUG
« no previous file with comments | « src/list.h ('k') | src/lithium-allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698