Reviewers: mvstanton,

Description:
Reset code age on the cloned code when serializing.

[email protected]

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

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

Affected files (+5, -4 lines):
  M src/objects.h
  M src/objects.cc
  M src/serialize.cc


Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 958c08243b4fbe13bb16ed6b083adcd2d7d9182b..991466d6131c73262c00af185d7bf0cb01929e3f 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10753,9 +10753,9 @@ static Code::Age EffectiveAge(Code::Age age) {
 }


-void Code::MakeYoung() {
+void Code::MakeYoung(Isolate* isolate) {
   byte* sequence = FindCodeAgeSequence();
-  if (sequence != NULL) MakeCodeAgeSequenceYoung(sequence, GetIsolate());
+  if (sequence != NULL) MakeCodeAgeSequenceYoung(sequence, isolate);
 }


Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 911458c3cb68d47532640e8fac6e0d88034350c8..ea1a51c2c01f8f78069ca43c244da81e7eecef31 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5315,7 +5315,7 @@ class Code: public HeapObject {
   // compilation stub.
   static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate);
   static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate);
-  void MakeYoung();
+  void MakeYoung(Isolate* isolate);
   void MakeOlder(MarkingParity);
   static bool IsYoungSequence(Isolate* isolate, byte* sequence);
   bool IsOld();
Index: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index e502c9559fce70b186d4a911936bf042239e8c71..c2dd338b7ec5c3151a4f9e7606a324f72d9aa8d2 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -1874,6 +1874,8 @@ int Serializer::ObjectSerializer::OutputRawData(
// To make snapshots reproducible, we need to wipe out all pointers in code.
     if (code_object_) {
       Code* code = CloneCodeObject(object_);
+      // Code age headers are not serializable.
+      code->MakeYoung(serializer_->isolate());
       WipeOutRelocations(code);
       // We need to wipe out the header fields *after* wiping out the
// relocations, because some of these fields are needed for the latter. @@ -2049,7 +2051,6 @@ void CodeSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code,
         if (code_object != main_code_ && !FLAG_serialize_inner) {
SerializeBuiltin(Builtins::kCompileLazy, how_to_code, where_to_point);
         } else {
-          code_object->MakeYoung();
           SerializeGeneric(code_object, how_to_code, where_to_point);
         }
         return;


--
--
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