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

Side by Side Diff: third_party/tcmalloc/chromium/src/packed-cache-inl.h

Issue 9320005: [NOT TO COMMIT!] Replace third_party/tcmalloc/chromium with tcmalloc r136 (the latest). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2007, Google Inc. 1 // Copyright (c) 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // the cache is T. See also the big comment at the top of the file. 132 // the cache is T. See also the big comment at the top of the file.
133 template <int kKeybits, typename T> 133 template <int kKeybits, typename T>
134 class PackedCache { 134 class PackedCache {
135 public: 135 public:
136 typedef uintptr_t K; 136 typedef uintptr_t K;
137 typedef size_t V; 137 typedef size_t V;
138 #ifdef TCMALLOC_SMALL_BUT_SLOW 138 #ifdef TCMALLOC_SMALL_BUT_SLOW
139 // Decrease the size map cache if running in the small memory mode. 139 // Decrease the size map cache if running in the small memory mode.
140 static const int kHashbits = 12; 140 static const int kHashbits = 12;
141 #else 141 #else
142 // We don't want the hash map to occupy 512K memory at Chromium, so 142 static const int kHashbits = 16;
143 // kHashbits is decreased from 16 to 12.
144 static const int kHashbits = 12;
145 #endif 143 #endif
146 static const int kValuebits = 7; 144 static const int kValuebits = 7;
147 static const bool kUseWholeKeys = kKeybits + kValuebits <= 8 * sizeof(T); 145 static const bool kUseWholeKeys = kKeybits + kValuebits <= 8 * sizeof(T);
148 146
149 explicit PackedCache(V initial_value) { 147 explicit PackedCache(V initial_value) {
150 COMPILE_ASSERT(kKeybits <= sizeof(K) * 8, key_size); 148 COMPILE_ASSERT(kKeybits <= sizeof(K) * 8, key_size);
151 COMPILE_ASSERT(kValuebits <= sizeof(V) * 8, value_size); 149 COMPILE_ASSERT(kValuebits <= sizeof(V) * 8, value_size);
152 COMPILE_ASSERT(kHashbits <= kKeybits, hash_function); 150 COMPILE_ASSERT(kHashbits <= kKeybits, hash_function);
153 COMPILE_ASSERT(kKeybits - kHashbits + kValuebits <= kTbits, 151 COMPILE_ASSERT(kKeybits - kHashbits + kValuebits <= kTbits,
154 entry_size_must_be_big_enough); 152 entry_size_must_be_big_enough);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 static const V kValueMask = N_ONES_(V, kValuebits); 229 static const V kValueMask = N_ONES_(V, kValuebits);
232 230
233 // array_ is the cache. Its elements are volatile because any 231 // array_ is the cache. Its elements are volatile because any
234 // thread can write any array element at any time. 232 // thread can write any array element at any time.
235 volatile T array_[1 << kHashbits]; 233 volatile T array_[1 << kHashbits];
236 }; 234 };
237 235
238 #undef N_ONES_ 236 #undef N_ONES_
239 237
240 #endif // TCMALLOC_PACKED_CACHE_INL_H_ 238 #endif // TCMALLOC_PACKED_CACHE_INL_H_
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/memory_region_map.cc ('k') | third_party/tcmalloc/chromium/src/page_heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698