Chromium Code Reviews| Index: src/serialize.cc |
| diff --git a/src/serialize.cc b/src/serialize.cc |
| index 20319357ab57cde4d60ca3f9d6c77ae64d67561d..4156dfbf626fef88ebe2ec6c55f84240bf8a869e 100644 |
| --- a/src/serialize.cc |
| +++ b/src/serialize.cc |
| @@ -867,7 +867,7 @@ class StringTableInsertionKey : public HashTableKey { |
| }; |
| -HeapObject* Deserializer::ProcessObjectFromSerializedCode(HeapObject* obj) { |
| +HeapObject* Deserializer::ProcessNewObjectFromSerializedCode(HeapObject* obj) { |
| if (obj->IsString()) { |
| String* string = String::cast(obj); |
| // Uninitialize hash field as the hash seed may have changed. |
| @@ -876,13 +876,23 @@ HeapObject* Deserializer::ProcessObjectFromSerializedCode(HeapObject* obj) { |
| DisallowHeapAllocation no_gc; |
| HandleScope scope(isolate_); |
| StringTableInsertionKey key(string); |
| - return *StringTable::LookupKey(isolate_, &key); |
| + String* canonical = *StringTable::LookupKey(isolate_, &key); |
| + string->SetForwardedInternalizedString(canonical); |
| + return canonical; |
| } |
| } |
| return obj; |
| } |
| +Object* Deserializer::ProcessBackRefInSerializedCode(Object* obj) { |
| + if (obj->IsInternalizedString()) { |
| + return String::cast(obj)->GetForwardedInternalizedString(); |
| + } |
| + return obj; |
| +} |
| + |
| + |
| // This routine writes the new object into the pointer provided and then |
| // returns true if the new object was in young space and false otherwise. |
| // The reason for this strange interface is that otherwise the object is |
| @@ -907,7 +917,7 @@ void Deserializer::ReadObject(int space_number, |
| if (obj->IsAllocationSite()) RelinkAllocationSite(AllocationSite::cast(obj)); |
| // Fix up strings from serialized user code. |
| - if (deserializing_user_code()) obj = ProcessObjectFromSerializedCode(obj); |
| + if (deserializing_user_code()) obj = ProcessNewObjectFromSerializedCode(obj); |
| *write_back = obj; |
| #ifdef DEBUG |
| @@ -972,6 +982,9 @@ void Deserializer::ReadChunk(Object** current, |
| } else if (where == kBackref) { \ |
| emit_write_barrier = (space_number == NEW_SPACE); \ |
| new_object = GetAddressFromEnd(data & kSpaceMask); \ |
| + if (deserializing_user_code()) { \ |
|
mvstanton
2014/07/22 13:31:31
Just a thought, take it or leave it: what about ch
Yang
2014/07/23 06:55:58
I'd like to leave it this way, since it mirrors th
|
| + new_object = ProcessBackRefInSerializedCode(new_object); \ |
| + } \ |
| } else if (where == kBuiltin) { \ |
| ASSERT(deserializing_user_code()); \ |
| int builtin_id = source_->GetInt(); \ |
| @@ -992,6 +1005,9 @@ void Deserializer::ReadChunk(Object** current, |
| reinterpret_cast<Address>(current) + skip); \ |
| emit_write_barrier = (space_number == NEW_SPACE); \ |
| new_object = GetAddressFromEnd(data & kSpaceMask); \ |
| + if (deserializing_user_code()) { \ |
| + new_object = ProcessBackRefInSerializedCode(new_object); \ |
| + } \ |
| } \ |
| if (within == kInnerPointer) { \ |
| if (space_number != CODE_SPACE || new_object->IsCode()) { \ |