16 template<
class AllocationPolicy>
77 Entry*
Next(Entry* p)
const;
98 template<
class AllocationPolicy>
102 Initialize(initial_capacity, allocator);
106 template<
class AllocationPolicy>
108 AllocationPolicy::Delete(map_);
112 template<
class AllocationPolicy>
117 Entry* p = Probe(key, hash);
127 p->
order = occupancy_;
131 if (occupancy_ + occupancy_/4 >= capacity_) {
133 p = Probe(key, hash);
144 template<
class AllocationPolicy>
147 Entry* p = Probe(key, hash);
153 void* value = p->
value;
168 DCHECK(occupancy_ < capacity_);
175 if (q == map_end()) {
187 Entry* r = map_ + (q->
hash & (capacity_ - 1));
192 if ((q > p && (r <= p || r > q)) ||
193 (q < p && (r <= p && r > q))) {
206 template<
class AllocationPolicy>
209 const Entry* end = map_end();
210 for (
Entry* p = map_; p < end; p++) {
217 template<
class AllocationPolicy>
220 return Next(map_ - 1);
224 template<
class AllocationPolicy>
227 const Entry* end = map_end();
228 DCHECK(map_ - 1 <= p && p < end);
229 for (p++; p < end; p++) {
238 template<
class AllocationPolicy>
244 Entry* p = map_ + (hash & (capacity_ - 1));
245 const Entry* end = map_end();
246 DCHECK(map_ <= p && p < end);
248 DCHECK(occupancy_ < capacity_);
249 while (p->
key !=
NULL && (hash != p->
hash || !match_(key, p->
key))) {
260 template<
class AllocationPolicy>
264 map_ =
reinterpret_cast<Entry*
>(allocator.New(capacity *
sizeof(
Entry)));
269 capacity_ = capacity;
274 template<
class AllocationPolicy>
280 Initialize(capacity_ * 2, allocator);
284 if (p->key !=
NULL) {
285 Entry* entry = Lookup(p->key, p->hash,
true, allocator);
286 entry->
value = p->value;
287 entry->
order = p->order;
293 AllocationPolicy::Delete(
map);
298 template<
class Key,
class Value,
class AllocationPolicy>
341 return Iterator(
this, this->
Lookup(key, key->Hash(), insert, allocator));
The superclass of all JavaScript values and objects.
Entry * Next(Entry *p) const
uint32_t occupancy() const
void Resize(AllocationPolicy allocator)
uint32_t capacity() const
Entry * Lookup(void *key, uint32_t hash, bool insert, AllocationPolicy allocator=AllocationPolicy())
void * Remove(void *key, uint32_t hash)
static const uint32_t kDefaultHashMapCapacity
bool(* MatchFun)(void *key1, void *key2)
static bool PointersMatch(void *key1, void *key2)
Entry * Probe(void *key, uint32_t hash)
void Initialize(uint32_t capacity, AllocationPolicy allocator)
TemplateHashMapImpl(MatchFun match, uint32_t capacity=kDefaultHashMapCapacity, AllocationPolicy allocator=AllocationPolicy())
const TemplateHashMapImpl< AllocationPolicy > * map_
Iterator(const TemplateHashMapImpl< AllocationPolicy > *map, typename TemplateHashMapImpl< AllocationPolicy >::Entry *entry)
TemplateHashMapImpl< AllocationPolicy >::Entry * entry_
value_type * operator->()
bool operator!=(const Iterator &other)
STATIC_ASSERT(sizeof(Key *)==sizeof(void *))
TemplateHashMap(typename TemplateHashMapImpl< AllocationPolicy >::MatchFun match, AllocationPolicy allocator=AllocationPolicy())
Iterator find(Key *key, bool insert=false, AllocationPolicy allocator=AllocationPolicy())
STATIC_ASSERT(sizeof(Value *)==sizeof(void *))
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
bool IsPowerOfTwo32(uint32_t value)
TemplateHashMapImpl< FreeStoreAllocationPolicy > HashMap
void FatalProcessOutOfMemory(const char *message)
Debugger support for the V8 JavaScript engine.