Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index f835e56d9cf85e3f2999d7d9641faae0bf953333..b282a3173dbea116365f235206d61324e3bb05bd 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); |
| } |
| @@ -3076,7 +3078,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, |
| @@ -3098,6 +3099,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)); |
| } |
| @@ -3195,6 +3216,7 @@ CAST_ACCESSOR(NameDictionary) |
| CAST_ACCESSOR(NormalizedMapCache) |
| CAST_ACCESSOR(Object) |
| CAST_ACCESSOR(ObjectHashTable) |
| +CAST_ACCESSOR(ObjectHashSet) |
|
adamk
2016/06/27 19:19:33
Nit: looks like this list is in alphabetical order
Camillo Bruni
2016/06/29 17:27:56
done.
|
| CAST_ACCESSOR(Oddball) |
| CAST_ACCESSOR(OrderedHashMap) |
| CAST_ACCESSOR(OrderedHashSet) |
| @@ -5099,7 +5121,7 @@ bool Code::is_debug_stub() { |
| #define CASE_DEBUG_BUILTIN(name, kind, extra) case Builtins::k##name: |
| BUILTIN_LIST_DEBUG_A(CASE_DEBUG_BUILTIN) |
| #undef CASE_DEBUG_BUILTIN |
| - return true; |
| + return true; |
|
adamk
2016/06/27 19:19:33
This whitespace change looks wrong..git cl format'
Camillo Bruni
2016/06/29 17:27:56
indeed, changing back
|
| default: |
| return false; |
| } |