1// Copyright 2020 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef V8_OBJECTS_STRING_SET_H_ 6#define V8_OBJECTS_STRING_SET_H_ 7 8#include "src/objects/hash-table.h" 9 10// Has to be the last include (doesn't have include guards): 11#include "src/objects/object-macros.h" 12 13namespace v8 { 14namespace internal { 15 16class StringSetShape : public BaseShape<String> { 17 public: 18 static inline bool IsMatch(String key, Object value); 19 static inline uint32_t Hash(ReadOnlyRoots roots, String key); 20 static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object); 21 22 static const int kPrefixSize = 0; 23 static const int kEntrySize = 1; 24 static const bool kMatchNeedsHoleCheck = true; 25}; 26 27EXTERN_DECLARE_HASH_TABLE(StringSet, StringSetShape) 28 29class StringSet : public HashTable<StringSet, StringSetShape> { 30 public: 31 V8_EXPORT_PRIVATE static Handle<StringSet> New(Isolate* isolate); 32 V8_EXPORT_PRIVATE static Handle<StringSet> Add(Isolate* isolate, 33 Handle<StringSet> stringset, 34 Handle<String> name); 35 V8_EXPORT_PRIVATE bool Has(Isolate* isolate, Handle<String> name); 36 37 DECL_CAST(StringSet) 38 OBJECT_CONSTRUCTORS(StringSet, HashTable<StringSet, StringSetShape>); 39}; 40 41} // namespace internal 42} // namespace v8 43 44#include "src/objects/object-macros-undef.h" 45 46#endif // V8_OBJECTS_STRING_SET_H_ 47