Chromium Code Reviews| Index: runtime/vm/raw_object_snapshot.cc |
| diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc |
| index 945787f6728d6fcbe90c6096a17be226e8cd3f57..abb28a859824098b3655cdafba1e17f5526a4652 100644 |
| --- a/runtime/vm/raw_object_snapshot.cc |
| +++ b/runtime/vm/raw_object_snapshot.cc |
| @@ -1132,6 +1132,108 @@ void RawFourByteString::WriteTo(SnapshotWriter* writer, |
| } |
| +RawExternalOneByteString* ExternalOneByteString::ReadFrom( |
| + SnapshotReader* reader, |
| + intptr_t object_id, |
| + bool classes_serialized) { |
| + UNREACHABLE(); |
| + return ExternalOneByteString::null(); |
| +} |
| + |
| + |
| +void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, |
|
Ivan Posva
2011/11/18 19:36:44
Maybe a comment stating that external strings are
cshapiro
2011/11/19 01:08:29
Certainly. Done.
|
| + intptr_t object_id, |
| + bool serialize_classes) { |
| + ASSERT(writer != NULL); |
| + intptr_t len = Smi::Value(ptr()->length_); |
| + |
| + // Write out the serialization header value for this object. |
| + writer->WriteObjectHeader(kInlined, object_id); |
| + |
| + // Write out the class information. |
| + writer->WriteObjectHeader(kObjectId, ObjectStore::kOneByteStringClass); |
| + |
| + // Write out the length field. |
| + writer->Write<RawObject*>(ptr()->length_); |
| + |
| + // Write out the hash field. |
| + writer->Write<RawObject*>(ptr()->hash_); |
| + |
| + // Write out the string. |
| + for (int i = 0; i < len; i++) { |
| + writer->Write<uint8_t>(ptr()->external_data_->data_[i]); |
| + } |
| +} |
| + |
| + |
| +RawExternalTwoByteString* ExternalTwoByteString::ReadFrom( |
| + SnapshotReader* reader, |
| + intptr_t object_id, |
| + bool classes_serialized) { |
| + UNREACHABLE(); |
| + return ExternalTwoByteString::null(); |
| +} |
| + |
| + |
| +void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, |
| + intptr_t object_id, |
| + bool serialize_classes) { |
| + ASSERT(writer != NULL); |
| + intptr_t len = Smi::Value(ptr()->length_); |
| + |
| + // Write out the serialization header value for this object. |
| + writer->WriteObjectHeader(kInlined, object_id); |
| + |
| + // Write out the class information. |
| + writer->WriteObjectHeader(kObjectId, ObjectStore::kTwoByteStringClass); |
| + |
| + // Write out the length field. |
| + writer->Write<RawObject*>(ptr()->length_); |
| + |
| + // Write out the hash field. |
| + writer->Write<RawObject*>(ptr()->hash_); |
| + |
| + // Write out the string. |
| + for (int i = 0; i < len; i++) { |
| + writer->Write<uint16_t>(ptr()->external_data_->data_[i]); |
| + } |
| +} |
| + |
| + |
| +RawExternalFourByteString* ExternalFourByteString::ReadFrom( |
| + SnapshotReader* reader, |
| + intptr_t object_id, |
| + bool classes_serialized) { |
| + UNREACHABLE(); |
| + return ExternalFourByteString::null(); |
| +} |
| + |
| + |
| +void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, |
| + intptr_t object_id, |
| + bool serialize_classes) { |
| + ASSERT(writer != NULL); |
| + intptr_t len = Smi::Value(ptr()->length_); |
| + |
| + // Write out the serialization header value for this object. |
| + writer->WriteObjectHeader(kInlined, object_id); |
| + |
| + // Write out the class information. |
| + writer->WriteObjectHeader(kObjectId, ObjectStore::kFourByteStringClass); |
| + |
| + // Write out the length field. |
| + writer->Write<RawObject*>(ptr()->length_); |
| + |
| + // Write out the hash field. |
| + writer->Write<RawObject*>(ptr()->hash_); |
| + |
| + // Write out the string. |
| + for (int i = 0; i < len; i++) { |
| + writer->Write<uint32_t>(ptr()->external_data_->data_[i]); |
| + } |
| +} |
| + |
| + |
| RawBool* Bool::ReadFrom(SnapshotReader* reader, |
| intptr_t object_id, |
| bool classes_serialized) { |