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

Unified Diff: runtime/vm/freelist.cc

Issue 511963007: Pretenure some strings into bump-allocated block (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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
« no previous file with comments | « runtime/vm/freelist.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/freelist.cc
===================================================================
--- runtime/vm/freelist.cc (revision 39687)
+++ runtime/vm/freelist.cc (working copy)
@@ -235,8 +235,8 @@
}
-intptr_t FreeList::Length(int index) const {
- MutexLocker ml(mutex_);
+intptr_t FreeList::LengthLocked(int index) const {
+ DEBUG_ASSERT(mutex_->Owner() == Isolate::Current());
ASSERT(index >= 0);
ASSERT(index < kNumLists);
intptr_t result = 0;
@@ -258,7 +258,7 @@
continue;
}
small_sizes += 1;
- intptr_t list_length = Length(i);
+ intptr_t list_length = LengthLocked(i);
small_objects += list_length;
intptr_t list_bytes = list_length * i * kObjectAlignment;
small_bytes += list_bytes;
@@ -341,4 +341,26 @@
}
}
+
+FreeListElement* FreeList::TryAllocateLarge(intptr_t minimum_size) {
+ MutexLocker ml(mutex_);
+ FreeListElement* previous = NULL;
+ FreeListElement* current = free_lists_[kNumLists];
+ // TODO(koda): Find largest.
+ while (current != NULL) {
+ FreeListElement* next = current->next();
+ if (current->Size() >= minimum_size) {
+ if (previous == NULL) {
+ free_lists_[kNumLists] = next;
+ } else {
+ previous->set_next(next);
+ }
+ return current;
+ }
+ previous = current;
+ current = next;
+ }
+ return NULL;
+}
+
} // namespace dart
« no previous file with comments | « runtime/vm/freelist.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698