Revert of Serializer: clear string hash for code serializer. (patchset #1 id:1 of https://codereview.chromium.org/1183483006/)
Reason for revert: This led to the roll being stuck: https://codereview.chromium.org/1189863003/ Original issue's description: > Serializer: clear string hash for code serializer. > > R=jochen@chromium.org > BUG=v8:4179 > LOG=N > > Committed: https://crrev.com/a0342678e865337215f9195f983c6013b60e7641 > Cr-Commit-Position: refs/heads/master@{#29016} TBR=jochen@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=v8:4179 Review URL: https://codereview.chromium.org/1186173004 Cr-Commit-Position: refs/heads/master@{#29065}
This commit is contained in:
parent
ad6e739165
commit
22160e7c39
@ -714,16 +714,20 @@ class StringTableInsertionKey : public HashTableKey {
|
|||||||
|
|
||||||
HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
|
HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
|
||||||
if (deserializing_user_code()) {
|
if (deserializing_user_code()) {
|
||||||
if (obj->IsInternalizedString()) {
|
if (obj->IsString()) {
|
||||||
|
String* string = String::cast(obj);
|
||||||
|
// 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
|
// Canonicalize the internalized string. If it already exists in the
|
||||||
// string table, set it to forward to the existing one.
|
// string table, set it to forward to the existing one.
|
||||||
DisallowHeapAllocation no_gc;
|
DisallowHeapAllocation no_gc;
|
||||||
String* string = String::cast(obj);
|
|
||||||
HandleScope scope(isolate_);
|
HandleScope scope(isolate_);
|
||||||
StringTableInsertionKey key(string);
|
StringTableInsertionKey key(string);
|
||||||
String* canonical = *StringTable::LookupKey(isolate_, &key);
|
String* canonical = *StringTable::LookupKey(isolate_, &key);
|
||||||
string->SetForwardedInternalizedString(canonical);
|
string->SetForwardedInternalizedString(canonical);
|
||||||
return canonical;
|
return canonical;
|
||||||
|
}
|
||||||
} else if (obj->IsScript()) {
|
} else if (obj->IsScript()) {
|
||||||
// Assign a new script id to avoid collision.
|
// Assign a new script id to avoid collision.
|
||||||
Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
|
Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
|
||||||
@ -2314,24 +2318,12 @@ void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
|
|||||||
void CodeSerializer::SerializeGeneric(HeapObject* heap_object,
|
void CodeSerializer::SerializeGeneric(HeapObject* heap_object,
|
||||||
HowToCode how_to_code,
|
HowToCode how_to_code,
|
||||||
WhereToPoint where_to_point) {
|
WhereToPoint where_to_point) {
|
||||||
int string_hash = String::kEmptyHashField;
|
if (heap_object->IsInternalizedString()) num_internalized_strings_++;
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Object has not yet been serialized. Serialize it here.
|
// Object has not yet been serialized. Serialize it here.
|
||||||
ObjectSerializer serializer(this, heap_object, sink_, how_to_code,
|
ObjectSerializer serializer(this, heap_object, sink_, how_to_code,
|
||||||
where_to_point);
|
where_to_point);
|
||||||
serializer.Serialize();
|
serializer.Serialize();
|
||||||
|
|
||||||
if (string_hash != String::kEmptyHashField) {
|
|
||||||
// Restore string hash.
|
|
||||||
String::cast(heap_object)->set_hash_field(String::kEmptyHashField);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ class SerializerDeserializer: public ObjectVisitor {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
static bool CanBeDeferred(HeapObject* o) {
|
static bool CanBeDeferred(HeapObject* o) {
|
||||||
return !o->IsInternalizedString() && !o->IsScript();
|
return !o->IsString() && !o->IsScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- byte code range 0x00..0x7f ----------
|
// ---------- byte code range 0x00..0x7f ----------
|
||||||
|
Loading…
Reference in New Issue
Block a user