Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 8383029: Implement external strings. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fully displace external string metadata Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« runtime/vm/raw_object.h ('K') | « runtime/vm/raw_object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« runtime/vm/raw_object.h ('K') | « runtime/vm/raw_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698