Commit d9467de4 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

[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: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#61292}
parent ddc1184d
...@@ -6860,6 +6860,7 @@ Handle<String> StringTable::LookupString(Isolate* isolate, ...@@ -6860,6 +6860,7 @@ Handle<String> StringTable::LookupString(Isolate* isolate,
} }
// static // static
template <typename StringTableKey>
Handle<String> StringTable::LookupKey(Isolate* isolate, StringTableKey* key) { Handle<String> StringTable::LookupKey(Isolate* isolate, StringTableKey* key) {
Handle<StringTable> table = isolate->factory()->string_table(); Handle<StringTable> table = isolate->factory()->string_table();
int entry = table->FindEntry(isolate, key); int entry = table->FindEntry(isolate, key);
...@@ -6877,6 +6878,13 @@ Handle<String> StringTable::LookupKey(Isolate* isolate, StringTableKey* key) { ...@@ -6877,6 +6878,13 @@ Handle<String> StringTable::LookupKey(Isolate* isolate, StringTableKey* key) {
return AddKeyNoResize(isolate, 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, Handle<String> StringTable::AddKeyNoResize(Isolate* isolate,
StringTableKey* key) { StringTableKey* key) {
Handle<StringTable> table = isolate->factory()->string_table(); Handle<StringTable> table = isolate->factory()->string_table();
......
...@@ -150,7 +150,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable ...@@ -150,7 +150,7 @@ class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) HashTable
// Find entry for key otherwise return kNotFound. // Find entry for key otherwise return kNotFound.
inline int FindEntry(ReadOnlyRoots roots, Key key, int32_t hash); 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. // Rehashes the table in-place.
void Rehash(ReadOnlyRoots roots); void Rehash(ReadOnlyRoots roots);
......
...@@ -65,6 +65,7 @@ class StringTable : public HashTable<StringTable, StringTableShape> { ...@@ -65,6 +65,7 @@ class StringTable : public HashTable<StringTable, StringTableShape> {
// added. The return value is the string found. // added. The return value is the string found.
V8_EXPORT_PRIVATE static Handle<String> LookupString(Isolate* isolate, V8_EXPORT_PRIVATE static Handle<String> LookupString(Isolate* isolate,
Handle<String> key); Handle<String> key);
template <typename StringTableKey>
static Handle<String> LookupKey(Isolate* isolate, StringTableKey* key); static Handle<String> LookupKey(Isolate* isolate, StringTableKey* key);
static Handle<String> AddKeyNoResize(Isolate* isolate, StringTableKey* key); static Handle<String> AddKeyNoResize(Isolate* isolate, StringTableKey* key);
static String ForwardStringIfExists(Isolate* isolate, StringTableKey* key, static String ForwardStringIfExists(Isolate* isolate, StringTableKey* key,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment