Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/bigint_operations.h" | 5 #include "vm/bigint_operations.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
| 9 #include "vm/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1125 // Write out the hash field. | 1125 // Write out the hash field. |
| 1126 writer->Write<RawObject*>(ptr()->hash_); | 1126 writer->Write<RawObject*>(ptr()->hash_); |
| 1127 | 1127 |
| 1128 // Write out the string. | 1128 // Write out the string. |
| 1129 for (intptr_t i = 0; i < len; i++) { | 1129 for (intptr_t i = 0; i < len; i++) { |
| 1130 writer->Write<uint32_t>(ptr()->data_[i]); | 1130 writer->Write<uint32_t>(ptr()->data_[i]); |
| 1131 } | 1131 } |
| 1132 } | 1132 } |
| 1133 | 1133 |
| 1134 | 1134 |
| 1135 RawExternalOneByteString* ExternalOneByteString::ReadFrom( | |
| 1136 SnapshotReader* reader, | |
| 1137 intptr_t object_id, | |
| 1138 bool classes_serialized) { | |
| 1139 UNREACHABLE(); | |
| 1140 return ExternalOneByteString::null(); | |
| 1141 } | |
| 1142 | |
| 1143 | |
| 1144 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.
| |
| 1145 intptr_t object_id, | |
| 1146 bool serialize_classes) { | |
| 1147 ASSERT(writer != NULL); | |
| 1148 intptr_t len = Smi::Value(ptr()->length_); | |
| 1149 | |
| 1150 // Write out the serialization header value for this object. | |
| 1151 writer->WriteObjectHeader(kInlined, object_id); | |
| 1152 | |
| 1153 // Write out the class information. | |
| 1154 writer->WriteObjectHeader(kObjectId, ObjectStore::kOneByteStringClass); | |
| 1155 | |
| 1156 // Write out the length field. | |
| 1157 writer->Write<RawObject*>(ptr()->length_); | |
| 1158 | |
| 1159 // Write out the hash field. | |
| 1160 writer->Write<RawObject*>(ptr()->hash_); | |
| 1161 | |
| 1162 // Write out the string. | |
| 1163 for (int i = 0; i < len; i++) { | |
| 1164 writer->Write<uint8_t>(ptr()->external_data_->data_[i]); | |
| 1165 } | |
| 1166 } | |
| 1167 | |
| 1168 | |
| 1169 RawExternalTwoByteString* ExternalTwoByteString::ReadFrom( | |
| 1170 SnapshotReader* reader, | |
| 1171 intptr_t object_id, | |
| 1172 bool classes_serialized) { | |
| 1173 UNREACHABLE(); | |
| 1174 return ExternalTwoByteString::null(); | |
| 1175 } | |
| 1176 | |
| 1177 | |
| 1178 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, | |
| 1179 intptr_t object_id, | |
| 1180 bool serialize_classes) { | |
| 1181 ASSERT(writer != NULL); | |
| 1182 intptr_t len = Smi::Value(ptr()->length_); | |
| 1183 | |
| 1184 // Write out the serialization header value for this object. | |
| 1185 writer->WriteObjectHeader(kInlined, object_id); | |
| 1186 | |
| 1187 // Write out the class information. | |
| 1188 writer->WriteObjectHeader(kObjectId, ObjectStore::kTwoByteStringClass); | |
| 1189 | |
| 1190 // Write out the length field. | |
| 1191 writer->Write<RawObject*>(ptr()->length_); | |
| 1192 | |
| 1193 // Write out the hash field. | |
| 1194 writer->Write<RawObject*>(ptr()->hash_); | |
| 1195 | |
| 1196 // Write out the string. | |
| 1197 for (int i = 0; i < len; i++) { | |
| 1198 writer->Write<uint16_t>(ptr()->external_data_->data_[i]); | |
| 1199 } | |
| 1200 } | |
| 1201 | |
| 1202 | |
| 1203 RawExternalFourByteString* ExternalFourByteString::ReadFrom( | |
| 1204 SnapshotReader* reader, | |
| 1205 intptr_t object_id, | |
| 1206 bool classes_serialized) { | |
| 1207 UNREACHABLE(); | |
| 1208 return ExternalFourByteString::null(); | |
| 1209 } | |
| 1210 | |
| 1211 | |
| 1212 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, | |
| 1213 intptr_t object_id, | |
| 1214 bool serialize_classes) { | |
| 1215 ASSERT(writer != NULL); | |
| 1216 intptr_t len = Smi::Value(ptr()->length_); | |
| 1217 | |
| 1218 // Write out the serialization header value for this object. | |
| 1219 writer->WriteObjectHeader(kInlined, object_id); | |
| 1220 | |
| 1221 // Write out the class information. | |
| 1222 writer->WriteObjectHeader(kObjectId, ObjectStore::kFourByteStringClass); | |
| 1223 | |
| 1224 // Write out the length field. | |
| 1225 writer->Write<RawObject*>(ptr()->length_); | |
| 1226 | |
| 1227 // Write out the hash field. | |
| 1228 writer->Write<RawObject*>(ptr()->hash_); | |
| 1229 | |
| 1230 // Write out the string. | |
| 1231 for (int i = 0; i < len; i++) { | |
| 1232 writer->Write<uint32_t>(ptr()->external_data_->data_[i]); | |
| 1233 } | |
| 1234 } | |
| 1235 | |
| 1236 | |
| 1135 RawBool* Bool::ReadFrom(SnapshotReader* reader, | 1237 RawBool* Bool::ReadFrom(SnapshotReader* reader, |
| 1136 intptr_t object_id, | 1238 intptr_t object_id, |
| 1137 bool classes_serialized) { | 1239 bool classes_serialized) { |
| 1138 UNREACHABLE(); | 1240 UNREACHABLE(); |
| 1139 return Bool::null(); | 1241 return Bool::null(); |
| 1140 } | 1242 } |
| 1141 | 1243 |
| 1142 | 1244 |
| 1143 void RawBool::WriteTo(SnapshotWriter* writer, | 1245 void RawBool::WriteTo(SnapshotWriter* writer, |
| 1144 intptr_t object_id, | 1246 intptr_t object_id, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1320 // Write out all the other fields. | 1422 // Write out all the other fields. |
| 1321 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1423 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1322 writer->WriteObject(ptr()->pattern_); | 1424 writer->WriteObject(ptr()->pattern_); |
| 1323 writer->Write<intptr_t>(ptr()->type_); | 1425 writer->Write<intptr_t>(ptr()->type_); |
| 1324 writer->Write<intptr_t>(ptr()->flags_); | 1426 writer->Write<intptr_t>(ptr()->flags_); |
| 1325 | 1427 |
| 1326 // Do not write out the data part which is native. | 1428 // Do not write out the data part which is native. |
| 1327 } | 1429 } |
| 1328 | 1430 |
| 1329 } // namespace dart | 1431 } // namespace dart |
| OLD | NEW |