• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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_INL_H_
6 #define V8_OBJECTS_STRING_SET_INL_H_
7 
8 #include "src/objects/string-inl.h"
9 #include "src/objects/string-set.h"
10 
11 // Has to be the last include (doesn't have include guards):
12 #include "src/objects/object-macros.h"
13 
14 namespace v8 {
15 namespace internal {
16 
CAST_ACCESSOR(StringSet)17 CAST_ACCESSOR(StringSet)
18 
19 StringSet::StringSet(Address ptr) : HashTable<StringSet, StringSetShape>(ptr) {
20   SLOW_DCHECK(IsStringSet());
21 }
22 
IsMatch(String key,Object value)23 bool StringSetShape::IsMatch(String key, Object value) {
24   DCHECK(value.IsString());
25   return key.Equals(String::cast(value));
26 }
27 
Hash(ReadOnlyRoots roots,String key)28 uint32_t StringSetShape::Hash(ReadOnlyRoots roots, String key) {
29   return key.EnsureHash();
30 }
31 
HashForObject(ReadOnlyRoots roots,Object object)32 uint32_t StringSetShape::HashForObject(ReadOnlyRoots roots, Object object) {
33   return String::cast(object).EnsureHash();
34 }
35 
36 }  // namespace internal
37 }  // namespace v8
38 
39 #include "src/objects/object-macros-undef.h"
40 
41 #endif  // V8_OBJECTS_STRING_SET_INL_H_
42