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

Side by Side Diff: src/identity-map.h

Issue 1696363002: Use a better hash function in IdentityMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | src/identity-map.cc » ('j') | src/identity-map.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_IDENTITY_MAP_H_ 5 #ifndef V8_IDENTITY_MAP_H_
6 #define V8_IDENTITY_MAP_H_ 6 #define V8_IDENTITY_MAP_H_
7 7
8 #include "src/base/functional.h"
8 #include "src/handles.h" 9 #include "src/handles.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 13
13 // Forward declarations. 14 // Forward declarations.
14 class Heap; 15 class Heap;
15 class Zone; 16 class Zone;
16 17
17 // Base class of identity maps contains shared code for all template 18 // Base class of identity maps contains shared code for all template
(...skipping 23 matching lines...) Expand all
41 private: 42 private:
42 // Internal implementation should not be called directly by subclasses. 43 // Internal implementation should not be called directly by subclasses.
43 int LookupIndex(Object* address); 44 int LookupIndex(Object* address);
44 int InsertIndex(Object* address); 45 int InsertIndex(Object* address);
45 void Rehash(); 46 void Rehash();
46 void Resize(); 47 void Resize();
47 RawEntry Lookup(Object* key); 48 RawEntry Lookup(Object* key);
48 RawEntry Insert(Object* key); 49 RawEntry Insert(Object* key);
49 int Hash(Object* address); 50 int Hash(Object* address);
50 51
52 base::hash<uintptr_t> hasher_;
51 Heap* heap_; 53 Heap* heap_;
52 Zone* zone_; 54 Zone* zone_;
53 int gc_counter_; 55 int gc_counter_;
54 int size_; 56 int size_;
55 int mask_; 57 int mask_;
56 Object** keys_; 58 Object** keys_;
57 void** values_; 59 void** values_;
58 }; 60 };
59 61
60 // Implements an identity map from object addresses to a given value type {V}. 62 // Implements an identity map from object addresses to a given value type {V}.
(...skipping 26 matching lines...) Expand all
87 void Set(Handle<Object> key, V v) { Set(*key, v); } 89 void Set(Handle<Object> key, V v) { Set(*key, v); }
88 void Set(Object* key, V v) { *(reinterpret_cast<V*>(GetEntry(key))) = v; } 90 void Set(Object* key, V v) { *(reinterpret_cast<V*>(GetEntry(key))) = v; }
89 91
90 // Removes all elements from the map. 92 // Removes all elements from the map.
91 void Clear() { IdentityMapBase::Clear(); } 93 void Clear() { IdentityMapBase::Clear(); }
92 }; 94 };
93 } // namespace internal 95 } // namespace internal
94 } // namespace v8 96 } // namespace v8
95 97
96 #endif // V8_IDENTITY_MAP_H_ 98 #endif // V8_IDENTITY_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/identity-map.cc » ('j') | src/identity-map.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698