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

Unified Diff: runtime/vm/freelist.cc

Issue 10806078: Improve the performance of bit set searches with a compiler intrinsic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: add new header files 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
« runtime/platform/utils.h ('K') | « runtime/vm/bit_set.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/freelist.cc
diff --git a/runtime/vm/freelist.cc b/runtime/vm/freelist.cc
index 391dd22bcde0decd7b8f4f013a7e948e66aed057..ffc88aeaf5a4d441f8f51cf996b55c5cb6a89cd4 100644
--- a/runtime/vm/freelist.cc
+++ b/runtime/vm/freelist.cc
@@ -54,17 +54,17 @@ uword FreeList::TryAllocate(intptr_t size) {
return reinterpret_cast<uword>(DequeueElement(index));
}
- if (index < kNumLists) {
- index++;
- while (index < kNumLists) {
- if (free_map_.Test(index)) {
- // Dequeue an element from the list, split and enqueue the remainder in
- // the appropriate list.
- FreeListElement* element = DequeueElement(index);
- SplitElementAfterAndEnqueue(element, size);
- return reinterpret_cast<uword>(element);
- }
- index++;
+ if ((index + 1) < kNumLists) {
+ intptr_t next_index = free_map_.Next(index + 1);
+ if (next_index == kNumLists) {
+ next_index = -1;
+ }
siva 2012/07/24 01:07:43 per offline discussion this check could go away if
+ if (next_index != -1) {
+ // Dequeue an element from the list, split and enqueue the remainder in
+ // the appropriate list.
+ FreeListElement* element = DequeueElement(next_index);
+ SplitElementAfterAndEnqueue(element, size);
+ return reinterpret_cast<uword>(element);
}
}
« runtime/platform/utils.h ('K') | « runtime/vm/bit_set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698