Chromium Code Reviews| Index: vm/raw_object_snapshot.cc |
| =================================================================== |
| --- vm/raw_object_snapshot.cc (revision 4983) |
| +++ vm/raw_object_snapshot.cc (working copy) |
| @@ -1710,6 +1710,48 @@ |
| } |
| +RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, |
| + intptr_t object_id, |
| + intptr_t tags, |
| + Snapshot::Kind kind) { |
| + ASSERT(reader != NULL); |
| + |
| + // Read the length so that we can determine instance size to allocate. |
|
cshapiro
2012/03/06 00:56:31
Maybe use the common array reader. See my comment
siva
2012/03/06 23:32:33
See my comment below.
On 2012/03/06 00:56:31, csh
|
| + intptr_t capacity = reader->ReadIntptrValue(); |
| + intptr_t length = reader->ReadIntptrValue(); |
| + GrowableObjectArray& array = GrowableObjectArray::ZoneHandle( |
| + reader->isolate(), reader->NewGrowableObjectArray()); |
| + reader->AddBackwardReference(object_id, &array); |
| + array.set_capacity(capacity); |
| + array.set_length(length); |
| + Array& contents = Array::Handle(); |
| + contents ^= reader->ReadObject(); |
| + array.set_data(contents); |
| + return array.raw(); |
| +} |
| + |
| + |
| +void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, |
| + intptr_t object_id, |
| + Snapshot::Kind kind) { |
| + ASSERT(writer != NULL); |
| + |
| + // Write out the serialization header value for this object. |
| + writer->WriteSerializationMarker(kInlined, object_id); |
| + |
| + // Write out the class and tags information. |
| + writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass, |
| + ptr()->tags_); |
| + |
| + // Write out the capacity and length fields. |
| + writer->WriteIntptrValue(ptr()->capacity_); |
|
cshapiro
2012/03/06 00:56:31
Hmm... if you get rid of the capacity member you c
siva
2012/03/06 23:32:33
I got rid of the capacity_ field.
I prefer to wri
|
| + writer->WriteIntptrValue(ptr()->length_); |
| + |
| + // Write out the Array object. |
| + writer->WriteObject(ptr()->data_); |
| +} |
| + |
| + |
| RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader, |
| intptr_t object_id, |
| intptr_t tags, |