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

Unified Diff: src/identity-map.h

Issue 1419563004: Simplify IdentityMap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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/heap/heap.h ('k') | src/identity-map.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/identity-map.h
diff --git a/src/identity-map.h b/src/identity-map.h
index 7c3e6a98bff94fc5e5c8928798e824fc8f2b4555..2c4a0f33991f48401ecb9668218a374333d6c5c9 100644
--- a/src/identity-map.h
+++ b/src/identity-map.h
@@ -17,11 +17,6 @@ class Zone;
// Base class of identity maps contains shared code for all template
// instantions.
class IdentityMapBase {
- public:
- // Enable or disable concurrent mode for this map. Concurrent mode implies
- // taking the heap's relocation lock during most operations.
- void SetConcurrent(bool concurrent) { concurrent_ = concurrent; }
-
protected:
// Allow Tester to access internals, including changing the address of objects
// within the {keys_} array in order to simulate a moving GC.
@@ -32,7 +27,6 @@ class IdentityMapBase {
IdentityMapBase(Heap* heap, Zone* zone)
: heap_(heap),
zone_(zone),
- concurrent_(false),
gc_counter_(-1),
size_(0),
mask_(0),
@@ -40,8 +34,8 @@ class IdentityMapBase {
values_(nullptr) {}
~IdentityMapBase();
- RawEntry GetEntry(Handle<Object> key);
- RawEntry FindEntry(Handle<Object> key);
+ RawEntry GetEntry(Object* key);
+ RawEntry FindEntry(Object* key);
private:
// Internal implementation should not be called directly by subclasses.
@@ -49,13 +43,12 @@ class IdentityMapBase {
int InsertIndex(Object* address);
void Rehash();
void Resize();
- RawEntry Lookup(Handle<Object> key);
- RawEntry Insert(Handle<Object> key);
+ RawEntry Lookup(Object* key);
+ RawEntry Insert(Object* key);
int Hash(Object* address);
Heap* heap_;
Zone* zone_;
- bool concurrent_;
int gc_counter_;
int size_;
int mask_;
@@ -79,18 +72,19 @@ class IdentityMap : public IdentityMapBase {
// as the identity, returning:
// found => a pointer to the storage location for the value
// not found => a pointer to a new storage location for the value
- V* Get(Handle<Object> key) { return reinterpret_cast<V*>(GetEntry(key)); }
+ V* Get(Handle<Object> key) { return Get(*key); }
+ V* Get(Object* key) { return reinterpret_cast<V*>(GetEntry(key)); }
// Searches this map for the given key using the object's address
// as the identity, returning:
// found => a pointer to the storage location for the value
// not found => {nullptr}
- V* Find(Handle<Object> key) { return reinterpret_cast<V*>(FindEntry(key)); }
+ V* Find(Handle<Object> key) { return Find(*key); }
+ V* Find(Object* key) { return reinterpret_cast<V*>(FindEntry(key)); }
// Set the value for the given key.
- void Set(Handle<Object> key, V value) {
- *(reinterpret_cast<V*>(GetEntry(key))) = value;
- }
+ void Set(Handle<Object> key, V v) { Set(*key, v); }
+ void Set(Object* key, V v) { *(reinterpret_cast<V*>(GetEntry(key))) = v; }
};
} // namespace internal
} // namespace v8
« no previous file with comments | « src/heap/heap.h ('k') | src/identity-map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698