Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Unified Diff: src/objects.cc

Issue 2760413002: Minor optimization to v8::internal::Factory::InternalizeOneByteString.
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index a63255a931090e60b01e5caf48e2747cdc9a7c97..97b4a378d159bf8caa312602a1d2f7b9a6ab9303 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11763,19 +11763,6 @@ uint32_t StringHasher::MakeArrayIndexHash(uint32_t value, int length) {
}
-uint32_t StringHasher::GetHashField() {
- if (length_ <= String::kMaxHashCalcLength) {
- if (is_array_index_) {
- return MakeArrayIndexHash(array_index_, length_);
- }
- return (GetHashCore(raw_running_hash_) << String::kHashShift) |
- String::kIsNotArrayIndexMask;
- } else {
- return (length_ << String::kHashShift) | String::kIsNotArrayIndexMask;
- }
-}
-
-
uint32_t StringHasher::ComputeUtf8Hash(Vector<const char> chars,
uint32_t seed,
int* utf16_length_out) {
@@ -17411,16 +17398,9 @@ Handle<String> StringTable::LookupString(Isolate* isolate,
return result;
}
-
-Handle<String> StringTable::LookupKey(Isolate* isolate, HashTableKey* key) {
- Handle<StringTable> table = isolate->factory()->string_table();
- int entry = table->FindEntry(key);
-
- // String already in table.
- if (entry != kNotFound) {
- return handle(String::cast(table->KeyAt(entry)), isolate);
- }
-
+Handle<String> StringTable::InsertKey(Isolate* isolate,
+ Handle<StringTable> table,
+ HashTableKey* key, int32_t hash) {
// Adding new string. Grow table if needed.
table = StringTable::EnsureCapacity(table, 1, key);
@@ -17431,7 +17411,7 @@ Handle<String> StringTable::LookupKey(Isolate* isolate, HashTableKey* key) {
CHECK(!string.is_null());
// Add the new string and return it along with the string table.
- entry = table->FindInsertionEntry(key->Hash());
+ int entry = table->FindInsertionEntry(hash);
table->set(EntryToIndex(entry), *string);
table->ElementAdded();
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698