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

Unified Diff: runtime/vm/growable_array.h

Issue 10696151: Skeleton of a linear scan register allocator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address comments Created 8 years, 5 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
Index: runtime/vm/growable_array.h
diff --git a/runtime/vm/growable_array.h b/runtime/vm/growable_array.h
index 49ae5fa230a731d39c1bc72b0a4d9e1d670982ec..2a7fd98be540b81d4a65c51d446fb5376cb47e66 100644
--- a/runtime/vm/growable_array.h
+++ b/runtime/vm/growable_array.h
@@ -59,7 +59,7 @@ class BaseGrowableArray : public B {
}
void AddArray(const BaseGrowableArray<T, B>& src) {
- for (int i = 0; i < src.length(); i++) {
+ for (intptr_t i = 0; i < src.length(); i++) {
Add(src[i]);
}
}
@@ -76,6 +76,14 @@ class BaseGrowableArray : public B {
}
}
+ void InsertAt(intptr_t idx, const T& value) {
+ Resize(length() + 1);
+ for (intptr_t i = length_ - 2; i >= idx; i--) {
+ data_[i + 1] = data_[i];
+ }
+ data_[idx] = value;
+ }
+
// Sort the array in place.
inline void Sort(int compare(const T*, const T*));

Powered by Google App Engine
This is Rietveld 408576698