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

Unified Diff: src/small-pointer-list.h

Issue 7655017: Improve memory usage of receiver type feedback. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: ReceiverTypeList -> SmallMapList Created 9 years, 4 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: src/small-pointer-list.h
diff --git a/src/small-pointer-list.h b/src/small-pointer-list.h
index 6291d9ee8628d08492dc53ce30628b25066dfead..6c5ce890d2cb64fe8c437bf99c96efb144786357 100644
--- a/src/small-pointer-list.h
+++ b/src/small-pointer-list.h
@@ -44,6 +44,31 @@ class SmallPointerList {
public:
SmallPointerList() : data_(kEmptyTag) {}
+ explicit SmallPointerList(int capacity) : data_(kEmptyTag) {
+ Reserve(capacity);
+ }
+
+ void Reserve(int capacity) {
+ if (capacity < 2) return;
+ if ((data_ & kTagMask) == kListTag) {
+ if (list()->capacity() >= capacity) return;
+ int old_length = list()->length();
+ list()->AddBlock(NULL, capacity - list()->capacity());
+ list()->Rewind(old_length);
+ return;
+ }
+ PointerList* list = new PointerList(capacity);
+ if ((data_ & kTagMask) == kSingletonTag) {
+ list->Add(single_value());
+ }
+ ASSERT(IsAligned(reinterpret_cast<intptr_t>(list), kPointerAlignment));
+ data_ = reinterpret_cast<intptr_t>(list) | kListTag;
+ }
+
+ void Clear() {
+ data_ = kEmptyTag;
+ }
+
bool is_empty() const { return length() == 0; }
int length() const {
« src/ast.h ('K') | « src/hydrogen-instructions.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698