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

Unified Diff: src/snapshot/deserializer.cc

Issue 2807023003: [snapshot] encode resource before serializing. (Closed)
Patch Set: fix Created 3 years, 8 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/deserializer.h ('k') | src/snapshot/natives.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/deserializer.cc
diff --git a/src/snapshot/deserializer.cc b/src/snapshot/deserializer.cc
index ab17b28bb2505196a5fa70716858927ea42f1fae..5656dee3bc1650ac2a3ebeb4ba383eee88738bbf 100644
--- a/src/snapshot/deserializer.cc
+++ b/src/snapshot/deserializer.cc
@@ -356,6 +356,14 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
if (isolate_->external_reference_redirector()) {
accessor_infos_.Add(AccessorInfo::cast(obj));
}
+ } else if (obj->IsExternalOneByteString()) {
+ DCHECK(obj->map() == isolate_->heap()->native_source_string_map());
+ ExternalOneByteString* string = ExternalOneByteString::cast(obj);
+ DCHECK(string->is_short());
+ string->set_resource(
+ NativesExternalStringResource::DecodeForDeserialization(
+ string->resource()));
+ isolate_->heap()->RegisterExternalString(string);
}
// Check alignment.
DCHECK_EQ(0, Heap::GetFillToAlign(obj->address(), obj->RequiredAlignment()));
@@ -502,16 +510,6 @@ Address Deserializer::Allocate(int space_index, int size) {
}
}
-Object** Deserializer::CopyInNativesSource(Vector<const char> source_vector,
- Object** current) {
- DCHECK(!isolate_->heap()->deserialization_complete());
- NativesExternalStringResource* resource = new NativesExternalStringResource(
- source_vector.start(), source_vector.length());
- Object* resource_obj = reinterpret_cast<Object*>(resource);
- UnalignedCopy(current++, &resource_obj);
- return current;
-}
-
bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
Address current_object_address) {
Isolate* const isolate = isolate_;
@@ -814,16 +812,6 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
CHECK(false);
break;
- case kNativesStringResource:
- current = CopyInNativesSource(Natives::GetScriptSource(source_.Get()),
- current);
- break;
-
- case kExtraNativesStringResource:
- current = CopyInNativesSource(
- ExtraNatives::GetScriptSource(source_.Get()), current);
- break;
-
// Deserialize raw data of variable length.
case kVariableRawData: {
int size_in_bytes = source_.GetInt();
« no previous file with comments | « src/snapshot/deserializer.h ('k') | src/snapshot/natives.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698