Reviewers: mvstanton,

Description:
Add deserialized scripts to script list.


[email protected]

Please review this at https://codereview.chromium.org/1296793003/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+17, -3 lines):
  M src/snapshot/serialize.h
  M src/snapshot/serialize.cc


Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index a3a22336d108d65f37cb3cb23e68e6da9eb5c029..967a667928e048cae52abb5a6e9699f27e8bfeea 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -634,6 +634,7 @@ MaybeHandle<SharedFunctionInfo> Deserializer::DeserializeCode(
       result = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root));
     }
     CommitNewInternalizedStrings(isolate);
+    CommitNewScripts(isolate);
     return scope.CloseAndEscape(result);
   }
 }
@@ -726,8 +727,7 @@ HeapObject* Deserializer::PostProcessNewObject(HeapObject* obj, int space) {
         }
       }
     } 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));
     }
@@ -771,6 +771,18 @@ void Deserializer::CommitNewInternalizedStrings(Isolate* isolate) {
 }


+void Deserializer::CommitNewScripts(Isolate* isolate) {
+  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));
+  }
+}
+
+
 HeapObject* Deserializer::GetBackReferencedObject(int space) {
   HeapObject* obj;
   BackReference back_reference(source_.GetInt());
Index: src/snapshot/serialize.h
diff --git a/src/snapshot/serialize.h b/src/snapshot/serialize.h
index 512aad1877731a502e145d09a82461022e1910ae..a9fc6ea5c929f24f0e5fc61ea2178b8b4da663f0 100644
--- a/src/snapshot/serialize.h
+++ b/src/snapshot/serialize.h
@@ -576,7 +576,7 @@ class Deserializer: public SerializerDeserializer {

   void DeserializeDeferredObjects();

-  void CommitNewInternalizedStrings(Isolate* isolate);
+  void DeferredPostProcess(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
@@ -619,7 +619,9 @@ class Deserializer: public SerializerDeserializer {

   List<HeapObject*> deserialized_large_objects_;
   List<Code*> new_code_objects_;
+  List<Handle<Object> > deferred_post_process_object_;
   List<Handle<String> > new_internalized_strings_;
+  List<Handle<Script> > new_scripts_;

   bool deserializing_user_code_;



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to