Commit ee9020dd authored by yangguo's avatar yangguo Committed by Commit bot

Serializer: attach alignment to deferred objects.

R=jkummerow@chromium.org
BUG=chromium:523919
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#31956}
parent bae4492a
...@@ -636,18 +636,27 @@ void Deserializer::VisitPointers(Object** start, Object** end) { ...@@ -636,18 +636,27 @@ void Deserializer::VisitPointers(Object** start, Object** end) {
void Deserializer::DeserializeDeferredObjects() { void Deserializer::DeserializeDeferredObjects() {
for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) { for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) {
int space = code & kSpaceMask; switch (code) {
DCHECK(space <= kNumberOfSpaces); case kAlignmentPrefix:
DCHECK(code - space == kNewObject); case kAlignmentPrefix + 1:
HeapObject* object = GetBackReferencedObject(space); case kAlignmentPrefix + 2:
int size = source_.GetInt() << kPointerSizeLog2; SetAlignment(code);
Address obj_address = object->address(); break;
Object** start = reinterpret_cast<Object**>(obj_address + kPointerSize); default: {
Object** end = reinterpret_cast<Object**>(obj_address + size); int space = code & kSpaceMask;
bool filled = ReadData(start, end, space, obj_address); DCHECK(space <= kNumberOfSpaces);
CHECK(filled); DCHECK(code - space == kNewObject);
DCHECK(CanBeDeferred(object)); HeapObject* object = GetBackReferencedObject(space);
PostProcessNewObject(object, space); int size = source_.GetInt() << kPointerSizeLog2;
Address obj_address = object->address();
Object** start = reinterpret_cast<Object**>(obj_address + kPointerSize);
Object** end = reinterpret_cast<Object**>(obj_address + size);
bool filled = ReadData(start, end, space, obj_address);
CHECK(filled);
DCHECK(CanBeDeferred(object));
PostProcessNewObject(object, space);
}
}
} }
} }
...@@ -1188,12 +1197,9 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space, ...@@ -1188,12 +1197,9 @@ bool Deserializer::ReadData(Object** current, Object** limit, int source_space,
case kAlignmentPrefix: case kAlignmentPrefix:
case kAlignmentPrefix + 1: case kAlignmentPrefix + 1:
case kAlignmentPrefix + 2: { case kAlignmentPrefix + 2:
DCHECK_EQ(kWordAligned, next_alignment_); SetAlignment(data);
next_alignment_ =
static_cast<AllocationAlignment>(data - (kAlignmentPrefix - 1));
break; break;
}
STATIC_ASSERT(kNumberOfRootArrayConstants == Heap::kOldSpaceRoots); STATIC_ASSERT(kNumberOfRootArrayConstants == Heap::kOldSpaceRoots);
STATIC_ASSERT(kNumberOfRootArrayConstants == 32); STATIC_ASSERT(kNumberOfRootArrayConstants == 32);
...@@ -2057,6 +2063,7 @@ void Serializer::ObjectSerializer::SerializeDeferred() { ...@@ -2057,6 +2063,7 @@ void Serializer::ObjectSerializer::SerializeDeferred() {
CHECK_EQ(0, bytes_processed_so_far_); CHECK_EQ(0, bytes_processed_so_far_);
bytes_processed_so_far_ = kPointerSize; bytes_processed_so_far_ = kPointerSize;
serializer_->PutAlignmentPrefix(object_);
sink_->Put(kNewObject + reference.space(), "deferred object"); sink_->Put(kNewObject + reference.space(), "deferred object");
serializer_->PutBackReference(object_, reference); serializer_->PutBackReference(object_, reference);
sink_->PutInt(size >> kPointerSizeLog2, "deferred object size"); sink_->PutInt(size >> kPointerSizeLog2, "deferred object size");
......
...@@ -403,6 +403,14 @@ class Deserializer: public SerializerDeserializer { ...@@ -403,6 +403,14 @@ class Deserializer: public SerializerDeserializer {
memcpy(dest, src, sizeof(*src)); memcpy(dest, src, sizeof(*src));
} }
void SetAlignment(byte data) {
DCHECK_EQ(kWordAligned, next_alignment_);
int alignment = data - (kAlignmentPrefix - 1);
DCHECK_LE(kWordAligned, alignment);
DCHECK_LE(alignment, kSimd128Unaligned);
next_alignment_ = static_cast<AllocationAlignment>(alignment);
}
void DeserializeDeferredObjects(); void DeserializeDeferredObjects();
void FlushICacheForNewIsolate(); void FlushICacheForNewIsolate();
......
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --cache=code
[1.5,
[2.5,
[3.5,
[4.5,
[5.5,
[6.5,
[7.5,
[8.5,
[9.5,
[10.5,
[11.5,
[12.5,
[13.5,
[14.5,
[15.5,
[16.5,
[17.5,
[18.5,
[19.5,
[20.5,
[21.5,
[22.5,
[23.5,
[24.5,
[25.5]]]]]]]]]]]]]]]]]]]]]]]]];
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