Commit 38ef0e94 authored by yangguo's avatar yangguo Committed by Commit bot

Add deserialized scripts to script list.

TBR=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/1296793003

Cr-Commit-Position: refs/heads/master@{#30266}
parent 95845ad4
...@@ -633,7 +633,7 @@ MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode( ...@@ -633,7 +633,7 @@ MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode(
DeserializeDeferredObjects(); DeserializeDeferredObjects();
result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root)); result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root));
} }
CommitNewInternalizedStrings(isolate); CommitPostProcessedObjects(isolate);
return scope.CloseAndEscape(result); return scope.CloseAndEscape(result);
} }
} }
...@@ -726,8 +726,7 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) { ...@@ -726,8 +726,7 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
} }
} }
} else if (obj->IsScript()) { } else if (obj->IsScript()) {
// Assign a new script id to avoid collision. new_scripts_.Add(handle(Script::cast(obj)));
Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
} else { } else {
DCHECK(CanBeDeferred(obj)); DCHECK(CanBeDeferred(obj));
} }
...@@ -760,7 +759,7 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) { ...@@ -760,7 +759,7 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
} }
void Deserializer::CommitNewInternalizedStrings(Isolate* isolate) { void Deserializer::CommitPostProcessedObjects(Isolate* isolate) {
StringTable::EnsureCapacityForDeserialization( StringTable::EnsureCapacityForDeserialization(
isolate, new_internalized_strings_.length()); isolate, new_internalized_strings_.length());
for (Handle<String> string : new_internalized_strings_) { for (Handle<String> string : new_internalized_strings_) {
...@@ -768,6 +767,15 @@ void Deserializer::CommitNewInternalizedStrings(Isolate* isolate) { ...@@ -768,6 +767,15 @@ void Deserializer::CommitNewInternalizedStrings(Isolate* isolate) {
DCHECK_NULL(StringTable::LookupKeyIfExists(isolate, &key)); DCHECK_NULL(StringTable::LookupKeyIfExists(isolate, &key));
StringTable::LookupKey(isolate, &key); StringTable::LookupKey(isolate, &key);
} }
Heap* heap = isolate->heap();
Factory* factory = isolate->factory();
for (Handle<Script> script : new_scripts_) {
// Assign a new script id to avoid collision.
script->set_id(isolate_->heap()->NextScriptId());
// Add script to list.
heap->set_script_list(*WeakFixedArray::Add(factory->script_list(), script));
}
} }
......
...@@ -576,7 +576,7 @@ class Deserializer: public SerializerDeserializer { ...@@ -576,7 +576,7 @@ class Deserializer: public SerializerDeserializer {
void DeserializeDeferredObjects(); void DeserializeDeferredObjects();
void CommitNewInternalizedStrings(Isolate* isolate); void CommitPostProcessedObjects(Isolate* isolate);
// Fills in some heap data in an area from start to end (non-inclusive). The // Fills in some heap data in an area from start to end (non-inclusive). The
// space id is used for the write barrier. The object_address is the address // space id is used for the write barrier. The object_address is the address
...@@ -620,6 +620,7 @@ class Deserializer: public SerializerDeserializer { ...@@ -620,6 +620,7 @@ class Deserializer: public SerializerDeserializer {
List<HeapObject*> deserialized_large_objects_; List<HeapObject*> deserialized_large_objects_;
List<Code*> new_code_objects_; List<Code*> new_code_objects_;
List<Handle<String> > new_internalized_strings_; List<Handle<String> > new_internalized_strings_;
List<Handle<Script> > new_scripts_;
bool deserializing_user_code_; bool deserializing_user_code_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment