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

Unified Diff: src/objects.cc

Issue 1774943002: Install the internalized string as flattened version into cons-strings for fast re-internalization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | 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 708135e71724b1f44735ca35a50769a97854413b..d67fc9eb216c65db935c348d08ce7a098d7a5fac 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -17957,8 +17957,20 @@ void StringTable::EnsureCapacityForDeserialization(Isolate* isolate,
Handle<String> StringTable::LookupString(Isolate* isolate,
Handle<String> string) {
+ if (string->IsConsString() && string->IsFlat()) {
+ string = String::Flatten(string);
+ if (string->IsInternalizedString()) return string;
+ }
+
InternalizedStringKey key(string);
- return LookupKey(isolate, &key);
+ Handle<String> result = LookupKey(isolate, &key);
+
+ if (string->IsConsString()) {
+ Handle<ConsString> cons = Handle<ConsString>::cast(string);
+ cons->set_first(*result);
+ cons->set_second(isolate->heap()->empty_string());
+ }
+ return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698