Commit 98de0a63 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[serializer][ptr-compr] Add byte code for cleared weak reference

in order to be able to properly deserialize the latter in case of enabled
pointer compression where the cleared weak reference value is Isolate-dependent.

Bug: v8:7703
Change-Id: Ied995bc15317c83fcc03cf27de3fbf135659a9d5
Reviewed-on: https://chromium-review.googlesource.com/c/1333676
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57510}
parent 18de765e
...@@ -649,6 +649,11 @@ bool Deserializer::ReadData(UnalignedSlot current, UnalignedSlot limit, ...@@ -649,6 +649,11 @@ bool Deserializer::ReadData(UnalignedSlot current, UnalignedSlot limit,
break; break;
} }
case kClearedWeakReference:
UnalignedCopy(current, HeapObjectReference::ClearedValue(isolate_));
current.Advance();
break;
case kWeakPrefix: case kWeakPrefix:
DCHECK(!allocator()->next_reference_is_weak()); DCHECK(!allocator()->next_reference_is_weak());
allocator()->set_next_reference_is_weak(true); allocator()->set_next_reference_is_weak(true);
......
...@@ -142,8 +142,7 @@ class SerializerDeserializer : public RootVisitor { ...@@ -142,8 +142,7 @@ class SerializerDeserializer : public RootVisitor {
V(0x79) \ V(0x79) \
V(0x7a) \ V(0x7a) \
V(0x7b) \ V(0x7b) \
V(0x7c) \ V(0x7c)
V(0x7d)
// ---------- byte code range 0x00..0x7f ---------- // ---------- byte code range 0x00..0x7f ----------
// Byte codes in this range represent Where, HowToCode and WhereToPoint. // Byte codes in this range represent Where, HowToCode and WhereToPoint.
...@@ -236,6 +235,7 @@ class SerializerDeserializer : public RootVisitor { ...@@ -236,6 +235,7 @@ class SerializerDeserializer : public RootVisitor {
static const int kApiReference = 0x3d; static const int kApiReference = 0x3d;
// In-place weak references // In-place weak references
static const int kClearedWeakReference = 0x7d;
static const int kWeakPrefix = 0x7e; static const int kWeakPrefix = 0x7e;
// Encodes an off-heap instruction stream target. // Encodes an off-heap instruction stream target.
......
...@@ -669,12 +669,19 @@ void Serializer::ObjectSerializer::VisitPointers(HeapObject* host, ...@@ -669,12 +669,19 @@ void Serializer::ObjectSerializer::VisitPointers(HeapObject* host,
MaybeObjectSlot end) { MaybeObjectSlot end) {
MaybeObjectSlot current = start; MaybeObjectSlot current = start;
while (current < end) { while (current < end) {
while (current < end && ((*current)->IsSmi() || (*current)->IsCleared())) { while (current < end && (*current)->IsSmi()) {
++current; ++current;
} }
if (current < end) { if (current < end) {
OutputRawData(current.address()); OutputRawData(current.address());
} }
// TODO(ishell): Revisit this change once we stick to 32-bit compressed
// tagged values.
while (current < end && (*current)->IsCleared()) {
sink_->Put(kClearedWeakReference, "ClearedWeakReference");
bytes_processed_so_far_ += kPointerSize;
++current;
}
HeapObject* current_contents; HeapObject* current_contents;
HeapObjectReferenceType reference_type; HeapObjectReferenceType reference_type;
while (current < end && while (current < end &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment