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

Unified Diff: src/snapshot/serialize.cc

Issue 1186173004: Revert of Serializer: clear string hash for code serializer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/snapshot/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index 8b382c09fb1a3c047a1c22f02dd2dc3ad9703b42..57092e1b46238336fff16a11e9a510324fbceea4 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -714,16 +714,20 @@
HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
if (deserializing_user_code()) {
- if (obj->IsInternalizedString()) {
- // Canonicalize the internalized string. If it already exists in the
- // string table, set it to forward to the existing one.
- DisallowHeapAllocation no_gc;
+ if (obj->IsString()) {
String* string = String::cast(obj);
- HandleScope scope(isolate_);
- StringTableInsertionKey key(string);
- String* canonical = *StringTable::LookupKey(isolate_, &key);
- string->SetForwardedInternalizedString(canonical);
- return canonical;
+ // Uninitialize hash field as the hash seed may have changed.
+ string->set_hash_field(String::kEmptyHashField);
+ if (string->IsInternalizedString()) {
+ // Canonicalize the internalized string. If it already exists in the
+ // string table, set it to forward to the existing one.
+ DisallowHeapAllocation no_gc;
+ HandleScope scope(isolate_);
+ StringTableInsertionKey key(string);
+ String* canonical = *StringTable::LookupKey(isolate_, &key);
+ string->SetForwardedInternalizedString(canonical);
+ return canonical;
+ }
} else if (obj->IsScript()) {
// Assign a new script id to avoid collision.
Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
@@ -2300,24 +2304,12 @@
void CodeSerializer::SerializeGeneric(HeapObject* heap_object,
HowToCode how_to_code,
WhereToPoint where_to_point) {
- int string_hash = String::kEmptyHashField;
- if (heap_object->IsString()) {
- String* string = String::cast(heap_object);
- if (string->IsInternalizedString()) num_internalized_strings_++;
- // Temporarily clear string hash.
- string_hash = string->hash_field();
- string->set_hash_field(String::kEmptyHashField);
- }
+ if (heap_object->IsInternalizedString()) num_internalized_strings_++;
// Object has not yet been serialized. Serialize it here.
ObjectSerializer serializer(this, heap_object, sink_, how_to_code,
where_to_point);
serializer.Serialize();
-
- if (string_hash != String::kEmptyHashField) {
- // Restore string hash.
- String::cast(heap_object)->set_hash_field(String::kEmptyHashField);
- }
}
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698