Index: src/snapshot/serialize.cc |
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc |
index 58a80940ee51b8d8403b7daa156bb19e3c022e04..09d20d8170b07e9f3e49bb6f3d0bd2bc4061d756 100644 |
--- a/src/snapshot/serialize.cc |
+++ b/src/snapshot/serialize.cc |
@@ -1797,8 +1797,15 @@ void PartialSerializer::SerializeObject(HeapObject* obj, HowToCode how_to_code, |
// Clear literal boilerplates. |
if (obj->IsJSFunction()) { |
- FixedArray* literals = JSFunction::cast(obj)->literals(); |
- for (int i = 0; i < literals->length(); i++) literals->set_undefined(i); |
+ LiteralsArray* literals = JSFunction::cast(obj)->literals(); |
+ for (int i = 0; i < literals->literals_count(); i++) { |
+ literals->set_undefined(i); |
+ } |
+ // TODO(mvstanton): remove this line when the vector moves to the closure. |
+ // We need to clear the vector so the serializer doesn't try to serialize |
+ // the vector in the startup snapshot and the partial snapshot(s). |
+ literals->set_feedback_vector( |
+ TypeFeedbackVector::cast(isolate_->heap()->empty_fixed_array())); |
} |
// Object has not yet been serialized. Serialize it here. |