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

Unified Diff: src/hashmap.h

Issue 528993002: First step to cleanup the power-of-2 mess. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: clang-format 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 | « src/gdb-jit.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hashmap.h
diff --git a/src/hashmap.h b/src/hashmap.h
index 26dbd584736e5afb8bb52a4fb025f551bf328444..33eb115258b4eaa6f0079fb0ceaec0b2cc4bce3c 100644
--- a/src/hashmap.h
+++ b/src/hashmap.h
@@ -6,6 +6,7 @@
#define V8_HASHMAP_H_
#include "src/allocation.h"
+#include "src/base/bits.h"
#include "src/base/logging.h"
#include "src/utils.h"
@@ -239,7 +240,7 @@ typename TemplateHashMapImpl<AllocationPolicy>::Entry*
TemplateHashMapImpl<AllocationPolicy>::Probe(void* key, uint32_t hash) {
DCHECK(key != NULL);
- DCHECK(IsPowerOf2(capacity_));
+ DCHECK(base::bits::IsPowerOfTwo32(capacity_));
Entry* p = map_ + (hash & (capacity_ - 1));
const Entry* end = map_end();
DCHECK(map_ <= p && p < end);
@@ -259,7 +260,7 @@ typename TemplateHashMapImpl<AllocationPolicy>::Entry*
template<class AllocationPolicy>
void TemplateHashMapImpl<AllocationPolicy>::Initialize(
uint32_t capacity, AllocationPolicy allocator) {
- DCHECK(IsPowerOf2(capacity));
+ DCHECK(base::bits::IsPowerOfTwo32(capacity));
map_ = reinterpret_cast<Entry*>(allocator.New(capacity * sizeof(Entry)));
if (map_ == NULL) {
v8::internal::FatalProcessOutOfMemory("HashMap::Initialize");
« no previous file with comments | « src/gdb-jit.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698