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

Unified Diff: src/objects.h

Issue 257853003: ObjectHashTable's key and WeakHashTable's key types are now Handle<Object> instead of Object*. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index f8b9ad1e9a92f4209e0d72674db29dc7b4669327..760a7a12cf517bbefc3a7fd48122d0b43198c06f 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -3681,8 +3681,7 @@ class HashTable: public FixedArray {
// Wrapper methods
inline uint32_t Hash(Key key) {
if (Shape::UsesSeed) {
- return Shape::SeededHash(key,
- GetHeap()->HashSeed());
+ return Shape::SeededHash(key, GetHeap()->HashSeed());
} else {
return Shape::Hash(key);
}
@@ -3690,8 +3689,7 @@ class HashTable: public FixedArray {
inline uint32_t HashForObject(Key key, Object* object) {
if (Shape::UsesSeed) {
- return Shape::SeededHashForObject(key,
- GetHeap()->HashSeed(), object);
+ return Shape::SeededHashForObject(key, GetHeap()->HashSeed(), object);
} else {
return Shape::HashForObject(key, object);
}
@@ -4260,13 +4258,14 @@ class UnseededNumberDictionary
};
-class ObjectHashTableShape : public BaseShape<Object*> {
+class ObjectHashTableShape : public BaseShape<Handle<Object> > {
public:
- static inline bool IsMatch(Object* key, Object* other);
- static inline uint32_t Hash(Object* key);
- static inline uint32_t HashForObject(Object* key, Object* object);
+ static inline bool IsMatch(Handle<Object> key, Object* other);
+ static inline uint32_t Hash(Handle<Object> key);
+ static inline uint32_t HashForObject(Handle<Object> key, Object* object);
MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
- Object* key);
+ Handle<Object> key);
+ static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Object> key);
static const int kPrefixSize = 0;
static const int kEntrySize = 2;
};
@@ -4276,9 +4275,9 @@ class ObjectHashTableShape : public BaseShape<Object*> {
// using the identity hash of the key for hashing purposes.
class ObjectHashTable: public HashTable<ObjectHashTable,
ObjectHashTableShape,
- Object*> {
+ Handle<Object> > {
typedef HashTable<
- ObjectHashTable, ObjectHashTableShape, Object*> DerivedHashTable;
+ ObjectHashTable, ObjectHashTableShape, Handle<Object> > DerivedHashTable;
public:
static inline ObjectHashTable* cast(Object* obj) {
ASSERT(obj->IsHashTable());
@@ -4294,6 +4293,10 @@ class ObjectHashTable: public HashTable<ObjectHashTable,
// returned in case the key is not present.
Object* Lookup(Object* key);
+ int FindEntry(Handle<Object> key);
+ // TODO(ishell): Remove this when all the callers are handlified.
+ int FindEntry(Object* key);
+
// Adds (or overwrites) the value associated with the given key. Mapping a
// key to the hole value causes removal of the whole entry.
static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table,
@@ -4492,13 +4495,12 @@ class OrderedHashMap:public OrderedHashTable<
template <int entrysize>
-class WeakHashTableShape : public BaseShape<Object*> {
+class WeakHashTableShape : public BaseShape<Handle<Object> > {
public:
- static inline bool IsMatch(Object* key, Object* other);
- static inline uint32_t Hash(Object* key);
- static inline uint32_t HashForObject(Object* key, Object* object);
- MUST_USE_RESULT static inline MaybeObject* AsObject(Heap* heap,
- Object* key);
+ static inline bool IsMatch(Handle<Object> key, Object* other);
+ static inline uint32_t Hash(Handle<Object> key);
+ static inline uint32_t HashForObject(Handle<Object> key, Object* object);
+ static inline Handle<Object> AsHandle(Isolate* isolate, Handle<Object> key);
static const int kPrefixSize = 0;
static const int kEntrySize = entrysize;
};
@@ -4509,7 +4511,9 @@ class WeakHashTableShape : public BaseShape<Object*> {
// embedded in optimized code to dependent code lists.
class WeakHashTable: public HashTable<WeakHashTable,
WeakHashTableShape<2>,
- Object*> {
+ Handle<Object> > {
+ typedef HashTable<
+ WeakHashTable, WeakHashTableShape<2>, Handle<Object> > DerivedHashTable;
public:
static inline WeakHashTable* cast(Object* obj) {
ASSERT(obj->IsHashTable());
@@ -4520,6 +4524,10 @@ class WeakHashTable: public HashTable<WeakHashTable,
// returned in case the key is not present.
Object* Lookup(Object* key);
+ int FindEntry(Handle<Object> key);
+ // TODO(ishell): Remove this when all the callers are handlified.
+ int FindEntry(Object* key);
+
// Adds (or overwrites) the value associated with the given key. Mapping a
// key to the hole value causes removal of the whole entry.
MUST_USE_RESULT static Handle<WeakHashTable> Put(Handle<WeakHashTable> table,
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698