OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_STRING_TABLE_H_ | 5 #ifndef V8_OBJECTS_STRING_TABLE_H_ |
6 #define V8_OBJECTS_STRING_TABLE_H_ | 6 #define V8_OBJECTS_STRING_TABLE_H_ |
7 | 7 |
8 #include "src/objects/hash-table.h" | 8 #include "src/objects/hash-table.h" |
9 | 9 |
10 // Has to be the last include (doesn't have include guards): | 10 // Has to be the last include (doesn't have include guards): |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 static String* LookupKeyIfExists(Isolate* isolate, StringTableKey* key); | 62 static String* LookupKeyIfExists(Isolate* isolate, StringTableKey* key); |
63 | 63 |
64 // Looks up a string that is equal to the given string and returns | 64 // Looks up a string that is equal to the given string and returns |
65 // string handle if it is found, or an empty handle otherwise. | 65 // string handle if it is found, or an empty handle otherwise. |
66 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists( | 66 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists( |
67 Isolate* isolate, uint16_t c1, uint16_t c2); | 67 Isolate* isolate, uint16_t c1, uint16_t c2); |
68 static Object* LookupStringIfExists_NoAllocate(String* string); | 68 static Object* LookupStringIfExists_NoAllocate(String* string); |
69 | 69 |
70 static void EnsureCapacityForDeserialization(Isolate* isolate, int expected); | 70 static void EnsureCapacityForDeserialization(Isolate* isolate, int expected); |
71 | 71 |
72 DECLARE_CAST(StringTable) | 72 DECL_CAST(StringTable) |
73 | 73 |
74 private: | 74 private: |
75 template <bool seq_one_byte> | 75 template <bool seq_one_byte> |
76 friend class JsonParser; | 76 friend class JsonParser; |
77 | 77 |
78 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); | 78 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); |
79 }; | 79 }; |
80 | 80 |
81 class StringSetShape : public BaseShape<String*> { | 81 class StringSetShape : public BaseShape<String*> { |
82 public: | 82 public: |
83 static inline bool IsMatch(String* key, Object* value); | 83 static inline bool IsMatch(String* key, Object* value); |
84 static inline uint32_t Hash(Isolate* isolate, String* key); | 84 static inline uint32_t Hash(Isolate* isolate, String* key); |
85 static inline uint32_t HashForObject(Isolate* isolate, Object* object); | 85 static inline uint32_t HashForObject(Isolate* isolate, Object* object); |
86 | 86 |
87 static const int kPrefixSize = 0; | 87 static const int kPrefixSize = 0; |
88 static const int kEntrySize = 1; | 88 static const int kEntrySize = 1; |
89 }; | 89 }; |
90 | 90 |
91 class StringSet : public HashTable<StringSet, StringSetShape> { | 91 class StringSet : public HashTable<StringSet, StringSetShape> { |
92 public: | 92 public: |
93 static Handle<StringSet> New(Isolate* isolate); | 93 static Handle<StringSet> New(Isolate* isolate); |
94 static Handle<StringSet> Add(Handle<StringSet> blacklist, | 94 static Handle<StringSet> Add(Handle<StringSet> blacklist, |
95 Handle<String> name); | 95 Handle<String> name); |
96 bool Has(Handle<String> name); | 96 bool Has(Handle<String> name); |
97 | 97 |
98 DECLARE_CAST(StringSet) | 98 DECL_CAST(StringSet) |
99 }; | 99 }; |
100 | 100 |
101 } // namespace internal | 101 } // namespace internal |
102 } // namespace v8 | 102 } // namespace v8 |
103 | 103 |
104 #include "src/objects/object-macros-undef.h" | 104 #include "src/objects/object-macros-undef.h" |
105 | 105 |
106 #endif // V8_OBJECTS_STRING_TABLE_H_ | 106 #endif // V8_OBJECTS_STRING_TABLE_H_ |
OLD | NEW |