| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 // Set all non object fields. | 135 // Set all non object fields. |
| 136 unresolved_class.set_token_pos(reader->ReadIntptrValue()); | 136 unresolved_class.set_token_pos(reader->ReadIntptrValue()); |
| 137 | 137 |
| 138 // Set all the object fields. | 138 // Set all the object fields. |
| 139 // TODO(5411462): Need to assert No GC can happen here, even though | 139 // TODO(5411462): Need to assert No GC can happen here, even though |
| 140 // allocations may happen. | 140 // allocations may happen. |
| 141 intptr_t num_flds = (unresolved_class.raw()->to() - | 141 intptr_t num_flds = (unresolved_class.raw()->to() - |
| 142 unresolved_class.raw()->from()); | 142 unresolved_class.raw()->from()); |
| 143 for (intptr_t i = 0; i <= num_flds; i++) { | 143 for (intptr_t i = 0; i <= num_flds; i++) { |
| 144 *(unresolved_class.raw()->from() + i) = reader->ReadObjectRef(); | 144 unresolved_class.StorePointer((unresolved_class.raw()->from() + i), |
| 145 reader->ReadObjectRef()); |
| 145 } | 146 } |
| 146 return unresolved_class.raw(); | 147 return unresolved_class.raw(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 | 150 |
| 150 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, | 151 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, |
| 151 intptr_t object_id, | 152 intptr_t object_id, |
| 152 Snapshot::Kind kind) { | 153 Snapshot::Kind kind) { |
| 153 ASSERT(writer != NULL); | 154 ASSERT(writer != NULL); |
| 154 | 155 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 200 |
| 200 // Set all non object fields. | 201 // Set all non object fields. |
| 201 type.set_token_pos(reader->ReadIntptrValue()); | 202 type.set_token_pos(reader->ReadIntptrValue()); |
| 202 type.set_type_state(reader->Read<int8_t>()); | 203 type.set_type_state(reader->Read<int8_t>()); |
| 203 | 204 |
| 204 // Set all the object fields. | 205 // Set all the object fields. |
| 205 // TODO(5411462): Need to assert No GC can happen here, even though | 206 // TODO(5411462): Need to assert No GC can happen here, even though |
| 206 // allocations may happen. | 207 // allocations may happen. |
| 207 intptr_t num_flds = (type.raw()->to() - type.raw()->from()); | 208 intptr_t num_flds = (type.raw()->to() - type.raw()->from()); |
| 208 for (intptr_t i = 0; i <= num_flds; i++) { | 209 for (intptr_t i = 0; i <= num_flds; i++) { |
| 209 *(type.raw()->from() + i) = reader->ReadObjectRef(); | 210 type.StorePointer((type.raw()->from() + i), reader->ReadObjectRef()); |
| 210 } | 211 } |
| 211 | 212 |
| 212 // If object needs to be a canonical object, Canonicalize it. | 213 // If object needs to be a canonical object, Canonicalize it. |
| 213 if ((kind != Snapshot::kFull) && type.IsCanonical()) { | 214 if ((kind != Snapshot::kFull) && type.IsCanonical()) { |
| 214 type ^= type.Canonicalize(); | 215 type ^= type.Canonicalize(); |
| 215 } | 216 } |
| 216 return type.raw(); | 217 return type.raw(); |
| 217 } | 218 } |
| 218 | 219 |
| 219 | 220 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 type_parameter.set_index(reader->ReadIntptrValue()); | 258 type_parameter.set_index(reader->ReadIntptrValue()); |
| 258 type_parameter.set_token_pos(reader->ReadIntptrValue()); | 259 type_parameter.set_token_pos(reader->ReadIntptrValue()); |
| 259 type_parameter.set_type_state(reader->Read<int8_t>()); | 260 type_parameter.set_type_state(reader->Read<int8_t>()); |
| 260 | 261 |
| 261 // Set all the object fields. | 262 // Set all the object fields. |
| 262 // TODO(5411462): Need to assert No GC can happen here, even though | 263 // TODO(5411462): Need to assert No GC can happen here, even though |
| 263 // allocations may happen. | 264 // allocations may happen. |
| 264 intptr_t num_flds = (type_parameter.raw()->to() - | 265 intptr_t num_flds = (type_parameter.raw()->to() - |
| 265 type_parameter.raw()->from()); | 266 type_parameter.raw()->from()); |
| 266 for (intptr_t i = 0; i <= num_flds; i++) { | 267 for (intptr_t i = 0; i <= num_flds; i++) { |
| 267 *(type_parameter.raw()->from() + i) = reader->ReadObjectRef(); | 268 type_parameter.StorePointer((type_parameter.raw()->from() + i), |
| 269 reader->ReadObjectRef()); |
| 268 } | 270 } |
| 269 | 271 |
| 270 return type_parameter.raw(); | 272 return type_parameter.raw(); |
| 271 } | 273 } |
| 272 | 274 |
| 273 | 275 |
| 274 void RawTypeParameter::WriteTo(SnapshotWriter* writer, | 276 void RawTypeParameter::WriteTo(SnapshotWriter* writer, |
| 275 intptr_t object_id, | 277 intptr_t object_id, |
| 276 Snapshot::Kind kind) { | 278 Snapshot::Kind kind) { |
| 277 ASSERT(writer != NULL); | 279 ASSERT(writer != NULL); |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 context.set_tags(tags); | 1028 context.set_tags(tags); |
| 1027 | 1029 |
| 1028 // Set the isolate implicitly. | 1030 // Set the isolate implicitly. |
| 1029 context.set_isolate(Isolate::Current()); | 1031 context.set_isolate(Isolate::Current()); |
| 1030 | 1032 |
| 1031 // Set all the object fields. | 1033 // Set all the object fields. |
| 1032 // TODO(5411462): Need to assert No GC can happen here, even though | 1034 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1033 // allocations may happen. | 1035 // allocations may happen. |
| 1034 intptr_t num_flds = (context.raw()->to(num_vars) - context.raw()->from()); | 1036 intptr_t num_flds = (context.raw()->to(num_vars) - context.raw()->from()); |
| 1035 for (intptr_t i = 0; i <= num_flds; i++) { | 1037 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1036 *(context.raw()->from() + i) = reader->ReadObjectRef(); | 1038 context.StorePointer((context.raw()->from() + i), reader->ReadObjectRef()); |
| 1037 } | 1039 } |
| 1038 | 1040 |
| 1039 return context.raw(); | 1041 return context.raw(); |
| 1040 } | 1042 } |
| 1041 | 1043 |
| 1042 | 1044 |
| 1043 void RawContext::WriteTo(SnapshotWriter* writer, | 1045 void RawContext::WriteTo(SnapshotWriter* writer, |
| 1044 intptr_t object_id, | 1046 intptr_t object_id, |
| 1045 Snapshot::Kind kind) { | 1047 Snapshot::Kind kind) { |
| 1046 ASSERT(writer != NULL); | 1048 ASSERT(writer != NULL); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 reader->AddBackRef(object_id, &api_error, kIsDeserialized); | 1175 reader->AddBackRef(object_id, &api_error, kIsDeserialized); |
| 1174 | 1176 |
| 1175 // Set the object tags. | 1177 // Set the object tags. |
| 1176 api_error.set_tags(tags); | 1178 api_error.set_tags(tags); |
| 1177 | 1179 |
| 1178 // Set all the object fields. | 1180 // Set all the object fields. |
| 1179 // TODO(5411462): Need to assert No GC can happen here, even though | 1181 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1180 // allocations may happen. | 1182 // allocations may happen. |
| 1181 intptr_t num_flds = (api_error.raw()->to() - api_error.raw()->from()); | 1183 intptr_t num_flds = (api_error.raw()->to() - api_error.raw()->from()); |
| 1182 for (intptr_t i = 0; i <= num_flds; i++) { | 1184 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1183 *(api_error.raw()->from() + i) = reader->ReadObjectRef(); | 1185 api_error.StorePointer((api_error.raw()->from() + i), |
| 1186 reader->ReadObjectRef()); |
| 1184 } | 1187 } |
| 1185 | 1188 |
| 1186 return api_error.raw(); | 1189 return api_error.raw(); |
| 1187 } | 1190 } |
| 1188 | 1191 |
| 1189 | 1192 |
| 1190 void RawApiError::WriteTo(SnapshotWriter* writer, | 1193 void RawApiError::WriteTo(SnapshotWriter* writer, |
| 1191 intptr_t object_id, | 1194 intptr_t object_id, |
| 1192 Snapshot::Kind kind) { | 1195 Snapshot::Kind kind) { |
| 1193 ASSERT(writer != NULL); | 1196 ASSERT(writer != NULL); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1218 | 1221 |
| 1219 // Set the object tags. | 1222 // Set the object tags. |
| 1220 language_error.set_tags(tags); | 1223 language_error.set_tags(tags); |
| 1221 | 1224 |
| 1222 // Set all the object fields. | 1225 // Set all the object fields. |
| 1223 // TODO(5411462): Need to assert No GC can happen here, even though | 1226 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1224 // allocations may happen. | 1227 // allocations may happen. |
| 1225 intptr_t num_flds = | 1228 intptr_t num_flds = |
| 1226 (language_error.raw()->to() - language_error.raw()->from()); | 1229 (language_error.raw()->to() - language_error.raw()->from()); |
| 1227 for (intptr_t i = 0; i <= num_flds; i++) { | 1230 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1228 *(language_error.raw()->from() + i) = reader->ReadObjectRef(); | 1231 language_error.StorePointer((language_error.raw()->from() + i), |
| 1232 reader->ReadObjectRef()); |
| 1229 } | 1233 } |
| 1230 | 1234 |
| 1231 return language_error.raw(); | 1235 return language_error.raw(); |
| 1232 } | 1236 } |
| 1233 | 1237 |
| 1234 | 1238 |
| 1235 void RawLanguageError::WriteTo(SnapshotWriter* writer, | 1239 void RawLanguageError::WriteTo(SnapshotWriter* writer, |
| 1236 intptr_t object_id, | 1240 intptr_t object_id, |
| 1237 Snapshot::Kind kind) { | 1241 Snapshot::Kind kind) { |
| 1238 ASSERT(writer != NULL); | 1242 ASSERT(writer != NULL); |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2174 // Write out the class and tags information. | 2178 // Write out the class and tags information. |
| 2175 writer->WriteIndexedObject(kWeakPropertyCid); | 2179 writer->WriteIndexedObject(kWeakPropertyCid); |
| 2176 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2180 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2177 | 2181 |
| 2178 // Write out all the other fields. | 2182 // Write out all the other fields. |
| 2179 writer->Write<RawObject*>(ptr()->key_); | 2183 writer->Write<RawObject*>(ptr()->key_); |
| 2180 writer->Write<RawObject*>(ptr()->value_); | 2184 writer->Write<RawObject*>(ptr()->value_); |
| 2181 } | 2185 } |
| 2182 | 2186 |
| 2183 } // namespace dart | 2187 } // namespace dart |
| OLD | NEW |