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

Unified Diff: src/serialize.cc

Issue 411483002: Correctly hook up back references to internalized strings in code deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: edited comment Created 6 years, 5 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/serialize.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) { \
+ 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()) { \
« no previous file with comments | « src/serialize.h ('k') | test/cctest/test-serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698