[runtime] Specialize LookupKey to StringTableKey

Change-Id: I079befeac55aae9ef9ff7743f69fdd3977adcb18
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1598760
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61292}
This commit is contained in:
Toon Verwaest 2019-05-07 16:18:58 +02:00 committed by Commit Bot
parent ddc1184db5
commit d9467de414
3 changed files with 10 additions and 1 deletions

View File

@ -6860,6 +6860,7 @@ Handle<String> StringTable::LookupString(Isolate* isolate,
}
// static
template <typename StringTableKey>
Handle<String> StringTable::LookupKey(Isolate* isolate, StringTableKey* key) {
Handle<StringTable> table = isolate->factory()->string_table();
int entry = table->FindEntry(isolate, key);
@ -6877,6 +6878,13 @@ Handle<String> StringTable::LookupKey(Isolate* isolate, StringTableKey* key) {
return AddKeyNoResize(isolate, key);
}
template Handle<String> StringTable::LookupKey(Isolate* isolate,
OneByteStringKey* key);
template Handle<String> StringTable::LookupKey(Isolate* isolate,
TwoByteStringKey* key);
template Handle<String> StringTable::LookupKey(Isolate* isolate,
SeqOneByteSubStringKey* key);
Handle<String> StringTable::AddKeyNoResize(Isolate* isolate,
StringTableKey* key) {
Handle<StringTable> table = isolate->factory()->string_table();

View File

@ -150,7 +150,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable
// Find entry for key otherwise return kNotFound.
inline int FindEntry(ReadOnlyRoots roots, Key key, int32_t hash);
int FindEntry(Isolate* isolate, Key key);
inline int FindEntry(Isolate* isolate, Key key);
// Rehashes the table in-place.
void Rehash(ReadOnlyRoots roots);

View File

@ -65,6 +65,7 @@ class StringTable : public HashTable<StringTable, StringTableShape> {
// added. The return value is the string found.
V8_EXPORT_PRIVATE static Handle<String> LookupString(Isolate* isolate,
Handle<String> key);
template <typename StringTableKey>
static Handle<String> LookupKey(Isolate* isolate, StringTableKey* key);
static Handle<String> AddKeyNoResize(Isolate* isolate, StringTableKey* key);
static String ForwardStringIfExists(Isolate* isolate, StringTableKey* key,