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

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

Issue 1651133002: [interpreter] Move temporary register allocator into own file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate review comments from rmcilroy. 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') | no next file with comments »
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/handles.h" 8 #include "src/handles.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 18 matching lines...) Expand all
29 zone_(zone), 29 zone_(zone),
30 gc_counter_(-1), 30 gc_counter_(-1),
31 size_(0), 31 size_(0),
32 mask_(0), 32 mask_(0),
33 keys_(nullptr), 33 keys_(nullptr),
34 values_(nullptr) {} 34 values_(nullptr) {}
35 ~IdentityMapBase(); 35 ~IdentityMapBase();
36 36
37 RawEntry GetEntry(Object* key); 37 RawEntry GetEntry(Object* key);
38 RawEntry FindEntry(Object* key); 38 RawEntry FindEntry(Object* key);
39 void Clear();
39 40
40 private: 41 private:
41 // Internal implementation should not be called directly by subclasses. 42 // Internal implementation should not be called directly by subclasses.
42 int LookupIndex(Object* address); 43 int LookupIndex(Object* address);
43 int InsertIndex(Object* address); 44 int InsertIndex(Object* address);
44 void Rehash(); 45 void Rehash();
45 void Resize(); 46 void Resize();
46 RawEntry Lookup(Object* key); 47 RawEntry Lookup(Object* key);
47 RawEntry Insert(Object* key); 48 RawEntry Insert(Object* key);
48 int Hash(Object* address); 49 int Hash(Object* address);
(...skipping 29 matching lines...) Expand all
78 // Searches this map for the given key using the object's address 79 // Searches this map for the given key using the object's address
79 // as the identity, returning: 80 // as the identity, returning:
80 // found => a pointer to the storage location for the value 81 // found => a pointer to the storage location for the value
81 // not found => {nullptr} 82 // not found => {nullptr}
82 V* Find(Handle<Object> key) { return Find(*key); } 83 V* Find(Handle<Object> key) { return Find(*key); }
83 V* Find(Object* key) { return reinterpret_cast<V*>(FindEntry(key)); } 84 V* Find(Object* key) { return reinterpret_cast<V*>(FindEntry(key)); }
84 85
85 // Set the value for the given key. 86 // Set the value for the given key.
86 void Set(Handle<Object> key, V v) { Set(*key, v); } 87 void Set(Handle<Object> key, V v) { Set(*key, v); }
87 void Set(Object* key, V v) { *(reinterpret_cast<V*>(GetEntry(key))) = v; } 88 void Set(Object* key, V v) { *(reinterpret_cast<V*>(GetEntry(key))) = v; }
89
90 // Removes all elements from the map.
91 void Clear() { IdentityMapBase::Clear(); }
88 }; 92 };
89 } // namespace internal 93 } // namespace internal
90 } // namespace v8 94 } // namespace v8
91 95
92 #endif // V8_IDENTITY_MAP_H_ 96 #endif // V8_IDENTITY_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/identity-map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698