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 9a1be618eab884ab160b2025a087f5029beea9a7..bc7f122f2b33a28edeb4bd1c348927cb4e17f143 100644 |
| --- a/runtime/vm/raw_object_snapshot.cc |
| +++ b/runtime/vm/raw_object_snapshot.cc |
| @@ -1134,6 +1134,108 @@ void RawFourByteString::WriteTo(SnapshotWriter* writer, |
| } |
| +RawExternalOneByteString* ExternalOneByteString::ReadFrom( |
|
Anton Muhin
2011/10/25 10:19:02
should we allow to serialize externalized strings?
cshapiro
2011/10/25 20:42:47
No, we should not. What this code does is seriali
|
| + SnapshotReader* reader, |
| + intptr_t object_id, |
| + bool classes_serialized) { |
| + UNREACHABLE(); |
| + return ExternalOneByteString::null(); |
| +} |
| + |
| + |
| +void RawExternalOneByteString::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::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()->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()->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()->data_[i]); |
| + } |
| +} |
| + |
| + |
| RawBool* Bool::ReadFrom(SnapshotReader* reader, |
| intptr_t object_id, |
| bool classes_serialized) { |