Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Unified Diff: src/snapshot/serialize.cc

Issue 1072923003: Serializer: canonicalize cleared weak cells. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/snapshot/serialize.cc
diff --git a/src/snapshot/serialize.cc b/src/snapshot/serialize.cc
index b7c7dc1dd1c012264705860fd832e087910fc67e..713f245f668fb507e8ae5788c5ecfabe31619084 100644
--- a/src/snapshot/serialize.cc
+++ b/src/snapshot/serialize.cc
@@ -1092,6 +1092,12 @@ void Deserializer::ReadData(Object** current, Object** limit, int source_space,
break;
}
+ case kClearedWeakCell: {
+ Object* cleared_weak_cell = isolate_->heap()->cleared_weak_cell();
+ UnalignedCopy(current++, &cleared_weak_cell);
+ break;
+ }
+
case kSynchronize:
// If we get here then that indicates that you have a mismatch between
// the number of GC roots when serializing and deserializing.
@@ -1462,6 +1468,11 @@ bool Serializer::BackReferenceIsAlreadyAllocated(BackReference reference) {
bool Serializer::SerializeKnownObject(HeapObject* obj, HowToCode how_to_code,
WhereToPoint where_to_point, int skip) {
+ if (obj->IsWeakCell() && WeakCell::cast(obj)->cleared()) {
+ FlushSkip(skip);
+ sink_->Put(kClearedWeakCell, "ClearedWeakCell");
+ return true;
+ }
if (how_to_code == kPlain && where_to_point == kStartOfObject) {
// Encode a reference to a hot object by its index in the working set.
int index = hot_objects_.Find(obj);
« no previous file with comments | « src/snapshot/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698