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

Unified Diff: src/utils.h

Issue 9179012: Reduce boot-up memory use of V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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/utils.h
===================================================================
--- src/utils.h (revision 10407)
+++ src/utils.h (working copy)
@@ -153,11 +153,9 @@
}
-// Returns the smallest power of two which is >= x. If you pass in a
-// number that is already a power of two, it is returned as is.
-// Implementation is from "Hacker's Delight" by Henry S. Warren, Jr.,
-// figure 3-3, page 48, where the function is called clp2.
-inline uint32_t RoundUpToPowerOf2(uint32_t x) {
+template<typename int_type>
+inline int RoundUpToPowerOf2(int_type x_argument) {
+ uintptr_t x = static_cast<uintptr_t>(x_argument);
ASSERT(x <= 0x80000000u);
x = x - 1;
x = x | (x >> 1);
@@ -165,7 +163,7 @@
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >> 16);
- return x + 1;
+ return static_cast<int_type>(x + 1);
}
« src/spaces-inl.h ('K') | « src/store-buffer.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698