Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index b177deaa414c78999ae8a90efa65cea038e5795c..5d59cd3e19ef74852fe1fd0f2a3be3416fd8a4a3 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -859,6 +859,8 @@ bool HeapObject::IsStringTable() const { return IsHashTable(); } |
bool HeapObject::IsStringSet() const { return IsHashTable(); } |
+bool HeapObject::IsObjectHashSet() const { return IsHashTable(); } |
+ |
bool HeapObject::IsNormalizedMapCache() const { |
return NormalizedMapCache::IsNormalizedMapCache(this); |
} |
@@ -3073,7 +3075,6 @@ int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key) { |
return FindEntry(isolate, key, HashTable::Hash(key)); |
} |
- |
// Find entry for key otherwise return kNotFound. |
template <typename Derived, typename Shape, typename Key> |
int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key, |
@@ -3095,6 +3096,26 @@ int HashTable<Derived, Shape, Key>::FindEntry(Isolate* isolate, Key key, |
return kNotFound; |
} |
+template <typename Derived, typename Shape, typename Key> |
+bool HashTable<Derived, Shape, Key>::Has(Key key) { |
+ return FindEntry(key) != kNotFound; |
+} |
+ |
+template <typename Derived, typename Shape, typename Key> |
+bool HashTable<Derived, Shape, Key>::Has(Isolate* isolate, Key key) { |
+ return FindEntry(isolate, key) != kNotFound; |
+} |
+ |
+bool ObjectHashSet::Has(Isolate* isolate, Handle<Object> key, int32_t hash) { |
+ return FindEntry(isolate, key, hash) != kNotFound; |
+} |
+ |
+bool ObjectHashSet::Has(Isolate* isolate, Handle<Object> key) { |
+ Object* hash = key->GetHash(); |
+ if (!hash->IsSmi()) return false; |
+ return FindEntry(isolate, key, Smi::cast(hash)->value()) != kNotFound; |
+} |
+ |
bool StringSetShape::IsMatch(String* key, Object* value) { |
return value->IsString() && key->Equals(String::cast(value)); |
} |
@@ -3191,6 +3212,7 @@ CAST_ACCESSOR(NameDictionary) |
CAST_ACCESSOR(NormalizedMapCache) |
CAST_ACCESSOR(Object) |
CAST_ACCESSOR(ObjectHashTable) |
+CAST_ACCESSOR(ObjectHashSet) |
CAST_ACCESSOR(Oddball) |
CAST_ACCESSOR(OrderedHashMap) |
CAST_ACCESSOR(OrderedHashSet) |