[cleanup] Remove dead code in StartupSerializer
Now that we don't iterate over the strong roots in the StartupSerializer twice, remove code related to skipping non-immortal immovable roots. Factor out code from Serializer::VisitRootPointers and use that method in the StartSerializer override. Also update comments that reflected the old way of serializing. Change-Id: Ieb5e63389f455b963244717cada7e5ccde8e41cb Reviewed-on: https://chromium-review.googlesource.com/1179669 Commit-Queue: Dan Elphick <delphick@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#55218}
This commit is contained in:
parent
378375d2e5
commit
7b3676da42
@ -116,11 +116,16 @@ void Serializer<AllocatorT>::VisitRootPointers(Root root,
|
||||
if (root == Root::kBuiltins || root == Root::kDispatchTable) return;
|
||||
|
||||
for (Object** current = start; current < end; current++) {
|
||||
if ((*current)->IsSmi()) {
|
||||
PutSmi(Smi::cast(*current));
|
||||
} else {
|
||||
SerializeObject(HeapObject::cast(*current), kPlain, kStartOfObject, 0);
|
||||
}
|
||||
SerializeRootObject(*current);
|
||||
}
|
||||
}
|
||||
|
||||
template <class AllocatorT>
|
||||
void Serializer<AllocatorT>::SerializeRootObject(Object* object) {
|
||||
if (object->IsSmi()) {
|
||||
PutSmi(Smi::cast(object));
|
||||
} else {
|
||||
SerializeObject(HeapObject::cast(object), kPlain, kStartOfObject, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,7 @@ class Serializer : public SerializerDeserializer {
|
||||
|
||||
void VisitRootPointers(Root root, const char* description, Object** start,
|
||||
Object** end) override;
|
||||
void SerializeRootObject(Object* object);
|
||||
|
||||
void PutRoot(int index, HeapObject* object, HowToCode how, WhereToPoint where,
|
||||
int skip);
|
||||
|
@ -132,24 +132,13 @@ void StartupSerializer::VisitRootPointers(Root root, const char* description,
|
||||
Object** start, Object** end) {
|
||||
if (start == isolate()->heap()->roots_array_start()) {
|
||||
// Serializing the root list needs special handling:
|
||||
// - The first pass over the root list only serializes immortal immovables.
|
||||
// - The second pass over the root list serializes the rest.
|
||||
// - Only root list elements that have been fully serialized can be
|
||||
// referenced via as root by using kRootArray bytecodes.
|
||||
int skip = 0;
|
||||
// referenced using kRootArray bytecodes.
|
||||
for (Object** current = start; current < end; current++) {
|
||||
SerializeRootObject(*current);
|
||||
int root_index = static_cast<int>(current - start);
|
||||
if ((*current)->IsSmi()) {
|
||||
FlushSkip(skip);
|
||||
PutSmi(Smi::cast(*current));
|
||||
} else {
|
||||
SerializeObject(HeapObject::cast(*current), kPlain, kStartOfObject,
|
||||
skip);
|
||||
}
|
||||
root_has_been_serialized_.set(root_index);
|
||||
skip = 0;
|
||||
}
|
||||
FlushSkip(skip);
|
||||
} else {
|
||||
Serializer::VisitRootPointers(root, description, start, end);
|
||||
}
|
||||
|
@ -18,10 +18,10 @@ class StartupSerializer : public Serializer<> {
|
||||
~StartupSerializer() override;
|
||||
|
||||
// Serialize the current state of the heap. The order is:
|
||||
// 1) Immortal immovable roots
|
||||
// 2) Remaining strong references.
|
||||
// 3) Partial snapshot cache.
|
||||
// 4) Weak references (e.g. the string table).
|
||||
// 1) Strong roots
|
||||
// 2) Builtins and bytecode handlers
|
||||
// 3) Partial snapshot cache
|
||||
// 4) Weak references (e.g. the string table)
|
||||
void SerializeStrongReferences();
|
||||
void SerializeWeakReferencesAndDeferred();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user