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

Unified Diff: runtime/vm/freelist.cc

Issue 538213003: Speed up freelist by using intrinsics to find last set bit. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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/bit_set_test.cc ('k') | runtime/vm/vm_sources.gypi » ('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 39895)
+++ runtime/vm/freelist.cc (working copy)
@@ -231,12 +231,13 @@
FreeListElement* result = free_lists_[index];
FreeListElement* next = result->next();
if (next == NULL && index != kNumLists) {
- free_map_.Set(index, false);
intptr_t size = index << kObjectAlignmentLog2;
if (size == last_free_small_size_) {
- // Note: Last() returns -1 if none are set; avoid shift of negative.
- last_free_small_size_ = free_map_.Last() * kObjectAlignment;
- // TODO(koda): Consider adding BitSet::Previous(i).
+ // Note: This is -1 * kObjectAlignment if no other small sizes remain.
+ last_free_small_size_ =
+ free_map_.ClearLastAndFindPrevious(index) * kObjectAlignment;
+ } else {
+ free_map_.Set(index, false);
}
}
free_lists_[index] = next;
« no previous file with comments | « runtime/vm/bit_set_test.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698