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

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: Finish native peer support Created 9 years, 2 months 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/include/dart_api.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 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(
+ 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) {
« runtime/include/dart_api.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