DeserializeDeferredObjects();
result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root));
}
- CommitNewInternalizedStrings(isolate);
+ CommitPostProcessedObjects(isolate);
return scope.CloseAndEscape(result);
}
}
}
}
} else if (obj->IsScript()) {
- // Assign a new script id to avoid collision.
- Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
+ new_scripts_.Add(handle(Script::cast(obj)));
} else {
DCHECK(CanBeDeferred(obj));
}
}
-void Deserializer::CommitNewInternalizedStrings(Isolate* isolate) {
+void Deserializer::CommitPostProcessedObjects(Isolate* isolate) {
StringTable::EnsureCapacityForDeserialization(
isolate, new_internalized_strings_.length());
for (Handle<String> string : new_internalized_strings_) {
DCHECK_NULL(StringTable::LookupKeyIfExists(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));
+ }
}
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
// space id is used for the write barrier. The object_address is the address
List<HeapObject*> deserialized_large_objects_;
List<Code*> new_code_objects_;
List<Handle<String> > new_internalized_strings_;
+ List<Handle<Script> > new_scripts_;
bool deserializing_user_code_;