Use easier method to determine allocation space when serializing.

R=hpayer@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#26851}
This commit is contained in:
yangguo 2015-02-25 06:05:39 -08:00 committed by Commit bot
parent f9fd33c10f
commit 30a6e46a39
2 changed files with 3 additions and 15 deletions

View File

@ -1888,7 +1888,9 @@ void Serializer::ObjectSerializer::Serialize() {
int size = object_->Size();
Map* map = object_->map();
SerializePrologue(Serializer::SpaceOfObject(object_), size, map);
AllocationSpace space =
MemoryChunk::FromAddress(object_->address())->owner()->identity();
SerializePrologue(space, size, map);
// Serialize the rest of the object.
CHECK_EQ(0, bytes_processed_so_far_);
@ -2128,19 +2130,6 @@ int Serializer::ObjectSerializer::OutputRawData(
}
AllocationSpace Serializer::SpaceOfObject(HeapObject* object) {
for (int i = FIRST_SPACE; i <= LAST_SPACE; i++) {
AllocationSpace s = static_cast<AllocationSpace>(i);
if (object->GetHeap()->InSpace(object, s)) {
DCHECK(i < kNumberOfSpaces);
return s;
}
}
UNREACHABLE();
return FIRST_SPACE;
}
BackReference Serializer::AllocateLargeObject(int size) {
// Large objects are allocated one-by-one when deserializing. We do not
// have to keep track of multiple chunks.

View File

@ -732,7 +732,6 @@ class Serializer : public SerializerDeserializer {
bool BackReferenceIsAlreadyAllocated(BackReference back_reference);
// This will return the space for an object.
static AllocationSpace SpaceOfObject(HeapObject* object);
BackReference AllocateLargeObject(int size);
BackReference Allocate(AllocationSpace space, int size);
int EncodeExternalReference(Address addr) {