Commit f196a953 authored by vchigrin's avatar vchigrin Committed by Commit bot

Fix crash in V8 during serializing objects requiring alignment.

Review URL: https://codereview.chromium.org/793753002

Cr-Commit-Position: refs/heads/master@{#25764}
parent 9aab9f13
...@@ -1657,14 +1657,17 @@ void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space, ...@@ -1657,14 +1657,17 @@ void Serializer::ObjectSerializer::SerializePrologue(AllocationSpace space,
} }
back_reference = serializer_->AllocateLargeObject(size); back_reference = serializer_->AllocateLargeObject(size);
} else { } else {
bool needs_double_align = false;
if (object_->NeedsToEnsureDoubleAlignment()) { if (object_->NeedsToEnsureDoubleAlignment()) {
// Add wriggle room for double alignment padding. // Add wriggle room for double alignment padding.
back_reference = serializer_->Allocate(space, size + kPointerSize); back_reference = serializer_->Allocate(space, size + kPointerSize);
sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel"); needs_double_align = true;
} else { } else {
back_reference = serializer_->Allocate(space, size); back_reference = serializer_->Allocate(space, size);
} }
sink_->Put(kNewObject + reference_representation_ + space, "NewObject"); sink_->Put(kNewObject + reference_representation_ + space, "NewObject");
if (needs_double_align)
sink_->PutInt(kDoubleAlignmentSentinel, "DoubleAlignSentinel");
int encoded_size = size >> kObjectAlignmentBits; int encoded_size = size >> kObjectAlignmentBits;
DCHECK_NE(kDoubleAlignmentSentinel, encoded_size); DCHECK_NE(kDoubleAlignmentSentinel, encoded_size);
sink_->PutInt(encoded_size, "ObjectSizeInWords"); sink_->PutInt(encoded_size, "ObjectSizeInWords");
......
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