| 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/native_entry.h" | 5 #include "vm/native_entry.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/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 kAsReference); | 68 kAsReference); |
| 69 cls.StorePointer(&cls.raw_ptr()->dependent_code_, Array::null()); | 69 cls.StorePointer(&cls.raw_ptr()->dependent_code_, Array::null()); |
| 70 ASSERT(!cls.IsInFullSnapshot()); | 70 ASSERT(!cls.IsInFullSnapshot()); |
| 71 } else { | 71 } else { |
| 72 cls ^= reader->ReadClassId(object_id); | 72 cls ^= reader->ReadClassId(object_id); |
| 73 ASSERT((kind == Snapshot::kMessage) || cls.IsInFullSnapshot()); | 73 ASSERT((kind == Snapshot::kMessage) || cls.IsInFullSnapshot()); |
| 74 } | 74 } |
| 75 return cls.raw(); | 75 return cls.raw(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 | |
| 79 void RawClass::WriteTo(SnapshotWriter* writer, | 78 void RawClass::WriteTo(SnapshotWriter* writer, |
| 80 intptr_t object_id, | 79 intptr_t object_id, |
| 81 Snapshot::Kind kind, | 80 Snapshot::Kind kind, |
| 82 bool as_reference) { | 81 bool as_reference) { |
| 83 ASSERT(writer != NULL); | 82 ASSERT(writer != NULL); |
| 84 bool is_in_fullsnapshot = Class::IsInFullSnapshot(this); | 83 bool is_in_fullsnapshot = Class::IsInFullSnapshot(this); |
| 85 | 84 |
| 86 // Write out the serialization header value for this object. | 85 // Write out the serialization header value for this object. |
| 87 writer->WriteInlinedObjectHeader(object_id); | 86 writer->WriteInlinedObjectHeader(object_id); |
| 88 | 87 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 writer->WriteClassId(this); | 123 writer->WriteClassId(this); |
| 125 } else { | 124 } else { |
| 126 // We do not allow regular dart instances in isolate messages. | 125 // We do not allow regular dart instances in isolate messages. |
| 127 writer->SetWriteException(Exceptions::kArgument, | 126 writer->SetWriteException(Exceptions::kArgument, |
| 128 "Illegal argument in isolate message" | 127 "Illegal argument in isolate message" |
| 129 " : (object is a regular Dart Instance)"); | 128 " : (object is a regular Dart Instance)"); |
| 130 } | 129 } |
| 131 } | 130 } |
| 132 } | 131 } |
| 133 | 132 |
| 134 | |
| 135 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, | 133 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader, |
| 136 intptr_t object_id, | 134 intptr_t object_id, |
| 137 intptr_t tags, | 135 intptr_t tags, |
| 138 Snapshot::Kind kind, | 136 Snapshot::Kind kind, |
| 139 bool as_reference) { | 137 bool as_reference) { |
| 140 ASSERT(reader != NULL); | 138 ASSERT(reader != NULL); |
| 141 | 139 |
| 142 // Allocate unresolved class object. | 140 // Allocate unresolved class object. |
| 143 UnresolvedClass& unresolved_class = | 141 UnresolvedClass& unresolved_class = |
| 144 UnresolvedClass::ZoneHandle(reader->zone(), UnresolvedClass::New()); | 142 UnresolvedClass::ZoneHandle(reader->zone(), UnresolvedClass::New()); |
| 145 reader->AddBackRef(object_id, &unresolved_class, kIsDeserialized); | 143 reader->AddBackRef(object_id, &unresolved_class, kIsDeserialized); |
| 146 | 144 |
| 147 // Set all non object fields. | 145 // Set all non object fields. |
| 148 unresolved_class.set_token_pos( | 146 unresolved_class.set_token_pos( |
| 149 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); | 147 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); |
| 150 | 148 |
| 151 // Set all the object fields. | 149 // Set all the object fields. |
| 152 READ_OBJECT_FIELDS(unresolved_class, unresolved_class.raw()->from(), | 150 READ_OBJECT_FIELDS(unresolved_class, unresolved_class.raw()->from(), |
| 153 unresolved_class.raw()->to(), kAsReference); | 151 unresolved_class.raw()->to(), kAsReference); |
| 154 | 152 |
| 155 return unresolved_class.raw(); | 153 return unresolved_class.raw(); |
| 156 } | 154 } |
| 157 | 155 |
| 158 | |
| 159 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, | 156 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, |
| 160 intptr_t object_id, | 157 intptr_t object_id, |
| 161 Snapshot::Kind kind, | 158 Snapshot::Kind kind, |
| 162 bool as_reference) { | 159 bool as_reference) { |
| 163 ASSERT(writer != NULL); | 160 ASSERT(writer != NULL); |
| 164 | 161 |
| 165 // Write out the serialization header value for this object. | 162 // Write out the serialization header value for this object. |
| 166 writer->WriteInlinedObjectHeader(object_id); | 163 writer->WriteInlinedObjectHeader(object_id); |
| 167 | 164 |
| 168 // Write out the class and tags information. | 165 // Write out the class and tags information. |
| 169 writer->WriteVMIsolateObject(kUnresolvedClassCid); | 166 writer->WriteVMIsolateObject(kUnresolvedClassCid); |
| 170 writer->WriteTags(writer->GetObjectTags(this)); | 167 writer->WriteTags(writer->GetObjectTags(this)); |
| 171 | 168 |
| 172 // Write out all the non object pointer fields. | 169 // Write out all the non object pointer fields. |
| 173 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); | 170 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); |
| 174 | 171 |
| 175 // Write out all the object pointer fields. | 172 // Write out all the object pointer fields. |
| 176 SnapshotWriterVisitor visitor(writer, kAsReference); | 173 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 177 visitor.VisitPointers(from(), to()); | 174 visitor.VisitPointers(from(), to()); |
| 178 } | 175 } |
| 179 | 176 |
| 180 | |
| 181 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, | 177 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, |
| 182 intptr_t object_id, | 178 intptr_t object_id, |
| 183 intptr_t tags, | 179 intptr_t tags, |
| 184 Snapshot::Kind kind, | 180 Snapshot::Kind kind, |
| 185 bool as_reference) { | 181 bool as_reference) { |
| 186 UNREACHABLE(); // AbstractType is an abstract class. | 182 UNREACHABLE(); // AbstractType is an abstract class. |
| 187 return NULL; | 183 return NULL; |
| 188 } | 184 } |
| 189 | 185 |
| 190 | |
| 191 void RawAbstractType::WriteTo(SnapshotWriter* writer, | 186 void RawAbstractType::WriteTo(SnapshotWriter* writer, |
| 192 intptr_t object_id, | 187 intptr_t object_id, |
| 193 Snapshot::Kind kind, | 188 Snapshot::Kind kind, |
| 194 bool as_reference) { | 189 bool as_reference) { |
| 195 UNREACHABLE(); // AbstractType is an abstract class. | 190 UNREACHABLE(); // AbstractType is an abstract class. |
| 196 } | 191 } |
| 197 | 192 |
| 198 | |
| 199 RawType* Type::ReadFrom(SnapshotReader* reader, | 193 RawType* Type::ReadFrom(SnapshotReader* reader, |
| 200 intptr_t object_id, | 194 intptr_t object_id, |
| 201 intptr_t tags, | 195 intptr_t tags, |
| 202 Snapshot::Kind kind, | 196 Snapshot::Kind kind, |
| 203 bool as_reference) { | 197 bool as_reference) { |
| 204 ASSERT(reader != NULL); | 198 ASSERT(reader != NULL); |
| 205 | 199 |
| 206 // Determine if the type class of this type is in the full snapshot. | 200 // Determine if the type class of this type is in the full snapshot. |
| 207 bool typeclass_is_in_fullsnapshot = reader->Read<bool>(); | 201 bool typeclass_is_in_fullsnapshot = reader->Read<bool>(); |
| 208 | 202 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 228 type.set_type_class(*reader->ClassHandle()); | 222 type.set_type_class(*reader->ClassHandle()); |
| 229 | 223 |
| 230 // Set the canonical bit. | 224 // Set the canonical bit. |
| 231 if (!defer_canonicalization && is_canonical) { | 225 if (!defer_canonicalization && is_canonical) { |
| 232 type.SetCanonical(); | 226 type.SetCanonical(); |
| 233 } | 227 } |
| 234 | 228 |
| 235 return type.raw(); | 229 return type.raw(); |
| 236 } | 230 } |
| 237 | 231 |
| 238 | |
| 239 void RawType::WriteTo(SnapshotWriter* writer, | 232 void RawType::WriteTo(SnapshotWriter* writer, |
| 240 intptr_t object_id, | 233 intptr_t object_id, |
| 241 Snapshot::Kind kind, | 234 Snapshot::Kind kind, |
| 242 bool as_reference) { | 235 bool as_reference) { |
| 243 ASSERT(writer != NULL); | 236 ASSERT(writer != NULL); |
| 244 | 237 |
| 245 // Only resolved and finalized types should be written to a snapshot. | 238 // Only resolved and finalized types should be written to a snapshot. |
| 246 ASSERT((ptr()->type_state_ == RawType::kFinalizedInstantiated) || | 239 ASSERT((ptr()->type_state_ == RawType::kFinalizedInstantiated) || |
| 247 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); | 240 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); |
| 248 ASSERT(ptr()->type_class_id_ != Object::null()); | 241 ASSERT(ptr()->type_class_id_ != Object::null()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 278 | 271 |
| 279 // Write out all the object pointer fields. | 272 // Write out all the object pointer fields. |
| 280 ASSERT(ptr()->type_class_id_ != Object::null()); | 273 ASSERT(ptr()->type_class_id_ != Object::null()); |
| 281 SnapshotWriterVisitor visitor(writer, kAsReference); | 274 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 282 visitor.VisitPointers(from(), to()); | 275 visitor.VisitPointers(from(), to()); |
| 283 | 276 |
| 284 // Write out the type class. | 277 // Write out the type class. |
| 285 writer->WriteObjectImpl(type_class, kAsReference); | 278 writer->WriteObjectImpl(type_class, kAsReference); |
| 286 } | 279 } |
| 287 | 280 |
| 288 | |
| 289 RawTypeRef* TypeRef::ReadFrom(SnapshotReader* reader, | 281 RawTypeRef* TypeRef::ReadFrom(SnapshotReader* reader, |
| 290 intptr_t object_id, | 282 intptr_t object_id, |
| 291 intptr_t tags, | 283 intptr_t tags, |
| 292 Snapshot::Kind kind, | 284 Snapshot::Kind kind, |
| 293 bool as_reference) { | 285 bool as_reference) { |
| 294 ASSERT(reader != NULL); | 286 ASSERT(reader != NULL); |
| 295 | 287 |
| 296 // Allocate type ref object. | 288 // Allocate type ref object. |
| 297 TypeRef& type_ref = TypeRef::ZoneHandle(reader->zone(), TypeRef::New()); | 289 TypeRef& type_ref = TypeRef::ZoneHandle(reader->zone(), TypeRef::New()); |
| 298 reader->AddBackRef(object_id, &type_ref, kIsDeserialized); | 290 reader->AddBackRef(object_id, &type_ref, kIsDeserialized); |
| 299 | 291 |
| 300 // Set all the object fields. | 292 // Set all the object fields. |
| 301 READ_OBJECT_FIELDS(type_ref, type_ref.raw()->from(), type_ref.raw()->to(), | 293 READ_OBJECT_FIELDS(type_ref, type_ref.raw()->from(), type_ref.raw()->to(), |
| 302 kAsReference); | 294 kAsReference); |
| 303 | 295 |
| 304 return type_ref.raw(); | 296 return type_ref.raw(); |
| 305 } | 297 } |
| 306 | 298 |
| 307 | |
| 308 void RawTypeRef::WriteTo(SnapshotWriter* writer, | 299 void RawTypeRef::WriteTo(SnapshotWriter* writer, |
| 309 intptr_t object_id, | 300 intptr_t object_id, |
| 310 Snapshot::Kind kind, | 301 Snapshot::Kind kind, |
| 311 bool as_reference) { | 302 bool as_reference) { |
| 312 ASSERT(writer != NULL); | 303 ASSERT(writer != NULL); |
| 313 | 304 |
| 314 // Write out the serialization header value for this object. | 305 // Write out the serialization header value for this object. |
| 315 writer->WriteInlinedObjectHeader(object_id); | 306 writer->WriteInlinedObjectHeader(object_id); |
| 316 | 307 |
| 317 // Write out the class and tags information. | 308 // Write out the class and tags information. |
| 318 writer->WriteIndexedObject(kTypeRefCid); | 309 writer->WriteIndexedObject(kTypeRefCid); |
| 319 writer->WriteTags(writer->GetObjectTags(this)); | 310 writer->WriteTags(writer->GetObjectTags(this)); |
| 320 | 311 |
| 321 // Write out all the object pointer fields. | 312 // Write out all the object pointer fields. |
| 322 SnapshotWriterVisitor visitor(writer, kAsReference); | 313 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 323 visitor.VisitPointers(from(), to()); | 314 visitor.VisitPointers(from(), to()); |
| 324 } | 315 } |
| 325 | 316 |
| 326 | |
| 327 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, | 317 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, |
| 328 intptr_t object_id, | 318 intptr_t object_id, |
| 329 intptr_t tags, | 319 intptr_t tags, |
| 330 Snapshot::Kind kind, | 320 Snapshot::Kind kind, |
| 331 bool as_reference) { | 321 bool as_reference) { |
| 332 ASSERT(reader != NULL); | 322 ASSERT(reader != NULL); |
| 333 | 323 |
| 334 // Allocate type parameter object. | 324 // Allocate type parameter object. |
| 335 TypeParameter& type_parameter = | 325 TypeParameter& type_parameter = |
| 336 TypeParameter::ZoneHandle(reader->zone(), TypeParameter::New()); | 326 TypeParameter::ZoneHandle(reader->zone(), TypeParameter::New()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 347 type_parameter.raw()->to(), kAsReference); | 337 type_parameter.raw()->to(), kAsReference); |
| 348 | 338 |
| 349 // Read in the parameterized class. | 339 // Read in the parameterized class. |
| 350 (*reader->ClassHandle()) = | 340 (*reader->ClassHandle()) = |
| 351 Class::RawCast(reader->ReadObjectImpl(kAsReference)); | 341 Class::RawCast(reader->ReadObjectImpl(kAsReference)); |
| 352 type_parameter.set_parameterized_class(*reader->ClassHandle()); | 342 type_parameter.set_parameterized_class(*reader->ClassHandle()); |
| 353 | 343 |
| 354 return type_parameter.raw(); | 344 return type_parameter.raw(); |
| 355 } | 345 } |
| 356 | 346 |
| 357 | |
| 358 void RawTypeParameter::WriteTo(SnapshotWriter* writer, | 347 void RawTypeParameter::WriteTo(SnapshotWriter* writer, |
| 359 intptr_t object_id, | 348 intptr_t object_id, |
| 360 Snapshot::Kind kind, | 349 Snapshot::Kind kind, |
| 361 bool as_reference) { | 350 bool as_reference) { |
| 362 ASSERT(writer != NULL); | 351 ASSERT(writer != NULL); |
| 363 | 352 |
| 364 // Only finalized type parameters should be written to a snapshot. | 353 // Only finalized type parameters should be written to a snapshot. |
| 365 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); | 354 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); |
| 366 | 355 |
| 367 // Write out the serialization header value for this object. | 356 // Write out the serialization header value for this object. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 379 // Write out all the object pointer fields. | 368 // Write out all the object pointer fields. |
| 380 SnapshotWriterVisitor visitor(writer, kAsReference); | 369 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 381 visitor.VisitPointers(from(), to()); | 370 visitor.VisitPointers(from(), to()); |
| 382 | 371 |
| 383 // Write out the parameterized class. | 372 // Write out the parameterized class. |
| 384 RawClass* param_class = | 373 RawClass* param_class = |
| 385 writer->isolate()->class_table()->At(ptr()->parameterized_class_id_); | 374 writer->isolate()->class_table()->At(ptr()->parameterized_class_id_); |
| 386 writer->WriteObjectImpl(param_class, kAsReference); | 375 writer->WriteObjectImpl(param_class, kAsReference); |
| 387 } | 376 } |
| 388 | 377 |
| 389 | |
| 390 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, | 378 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, |
| 391 intptr_t object_id, | 379 intptr_t object_id, |
| 392 intptr_t tags, | 380 intptr_t tags, |
| 393 Snapshot::Kind kind, | 381 Snapshot::Kind kind, |
| 394 bool as_reference) { | 382 bool as_reference) { |
| 395 ASSERT(reader != NULL); | 383 ASSERT(reader != NULL); |
| 396 | 384 |
| 397 // Allocate bounded type object. | 385 // Allocate bounded type object. |
| 398 BoundedType& bounded_type = | 386 BoundedType& bounded_type = |
| 399 BoundedType::ZoneHandle(reader->zone(), BoundedType::New()); | 387 BoundedType::ZoneHandle(reader->zone(), BoundedType::New()); |
| 400 reader->AddBackRef(object_id, &bounded_type, kIsDeserialized); | 388 reader->AddBackRef(object_id, &bounded_type, kIsDeserialized); |
| 401 | 389 |
| 402 // Set all the object fields. | 390 // Set all the object fields. |
| 403 READ_OBJECT_FIELDS(bounded_type, bounded_type.raw()->from(), | 391 READ_OBJECT_FIELDS(bounded_type, bounded_type.raw()->from(), |
| 404 bounded_type.raw()->to(), kAsReference); | 392 bounded_type.raw()->to(), kAsReference); |
| 405 | 393 |
| 406 return bounded_type.raw(); | 394 return bounded_type.raw(); |
| 407 } | 395 } |
| 408 | 396 |
| 409 | |
| 410 void RawBoundedType::WriteTo(SnapshotWriter* writer, | 397 void RawBoundedType::WriteTo(SnapshotWriter* writer, |
| 411 intptr_t object_id, | 398 intptr_t object_id, |
| 412 Snapshot::Kind kind, | 399 Snapshot::Kind kind, |
| 413 bool as_reference) { | 400 bool as_reference) { |
| 414 ASSERT(writer != NULL); | 401 ASSERT(writer != NULL); |
| 415 | 402 |
| 416 // Write out the serialization header value for this object. | 403 // Write out the serialization header value for this object. |
| 417 writer->WriteInlinedObjectHeader(object_id); | 404 writer->WriteInlinedObjectHeader(object_id); |
| 418 | 405 |
| 419 // Write out the class and tags information. | 406 // Write out the class and tags information. |
| 420 writer->WriteIndexedObject(kBoundedTypeCid); | 407 writer->WriteIndexedObject(kBoundedTypeCid); |
| 421 writer->WriteTags(writer->GetObjectTags(this)); | 408 writer->WriteTags(writer->GetObjectTags(this)); |
| 422 | 409 |
| 423 // Write out all the object pointer fields. | 410 // Write out all the object pointer fields. |
| 424 SnapshotWriterVisitor visitor(writer, kAsReference); | 411 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 425 visitor.VisitPointers(from(), to()); | 412 visitor.VisitPointers(from(), to()); |
| 426 } | 413 } |
| 427 | 414 |
| 428 | |
| 429 RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, | 415 RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, |
| 430 intptr_t object_id, | 416 intptr_t object_id, |
| 431 intptr_t tags, | 417 intptr_t tags, |
| 432 Snapshot::Kind kind, | 418 Snapshot::Kind kind, |
| 433 bool as_reference) { | 419 bool as_reference) { |
| 434 UNREACHABLE(); // MixinAppType objects do not survive finalization. | 420 UNREACHABLE(); // MixinAppType objects do not survive finalization. |
| 435 return MixinAppType::null(); | 421 return MixinAppType::null(); |
| 436 } | 422 } |
| 437 | 423 |
| 438 | |
| 439 void RawMixinAppType::WriteTo(SnapshotWriter* writer, | 424 void RawMixinAppType::WriteTo(SnapshotWriter* writer, |
| 440 intptr_t object_id, | 425 intptr_t object_id, |
| 441 Snapshot::Kind kind, | 426 Snapshot::Kind kind, |
| 442 bool as_reference) { | 427 bool as_reference) { |
| 443 UNREACHABLE(); // MixinAppType objects do not survive finalization. | 428 UNREACHABLE(); // MixinAppType objects do not survive finalization. |
| 444 } | 429 } |
| 445 | 430 |
| 446 | |
| 447 RawTypeArguments* TypeArguments::ReadFrom(SnapshotReader* reader, | 431 RawTypeArguments* TypeArguments::ReadFrom(SnapshotReader* reader, |
| 448 intptr_t object_id, | 432 intptr_t object_id, |
| 449 intptr_t tags, | 433 intptr_t tags, |
| 450 Snapshot::Kind kind, | 434 Snapshot::Kind kind, |
| 451 bool as_reference) { | 435 bool as_reference) { |
| 452 ASSERT(reader != NULL); | 436 ASSERT(reader != NULL); |
| 453 | 437 |
| 454 // Read the length so that we can determine instance size to allocate. | 438 // Read the length so that we can determine instance size to allocate. |
| 455 intptr_t len = reader->ReadSmiValue(); | 439 intptr_t len = reader->ReadSmiValue(); |
| 456 | 440 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 475 } | 459 } |
| 476 | 460 |
| 477 // Set the canonical bit. | 461 // Set the canonical bit. |
| 478 if (!defer_canonicalization && is_canonical) { | 462 if (!defer_canonicalization && is_canonical) { |
| 479 type_arguments.SetCanonical(); | 463 type_arguments.SetCanonical(); |
| 480 } | 464 } |
| 481 | 465 |
| 482 return type_arguments.raw(); | 466 return type_arguments.raw(); |
| 483 } | 467 } |
| 484 | 468 |
| 485 | |
| 486 void RawTypeArguments::WriteTo(SnapshotWriter* writer, | 469 void RawTypeArguments::WriteTo(SnapshotWriter* writer, |
| 487 intptr_t object_id, | 470 intptr_t object_id, |
| 488 Snapshot::Kind kind, | 471 Snapshot::Kind kind, |
| 489 bool as_reference) { | 472 bool as_reference) { |
| 490 ASSERT(writer != NULL); | 473 ASSERT(writer != NULL); |
| 491 | 474 |
| 492 // Write out the serialization header value for this object. | 475 // Write out the serialization header value for this object. |
| 493 writer->WriteInlinedObjectHeader(object_id); | 476 writer->WriteInlinedObjectHeader(object_id); |
| 494 | 477 |
| 495 // Write out the class and tags information. | 478 // Write out the class and tags information. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 517 writer->WriteVMIsolateObject(kDynamicType); | 500 writer->WriteVMIsolateObject(kDynamicType); |
| 518 } else { | 501 } else { |
| 519 writer->WriteObjectImpl(ptr()->types()[i], kAsReference); | 502 writer->WriteObjectImpl(ptr()->types()[i], kAsReference); |
| 520 } | 503 } |
| 521 } else { | 504 } else { |
| 522 writer->WriteObjectImpl(ptr()->types()[i], kAsReference); | 505 writer->WriteObjectImpl(ptr()->types()[i], kAsReference); |
| 523 } | 506 } |
| 524 } | 507 } |
| 525 } | 508 } |
| 526 | 509 |
| 527 | |
| 528 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, | 510 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, |
| 529 intptr_t object_id, | 511 intptr_t object_id, |
| 530 intptr_t tags, | 512 intptr_t tags, |
| 531 Snapshot::Kind kind, | 513 Snapshot::Kind kind, |
| 532 bool as_reference) { | 514 bool as_reference) { |
| 533 ASSERT(reader != NULL); | 515 ASSERT(reader != NULL); |
| 534 ASSERT(kind == Snapshot::kScript); | 516 ASSERT(kind == Snapshot::kScript); |
| 535 | 517 |
| 536 // Allocate function object. | 518 // Allocate function object. |
| 537 PatchClass& cls = PatchClass::ZoneHandle(reader->zone(), PatchClass::New()); | 519 PatchClass& cls = PatchClass::ZoneHandle(reader->zone(), PatchClass::New()); |
| 538 reader->AddBackRef(object_id, &cls, kIsDeserialized); | 520 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
| 539 | 521 |
| 540 // Set all the object fields. | 522 // Set all the object fields. |
| 541 READ_OBJECT_FIELDS(cls, cls.raw()->from(), cls.raw()->to(), kAsReference); | 523 READ_OBJECT_FIELDS(cls, cls.raw()->from(), cls.raw()->to(), kAsReference); |
| 542 | 524 |
| 543 return cls.raw(); | 525 return cls.raw(); |
| 544 } | 526 } |
| 545 | 527 |
| 546 | |
| 547 void RawPatchClass::WriteTo(SnapshotWriter* writer, | 528 void RawPatchClass::WriteTo(SnapshotWriter* writer, |
| 548 intptr_t object_id, | 529 intptr_t object_id, |
| 549 Snapshot::Kind kind, | 530 Snapshot::Kind kind, |
| 550 bool as_reference) { | 531 bool as_reference) { |
| 551 ASSERT(writer != NULL); | 532 ASSERT(writer != NULL); |
| 552 ASSERT(kind == Snapshot::kScript); | 533 ASSERT(kind == Snapshot::kScript); |
| 553 | 534 |
| 554 // Write out the serialization header value for this object. | 535 // Write out the serialization header value for this object. |
| 555 writer->WriteInlinedObjectHeader(object_id); | 536 writer->WriteInlinedObjectHeader(object_id); |
| 556 | 537 |
| 557 // Write out the class and tags information. | 538 // Write out the class and tags information. |
| 558 writer->WriteVMIsolateObject(kPatchClassCid); | 539 writer->WriteVMIsolateObject(kPatchClassCid); |
| 559 writer->WriteTags(writer->GetObjectTags(this)); | 540 writer->WriteTags(writer->GetObjectTags(this)); |
| 560 // Write out all the object pointer fields. | 541 // Write out all the object pointer fields. |
| 561 SnapshotWriterVisitor visitor(writer, kAsReference); | 542 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 562 visitor.VisitPointers(from(), to()); | 543 visitor.VisitPointers(from(), to()); |
| 563 } | 544 } |
| 564 | 545 |
| 565 | |
| 566 RawClosure* Closure::ReadFrom(SnapshotReader* reader, | 546 RawClosure* Closure::ReadFrom(SnapshotReader* reader, |
| 567 intptr_t object_id, | 547 intptr_t object_id, |
| 568 intptr_t tags, | 548 intptr_t tags, |
| 569 Snapshot::Kind kind, | 549 Snapshot::Kind kind, |
| 570 bool as_reference) { | 550 bool as_reference) { |
| 571 UNREACHABLE(); | 551 UNREACHABLE(); |
| 572 return Closure::null(); | 552 return Closure::null(); |
| 573 } | 553 } |
| 574 | 554 |
| 575 | |
| 576 void RawClosure::WriteTo(SnapshotWriter* writer, | 555 void RawClosure::WriteTo(SnapshotWriter* writer, |
| 577 intptr_t object_id, | 556 intptr_t object_id, |
| 578 Snapshot::Kind kind, | 557 Snapshot::Kind kind, |
| 579 bool as_reference) { | 558 bool as_reference) { |
| 580 ASSERT(writer != NULL); | 559 ASSERT(writer != NULL); |
| 581 ASSERT((kind == Snapshot::kMessage) || (kind == Snapshot::kScript)); | 560 ASSERT((kind == Snapshot::kMessage) || (kind == Snapshot::kScript)); |
| 582 | 561 |
| 583 // Check if closure is serializable, throw an exception otherwise. | 562 // Check if closure is serializable, throw an exception otherwise. |
| 584 RawFunction* func = writer->IsSerializableClosure(this); | 563 RawFunction* func = writer->IsSerializableClosure(this); |
| 585 if (func != Function::null()) { | 564 if (func != Function::null()) { |
| 586 writer->WriteStaticImplicitClosure(object_id, func, | 565 writer->WriteStaticImplicitClosure(object_id, func, |
| 587 writer->GetObjectTags(this)); | 566 writer->GetObjectTags(this)); |
| 588 return; | 567 return; |
| 589 } | 568 } |
| 590 | 569 |
| 591 UNREACHABLE(); | 570 UNREACHABLE(); |
| 592 } | 571 } |
| 593 | 572 |
| 594 | |
| 595 RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, | 573 RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, |
| 596 intptr_t object_id, | 574 intptr_t object_id, |
| 597 intptr_t tags, | 575 intptr_t tags, |
| 598 Snapshot::Kind kind, | 576 Snapshot::Kind kind, |
| 599 bool as_reference) { | 577 bool as_reference) { |
| 600 ASSERT(reader != NULL); | 578 ASSERT(reader != NULL); |
| 601 ASSERT(kind == Snapshot::kScript); | 579 ASSERT(kind == Snapshot::kScript); |
| 602 | 580 |
| 603 // Allocate closure data object. | 581 // Allocate closure data object. |
| 604 ClosureData& data = | 582 ClosureData& data = |
| 605 ClosureData::ZoneHandle(reader->zone(), ClosureData::New()); | 583 ClosureData::ZoneHandle(reader->zone(), ClosureData::New()); |
| 606 reader->AddBackRef(object_id, &data, kIsDeserialized); | 584 reader->AddBackRef(object_id, &data, kIsDeserialized); |
| 607 | 585 |
| 608 // Set all the object fields. | 586 // Set all the object fields. |
| 609 // Cached hash is null-initialized by ClosureData::New() | 587 // Cached hash is null-initialized by ClosureData::New() |
| 610 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to_snapshot(), | 588 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to_snapshot(), |
| 611 kAsInlinedObject); | 589 kAsInlinedObject); |
| 612 | 590 |
| 613 return data.raw(); | 591 return data.raw(); |
| 614 } | 592 } |
| 615 | 593 |
| 616 | |
| 617 void RawClosureData::WriteTo(SnapshotWriter* writer, | 594 void RawClosureData::WriteTo(SnapshotWriter* writer, |
| 618 intptr_t object_id, | 595 intptr_t object_id, |
| 619 Snapshot::Kind kind, | 596 Snapshot::Kind kind, |
| 620 bool as_reference) { | 597 bool as_reference) { |
| 621 ASSERT(writer != NULL); | 598 ASSERT(writer != NULL); |
| 622 ASSERT(kind == Snapshot::kScript); | 599 ASSERT(kind == Snapshot::kScript); |
| 623 | 600 |
| 624 // Write out the serialization header value for this object. | 601 // Write out the serialization header value for this object. |
| 625 writer->WriteInlinedObjectHeader(object_id); | 602 writer->WriteInlinedObjectHeader(object_id); |
| 626 | 603 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 641 // Parent function. | 618 // Parent function. |
| 642 writer->WriteObjectImpl(ptr()->parent_function_, kAsInlinedObject); | 619 writer->WriteObjectImpl(ptr()->parent_function_, kAsInlinedObject); |
| 643 | 620 |
| 644 // Signature type. | 621 // Signature type. |
| 645 writer->WriteObjectImpl(ptr()->signature_type_, kAsInlinedObject); | 622 writer->WriteObjectImpl(ptr()->signature_type_, kAsInlinedObject); |
| 646 | 623 |
| 647 // Canonical static closure. | 624 // Canonical static closure. |
| 648 writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject); | 625 writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject); |
| 649 } | 626 } |
| 650 | 627 |
| 651 | |
| 652 RawSignatureData* SignatureData::ReadFrom(SnapshotReader* reader, | 628 RawSignatureData* SignatureData::ReadFrom(SnapshotReader* reader, |
| 653 intptr_t object_id, | 629 intptr_t object_id, |
| 654 intptr_t tags, | 630 intptr_t tags, |
| 655 Snapshot::Kind kind, | 631 Snapshot::Kind kind, |
| 656 bool as_reference) { | 632 bool as_reference) { |
| 657 ASSERT(reader != NULL); | 633 ASSERT(reader != NULL); |
| 658 ASSERT(kind == Snapshot::kScript); | 634 ASSERT(kind == Snapshot::kScript); |
| 659 | 635 |
| 660 // Allocate signature data object. | 636 // Allocate signature data object. |
| 661 SignatureData& data = | 637 SignatureData& data = |
| 662 SignatureData::ZoneHandle(reader->zone(), SignatureData::New()); | 638 SignatureData::ZoneHandle(reader->zone(), SignatureData::New()); |
| 663 reader->AddBackRef(object_id, &data, kIsDeserialized); | 639 reader->AddBackRef(object_id, &data, kIsDeserialized); |
| 664 | 640 |
| 665 // Set all the object fields. | 641 // Set all the object fields. |
| 666 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), | 642 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), |
| 667 kAsInlinedObject); | 643 kAsInlinedObject); |
| 668 | 644 |
| 669 return data.raw(); | 645 return data.raw(); |
| 670 } | 646 } |
| 671 | 647 |
| 672 | |
| 673 void RawSignatureData::WriteTo(SnapshotWriter* writer, | 648 void RawSignatureData::WriteTo(SnapshotWriter* writer, |
| 674 intptr_t object_id, | 649 intptr_t object_id, |
| 675 Snapshot::Kind kind, | 650 Snapshot::Kind kind, |
| 676 bool as_reference) { | 651 bool as_reference) { |
| 677 ASSERT(writer != NULL); | 652 ASSERT(writer != NULL); |
| 678 ASSERT(kind == Snapshot::kScript); | 653 ASSERT(kind == Snapshot::kScript); |
| 679 | 654 |
| 680 // Write out the serialization header value for this object. | 655 // Write out the serialization header value for this object. |
| 681 writer->WriteInlinedObjectHeader(object_id); | 656 writer->WriteInlinedObjectHeader(object_id); |
| 682 | 657 |
| 683 // Write out the class and tags information. | 658 // Write out the class and tags information. |
| 684 writer->WriteVMIsolateObject(kSignatureDataCid); | 659 writer->WriteVMIsolateObject(kSignatureDataCid); |
| 685 writer->WriteTags(writer->GetObjectTags(this)); | 660 writer->WriteTags(writer->GetObjectTags(this)); |
| 686 | 661 |
| 687 // Write out all the object pointer fields. | 662 // Write out all the object pointer fields. |
| 688 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); | 663 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
| 689 visitor.VisitPointers(from(), to()); | 664 visitor.VisitPointers(from(), to()); |
| 690 } | 665 } |
| 691 | 666 |
| 692 | |
| 693 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader, | 667 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader, |
| 694 intptr_t object_id, | 668 intptr_t object_id, |
| 695 intptr_t tags, | 669 intptr_t tags, |
| 696 Snapshot::Kind kind, | 670 Snapshot::Kind kind, |
| 697 bool as_reference) { | 671 bool as_reference) { |
| 698 ASSERT(reader != NULL); | 672 ASSERT(reader != NULL); |
| 699 ASSERT(kind == Snapshot::kScript); | 673 ASSERT(kind == Snapshot::kScript); |
| 700 | 674 |
| 701 // Allocate redirection data object. | 675 // Allocate redirection data object. |
| 702 RedirectionData& data = | 676 RedirectionData& data = |
| 703 RedirectionData::ZoneHandle(reader->zone(), RedirectionData::New()); | 677 RedirectionData::ZoneHandle(reader->zone(), RedirectionData::New()); |
| 704 reader->AddBackRef(object_id, &data, kIsDeserialized); | 678 reader->AddBackRef(object_id, &data, kIsDeserialized); |
| 705 | 679 |
| 706 // Set all the object fields. | 680 // Set all the object fields. |
| 707 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), kAsReference); | 681 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), kAsReference); |
| 708 | 682 |
| 709 return data.raw(); | 683 return data.raw(); |
| 710 } | 684 } |
| 711 | 685 |
| 712 | |
| 713 void RawRedirectionData::WriteTo(SnapshotWriter* writer, | 686 void RawRedirectionData::WriteTo(SnapshotWriter* writer, |
| 714 intptr_t object_id, | 687 intptr_t object_id, |
| 715 Snapshot::Kind kind, | 688 Snapshot::Kind kind, |
| 716 bool as_reference) { | 689 bool as_reference) { |
| 717 ASSERT(writer != NULL); | 690 ASSERT(writer != NULL); |
| 718 ASSERT(kind == Snapshot::kScript); | 691 ASSERT(kind == Snapshot::kScript); |
| 719 | 692 |
| 720 // Write out the serialization header value for this object. | 693 // Write out the serialization header value for this object. |
| 721 writer->WriteInlinedObjectHeader(object_id); | 694 writer->WriteInlinedObjectHeader(object_id); |
| 722 | 695 |
| 723 // Write out the class and tags information. | 696 // Write out the class and tags information. |
| 724 writer->WriteVMIsolateObject(kRedirectionDataCid); | 697 writer->WriteVMIsolateObject(kRedirectionDataCid); |
| 725 writer->WriteTags(writer->GetObjectTags(this)); | 698 writer->WriteTags(writer->GetObjectTags(this)); |
| 726 | 699 |
| 727 // Write out all the object pointer fields. | 700 // Write out all the object pointer fields. |
| 728 SnapshotWriterVisitor visitor(writer, kAsReference); | 701 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 729 visitor.VisitPointers(from(), to()); | 702 visitor.VisitPointers(from(), to()); |
| 730 } | 703 } |
| 731 | 704 |
| 732 | |
| 733 RawFunction* Function::ReadFrom(SnapshotReader* reader, | 705 RawFunction* Function::ReadFrom(SnapshotReader* reader, |
| 734 intptr_t object_id, | 706 intptr_t object_id, |
| 735 intptr_t tags, | 707 intptr_t tags, |
| 736 Snapshot::Kind kind, | 708 Snapshot::Kind kind, |
| 737 bool as_reference) { | 709 bool as_reference) { |
| 738 ASSERT(reader != NULL); | 710 ASSERT(reader != NULL); |
| 739 ASSERT(kind == Snapshot::kScript); | 711 ASSERT(kind == Snapshot::kScript); |
| 740 | 712 |
| 741 bool is_in_fullsnapshot = reader->Read<bool>(); | 713 bool is_in_fullsnapshot = reader->Read<bool>(); |
| 742 if (!is_in_fullsnapshot) { | 714 if (!is_in_fullsnapshot) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 772 } else { | 744 } else { |
| 773 func.ClearICDataArray(); | 745 func.ClearICDataArray(); |
| 774 } | 746 } |
| 775 func.ClearCode(); | 747 func.ClearCode(); |
| 776 return func.raw(); | 748 return func.raw(); |
| 777 } else { | 749 } else { |
| 778 return reader->ReadFunctionId(object_id); | 750 return reader->ReadFunctionId(object_id); |
| 779 } | 751 } |
| 780 } | 752 } |
| 781 | 753 |
| 782 | |
| 783 void RawFunction::WriteTo(SnapshotWriter* writer, | 754 void RawFunction::WriteTo(SnapshotWriter* writer, |
| 784 intptr_t object_id, | 755 intptr_t object_id, |
| 785 Snapshot::Kind kind, | 756 Snapshot::Kind kind, |
| 786 bool as_reference) { | 757 bool as_reference) { |
| 787 ASSERT(writer != NULL); | 758 ASSERT(writer != NULL); |
| 788 ASSERT(kind == Snapshot::kScript); | 759 ASSERT(kind == Snapshot::kScript); |
| 789 bool is_in_fullsnapshot = false; | 760 bool is_in_fullsnapshot = false; |
| 790 bool owner_is_class = false; | 761 bool owner_is_class = false; |
| 791 if ((kind == Snapshot::kScript) && !Function::IsSignatureFunction(this)) { | 762 if ((kind == Snapshot::kScript) && !Function::IsSignatureFunction(this)) { |
| 792 intptr_t tags = writer->GetObjectTags(ptr()->owner_); | 763 intptr_t tags = writer->GetObjectTags(ptr()->owner_); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 visitor.VisitPointers(from(), to_snapshot()); | 809 visitor.VisitPointers(from(), to_snapshot()); |
| 839 if (is_optimized) { | 810 if (is_optimized) { |
| 840 // Write out the ic data array as the function is optimized. | 811 // Write out the ic data array as the function is optimized. |
| 841 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference); | 812 writer->WriteObjectImpl(ptr()->ic_data_array_, kAsReference); |
| 842 } | 813 } |
| 843 } else { | 814 } else { |
| 844 writer->WriteFunctionId(this, owner_is_class); | 815 writer->WriteFunctionId(this, owner_is_class); |
| 845 } | 816 } |
| 846 } | 817 } |
| 847 | 818 |
| 848 | |
| 849 RawField* Field::ReadFrom(SnapshotReader* reader, | 819 RawField* Field::ReadFrom(SnapshotReader* reader, |
| 850 intptr_t object_id, | 820 intptr_t object_id, |
| 851 intptr_t tags, | 821 intptr_t tags, |
| 852 Snapshot::Kind kind, | 822 Snapshot::Kind kind, |
| 853 bool as_reference) { | 823 bool as_reference) { |
| 854 ASSERT(reader != NULL); | 824 ASSERT(reader != NULL); |
| 855 ASSERT(kind == Snapshot::kScript); | 825 ASSERT(kind == Snapshot::kScript); |
| 856 | 826 |
| 857 // Allocate field object. | 827 // Allocate field object. |
| 858 Field& field = Field::ZoneHandle(reader->zone(), Field::New()); | 828 Field& field = Field::ZoneHandle(reader->zone(), Field::New()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 875 field.set_is_nullable(true); | 845 field.set_is_nullable(true); |
| 876 field.set_guarded_list_length(Field::kNoFixedLength); | 846 field.set_guarded_list_length(Field::kNoFixedLength); |
| 877 field.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); | 847 field.set_guarded_list_length_in_object_offset(Field::kUnknownLengthOffset); |
| 878 } else { | 848 } else { |
| 879 field.InitializeGuardedListLengthInObjectOffset(); | 849 field.InitializeGuardedListLengthInObjectOffset(); |
| 880 } | 850 } |
| 881 | 851 |
| 882 return field.raw(); | 852 return field.raw(); |
| 883 } | 853 } |
| 884 | 854 |
| 885 | |
| 886 void RawField::WriteTo(SnapshotWriter* writer, | 855 void RawField::WriteTo(SnapshotWriter* writer, |
| 887 intptr_t object_id, | 856 intptr_t object_id, |
| 888 Snapshot::Kind kind, | 857 Snapshot::Kind kind, |
| 889 bool as_reference) { | 858 bool as_reference) { |
| 890 ASSERT(writer != NULL); | 859 ASSERT(writer != NULL); |
| 891 ASSERT(kind == Snapshot::kScript); | 860 ASSERT(kind == Snapshot::kScript); |
| 892 | 861 |
| 893 // Write out the serialization header value for this object. | 862 // Write out the serialization header value for this object. |
| 894 writer->WriteInlinedObjectHeader(object_id); | 863 writer->WriteInlinedObjectHeader(object_id); |
| 895 | 864 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 920 } | 889 } |
| 921 } else { | 890 } else { |
| 922 writer->WriteObjectImpl(ptr()->value_.offset_, kAsReference); | 891 writer->WriteObjectImpl(ptr()->value_.offset_, kAsReference); |
| 923 } | 892 } |
| 924 // Write out the initializer function or saved initial value. | 893 // Write out the initializer function or saved initial value. |
| 925 writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference); | 894 writer->WriteObjectImpl(ptr()->initializer_.saved_value_, kAsReference); |
| 926 // Write out the guarded list length. | 895 // Write out the guarded list length. |
| 927 writer->WriteObjectImpl(ptr()->guarded_list_length_, kAsReference); | 896 writer->WriteObjectImpl(ptr()->guarded_list_length_, kAsReference); |
| 928 } | 897 } |
| 929 | 898 |
| 930 | |
| 931 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, | 899 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, |
| 932 intptr_t object_id, | 900 intptr_t object_id, |
| 933 intptr_t tags, | 901 intptr_t tags, |
| 934 Snapshot::Kind kind, | 902 Snapshot::Kind kind, |
| 935 bool as_reference) { | 903 bool as_reference) { |
| 936 ASSERT(reader != NULL); | 904 ASSERT(reader != NULL); |
| 937 ASSERT(kind != Snapshot::kMessage); | 905 ASSERT(kind != Snapshot::kMessage); |
| 938 | 906 |
| 939 // Create the literal token object. | 907 // Create the literal token object. |
| 940 LiteralToken& literal_token = | 908 LiteralToken& literal_token = |
| 941 LiteralToken::ZoneHandle(reader->zone(), LiteralToken::New()); | 909 LiteralToken::ZoneHandle(reader->zone(), LiteralToken::New()); |
| 942 reader->AddBackRef(object_id, &literal_token, kIsDeserialized); | 910 reader->AddBackRef(object_id, &literal_token, kIsDeserialized); |
| 943 | 911 |
| 944 // Read the token attributes. | 912 // Read the token attributes. |
| 945 Token::Kind token_kind = static_cast<Token::Kind>(reader->Read<int32_t>()); | 913 Token::Kind token_kind = static_cast<Token::Kind>(reader->Read<int32_t>()); |
| 946 literal_token.set_kind(token_kind); | 914 literal_token.set_kind(token_kind); |
| 947 | 915 |
| 948 // Set all the object fields. | 916 // Set all the object fields. |
| 949 READ_OBJECT_FIELDS(literal_token, literal_token.raw()->from(), | 917 READ_OBJECT_FIELDS(literal_token, literal_token.raw()->from(), |
| 950 literal_token.raw()->to(), kAsReference); | 918 literal_token.raw()->to(), kAsReference); |
| 951 | 919 |
| 952 return literal_token.raw(); | 920 return literal_token.raw(); |
| 953 } | 921 } |
| 954 | 922 |
| 955 | |
| 956 void RawLiteralToken::WriteTo(SnapshotWriter* writer, | 923 void RawLiteralToken::WriteTo(SnapshotWriter* writer, |
| 957 intptr_t object_id, | 924 intptr_t object_id, |
| 958 Snapshot::Kind kind, | 925 Snapshot::Kind kind, |
| 959 bool as_reference) { | 926 bool as_reference) { |
| 960 ASSERT(writer != NULL); | 927 ASSERT(writer != NULL); |
| 961 ASSERT(kind != Snapshot::kMessage); | 928 ASSERT(kind != Snapshot::kMessage); |
| 962 | 929 |
| 963 // Write out the serialization header value for this object. | 930 // Write out the serialization header value for this object. |
| 964 writer->WriteInlinedObjectHeader(object_id); | 931 writer->WriteInlinedObjectHeader(object_id); |
| 965 | 932 |
| 966 // Write out the class and tags information. | 933 // Write out the class and tags information. |
| 967 writer->WriteVMIsolateObject(kLiteralTokenCid); | 934 writer->WriteVMIsolateObject(kLiteralTokenCid); |
| 968 writer->WriteTags(writer->GetObjectTags(this)); | 935 writer->WriteTags(writer->GetObjectTags(this)); |
| 969 | 936 |
| 970 // Write out the kind field. | 937 // Write out the kind field. |
| 971 writer->Write<int32_t>(ptr()->kind_); | 938 writer->Write<int32_t>(ptr()->kind_); |
| 972 | 939 |
| 973 // Write out all the object pointer fields. | 940 // Write out all the object pointer fields. |
| 974 SnapshotWriterVisitor visitor(writer, kAsReference); | 941 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 975 visitor.VisitPointers(from(), to()); | 942 visitor.VisitPointers(from(), to()); |
| 976 } | 943 } |
| 977 | 944 |
| 978 | |
| 979 RawTokenStream* TokenStream::ReadFrom(SnapshotReader* reader, | 945 RawTokenStream* TokenStream::ReadFrom(SnapshotReader* reader, |
| 980 intptr_t object_id, | 946 intptr_t object_id, |
| 981 intptr_t tags, | 947 intptr_t tags, |
| 982 Snapshot::Kind kind, | 948 Snapshot::Kind kind, |
| 983 bool as_reference) { | 949 bool as_reference) { |
| 984 ASSERT(reader != NULL); | 950 ASSERT(reader != NULL); |
| 985 ASSERT(kind == Snapshot::kScript); | 951 ASSERT(kind == Snapshot::kScript); |
| 986 | 952 |
| 987 // Read the length so that we can determine number of tokens to read. | 953 // Read the length so that we can determine number of tokens to read. |
| 988 intptr_t len = reader->ReadSmiValue(); | 954 intptr_t len = reader->ReadSmiValue(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1003 // Read in the literal/identifier token array. | 969 // Read in the literal/identifier token array. |
| 1004 *(reader->TokensHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject); | 970 *(reader->TokensHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject); |
| 1005 token_stream.SetTokenObjects(*(reader->TokensHandle())); | 971 token_stream.SetTokenObjects(*(reader->TokensHandle())); |
| 1006 // Read in the private key in use by the token stream. | 972 // Read in the private key in use by the token stream. |
| 1007 *(reader->StringHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject); | 973 *(reader->StringHandle()) ^= reader->ReadObjectImpl(kAsInlinedObject); |
| 1008 token_stream.SetPrivateKey(*(reader->StringHandle())); | 974 token_stream.SetPrivateKey(*(reader->StringHandle())); |
| 1009 | 975 |
| 1010 return token_stream.raw(); | 976 return token_stream.raw(); |
| 1011 } | 977 } |
| 1012 | 978 |
| 1013 | |
| 1014 void RawTokenStream::WriteTo(SnapshotWriter* writer, | 979 void RawTokenStream::WriteTo(SnapshotWriter* writer, |
| 1015 intptr_t object_id, | 980 intptr_t object_id, |
| 1016 Snapshot::Kind kind, | 981 Snapshot::Kind kind, |
| 1017 bool as_reference) { | 982 bool as_reference) { |
| 1018 ASSERT(writer != NULL); | 983 ASSERT(writer != NULL); |
| 1019 ASSERT(kind == Snapshot::kScript); | 984 ASSERT(kind == Snapshot::kScript); |
| 1020 | 985 |
| 1021 // Write out the serialization header value for this object. | 986 // Write out the serialization header value for this object. |
| 1022 writer->WriteInlinedObjectHeader(object_id); | 987 writer->WriteInlinedObjectHeader(object_id); |
| 1023 | 988 |
| 1024 // Write out the class and tags information. | 989 // Write out the class and tags information. |
| 1025 writer->WriteVMIsolateObject(kTokenStreamCid); | 990 writer->WriteVMIsolateObject(kTokenStreamCid); |
| 1026 writer->WriteTags(writer->GetObjectTags(this)); | 991 writer->WriteTags(writer->GetObjectTags(this)); |
| 1027 | 992 |
| 1028 // Write out the length field and the token stream. | 993 // Write out the length field and the token stream. |
| 1029 RawExternalTypedData* stream = ptr()->stream_; | 994 RawExternalTypedData* stream = ptr()->stream_; |
| 1030 intptr_t len = Smi::Value(stream->ptr()->length_); | 995 intptr_t len = Smi::Value(stream->ptr()->length_); |
| 1031 writer->Write<RawObject*>(stream->ptr()->length_); | 996 writer->Write<RawObject*>(stream->ptr()->length_); |
| 1032 writer->WriteBytes(stream->ptr()->data_, len); | 997 writer->WriteBytes(stream->ptr()->data_, len); |
| 1033 | 998 |
| 1034 // Write out the literal/identifier token array. | 999 // Write out the literal/identifier token array. |
| 1035 writer->WriteObjectImpl(ptr()->token_objects_, kAsInlinedObject); | 1000 writer->WriteObjectImpl(ptr()->token_objects_, kAsInlinedObject); |
| 1036 // Write out the private key in use by the token stream. | 1001 // Write out the private key in use by the token stream. |
| 1037 writer->WriteObjectImpl(ptr()->private_key_, kAsInlinedObject); | 1002 writer->WriteObjectImpl(ptr()->private_key_, kAsInlinedObject); |
| 1038 } | 1003 } |
| 1039 | 1004 |
| 1040 | |
| 1041 RawScript* Script::ReadFrom(SnapshotReader* reader, | 1005 RawScript* Script::ReadFrom(SnapshotReader* reader, |
| 1042 intptr_t object_id, | 1006 intptr_t object_id, |
| 1043 intptr_t tags, | 1007 intptr_t tags, |
| 1044 Snapshot::Kind kind, | 1008 Snapshot::Kind kind, |
| 1045 bool as_reference) { | 1009 bool as_reference) { |
| 1046 ASSERT(reader != NULL); | 1010 ASSERT(reader != NULL); |
| 1047 ASSERT(kind == Snapshot::kScript); | 1011 ASSERT(kind == Snapshot::kScript); |
| 1048 | 1012 |
| 1049 // Allocate script object. | 1013 // Allocate script object. |
| 1050 Script& script = Script::ZoneHandle(reader->zone(), Script::New()); | 1014 Script& script = Script::ZoneHandle(reader->zone(), Script::New()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1070 script.StorePointer((script.raw()->from() + i), | 1034 script.StorePointer((script.raw()->from() + i), |
| 1071 reader->PassiveObjectHandle()->raw()); | 1035 reader->PassiveObjectHandle()->raw()); |
| 1072 } | 1036 } |
| 1073 | 1037 |
| 1074 script.set_load_timestamp( | 1038 script.set_load_timestamp( |
| 1075 FLAG_remove_script_timestamps_for_test ? 0 : OS::GetCurrentTimeMillis()); | 1039 FLAG_remove_script_timestamps_for_test ? 0 : OS::GetCurrentTimeMillis()); |
| 1076 | 1040 |
| 1077 return script.raw(); | 1041 return script.raw(); |
| 1078 } | 1042 } |
| 1079 | 1043 |
| 1080 | |
| 1081 void RawScript::WriteTo(SnapshotWriter* writer, | 1044 void RawScript::WriteTo(SnapshotWriter* writer, |
| 1082 intptr_t object_id, | 1045 intptr_t object_id, |
| 1083 Snapshot::Kind kind, | 1046 Snapshot::Kind kind, |
| 1084 bool as_reference) { | 1047 bool as_reference) { |
| 1085 ASSERT(writer != NULL); | 1048 ASSERT(writer != NULL); |
| 1086 ASSERT(tokens_ != TokenStream::null()); | 1049 ASSERT(tokens_ != TokenStream::null()); |
| 1087 ASSERT(kind == Snapshot::kScript); | 1050 ASSERT(kind == Snapshot::kScript); |
| 1088 | 1051 |
| 1089 // Write out the serialization header value for this object. | 1052 // Write out the serialization header value for this object. |
| 1090 writer->WriteInlinedObjectHeader(object_id); | 1053 writer->WriteInlinedObjectHeader(object_id); |
| 1091 | 1054 |
| 1092 // Write out the class and tags information. | 1055 // Write out the class and tags information. |
| 1093 writer->WriteVMIsolateObject(kScriptCid); | 1056 writer->WriteVMIsolateObject(kScriptCid); |
| 1094 writer->WriteTags(writer->GetObjectTags(this)); | 1057 writer->WriteTags(writer->GetObjectTags(this)); |
| 1095 | 1058 |
| 1096 // Write out all the non object fields. | 1059 // Write out all the non object fields. |
| 1097 writer->Write<int32_t>(ptr()->line_offset_); | 1060 writer->Write<int32_t>(ptr()->line_offset_); |
| 1098 writer->Write<int32_t>(ptr()->col_offset_); | 1061 writer->Write<int32_t>(ptr()->col_offset_); |
| 1099 writer->Write<int8_t>(ptr()->kind_); | 1062 writer->Write<int8_t>(ptr()->kind_); |
| 1100 | 1063 |
| 1101 // Write out all the object pointer fields. | 1064 // Write out all the object pointer fields. |
| 1102 SnapshotWriterVisitor visitor(writer, kAsReference); | 1065 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1103 visitor.VisitPointers(from(), to_snapshot(kind)); | 1066 visitor.VisitPointers(from(), to_snapshot(kind)); |
| 1104 } | 1067 } |
| 1105 | 1068 |
| 1106 | |
| 1107 RawLibrary* Library::ReadFrom(SnapshotReader* reader, | 1069 RawLibrary* Library::ReadFrom(SnapshotReader* reader, |
| 1108 intptr_t object_id, | 1070 intptr_t object_id, |
| 1109 intptr_t tags, | 1071 intptr_t tags, |
| 1110 Snapshot::Kind kind, | 1072 Snapshot::Kind kind, |
| 1111 bool as_reference) { | 1073 bool as_reference) { |
| 1112 ASSERT(reader != NULL); | 1074 ASSERT(reader != NULL); |
| 1113 ASSERT(kind != Snapshot::kMessage); | 1075 ASSERT(kind != Snapshot::kMessage); |
| 1114 | 1076 |
| 1115 Library& library = Library::ZoneHandle(reader->zone(), Library::null()); | 1077 Library& library = Library::ZoneHandle(reader->zone(), Library::null()); |
| 1116 reader->AddBackRef(object_id, &library, kIsDeserialized); | 1078 reader->AddBackRef(object_id, &library, kIsDeserialized); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1155 } | 1117 } |
| 1156 // Initialize caches that are not serialized. | 1118 // Initialize caches that are not serialized. |
| 1157 library.StorePointer(&library.raw_ptr()->resolved_names_, Array::null()); | 1119 library.StorePointer(&library.raw_ptr()->resolved_names_, Array::null()); |
| 1158 library.StorePointer(&library.raw_ptr()->exported_names_, Array::null()); | 1120 library.StorePointer(&library.raw_ptr()->exported_names_, Array::null()); |
| 1159 library.StorePointer(&library.raw_ptr()->loaded_scripts_, Array::null()); | 1121 library.StorePointer(&library.raw_ptr()->loaded_scripts_, Array::null()); |
| 1160 library.Register(reader->thread()); | 1122 library.Register(reader->thread()); |
| 1161 } | 1123 } |
| 1162 return library.raw(); | 1124 return library.raw(); |
| 1163 } | 1125 } |
| 1164 | 1126 |
| 1165 | |
| 1166 void RawLibrary::WriteTo(SnapshotWriter* writer, | 1127 void RawLibrary::WriteTo(SnapshotWriter* writer, |
| 1167 intptr_t object_id, | 1128 intptr_t object_id, |
| 1168 Snapshot::Kind kind, | 1129 Snapshot::Kind kind, |
| 1169 bool as_reference) { | 1130 bool as_reference) { |
| 1170 ASSERT(writer != NULL); | 1131 ASSERT(writer != NULL); |
| 1171 ASSERT(kind != Snapshot::kMessage); | 1132 ASSERT(kind != Snapshot::kMessage); |
| 1172 | 1133 |
| 1173 // Write out the serialization header value for this object. | 1134 // Write out the serialization header value for this object. |
| 1174 writer->WriteInlinedObjectHeader(object_id); | 1135 writer->WriteInlinedObjectHeader(object_id); |
| 1175 | 1136 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1200 | 1161 |
| 1201 // We do not write the loaded_scripts_ and resolved_names_ caches to the | 1162 // We do not write the loaded_scripts_ and resolved_names_ caches to the |
| 1202 // snapshot. They get initialized when reading the library from the | 1163 // snapshot. They get initialized when reading the library from the |
| 1203 // snapshot and will be rebuilt lazily. | 1164 // snapshot and will be rebuilt lazily. |
| 1204 // Write out all the object pointer fields. | 1165 // Write out all the object pointer fields. |
| 1205 SnapshotWriterVisitor visitor(writer, kAsReference); | 1166 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1206 visitor.VisitPointers(from(), to_snapshot()); | 1167 visitor.VisitPointers(from(), to_snapshot()); |
| 1207 } | 1168 } |
| 1208 } | 1169 } |
| 1209 | 1170 |
| 1210 | |
| 1211 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, | 1171 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, |
| 1212 intptr_t object_id, | 1172 intptr_t object_id, |
| 1213 intptr_t tags, | 1173 intptr_t tags, |
| 1214 Snapshot::Kind kind, | 1174 Snapshot::Kind kind, |
| 1215 bool as_reference) { | 1175 bool as_reference) { |
| 1216 ASSERT(reader != NULL); | 1176 ASSERT(reader != NULL); |
| 1217 ASSERT(kind == Snapshot::kScript); | 1177 ASSERT(kind == Snapshot::kScript); |
| 1218 | 1178 |
| 1219 // Allocate library prefix object. | 1179 // Allocate library prefix object. |
| 1220 LibraryPrefix& prefix = | 1180 LibraryPrefix& prefix = |
| 1221 LibraryPrefix::ZoneHandle(reader->zone(), LibraryPrefix::New()); | 1181 LibraryPrefix::ZoneHandle(reader->zone(), LibraryPrefix::New()); |
| 1222 reader->AddBackRef(object_id, &prefix, kIsDeserialized); | 1182 reader->AddBackRef(object_id, &prefix, kIsDeserialized); |
| 1223 | 1183 |
| 1224 // Set all non object fields. | 1184 // Set all non object fields. |
| 1225 prefix.StoreNonPointer(&prefix.raw_ptr()->num_imports_, | 1185 prefix.StoreNonPointer(&prefix.raw_ptr()->num_imports_, |
| 1226 reader->Read<int16_t>()); | 1186 reader->Read<int16_t>()); |
| 1227 prefix.StoreNonPointer(&prefix.raw_ptr()->is_deferred_load_, | 1187 prefix.StoreNonPointer(&prefix.raw_ptr()->is_deferred_load_, |
| 1228 reader->Read<bool>()); | 1188 reader->Read<bool>()); |
| 1229 prefix.StoreNonPointer(&prefix.raw_ptr()->is_loaded_, | 1189 prefix.StoreNonPointer(&prefix.raw_ptr()->is_loaded_, |
| 1230 !prefix.raw_ptr()->is_deferred_load_); | 1190 !prefix.raw_ptr()->is_deferred_load_); |
| 1231 | 1191 |
| 1232 // Set all the object fields. | 1192 // Set all the object fields. |
| 1233 READ_OBJECT_FIELDS(prefix, prefix.raw()->from(), | 1193 READ_OBJECT_FIELDS(prefix, prefix.raw()->from(), |
| 1234 prefix.raw()->to_snapshot(kind), kAsReference); | 1194 prefix.raw()->to_snapshot(kind), kAsReference); |
| 1235 prefix.StorePointer(&prefix.raw_ptr()->dependent_code_, Array::null()); | 1195 prefix.StorePointer(&prefix.raw_ptr()->dependent_code_, Array::null()); |
| 1236 | 1196 |
| 1237 return prefix.raw(); | 1197 return prefix.raw(); |
| 1238 } | 1198 } |
| 1239 | 1199 |
| 1240 | |
| 1241 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, | 1200 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, |
| 1242 intptr_t object_id, | 1201 intptr_t object_id, |
| 1243 Snapshot::Kind kind, | 1202 Snapshot::Kind kind, |
| 1244 bool as_reference) { | 1203 bool as_reference) { |
| 1245 ASSERT(writer != NULL); | 1204 ASSERT(writer != NULL); |
| 1246 ASSERT(kind == Snapshot::kScript); | 1205 ASSERT(kind == Snapshot::kScript); |
| 1247 | 1206 |
| 1248 // Write out the serialization header value for this object. | 1207 // Write out the serialization header value for this object. |
| 1249 writer->WriteInlinedObjectHeader(object_id); | 1208 writer->WriteInlinedObjectHeader(object_id); |
| 1250 | 1209 |
| 1251 // Write out the class and tags information. | 1210 // Write out the class and tags information. |
| 1252 writer->WriteIndexedObject(kLibraryPrefixCid); | 1211 writer->WriteIndexedObject(kLibraryPrefixCid); |
| 1253 writer->WriteTags(writer->GetObjectTags(this)); | 1212 writer->WriteTags(writer->GetObjectTags(this)); |
| 1254 | 1213 |
| 1255 // Write out all non object fields. | 1214 // Write out all non object fields. |
| 1256 writer->Write<int16_t>(ptr()->num_imports_); | 1215 writer->Write<int16_t>(ptr()->num_imports_); |
| 1257 writer->Write<bool>(ptr()->is_deferred_load_); | 1216 writer->Write<bool>(ptr()->is_deferred_load_); |
| 1258 | 1217 |
| 1259 // Write out all the object pointer fields. | 1218 // Write out all the object pointer fields. |
| 1260 SnapshotWriterVisitor visitor(writer, kAsReference); | 1219 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1261 visitor.VisitPointers(from(), to_snapshot(kind)); | 1220 visitor.VisitPointers(from(), to_snapshot(kind)); |
| 1262 } | 1221 } |
| 1263 | 1222 |
| 1264 | |
| 1265 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, | 1223 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, |
| 1266 intptr_t object_id, | 1224 intptr_t object_id, |
| 1267 intptr_t tags, | 1225 intptr_t tags, |
| 1268 Snapshot::Kind kind, | 1226 Snapshot::Kind kind, |
| 1269 bool as_reference) { | 1227 bool as_reference) { |
| 1270 ASSERT(reader != NULL); | 1228 ASSERT(reader != NULL); |
| 1271 ASSERT(kind == Snapshot::kScript); | 1229 ASSERT(kind == Snapshot::kScript); |
| 1272 | 1230 |
| 1273 // Allocate Namespace object. | 1231 // Allocate Namespace object. |
| 1274 Namespace& ns = Namespace::ZoneHandle(reader->zone(), Namespace::New()); | 1232 Namespace& ns = Namespace::ZoneHandle(reader->zone(), Namespace::New()); |
| 1275 reader->AddBackRef(object_id, &ns, kIsDeserialized); | 1233 reader->AddBackRef(object_id, &ns, kIsDeserialized); |
| 1276 | 1234 |
| 1277 // Set all the object fields. | 1235 // Set all the object fields. |
| 1278 READ_OBJECT_FIELDS(ns, ns.raw()->from(), ns.raw()->to(), kAsReference); | 1236 READ_OBJECT_FIELDS(ns, ns.raw()->from(), ns.raw()->to(), kAsReference); |
| 1279 | 1237 |
| 1280 return ns.raw(); | 1238 return ns.raw(); |
| 1281 } | 1239 } |
| 1282 | 1240 |
| 1283 | |
| 1284 void RawNamespace::WriteTo(SnapshotWriter* writer, | 1241 void RawNamespace::WriteTo(SnapshotWriter* writer, |
| 1285 intptr_t object_id, | 1242 intptr_t object_id, |
| 1286 Snapshot::Kind kind, | 1243 Snapshot::Kind kind, |
| 1287 bool as_reference) { | 1244 bool as_reference) { |
| 1288 ASSERT(writer != NULL); | 1245 ASSERT(writer != NULL); |
| 1289 ASSERT(kind == Snapshot::kScript); | 1246 ASSERT(kind == Snapshot::kScript); |
| 1290 | 1247 |
| 1291 // Write out the serialization header value for this object. | 1248 // Write out the serialization header value for this object. |
| 1292 writer->WriteInlinedObjectHeader(object_id); | 1249 writer->WriteInlinedObjectHeader(object_id); |
| 1293 | 1250 |
| 1294 // Write out the class and tags information. | 1251 // Write out the class and tags information. |
| 1295 writer->WriteVMIsolateObject(kNamespaceCid); | 1252 writer->WriteVMIsolateObject(kNamespaceCid); |
| 1296 writer->WriteTags(writer->GetObjectTags(this)); | 1253 writer->WriteTags(writer->GetObjectTags(this)); |
| 1297 | 1254 |
| 1298 // Write out all the object pointer fields. | 1255 // Write out all the object pointer fields. |
| 1299 SnapshotWriterVisitor visitor(writer, kAsReference); | 1256 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1300 visitor.VisitPointers(from(), to()); | 1257 visitor.VisitPointers(from(), to()); |
| 1301 } | 1258 } |
| 1302 | 1259 |
| 1303 | |
| 1304 RawCode* Code::ReadFrom(SnapshotReader* reader, | 1260 RawCode* Code::ReadFrom(SnapshotReader* reader, |
| 1305 intptr_t object_id, | 1261 intptr_t object_id, |
| 1306 intptr_t tags, | 1262 intptr_t tags, |
| 1307 Snapshot::Kind kind, | 1263 Snapshot::Kind kind, |
| 1308 bool as_reference) { | 1264 bool as_reference) { |
| 1309 UNREACHABLE(); | 1265 UNREACHABLE(); |
| 1310 return Code::null(); | 1266 return Code::null(); |
| 1311 } | 1267 } |
| 1312 | 1268 |
| 1313 | |
| 1314 void RawCode::WriteTo(SnapshotWriter* writer, | 1269 void RawCode::WriteTo(SnapshotWriter* writer, |
| 1315 intptr_t object_id, | 1270 intptr_t object_id, |
| 1316 Snapshot::Kind kind, | 1271 Snapshot::Kind kind, |
| 1317 bool as_reference) { | 1272 bool as_reference) { |
| 1318 UNREACHABLE(); | 1273 UNREACHABLE(); |
| 1319 } | 1274 } |
| 1320 | 1275 |
| 1321 | |
| 1322 RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, | 1276 RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, |
| 1323 intptr_t object_id, | 1277 intptr_t object_id, |
| 1324 intptr_t tags, | 1278 intptr_t tags, |
| 1325 Snapshot::Kind kind, | 1279 Snapshot::Kind kind, |
| 1326 bool as_reference) { | 1280 bool as_reference) { |
| 1327 UNREACHABLE(); | 1281 UNREACHABLE(); |
| 1328 return Instructions::null(); | 1282 return Instructions::null(); |
| 1329 } | 1283 } |
| 1330 | 1284 |
| 1331 | |
| 1332 void RawInstructions::WriteTo(SnapshotWriter* writer, | 1285 void RawInstructions::WriteTo(SnapshotWriter* writer, |
| 1333 intptr_t object_id, | 1286 intptr_t object_id, |
| 1334 Snapshot::Kind kind, | 1287 Snapshot::Kind kind, |
| 1335 bool as_reference) { | 1288 bool as_reference) { |
| 1336 UNREACHABLE(); | 1289 UNREACHABLE(); |
| 1337 } | 1290 } |
| 1338 | 1291 |
| 1339 | |
| 1340 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, | 1292 RawObjectPool* ObjectPool::ReadFrom(SnapshotReader* reader, |
| 1341 intptr_t object_id, | 1293 intptr_t object_id, |
| 1342 intptr_t tags, | 1294 intptr_t tags, |
| 1343 Snapshot::Kind kind, | 1295 Snapshot::Kind kind, |
| 1344 bool as_reference) { | 1296 bool as_reference) { |
| 1345 UNREACHABLE(); | 1297 UNREACHABLE(); |
| 1346 return ObjectPool::null(); | 1298 return ObjectPool::null(); |
| 1347 } | 1299 } |
| 1348 | 1300 |
| 1349 | |
| 1350 void RawObjectPool::WriteTo(SnapshotWriter* writer, | 1301 void RawObjectPool::WriteTo(SnapshotWriter* writer, |
| 1351 intptr_t object_id, | 1302 intptr_t object_id, |
| 1352 Snapshot::Kind kind, | 1303 Snapshot::Kind kind, |
| 1353 bool as_reference) { | 1304 bool as_reference) { |
| 1354 UNREACHABLE(); | 1305 UNREACHABLE(); |
| 1355 } | 1306 } |
| 1356 | 1307 |
| 1357 | |
| 1358 RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader, | 1308 RawPcDescriptors* PcDescriptors::ReadFrom(SnapshotReader* reader, |
| 1359 intptr_t object_id, | 1309 intptr_t object_id, |
| 1360 intptr_t tags, | 1310 intptr_t tags, |
| 1361 Snapshot::Kind kind, | 1311 Snapshot::Kind kind, |
| 1362 bool as_reference) { | 1312 bool as_reference) { |
| 1363 UNREACHABLE(); | 1313 UNREACHABLE(); |
| 1364 return PcDescriptors::null(); | 1314 return PcDescriptors::null(); |
| 1365 } | 1315 } |
| 1366 | 1316 |
| 1367 | |
| 1368 void RawPcDescriptors::WriteTo(SnapshotWriter* writer, | 1317 void RawPcDescriptors::WriteTo(SnapshotWriter* writer, |
| 1369 intptr_t object_id, | 1318 intptr_t object_id, |
| 1370 Snapshot::Kind kind, | 1319 Snapshot::Kind kind, |
| 1371 bool as_reference) { | 1320 bool as_reference) { |
| 1372 UNREACHABLE(); | 1321 UNREACHABLE(); |
| 1373 } | 1322 } |
| 1374 | 1323 |
| 1375 | |
| 1376 RawCodeSourceMap* CodeSourceMap::ReadFrom(SnapshotReader* reader, | 1324 RawCodeSourceMap* CodeSourceMap::ReadFrom(SnapshotReader* reader, |
| 1377 intptr_t object_id, | 1325 intptr_t object_id, |
| 1378 intptr_t tags, | 1326 intptr_t tags, |
| 1379 Snapshot::Kind kind, | 1327 Snapshot::Kind kind, |
| 1380 bool as_reference) { | 1328 bool as_reference) { |
| 1381 UNREACHABLE(); | 1329 UNREACHABLE(); |
| 1382 return CodeSourceMap::null(); | 1330 return CodeSourceMap::null(); |
| 1383 } | 1331 } |
| 1384 | 1332 |
| 1385 | |
| 1386 void RawCodeSourceMap::WriteTo(SnapshotWriter* writer, | 1333 void RawCodeSourceMap::WriteTo(SnapshotWriter* writer, |
| 1387 intptr_t object_id, | 1334 intptr_t object_id, |
| 1388 Snapshot::Kind kind, | 1335 Snapshot::Kind kind, |
| 1389 bool as_reference) { | 1336 bool as_reference) { |
| 1390 UNREACHABLE(); | 1337 UNREACHABLE(); |
| 1391 } | 1338 } |
| 1392 | 1339 |
| 1393 | |
| 1394 RawStackMap* StackMap::ReadFrom(SnapshotReader* reader, | 1340 RawStackMap* StackMap::ReadFrom(SnapshotReader* reader, |
| 1395 intptr_t object_id, | 1341 intptr_t object_id, |
| 1396 intptr_t tags, | 1342 intptr_t tags, |
| 1397 Snapshot::Kind kind, | 1343 Snapshot::Kind kind, |
| 1398 bool as_reference) { | 1344 bool as_reference) { |
| 1399 UNREACHABLE(); | 1345 UNREACHABLE(); |
| 1400 return StackMap::null(); | 1346 return StackMap::null(); |
| 1401 } | 1347 } |
| 1402 | 1348 |
| 1403 | |
| 1404 void RawStackMap::WriteTo(SnapshotWriter* writer, | 1349 void RawStackMap::WriteTo(SnapshotWriter* writer, |
| 1405 intptr_t object_id, | 1350 intptr_t object_id, |
| 1406 Snapshot::Kind kind, | 1351 Snapshot::Kind kind, |
| 1407 bool as_reference) { | 1352 bool as_reference) { |
| 1408 UNREACHABLE(); | 1353 UNREACHABLE(); |
| 1409 } | 1354 } |
| 1410 | 1355 |
| 1411 | |
| 1412 RawLocalVarDescriptors* LocalVarDescriptors::ReadFrom(SnapshotReader* reader, | 1356 RawLocalVarDescriptors* LocalVarDescriptors::ReadFrom(SnapshotReader* reader, |
| 1413 intptr_t object_id, | 1357 intptr_t object_id, |
| 1414 intptr_t tags, | 1358 intptr_t tags, |
| 1415 Snapshot::Kind kind, | 1359 Snapshot::Kind kind, |
| 1416 bool as_reference) { | 1360 bool as_reference) { |
| 1417 UNREACHABLE(); | 1361 UNREACHABLE(); |
| 1418 return LocalVarDescriptors::null(); | 1362 return LocalVarDescriptors::null(); |
| 1419 } | 1363 } |
| 1420 | 1364 |
| 1421 | |
| 1422 void RawLocalVarDescriptors::WriteTo(SnapshotWriter* writer, | 1365 void RawLocalVarDescriptors::WriteTo(SnapshotWriter* writer, |
| 1423 intptr_t object_id, | 1366 intptr_t object_id, |
| 1424 Snapshot::Kind kind, | 1367 Snapshot::Kind kind, |
| 1425 bool as_reference) { | 1368 bool as_reference) { |
| 1426 UNREACHABLE(); | 1369 UNREACHABLE(); |
| 1427 } | 1370 } |
| 1428 | 1371 |
| 1429 | |
| 1430 RawExceptionHandlers* ExceptionHandlers::ReadFrom(SnapshotReader* reader, | 1372 RawExceptionHandlers* ExceptionHandlers::ReadFrom(SnapshotReader* reader, |
| 1431 intptr_t object_id, | 1373 intptr_t object_id, |
| 1432 intptr_t tags, | 1374 intptr_t tags, |
| 1433 Snapshot::Kind kind, | 1375 Snapshot::Kind kind, |
| 1434 bool as_reference) { | 1376 bool as_reference) { |
| 1435 UNREACHABLE(); | 1377 UNREACHABLE(); |
| 1436 return ExceptionHandlers::null(); | 1378 return ExceptionHandlers::null(); |
| 1437 } | 1379 } |
| 1438 | 1380 |
| 1439 | |
| 1440 void RawExceptionHandlers::WriteTo(SnapshotWriter* writer, | 1381 void RawExceptionHandlers::WriteTo(SnapshotWriter* writer, |
| 1441 intptr_t object_id, | 1382 intptr_t object_id, |
| 1442 Snapshot::Kind kind, | 1383 Snapshot::Kind kind, |
| 1443 bool as_reference) { | 1384 bool as_reference) { |
| 1444 UNREACHABLE(); | 1385 UNREACHABLE(); |
| 1445 } | 1386 } |
| 1446 | 1387 |
| 1447 | |
| 1448 RawContext* Context::ReadFrom(SnapshotReader* reader, | 1388 RawContext* Context::ReadFrom(SnapshotReader* reader, |
| 1449 intptr_t object_id, | 1389 intptr_t object_id, |
| 1450 intptr_t tags, | 1390 intptr_t tags, |
| 1451 Snapshot::Kind kind, | 1391 Snapshot::Kind kind, |
| 1452 bool as_reference) { | 1392 bool as_reference) { |
| 1453 ASSERT(reader != NULL); | 1393 ASSERT(reader != NULL); |
| 1454 | 1394 |
| 1455 // Allocate context object. | 1395 // Allocate context object. |
| 1456 int32_t num_vars = reader->Read<int32_t>(); | 1396 int32_t num_vars = reader->Read<int32_t>(); |
| 1457 Context& context = Context::ZoneHandle(reader->zone()); | 1397 Context& context = Context::ZoneHandle(reader->zone()); |
| 1458 reader->AddBackRef(object_id, &context, kIsDeserialized); | 1398 reader->AddBackRef(object_id, &context, kIsDeserialized); |
| 1459 if (num_vars == 0) { | 1399 if (num_vars == 0) { |
| 1460 context ^= Object::empty_context().raw(); | 1400 context ^= Object::empty_context().raw(); |
| 1461 } else { | 1401 } else { |
| 1462 context ^= Context::New(num_vars); | 1402 context ^= Context::New(num_vars); |
| 1463 | 1403 |
| 1464 // Set all the object fields. | 1404 // Set all the object fields. |
| 1465 // TODO(5411462): Need to assert No GC can happen here, even though | 1405 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1466 // allocations may happen. | 1406 // allocations may happen. |
| 1467 intptr_t num_flds = (context.raw()->to(num_vars) - context.raw()->from()); | 1407 intptr_t num_flds = (context.raw()->to(num_vars) - context.raw()->from()); |
| 1468 for (intptr_t i = 0; i <= num_flds; i++) { | 1408 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1469 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); | 1409 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); |
| 1470 context.StorePointer((context.raw()->from() + i), | 1410 context.StorePointer((context.raw()->from() + i), |
| 1471 reader->PassiveObjectHandle()->raw()); | 1411 reader->PassiveObjectHandle()->raw()); |
| 1472 } | 1412 } |
| 1473 } | 1413 } |
| 1474 return context.raw(); | 1414 return context.raw(); |
| 1475 } | 1415 } |
| 1476 | 1416 |
| 1477 | |
| 1478 void RawContext::WriteTo(SnapshotWriter* writer, | 1417 void RawContext::WriteTo(SnapshotWriter* writer, |
| 1479 intptr_t object_id, | 1418 intptr_t object_id, |
| 1480 Snapshot::Kind kind, | 1419 Snapshot::Kind kind, |
| 1481 bool as_reference) { | 1420 bool as_reference) { |
| 1482 ASSERT(writer != NULL); | 1421 ASSERT(writer != NULL); |
| 1483 | 1422 |
| 1484 // Write out the serialization header value for this object. | 1423 // Write out the serialization header value for this object. |
| 1485 writer->WriteInlinedObjectHeader(object_id); | 1424 writer->WriteInlinedObjectHeader(object_id); |
| 1486 | 1425 |
| 1487 // Write out the class and tags information. | 1426 // Write out the class and tags information. |
| 1488 writer->WriteVMIsolateObject(kContextCid); | 1427 writer->WriteVMIsolateObject(kContextCid); |
| 1489 writer->WriteTags(writer->GetObjectTags(this)); | 1428 writer->WriteTags(writer->GetObjectTags(this)); |
| 1490 | 1429 |
| 1491 // Write out num of variables in the context. | 1430 // Write out num of variables in the context. |
| 1492 int32_t num_variables = ptr()->num_variables_; | 1431 int32_t num_variables = ptr()->num_variables_; |
| 1493 writer->Write<int32_t>(num_variables); | 1432 writer->Write<int32_t>(num_variables); |
| 1494 if (num_variables != 0) { | 1433 if (num_variables != 0) { |
| 1495 // Write out all the object pointer fields. | 1434 // Write out all the object pointer fields. |
| 1496 SnapshotWriterVisitor visitor(writer, kAsReference); | 1435 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1497 visitor.VisitPointers(from(), to(num_variables)); | 1436 visitor.VisitPointers(from(), to(num_variables)); |
| 1498 } | 1437 } |
| 1499 } | 1438 } |
| 1500 | 1439 |
| 1501 | |
| 1502 RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, | 1440 RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, |
| 1503 intptr_t object_id, | 1441 intptr_t object_id, |
| 1504 intptr_t tags, | 1442 intptr_t tags, |
| 1505 Snapshot::Kind kind, | 1443 Snapshot::Kind kind, |
| 1506 bool as_reference) { | 1444 bool as_reference) { |
| 1507 ASSERT(reader != NULL); | 1445 ASSERT(reader != NULL); |
| 1508 | 1446 |
| 1509 // Allocate context object. | 1447 // Allocate context object. |
| 1510 bool is_implicit = reader->Read<bool>(); | 1448 bool is_implicit = reader->Read<bool>(); |
| 1511 if (is_implicit) { | 1449 if (is_implicit) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1523 context_scope.SetIsConstAt(0, false); | 1461 context_scope.SetIsConstAt(0, false); |
| 1524 context_scope.SetTypeAt(0, *reader->TypeHandle()); | 1462 context_scope.SetTypeAt(0, *reader->TypeHandle()); |
| 1525 context_scope.SetContextIndexAt(0, 0); | 1463 context_scope.SetContextIndexAt(0, 0); |
| 1526 context_scope.SetContextLevelAt(0, 0); | 1464 context_scope.SetContextLevelAt(0, 0); |
| 1527 return context_scope.raw(); | 1465 return context_scope.raw(); |
| 1528 } | 1466 } |
| 1529 UNREACHABLE(); | 1467 UNREACHABLE(); |
| 1530 return NULL; | 1468 return NULL; |
| 1531 } | 1469 } |
| 1532 | 1470 |
| 1533 | |
| 1534 void RawContextScope::WriteTo(SnapshotWriter* writer, | 1471 void RawContextScope::WriteTo(SnapshotWriter* writer, |
| 1535 intptr_t object_id, | 1472 intptr_t object_id, |
| 1536 Snapshot::Kind kind, | 1473 Snapshot::Kind kind, |
| 1537 bool as_reference) { | 1474 bool as_reference) { |
| 1538 ASSERT(writer != NULL); | 1475 ASSERT(writer != NULL); |
| 1539 | 1476 |
| 1540 if (ptr()->is_implicit_) { | 1477 if (ptr()->is_implicit_) { |
| 1541 ASSERT(ptr()->num_variables_ == 1); | 1478 ASSERT(ptr()->num_variables_ == 1); |
| 1542 const VariableDesc* var = ptr()->VariableDescAddr(0); | 1479 const VariableDesc* var = ptr()->VariableDescAddr(0); |
| 1543 | 1480 |
| 1544 // Write out the serialization header value for this object. | 1481 // Write out the serialization header value for this object. |
| 1545 writer->WriteInlinedObjectHeader(object_id); | 1482 writer->WriteInlinedObjectHeader(object_id); |
| 1546 | 1483 |
| 1547 // Write out the class and tags information. | 1484 // Write out the class and tags information. |
| 1548 writer->WriteVMIsolateObject(kContextScopeCid); | 1485 writer->WriteVMIsolateObject(kContextScopeCid); |
| 1549 writer->WriteTags(writer->GetObjectTags(this)); | 1486 writer->WriteTags(writer->GetObjectTags(this)); |
| 1550 | 1487 |
| 1551 // Write out is_implicit flag for the context scope. | 1488 // Write out is_implicit flag for the context scope. |
| 1552 writer->Write<bool>(true); | 1489 writer->Write<bool>(true); |
| 1553 | 1490 |
| 1554 // Write out the type of 'this' the variable. | 1491 // Write out the type of 'this' the variable. |
| 1555 writer->WriteObjectImpl(var->type, kAsInlinedObject); | 1492 writer->WriteObjectImpl(var->type, kAsInlinedObject); |
| 1556 | 1493 |
| 1557 return; | 1494 return; |
| 1558 } | 1495 } |
| 1559 UNREACHABLE(); | 1496 UNREACHABLE(); |
| 1560 } | 1497 } |
| 1561 | 1498 |
| 1562 | |
| 1563 RawSingleTargetCache* SingleTargetCache::ReadFrom(SnapshotReader* reader, | 1499 RawSingleTargetCache* SingleTargetCache::ReadFrom(SnapshotReader* reader, |
| 1564 intptr_t object_id, | 1500 intptr_t object_id, |
| 1565 intptr_t tags, | 1501 intptr_t tags, |
| 1566 Snapshot::Kind kind, | 1502 Snapshot::Kind kind, |
| 1567 bool as_reference) { | 1503 bool as_reference) { |
| 1568 UNREACHABLE(); | 1504 UNREACHABLE(); |
| 1569 return SingleTargetCache::null(); | 1505 return SingleTargetCache::null(); |
| 1570 } | 1506 } |
| 1571 | 1507 |
| 1572 | |
| 1573 void RawSingleTargetCache::WriteTo(SnapshotWriter* writer, | 1508 void RawSingleTargetCache::WriteTo(SnapshotWriter* writer, |
| 1574 intptr_t object_id, | 1509 intptr_t object_id, |
| 1575 Snapshot::Kind kind, | 1510 Snapshot::Kind kind, |
| 1576 bool as_reference) { | 1511 bool as_reference) { |
| 1577 UNREACHABLE(); | 1512 UNREACHABLE(); |
| 1578 } | 1513 } |
| 1579 | 1514 |
| 1580 | |
| 1581 RawUnlinkedCall* UnlinkedCall::ReadFrom(SnapshotReader* reader, | 1515 RawUnlinkedCall* UnlinkedCall::ReadFrom(SnapshotReader* reader, |
| 1582 intptr_t object_id, | 1516 intptr_t object_id, |
| 1583 intptr_t tags, | 1517 intptr_t tags, |
| 1584 Snapshot::Kind kind, | 1518 Snapshot::Kind kind, |
| 1585 bool as_reference) { | 1519 bool as_reference) { |
| 1586 UNREACHABLE(); | 1520 UNREACHABLE(); |
| 1587 return UnlinkedCall::null(); | 1521 return UnlinkedCall::null(); |
| 1588 } | 1522 } |
| 1589 | 1523 |
| 1590 | |
| 1591 void RawUnlinkedCall::WriteTo(SnapshotWriter* writer, | 1524 void RawUnlinkedCall::WriteTo(SnapshotWriter* writer, |
| 1592 intptr_t object_id, | 1525 intptr_t object_id, |
| 1593 Snapshot::Kind kind, | 1526 Snapshot::Kind kind, |
| 1594 bool as_reference) { | 1527 bool as_reference) { |
| 1595 UNREACHABLE(); | 1528 UNREACHABLE(); |
| 1596 } | 1529 } |
| 1597 | 1530 |
| 1598 | |
| 1599 RawICData* ICData::ReadFrom(SnapshotReader* reader, | 1531 RawICData* ICData::ReadFrom(SnapshotReader* reader, |
| 1600 intptr_t object_id, | 1532 intptr_t object_id, |
| 1601 intptr_t tags, | 1533 intptr_t tags, |
| 1602 Snapshot::Kind kind, | 1534 Snapshot::Kind kind, |
| 1603 bool as_reference) { | 1535 bool as_reference) { |
| 1604 ASSERT(kind == Snapshot::kScript); | 1536 ASSERT(kind == Snapshot::kScript); |
| 1605 | 1537 |
| 1606 ICData& result = ICData::ZoneHandle(reader->zone(), ICData::New()); | 1538 ICData& result = ICData::ZoneHandle(reader->zone(), ICData::New()); |
| 1607 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1539 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 1608 | 1540 |
| 1609 NOT_IN_PRECOMPILED(result.set_deopt_id(reader->Read<int32_t>())); | 1541 NOT_IN_PRECOMPILED(result.set_deopt_id(reader->Read<int32_t>())); |
| 1610 result.set_state_bits(reader->Read<uint32_t>()); | 1542 result.set_state_bits(reader->Read<uint32_t>()); |
| 1611 #if defined(TAG_IC_DATA) | 1543 #if defined(TAG_IC_DATA) |
| 1612 result.set_tag(reader->Read<int16_t>()); | 1544 result.set_tag(reader->Read<int16_t>()); |
| 1613 #endif | 1545 #endif |
| 1614 | 1546 |
| 1615 // Set all the object fields. | 1547 // Set all the object fields. |
| 1616 READ_OBJECT_FIELDS(result, result.raw()->from(), | 1548 READ_OBJECT_FIELDS(result, result.raw()->from(), |
| 1617 result.raw()->to_snapshot(kind), kAsReference); | 1549 result.raw()->to_snapshot(kind), kAsReference); |
| 1618 | 1550 |
| 1619 return result.raw(); | 1551 return result.raw(); |
| 1620 } | 1552 } |
| 1621 | 1553 |
| 1622 | |
| 1623 void RawICData::WriteTo(SnapshotWriter* writer, | 1554 void RawICData::WriteTo(SnapshotWriter* writer, |
| 1624 intptr_t object_id, | 1555 intptr_t object_id, |
| 1625 Snapshot::Kind kind, | 1556 Snapshot::Kind kind, |
| 1626 bool as_reference) { | 1557 bool as_reference) { |
| 1627 ASSERT(kind == Snapshot::kScript); | 1558 ASSERT(kind == Snapshot::kScript); |
| 1628 | 1559 |
| 1629 // Write out the serialization header value for this object. | 1560 // Write out the serialization header value for this object. |
| 1630 writer->WriteInlinedObjectHeader(object_id); | 1561 writer->WriteInlinedObjectHeader(object_id); |
| 1631 | 1562 |
| 1632 // Write out the class and tags information. | 1563 // Write out the class and tags information. |
| 1633 writer->WriteVMIsolateObject(kICDataCid); | 1564 writer->WriteVMIsolateObject(kICDataCid); |
| 1634 writer->WriteTags(writer->GetObjectTags(this)); | 1565 writer->WriteTags(writer->GetObjectTags(this)); |
| 1635 | 1566 |
| 1636 // Write out all the non object fields. | 1567 // Write out all the non object fields. |
| 1637 NOT_IN_PRECOMPILED(writer->Write<int32_t>(ptr()->deopt_id_)); | 1568 NOT_IN_PRECOMPILED(writer->Write<int32_t>(ptr()->deopt_id_)); |
| 1638 writer->Write<uint32_t>(ptr()->state_bits_); | 1569 writer->Write<uint32_t>(ptr()->state_bits_); |
| 1639 #if defined(TAG_IC_DATA) | 1570 #if defined(TAG_IC_DATA) |
| 1640 writer->Write<int16_t>(ptr()->tag_); | 1571 writer->Write<int16_t>(ptr()->tag_); |
| 1641 #endif | 1572 #endif |
| 1642 | 1573 |
| 1643 // Write out all the object pointer fields. | 1574 // Write out all the object pointer fields. |
| 1644 // In precompiled snapshots, omit the owner field. The owner field may | 1575 // In precompiled snapshots, omit the owner field. The owner field may |
| 1645 // refer to a function which was always inlined and no longer needed. | 1576 // refer to a function which was always inlined and no longer needed. |
| 1646 SnapshotWriterVisitor visitor(writer, kAsReference); | 1577 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1647 visitor.VisitPointers(from(), to_snapshot(kind)); | 1578 visitor.VisitPointers(from(), to_snapshot(kind)); |
| 1648 } | 1579 } |
| 1649 | 1580 |
| 1650 | |
| 1651 RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, | 1581 RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, |
| 1652 intptr_t object_id, | 1582 intptr_t object_id, |
| 1653 intptr_t tags, | 1583 intptr_t tags, |
| 1654 Snapshot::Kind kind, | 1584 Snapshot::Kind kind, |
| 1655 bool as_reference) { | 1585 bool as_reference) { |
| 1656 UNREACHABLE(); | 1586 UNREACHABLE(); |
| 1657 return MegamorphicCache::null(); | 1587 return MegamorphicCache::null(); |
| 1658 } | 1588 } |
| 1659 | 1589 |
| 1660 | |
| 1661 void RawMegamorphicCache::WriteTo(SnapshotWriter* writer, | 1590 void RawMegamorphicCache::WriteTo(SnapshotWriter* writer, |
| 1662 intptr_t object_id, | 1591 intptr_t object_id, |
| 1663 Snapshot::Kind kind, | 1592 Snapshot::Kind kind, |
| 1664 bool as_reference) { | 1593 bool as_reference) { |
| 1665 UNREACHABLE(); | 1594 UNREACHABLE(); |
| 1666 } | 1595 } |
| 1667 | 1596 |
| 1668 | |
| 1669 RawSubtypeTestCache* SubtypeTestCache::ReadFrom(SnapshotReader* reader, | 1597 RawSubtypeTestCache* SubtypeTestCache::ReadFrom(SnapshotReader* reader, |
| 1670 intptr_t object_id, | 1598 intptr_t object_id, |
| 1671 intptr_t tags, | 1599 intptr_t tags, |
| 1672 Snapshot::Kind kind, | 1600 Snapshot::Kind kind, |
| 1673 bool as_reference) { | 1601 bool as_reference) { |
| 1674 UNREACHABLE(); | 1602 UNREACHABLE(); |
| 1675 return SubtypeTestCache::null(); | 1603 return SubtypeTestCache::null(); |
| 1676 } | 1604 } |
| 1677 | 1605 |
| 1678 | |
| 1679 void RawSubtypeTestCache::WriteTo(SnapshotWriter* writer, | 1606 void RawSubtypeTestCache::WriteTo(SnapshotWriter* writer, |
| 1680 intptr_t object_id, | 1607 intptr_t object_id, |
| 1681 Snapshot::Kind kind, | 1608 Snapshot::Kind kind, |
| 1682 bool as_reference) { | 1609 bool as_reference) { |
| 1683 UNREACHABLE(); | 1610 UNREACHABLE(); |
| 1684 } | 1611 } |
| 1685 | 1612 |
| 1686 | |
| 1687 RawError* Error::ReadFrom(SnapshotReader* reader, | 1613 RawError* Error::ReadFrom(SnapshotReader* reader, |
| 1688 intptr_t object_id, | 1614 intptr_t object_id, |
| 1689 intptr_t tags, | 1615 intptr_t tags, |
| 1690 Snapshot::Kind kind, | 1616 Snapshot::Kind kind, |
| 1691 bool as_referenec) { | 1617 bool as_referenec) { |
| 1692 UNREACHABLE(); | 1618 UNREACHABLE(); |
| 1693 return Error::null(); // Error is an abstract class. | 1619 return Error::null(); // Error is an abstract class. |
| 1694 } | 1620 } |
| 1695 | 1621 |
| 1696 | |
| 1697 void RawError::WriteTo(SnapshotWriter* writer, | 1622 void RawError::WriteTo(SnapshotWriter* writer, |
| 1698 intptr_t object_id, | 1623 intptr_t object_id, |
| 1699 Snapshot::Kind kind, | 1624 Snapshot::Kind kind, |
| 1700 bool as_reference) { | 1625 bool as_reference) { |
| 1701 UNREACHABLE(); // Error is an abstract class. | 1626 UNREACHABLE(); // Error is an abstract class. |
| 1702 } | 1627 } |
| 1703 | 1628 |
| 1704 | |
| 1705 RawApiError* ApiError::ReadFrom(SnapshotReader* reader, | 1629 RawApiError* ApiError::ReadFrom(SnapshotReader* reader, |
| 1706 intptr_t object_id, | 1630 intptr_t object_id, |
| 1707 intptr_t tags, | 1631 intptr_t tags, |
| 1708 Snapshot::Kind kind, | 1632 Snapshot::Kind kind, |
| 1709 bool as_reference) { | 1633 bool as_reference) { |
| 1710 ASSERT(reader != NULL); | 1634 ASSERT(reader != NULL); |
| 1711 | 1635 |
| 1712 // Allocate ApiError object. | 1636 // Allocate ApiError object. |
| 1713 ApiError& api_error = ApiError::ZoneHandle(reader->zone(), ApiError::New()); | 1637 ApiError& api_error = ApiError::ZoneHandle(reader->zone(), ApiError::New()); |
| 1714 reader->AddBackRef(object_id, &api_error, kIsDeserialized); | 1638 reader->AddBackRef(object_id, &api_error, kIsDeserialized); |
| 1715 | 1639 |
| 1716 // Set all the object fields. | 1640 // Set all the object fields. |
| 1717 READ_OBJECT_FIELDS(api_error, api_error.raw()->from(), api_error.raw()->to(), | 1641 READ_OBJECT_FIELDS(api_error, api_error.raw()->from(), api_error.raw()->to(), |
| 1718 kAsReference); | 1642 kAsReference); |
| 1719 | 1643 |
| 1720 return api_error.raw(); | 1644 return api_error.raw(); |
| 1721 } | 1645 } |
| 1722 | 1646 |
| 1723 | |
| 1724 void RawApiError::WriteTo(SnapshotWriter* writer, | 1647 void RawApiError::WriteTo(SnapshotWriter* writer, |
| 1725 intptr_t object_id, | 1648 intptr_t object_id, |
| 1726 Snapshot::Kind kind, | 1649 Snapshot::Kind kind, |
| 1727 bool as_reference) { | 1650 bool as_reference) { |
| 1728 ASSERT(writer != NULL); | 1651 ASSERT(writer != NULL); |
| 1729 | 1652 |
| 1730 // Write out the serialization header value for this object. | 1653 // Write out the serialization header value for this object. |
| 1731 writer->WriteInlinedObjectHeader(object_id); | 1654 writer->WriteInlinedObjectHeader(object_id); |
| 1732 | 1655 |
| 1733 // Write out the class and tags information. | 1656 // Write out the class and tags information. |
| 1734 writer->WriteVMIsolateObject(kApiErrorCid); | 1657 writer->WriteVMIsolateObject(kApiErrorCid); |
| 1735 writer->WriteTags(writer->GetObjectTags(this)); | 1658 writer->WriteTags(writer->GetObjectTags(this)); |
| 1736 | 1659 |
| 1737 // Write out all the object pointer fields. | 1660 // Write out all the object pointer fields. |
| 1738 SnapshotWriterVisitor visitor(writer, kAsReference); | 1661 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1739 visitor.VisitPointers(from(), to()); | 1662 visitor.VisitPointers(from(), to()); |
| 1740 } | 1663 } |
| 1741 | 1664 |
| 1742 | |
| 1743 RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, | 1665 RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, |
| 1744 intptr_t object_id, | 1666 intptr_t object_id, |
| 1745 intptr_t tags, | 1667 intptr_t tags, |
| 1746 Snapshot::Kind kind, | 1668 Snapshot::Kind kind, |
| 1747 bool as_reference) { | 1669 bool as_reference) { |
| 1748 ASSERT(reader != NULL); | 1670 ASSERT(reader != NULL); |
| 1749 | 1671 |
| 1750 // Allocate LanguageError object. | 1672 // Allocate LanguageError object. |
| 1751 LanguageError& language_error = | 1673 LanguageError& language_error = |
| 1752 LanguageError::ZoneHandle(reader->zone(), LanguageError::New()); | 1674 LanguageError::ZoneHandle(reader->zone(), LanguageError::New()); |
| 1753 reader->AddBackRef(object_id, &language_error, kIsDeserialized); | 1675 reader->AddBackRef(object_id, &language_error, kIsDeserialized); |
| 1754 | 1676 |
| 1755 // Set all non object fields. | 1677 // Set all non object fields. |
| 1756 language_error.set_token_pos( | 1678 language_error.set_token_pos( |
| 1757 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); | 1679 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); |
| 1758 language_error.set_report_after_token(reader->Read<bool>()); | 1680 language_error.set_report_after_token(reader->Read<bool>()); |
| 1759 language_error.set_kind(reader->Read<uint8_t>()); | 1681 language_error.set_kind(reader->Read<uint8_t>()); |
| 1760 | 1682 |
| 1761 // Set all the object fields. | 1683 // Set all the object fields. |
| 1762 READ_OBJECT_FIELDS(language_error, language_error.raw()->from(), | 1684 READ_OBJECT_FIELDS(language_error, language_error.raw()->from(), |
| 1763 language_error.raw()->to(), kAsReference); | 1685 language_error.raw()->to(), kAsReference); |
| 1764 | 1686 |
| 1765 return language_error.raw(); | 1687 return language_error.raw(); |
| 1766 } | 1688 } |
| 1767 | 1689 |
| 1768 | |
| 1769 void RawLanguageError::WriteTo(SnapshotWriter* writer, | 1690 void RawLanguageError::WriteTo(SnapshotWriter* writer, |
| 1770 intptr_t object_id, | 1691 intptr_t object_id, |
| 1771 Snapshot::Kind kind, | 1692 Snapshot::Kind kind, |
| 1772 bool as_reference) { | 1693 bool as_reference) { |
| 1773 ASSERT(writer != NULL); | 1694 ASSERT(writer != NULL); |
| 1774 | 1695 |
| 1775 // Write out the serialization header value for this object. | 1696 // Write out the serialization header value for this object. |
| 1776 writer->WriteInlinedObjectHeader(object_id); | 1697 writer->WriteInlinedObjectHeader(object_id); |
| 1777 | 1698 |
| 1778 // Write out the class and tags information. | 1699 // Write out the class and tags information. |
| 1779 writer->WriteVMIsolateObject(kLanguageErrorCid); | 1700 writer->WriteVMIsolateObject(kLanguageErrorCid); |
| 1780 writer->WriteTags(writer->GetObjectTags(this)); | 1701 writer->WriteTags(writer->GetObjectTags(this)); |
| 1781 | 1702 |
| 1782 // Write out all the non object fields. | 1703 // Write out all the non object fields. |
| 1783 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); | 1704 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); |
| 1784 writer->Write<bool>(ptr()->report_after_token_); | 1705 writer->Write<bool>(ptr()->report_after_token_); |
| 1785 writer->Write<uint8_t>(ptr()->kind_); | 1706 writer->Write<uint8_t>(ptr()->kind_); |
| 1786 | 1707 |
| 1787 // Write out all the object pointer fields. | 1708 // Write out all the object pointer fields. |
| 1788 SnapshotWriterVisitor visitor(writer, kAsReference); | 1709 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1789 visitor.VisitPointers(from(), to()); | 1710 visitor.VisitPointers(from(), to()); |
| 1790 } | 1711 } |
| 1791 | 1712 |
| 1792 | |
| 1793 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, | 1713 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, |
| 1794 intptr_t object_id, | 1714 intptr_t object_id, |
| 1795 intptr_t tags, | 1715 intptr_t tags, |
| 1796 Snapshot::Kind kind, | 1716 Snapshot::Kind kind, |
| 1797 bool as_reference) { | 1717 bool as_reference) { |
| 1798 UnhandledException& result = | 1718 UnhandledException& result = |
| 1799 UnhandledException::ZoneHandle(reader->zone(), UnhandledException::New()); | 1719 UnhandledException::ZoneHandle(reader->zone(), UnhandledException::New()); |
| 1800 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1720 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 1801 | 1721 |
| 1802 // Set all the object fields. | 1722 // Set all the object fields. |
| 1803 READ_OBJECT_FIELDS(result, result.raw()->from(), result.raw()->to(), | 1723 READ_OBJECT_FIELDS(result, result.raw()->from(), result.raw()->to(), |
| 1804 kAsReference); | 1724 kAsReference); |
| 1805 | 1725 |
| 1806 return result.raw(); | 1726 return result.raw(); |
| 1807 } | 1727 } |
| 1808 | 1728 |
| 1809 | |
| 1810 void RawUnhandledException::WriteTo(SnapshotWriter* writer, | 1729 void RawUnhandledException::WriteTo(SnapshotWriter* writer, |
| 1811 intptr_t object_id, | 1730 intptr_t object_id, |
| 1812 Snapshot::Kind kind, | 1731 Snapshot::Kind kind, |
| 1813 bool as_reference) { | 1732 bool as_reference) { |
| 1814 // Write out the serialization header value for this object. | 1733 // Write out the serialization header value for this object. |
| 1815 writer->WriteInlinedObjectHeader(object_id); | 1734 writer->WriteInlinedObjectHeader(object_id); |
| 1816 | 1735 |
| 1817 // Write out the class and tags information. | 1736 // Write out the class and tags information. |
| 1818 writer->WriteVMIsolateObject(kUnhandledExceptionCid); | 1737 writer->WriteVMIsolateObject(kUnhandledExceptionCid); |
| 1819 writer->WriteTags(writer->GetObjectTags(this)); | 1738 writer->WriteTags(writer->GetObjectTags(this)); |
| 1820 // Write out all the object pointer fields. | 1739 // Write out all the object pointer fields. |
| 1821 SnapshotWriterVisitor visitor(writer, kAsReference); | 1740 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 1822 visitor.VisitPointers(from(), to()); | 1741 visitor.VisitPointers(from(), to()); |
| 1823 } | 1742 } |
| 1824 | 1743 |
| 1825 | |
| 1826 RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, | 1744 RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, |
| 1827 intptr_t object_id, | 1745 intptr_t object_id, |
| 1828 intptr_t tags, | 1746 intptr_t tags, |
| 1829 Snapshot::Kind kind, | 1747 Snapshot::Kind kind, |
| 1830 bool as_reference) { | 1748 bool as_reference) { |
| 1831 UNREACHABLE(); | 1749 UNREACHABLE(); |
| 1832 return UnwindError::null(); | 1750 return UnwindError::null(); |
| 1833 } | 1751 } |
| 1834 | 1752 |
| 1835 | |
| 1836 void RawUnwindError::WriteTo(SnapshotWriter* writer, | 1753 void RawUnwindError::WriteTo(SnapshotWriter* writer, |
| 1837 intptr_t object_id, | 1754 intptr_t object_id, |
| 1838 Snapshot::Kind kind, | 1755 Snapshot::Kind kind, |
| 1839 bool as_reference) { | 1756 bool as_reference) { |
| 1840 UNREACHABLE(); | 1757 UNREACHABLE(); |
| 1841 } | 1758 } |
| 1842 | 1759 |
| 1843 | |
| 1844 RawInstance* Instance::ReadFrom(SnapshotReader* reader, | 1760 RawInstance* Instance::ReadFrom(SnapshotReader* reader, |
| 1845 intptr_t object_id, | 1761 intptr_t object_id, |
| 1846 intptr_t tags, | 1762 intptr_t tags, |
| 1847 Snapshot::Kind kind, | 1763 Snapshot::Kind kind, |
| 1848 bool as_reference) { | 1764 bool as_reference) { |
| 1849 ASSERT(reader != NULL); | 1765 ASSERT(reader != NULL); |
| 1850 | 1766 |
| 1851 // Create an Instance object or get canonical one if it is a canonical | 1767 // Create an Instance object or get canonical one if it is a canonical |
| 1852 // constant. | 1768 // constant. |
| 1853 Instance& obj = Instance::ZoneHandle(reader->zone(), Instance::null()); | 1769 Instance& obj = Instance::ZoneHandle(reader->zone(), Instance::null()); |
| 1854 obj ^= Object::Allocate(kInstanceCid, Instance::InstanceSize(), | 1770 obj ^= Object::Allocate(kInstanceCid, Instance::InstanceSize(), |
| 1855 HEAP_SPACE(kind)); | 1771 HEAP_SPACE(kind)); |
| 1856 if (RawObject::IsCanonical(tags)) { | 1772 if (RawObject::IsCanonical(tags)) { |
| 1857 obj = obj.CheckAndCanonicalize(reader->thread(), NULL); | 1773 obj = obj.CheckAndCanonicalize(reader->thread(), NULL); |
| 1858 } | 1774 } |
| 1859 reader->AddBackRef(object_id, &obj, kIsDeserialized); | 1775 reader->AddBackRef(object_id, &obj, kIsDeserialized); |
| 1860 | 1776 |
| 1861 return obj.raw(); | 1777 return obj.raw(); |
| 1862 } | 1778 } |
| 1863 | 1779 |
| 1864 | |
| 1865 void RawInstance::WriteTo(SnapshotWriter* writer, | 1780 void RawInstance::WriteTo(SnapshotWriter* writer, |
| 1866 intptr_t object_id, | 1781 intptr_t object_id, |
| 1867 Snapshot::Kind kind, | 1782 Snapshot::Kind kind, |
| 1868 bool as_reference) { | 1783 bool as_reference) { |
| 1869 ASSERT(writer != NULL); | 1784 ASSERT(writer != NULL); |
| 1870 | 1785 |
| 1871 // Write out the serialization header value for this object. | 1786 // Write out the serialization header value for this object. |
| 1872 writer->WriteInlinedObjectHeader(object_id); | 1787 writer->WriteInlinedObjectHeader(object_id); |
| 1873 | 1788 |
| 1874 // Write out the class and tags information. | 1789 // Write out the class and tags information. |
| 1875 writer->WriteIndexedObject(kInstanceCid); | 1790 writer->WriteIndexedObject(kInstanceCid); |
| 1876 writer->WriteTags(writer->GetObjectTags(this)); | 1791 writer->WriteTags(writer->GetObjectTags(this)); |
| 1877 } | 1792 } |
| 1878 | 1793 |
| 1879 | |
| 1880 RawInteger* Mint::ReadFrom(SnapshotReader* reader, | 1794 RawInteger* Mint::ReadFrom(SnapshotReader* reader, |
| 1881 intptr_t object_id, | 1795 intptr_t object_id, |
| 1882 intptr_t tags, | 1796 intptr_t tags, |
| 1883 Snapshot::Kind kind, | 1797 Snapshot::Kind kind, |
| 1884 bool as_reference) { | 1798 bool as_reference) { |
| 1885 ASSERT(reader != NULL); | 1799 ASSERT(reader != NULL); |
| 1886 | 1800 |
| 1887 // Read the 64 bit value for the object. | 1801 // Read the 64 bit value for the object. |
| 1888 int64_t value = reader->Read<int64_t>(); | 1802 int64_t value = reader->Read<int64_t>(); |
| 1889 | 1803 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1906 if (RawObject::IsCanonical(tags)) { | 1820 if (RawObject::IsCanonical(tags)) { |
| 1907 mint = Mint::NewCanonical(value); | 1821 mint = Mint::NewCanonical(value); |
| 1908 ASSERT(mint.IsCanonical()); | 1822 ASSERT(mint.IsCanonical()); |
| 1909 } else { | 1823 } else { |
| 1910 mint = Mint::New(value, HEAP_SPACE(kind)); | 1824 mint = Mint::New(value, HEAP_SPACE(kind)); |
| 1911 } | 1825 } |
| 1912 reader->AddBackRef(object_id, &mint, kIsDeserialized); | 1826 reader->AddBackRef(object_id, &mint, kIsDeserialized); |
| 1913 return mint.raw(); | 1827 return mint.raw(); |
| 1914 } | 1828 } |
| 1915 | 1829 |
| 1916 | |
| 1917 void RawMint::WriteTo(SnapshotWriter* writer, | 1830 void RawMint::WriteTo(SnapshotWriter* writer, |
| 1918 intptr_t object_id, | 1831 intptr_t object_id, |
| 1919 Snapshot::Kind kind, | 1832 Snapshot::Kind kind, |
| 1920 bool as_reference) { | 1833 bool as_reference) { |
| 1921 ASSERT(writer != NULL); | 1834 ASSERT(writer != NULL); |
| 1922 | 1835 |
| 1923 // Write out the serialization header value for this object. | 1836 // Write out the serialization header value for this object. |
| 1924 writer->WriteInlinedObjectHeader(object_id); | 1837 writer->WriteInlinedObjectHeader(object_id); |
| 1925 | 1838 |
| 1926 // Write out the class and tags information. | 1839 // Write out the class and tags information. |
| 1927 writer->WriteIndexedObject(kMintCid); | 1840 writer->WriteIndexedObject(kMintCid); |
| 1928 writer->WriteTags(writer->GetObjectTags(this)); | 1841 writer->WriteTags(writer->GetObjectTags(this)); |
| 1929 | 1842 |
| 1930 // Write out the 64 bit value. | 1843 // Write out the 64 bit value. |
| 1931 writer->Write<int64_t>(ptr()->value_); | 1844 writer->Write<int64_t>(ptr()->value_); |
| 1932 } | 1845 } |
| 1933 | 1846 |
| 1934 | |
| 1935 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, | 1847 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, |
| 1936 intptr_t object_id, | 1848 intptr_t object_id, |
| 1937 intptr_t tags, | 1849 intptr_t tags, |
| 1938 Snapshot::Kind kind, | 1850 Snapshot::Kind kind, |
| 1939 bool as_reference) { | 1851 bool as_reference) { |
| 1940 ASSERT(reader != NULL); | 1852 ASSERT(reader != NULL); |
| 1941 | 1853 |
| 1942 // Allocate bigint object. | 1854 // Allocate bigint object. |
| 1943 Bigint& obj = Bigint::ZoneHandle(reader->zone(), Bigint::New()); | 1855 Bigint& obj = Bigint::ZoneHandle(reader->zone(), Bigint::New()); |
| 1944 reader->AddBackRef(object_id, &obj, kIsDeserialized); | 1856 reader->AddBackRef(object_id, &obj, kIsDeserialized); |
| 1945 | 1857 |
| 1946 // Set all the object fields. | 1858 // Set all the object fields. |
| 1947 READ_OBJECT_FIELDS(obj, obj.raw()->from(), obj.raw()->to(), kAsInlinedObject); | 1859 READ_OBJECT_FIELDS(obj, obj.raw()->from(), obj.raw()->to(), kAsInlinedObject); |
| 1948 | 1860 |
| 1949 // If it is a canonical constant make it one. | 1861 // If it is a canonical constant make it one. |
| 1950 // When reading a full snapshot we don't need to canonicalize the object | 1862 // When reading a full snapshot we don't need to canonicalize the object |
| 1951 // as it would already be a canonical object. | 1863 // as it would already be a canonical object. |
| 1952 // When reading a script snapshot or a message snapshot we always have | 1864 // When reading a script snapshot or a message snapshot we always have |
| 1953 // to canonicalize the object. | 1865 // to canonicalize the object. |
| 1954 if (RawObject::IsCanonical(tags)) { | 1866 if (RawObject::IsCanonical(tags)) { |
| 1955 obj ^= obj.CheckAndCanonicalize(reader->thread(), NULL); | 1867 obj ^= obj.CheckAndCanonicalize(reader->thread(), NULL); |
| 1956 ASSERT(!obj.IsNull()); | 1868 ASSERT(!obj.IsNull()); |
| 1957 ASSERT(obj.IsCanonical()); | 1869 ASSERT(obj.IsCanonical()); |
| 1958 } | 1870 } |
| 1959 return obj.raw(); | 1871 return obj.raw(); |
| 1960 } | 1872 } |
| 1961 | 1873 |
| 1962 | |
| 1963 void RawBigint::WriteTo(SnapshotWriter* writer, | 1874 void RawBigint::WriteTo(SnapshotWriter* writer, |
| 1964 intptr_t object_id, | 1875 intptr_t object_id, |
| 1965 Snapshot::Kind kind, | 1876 Snapshot::Kind kind, |
| 1966 bool as_reference) { | 1877 bool as_reference) { |
| 1967 ASSERT(writer != NULL); | 1878 ASSERT(writer != NULL); |
| 1968 | 1879 |
| 1969 // Write out the serialization header value for this object. | 1880 // Write out the serialization header value for this object. |
| 1970 writer->WriteInlinedObjectHeader(object_id); | 1881 writer->WriteInlinedObjectHeader(object_id); |
| 1971 | 1882 |
| 1972 // Write out the class and tags information. | 1883 // Write out the class and tags information. |
| 1973 writer->WriteIndexedObject(kBigintCid); | 1884 writer->WriteIndexedObject(kBigintCid); |
| 1974 writer->WriteTags(writer->GetObjectTags(this)); | 1885 writer->WriteTags(writer->GetObjectTags(this)); |
| 1975 | 1886 |
| 1976 // Write out all the object pointer fields. | 1887 // Write out all the object pointer fields. |
| 1977 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); | 1888 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
| 1978 visitor.VisitPointers(from(), to()); | 1889 visitor.VisitPointers(from(), to()); |
| 1979 } | 1890 } |
| 1980 | 1891 |
| 1981 | |
| 1982 RawDouble* Double::ReadFrom(SnapshotReader* reader, | 1892 RawDouble* Double::ReadFrom(SnapshotReader* reader, |
| 1983 intptr_t object_id, | 1893 intptr_t object_id, |
| 1984 intptr_t tags, | 1894 intptr_t tags, |
| 1985 Snapshot::Kind kind, | 1895 Snapshot::Kind kind, |
| 1986 bool as_reference) { | 1896 bool as_reference) { |
| 1987 ASSERT(reader != NULL); | 1897 ASSERT(reader != NULL); |
| 1988 ASSERT(kind != Snapshot::kMessage); | 1898 ASSERT(kind != Snapshot::kMessage); |
| 1989 // Read the double value for the object. | 1899 // Read the double value for the object. |
| 1990 double value = reader->ReadDouble(); | 1900 double value = reader->ReadDouble(); |
| 1991 | 1901 |
| 1992 // Create a Double object or get canonical one if it is a canonical constant. | 1902 // Create a Double object or get canonical one if it is a canonical constant. |
| 1993 Double& dbl = Double::ZoneHandle(reader->zone(), Double::null()); | 1903 Double& dbl = Double::ZoneHandle(reader->zone(), Double::null()); |
| 1994 // When reading a script snapshot we need to canonicalize only those object | 1904 // When reading a script snapshot we need to canonicalize only those object |
| 1995 // references that are objects from the core library (loaded from a | 1905 // references that are objects from the core library (loaded from a |
| 1996 // full snapshot). Objects that are only in the script need not be | 1906 // full snapshot). Objects that are only in the script need not be |
| 1997 // canonicalized as they are already canonical. | 1907 // canonicalized as they are already canonical. |
| 1998 if (RawObject::IsCanonical(tags)) { | 1908 if (RawObject::IsCanonical(tags)) { |
| 1999 dbl = Double::NewCanonical(value); | 1909 dbl = Double::NewCanonical(value); |
| 2000 ASSERT(dbl.IsCanonical()); | 1910 ASSERT(dbl.IsCanonical()); |
| 2001 } else { | 1911 } else { |
| 2002 dbl = Double::New(value, HEAP_SPACE(kind)); | 1912 dbl = Double::New(value, HEAP_SPACE(kind)); |
| 2003 } | 1913 } |
| 2004 reader->AddBackRef(object_id, &dbl, kIsDeserialized); | 1914 reader->AddBackRef(object_id, &dbl, kIsDeserialized); |
| 2005 return dbl.raw(); | 1915 return dbl.raw(); |
| 2006 } | 1916 } |
| 2007 | 1917 |
| 2008 | |
| 2009 void RawDouble::WriteTo(SnapshotWriter* writer, | 1918 void RawDouble::WriteTo(SnapshotWriter* writer, |
| 2010 intptr_t object_id, | 1919 intptr_t object_id, |
| 2011 Snapshot::Kind kind, | 1920 Snapshot::Kind kind, |
| 2012 bool as_reference) { | 1921 bool as_reference) { |
| 2013 ASSERT(writer != NULL); | 1922 ASSERT(writer != NULL); |
| 2014 | 1923 |
| 2015 // Write out the serialization header value for this object. | 1924 // Write out the serialization header value for this object. |
| 2016 writer->WriteInlinedObjectHeader(object_id); | 1925 writer->WriteInlinedObjectHeader(object_id); |
| 2017 | 1926 |
| 2018 // Write out the class and tags information. | 1927 // Write out the class and tags information. |
| 2019 writer->WriteIndexedObject(kDoubleCid); | 1928 writer->WriteIndexedObject(kDoubleCid); |
| 2020 writer->WriteTags(writer->GetObjectTags(this)); | 1929 writer->WriteTags(writer->GetObjectTags(this)); |
| 2021 | 1930 |
| 2022 // Write out the double value. | 1931 // Write out the double value. |
| 2023 writer->WriteDouble(ptr()->value_); | 1932 writer->WriteDouble(ptr()->value_); |
| 2024 } | 1933 } |
| 2025 | 1934 |
| 2026 | |
| 2027 RawString* String::ReadFrom(SnapshotReader* reader, | 1935 RawString* String::ReadFrom(SnapshotReader* reader, |
| 2028 intptr_t object_id, | 1936 intptr_t object_id, |
| 2029 intptr_t tags, | 1937 intptr_t tags, |
| 2030 Snapshot::Kind kind, | 1938 Snapshot::Kind kind, |
| 2031 bool as_reference) { | 1939 bool as_reference) { |
| 2032 UNREACHABLE(); // String is an abstract class. | 1940 UNREACHABLE(); // String is an abstract class. |
| 2033 return String::null(); | 1941 return String::null(); |
| 2034 } | 1942 } |
| 2035 | 1943 |
| 2036 | |
| 2037 void RawString::WriteTo(SnapshotWriter* writer, | 1944 void RawString::WriteTo(SnapshotWriter* writer, |
| 2038 intptr_t object_id, | 1945 intptr_t object_id, |
| 2039 Snapshot::Kind kind, | 1946 Snapshot::Kind kind, |
| 2040 bool as_reference) { | 1947 bool as_reference) { |
| 2041 UNREACHABLE(); // String is an abstract class. | 1948 UNREACHABLE(); // String is an abstract class. |
| 2042 } | 1949 } |
| 2043 | 1950 |
| 2044 | |
| 2045 template <typename StringType, typename CharacterType, typename CallbackType> | 1951 template <typename StringType, typename CharacterType, typename CallbackType> |
| 2046 void String::ReadFromImpl(SnapshotReader* reader, | 1952 void String::ReadFromImpl(SnapshotReader* reader, |
| 2047 String* str_obj, | 1953 String* str_obj, |
| 2048 intptr_t len, | 1954 intptr_t len, |
| 2049 intptr_t tags, | 1955 intptr_t tags, |
| 2050 CallbackType new_symbol, | 1956 CallbackType new_symbol, |
| 2051 Snapshot::Kind kind) { | 1957 Snapshot::Kind kind) { |
| 2052 ASSERT(reader != NULL); | 1958 ASSERT(reader != NULL); |
| 2053 if (RawObject::IsCanonical(tags)) { | 1959 if (RawObject::IsCanonical(tags)) { |
| 2054 // Set up canonical string object. | 1960 // Set up canonical string object. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2067 } | 1973 } |
| 2068 NoSafepointScope no_safepoint; | 1974 NoSafepointScope no_safepoint; |
| 2069 CharacterType* str_addr = StringType::CharAddr(*str_obj, 0); | 1975 CharacterType* str_addr = StringType::CharAddr(*str_obj, 0); |
| 2070 for (intptr_t i = 0; i < len; i++) { | 1976 for (intptr_t i = 0; i < len; i++) { |
| 2071 *str_addr = reader->Read<CharacterType>(); | 1977 *str_addr = reader->Read<CharacterType>(); |
| 2072 str_addr++; | 1978 str_addr++; |
| 2073 } | 1979 } |
| 2074 } | 1980 } |
| 2075 } | 1981 } |
| 2076 | 1982 |
| 2077 | |
| 2078 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, | 1983 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, |
| 2079 intptr_t object_id, | 1984 intptr_t object_id, |
| 2080 intptr_t tags, | 1985 intptr_t tags, |
| 2081 Snapshot::Kind kind, | 1986 Snapshot::Kind kind, |
| 2082 bool as_reference) { | 1987 bool as_reference) { |
| 2083 // Read the length so that we can determine instance size to allocate. | 1988 // Read the length so that we can determine instance size to allocate. |
| 2084 ASSERT(reader != NULL); | 1989 ASSERT(reader != NULL); |
| 2085 intptr_t len = reader->ReadSmiValue(); | 1990 intptr_t len = reader->ReadSmiValue(); |
| 2086 String& str_obj = String::ZoneHandle(reader->zone(), String::null()); | 1991 String& str_obj = String::ZoneHandle(reader->zone(), String::null()); |
| 2087 | 1992 |
| 2088 String::ReadFromImpl<OneByteString, uint8_t>(reader, &str_obj, len, tags, | 1993 String::ReadFromImpl<OneByteString, uint8_t>(reader, &str_obj, len, tags, |
| 2089 Symbols::FromLatin1, kind); | 1994 Symbols::FromLatin1, kind); |
| 2090 reader->AddBackRef(object_id, &str_obj, kIsDeserialized); | 1995 reader->AddBackRef(object_id, &str_obj, kIsDeserialized); |
| 2091 return raw(str_obj); | 1996 return raw(str_obj); |
| 2092 } | 1997 } |
| 2093 | 1998 |
| 2094 | |
| 2095 RawTwoByteString* TwoByteString::ReadFrom(SnapshotReader* reader, | 1999 RawTwoByteString* TwoByteString::ReadFrom(SnapshotReader* reader, |
| 2096 intptr_t object_id, | 2000 intptr_t object_id, |
| 2097 intptr_t tags, | 2001 intptr_t tags, |
| 2098 Snapshot::Kind kind, | 2002 Snapshot::Kind kind, |
| 2099 bool as_reference) { | 2003 bool as_reference) { |
| 2100 // Read the length so that we can determine instance size to allocate. | 2004 // Read the length so that we can determine instance size to allocate. |
| 2101 ASSERT(reader != NULL); | 2005 ASSERT(reader != NULL); |
| 2102 intptr_t len = reader->ReadSmiValue(); | 2006 intptr_t len = reader->ReadSmiValue(); |
| 2103 String& str_obj = String::ZoneHandle(reader->zone(), String::null()); | 2007 String& str_obj = String::ZoneHandle(reader->zone(), String::null()); |
| 2104 | 2008 |
| 2105 String::ReadFromImpl<TwoByteString, uint16_t>(reader, &str_obj, len, tags, | 2009 String::ReadFromImpl<TwoByteString, uint16_t>(reader, &str_obj, len, tags, |
| 2106 Symbols::FromUTF16, kind); | 2010 Symbols::FromUTF16, kind); |
| 2107 reader->AddBackRef(object_id, &str_obj, kIsDeserialized); | 2011 reader->AddBackRef(object_id, &str_obj, kIsDeserialized); |
| 2108 return raw(str_obj); | 2012 return raw(str_obj); |
| 2109 } | 2013 } |
| 2110 | 2014 |
| 2111 | |
| 2112 template <typename T> | 2015 template <typename T> |
| 2113 static void StringWriteTo(SnapshotWriter* writer, | 2016 static void StringWriteTo(SnapshotWriter* writer, |
| 2114 intptr_t object_id, | 2017 intptr_t object_id, |
| 2115 Snapshot::Kind kind, | 2018 Snapshot::Kind kind, |
| 2116 intptr_t class_id, | 2019 intptr_t class_id, |
| 2117 intptr_t tags, | 2020 intptr_t tags, |
| 2118 RawSmi* length, | 2021 RawSmi* length, |
| 2119 T* data) { | 2022 T* data) { |
| 2120 ASSERT(writer != NULL); | 2023 ASSERT(writer != NULL); |
| 2121 intptr_t len = Smi::Value(length); | 2024 intptr_t len = Smi::Value(length); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2135 if (class_id == kOneByteStringCid) { | 2038 if (class_id == kOneByteStringCid) { |
| 2136 writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len); | 2039 writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len); |
| 2137 } else { | 2040 } else { |
| 2138 for (intptr_t i = 0; i < len; i++) { | 2041 for (intptr_t i = 0; i < len; i++) { |
| 2139 writer->Write(data[i]); | 2042 writer->Write(data[i]); |
| 2140 } | 2043 } |
| 2141 } | 2044 } |
| 2142 } | 2045 } |
| 2143 } | 2046 } |
| 2144 | 2047 |
| 2145 | |
| 2146 void RawOneByteString::WriteTo(SnapshotWriter* writer, | 2048 void RawOneByteString::WriteTo(SnapshotWriter* writer, |
| 2147 intptr_t object_id, | 2049 intptr_t object_id, |
| 2148 Snapshot::Kind kind, | 2050 Snapshot::Kind kind, |
| 2149 bool as_reference) { | 2051 bool as_reference) { |
| 2150 StringWriteTo(writer, object_id, kind, kOneByteStringCid, | 2052 StringWriteTo(writer, object_id, kind, kOneByteStringCid, |
| 2151 writer->GetObjectTags(this), ptr()->length_, ptr()->data()); | 2053 writer->GetObjectTags(this), ptr()->length_, ptr()->data()); |
| 2152 } | 2054 } |
| 2153 | 2055 |
| 2154 | |
| 2155 void RawTwoByteString::WriteTo(SnapshotWriter* writer, | 2056 void RawTwoByteString::WriteTo(SnapshotWriter* writer, |
| 2156 intptr_t object_id, | 2057 intptr_t object_id, |
| 2157 Snapshot::Kind kind, | 2058 Snapshot::Kind kind, |
| 2158 bool as_reference) { | 2059 bool as_reference) { |
| 2159 StringWriteTo(writer, object_id, kind, kTwoByteStringCid, | 2060 StringWriteTo(writer, object_id, kind, kTwoByteStringCid, |
| 2160 writer->GetObjectTags(this), ptr()->length_, ptr()->data()); | 2061 writer->GetObjectTags(this), ptr()->length_, ptr()->data()); |
| 2161 } | 2062 } |
| 2162 | 2063 |
| 2163 | |
| 2164 RawExternalOneByteString* ExternalOneByteString::ReadFrom( | 2064 RawExternalOneByteString* ExternalOneByteString::ReadFrom( |
| 2165 SnapshotReader* reader, | 2065 SnapshotReader* reader, |
| 2166 intptr_t object_id, | 2066 intptr_t object_id, |
| 2167 intptr_t tags, | 2067 intptr_t tags, |
| 2168 Snapshot::Kind kind, | 2068 Snapshot::Kind kind, |
| 2169 bool as_reference) { | 2069 bool as_reference) { |
| 2170 UNREACHABLE(); | 2070 UNREACHABLE(); |
| 2171 return ExternalOneByteString::null(); | 2071 return ExternalOneByteString::null(); |
| 2172 } | 2072 } |
| 2173 | 2073 |
| 2174 | |
| 2175 RawExternalTwoByteString* ExternalTwoByteString::ReadFrom( | 2074 RawExternalTwoByteString* ExternalTwoByteString::ReadFrom( |
| 2176 SnapshotReader* reader, | 2075 SnapshotReader* reader, |
| 2177 intptr_t object_id, | 2076 intptr_t object_id, |
| 2178 intptr_t tags, | 2077 intptr_t tags, |
| 2179 Snapshot::Kind kind, | 2078 Snapshot::Kind kind, |
| 2180 bool as_reference) { | 2079 bool as_reference) { |
| 2181 UNREACHABLE(); | 2080 UNREACHABLE(); |
| 2182 return ExternalTwoByteString::null(); | 2081 return ExternalTwoByteString::null(); |
| 2183 } | 2082 } |
| 2184 | 2083 |
| 2185 | |
| 2186 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, | 2084 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, |
| 2187 intptr_t object_id, | 2085 intptr_t object_id, |
| 2188 Snapshot::Kind kind, | 2086 Snapshot::Kind kind, |
| 2189 bool as_reference) { | 2087 bool as_reference) { |
| 2190 // Serialize as a non-external one byte string. | 2088 // Serialize as a non-external one byte string. |
| 2191 StringWriteTo(writer, object_id, kind, kOneByteStringCid, | 2089 StringWriteTo(writer, object_id, kind, kOneByteStringCid, |
| 2192 writer->GetObjectTags(this), ptr()->length_, | 2090 writer->GetObjectTags(this), ptr()->length_, |
| 2193 ptr()->external_data_->data()); | 2091 ptr()->external_data_->data()); |
| 2194 } | 2092 } |
| 2195 | 2093 |
| 2196 | |
| 2197 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, | 2094 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, |
| 2198 intptr_t object_id, | 2095 intptr_t object_id, |
| 2199 Snapshot::Kind kind, | 2096 Snapshot::Kind kind, |
| 2200 bool as_reference) { | 2097 bool as_reference) { |
| 2201 // Serialize as a non-external two byte string. | 2098 // Serialize as a non-external two byte string. |
| 2202 StringWriteTo(writer, object_id, kind, kTwoByteStringCid, | 2099 StringWriteTo(writer, object_id, kind, kTwoByteStringCid, |
| 2203 writer->GetObjectTags(this), ptr()->length_, | 2100 writer->GetObjectTags(this), ptr()->length_, |
| 2204 ptr()->external_data_->data()); | 2101 ptr()->external_data_->data()); |
| 2205 } | 2102 } |
| 2206 | 2103 |
| 2207 | |
| 2208 RawBool* Bool::ReadFrom(SnapshotReader* reader, | 2104 RawBool* Bool::ReadFrom(SnapshotReader* reader, |
| 2209 intptr_t object_id, | 2105 intptr_t object_id, |
| 2210 intptr_t tags, | 2106 intptr_t tags, |
| 2211 Snapshot::Kind kind, | 2107 Snapshot::Kind kind, |
| 2212 bool as_reference) { | 2108 bool as_reference) { |
| 2213 UNREACHABLE(); | 2109 UNREACHABLE(); |
| 2214 return Bool::null(); | 2110 return Bool::null(); |
| 2215 } | 2111 } |
| 2216 | 2112 |
| 2217 | |
| 2218 void RawBool::WriteTo(SnapshotWriter* writer, | 2113 void RawBool::WriteTo(SnapshotWriter* writer, |
| 2219 intptr_t object_id, | 2114 intptr_t object_id, |
| 2220 Snapshot::Kind kind, | 2115 Snapshot::Kind kind, |
| 2221 bool as_reference) { | 2116 bool as_reference) { |
| 2222 UNREACHABLE(); | 2117 UNREACHABLE(); |
| 2223 } | 2118 } |
| 2224 | 2119 |
| 2225 | |
| 2226 RawArray* Array::ReadFrom(SnapshotReader* reader, | 2120 RawArray* Array::ReadFrom(SnapshotReader* reader, |
| 2227 intptr_t object_id, | 2121 intptr_t object_id, |
| 2228 intptr_t tags, | 2122 intptr_t tags, |
| 2229 Snapshot::Kind kind, | 2123 Snapshot::Kind kind, |
| 2230 bool as_reference) { | 2124 bool as_reference) { |
| 2231 ASSERT(reader != NULL); | 2125 ASSERT(reader != NULL); |
| 2232 | 2126 |
| 2233 // Read the length so that we can determine instance size to allocate. | 2127 // Read the length so that we can determine instance size to allocate. |
| 2234 intptr_t len = reader->ReadSmiValue(); | 2128 intptr_t len = reader->ReadSmiValue(); |
| 2235 Array* array = NULL; | 2129 Array* array = NULL; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2246 reader->AddBackRef(object_id, array, state); | 2140 reader->AddBackRef(object_id, array, state); |
| 2247 } | 2141 } |
| 2248 if (!as_reference) { | 2142 if (!as_reference) { |
| 2249 // Read all the individual elements for inlined objects. | 2143 // Read all the individual elements for inlined objects. |
| 2250 ASSERT(!RawObject::IsCanonical(tags)); | 2144 ASSERT(!RawObject::IsCanonical(tags)); |
| 2251 reader->ArrayReadFrom(object_id, *array, len, tags); | 2145 reader->ArrayReadFrom(object_id, *array, len, tags); |
| 2252 } | 2146 } |
| 2253 return array->raw(); | 2147 return array->raw(); |
| 2254 } | 2148 } |
| 2255 | 2149 |
| 2256 | |
| 2257 RawImmutableArray* ImmutableArray::ReadFrom(SnapshotReader* reader, | 2150 RawImmutableArray* ImmutableArray::ReadFrom(SnapshotReader* reader, |
| 2258 intptr_t object_id, | 2151 intptr_t object_id, |
| 2259 intptr_t tags, | 2152 intptr_t tags, |
| 2260 Snapshot::Kind kind, | 2153 Snapshot::Kind kind, |
| 2261 bool as_reference) { | 2154 bool as_reference) { |
| 2262 ASSERT(reader != NULL); | 2155 ASSERT(reader != NULL); |
| 2263 | 2156 |
| 2264 // Read the length so that we can determine instance size to allocate. | 2157 // Read the length so that we can determine instance size to allocate. |
| 2265 intptr_t len = reader->ReadSmiValue(); | 2158 intptr_t len = reader->ReadSmiValue(); |
| 2266 Array* array = NULL; | 2159 Array* array = NULL; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2279 if (!as_reference) { | 2172 if (!as_reference) { |
| 2280 // Read all the individual elements for inlined objects. | 2173 // Read all the individual elements for inlined objects. |
| 2281 reader->ArrayReadFrom(object_id, *array, len, tags); | 2174 reader->ArrayReadFrom(object_id, *array, len, tags); |
| 2282 if (RawObject::IsCanonical(tags)) { | 2175 if (RawObject::IsCanonical(tags)) { |
| 2283 *array ^= array->CheckAndCanonicalize(reader->thread(), NULL); | 2176 *array ^= array->CheckAndCanonicalize(reader->thread(), NULL); |
| 2284 } | 2177 } |
| 2285 } | 2178 } |
| 2286 return raw(*array); | 2179 return raw(*array); |
| 2287 } | 2180 } |
| 2288 | 2181 |
| 2289 | |
| 2290 void RawArray::WriteTo(SnapshotWriter* writer, | 2182 void RawArray::WriteTo(SnapshotWriter* writer, |
| 2291 intptr_t object_id, | 2183 intptr_t object_id, |
| 2292 Snapshot::Kind kind, | 2184 Snapshot::Kind kind, |
| 2293 bool as_reference) { | 2185 bool as_reference) { |
| 2294 ASSERT(!this->IsCanonical()); | 2186 ASSERT(!this->IsCanonical()); |
| 2295 writer->ArrayWriteTo(object_id, kArrayCid, writer->GetObjectTags(this), | 2187 writer->ArrayWriteTo(object_id, kArrayCid, writer->GetObjectTags(this), |
| 2296 ptr()->length_, ptr()->type_arguments_, ptr()->data(), | 2188 ptr()->length_, ptr()->type_arguments_, ptr()->data(), |
| 2297 as_reference); | 2189 as_reference); |
| 2298 } | 2190 } |
| 2299 | 2191 |
| 2300 | |
| 2301 void RawImmutableArray::WriteTo(SnapshotWriter* writer, | 2192 void RawImmutableArray::WriteTo(SnapshotWriter* writer, |
| 2302 intptr_t object_id, | 2193 intptr_t object_id, |
| 2303 Snapshot::Kind kind, | 2194 Snapshot::Kind kind, |
| 2304 bool as_reference) { | 2195 bool as_reference) { |
| 2305 writer->ArrayWriteTo(object_id, kImmutableArrayCid, | 2196 writer->ArrayWriteTo(object_id, kImmutableArrayCid, |
| 2306 writer->GetObjectTags(this), ptr()->length_, | 2197 writer->GetObjectTags(this), ptr()->length_, |
| 2307 ptr()->type_arguments_, ptr()->data(), as_reference); | 2198 ptr()->type_arguments_, ptr()->data(), as_reference); |
| 2308 } | 2199 } |
| 2309 | 2200 |
| 2310 | |
| 2311 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, | 2201 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, |
| 2312 intptr_t object_id, | 2202 intptr_t object_id, |
| 2313 intptr_t tags, | 2203 intptr_t tags, |
| 2314 Snapshot::Kind kind, | 2204 Snapshot::Kind kind, |
| 2315 bool as_reference) { | 2205 bool as_reference) { |
| 2316 ASSERT(reader != NULL); | 2206 ASSERT(reader != NULL); |
| 2317 | 2207 |
| 2318 // Read the length so that we can determine instance size to allocate. | 2208 // Read the length so that we can determine instance size to allocate. |
| 2319 GrowableObjectArray& array = GrowableObjectArray::ZoneHandle( | 2209 GrowableObjectArray& array = GrowableObjectArray::ZoneHandle( |
| 2320 reader->zone(), GrowableObjectArray::null()); | 2210 reader->zone(), GrowableObjectArray::null()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2332 // Read length of growable array object. | 2222 // Read length of growable array object. |
| 2333 array.SetLength(reader->ReadSmiValue()); | 2223 array.SetLength(reader->ReadSmiValue()); |
| 2334 | 2224 |
| 2335 // Read the backing array of growable array object. | 2225 // Read the backing array of growable array object. |
| 2336 *(reader->ArrayHandle()) ^= reader->ReadObjectImpl(kAsReference); | 2226 *(reader->ArrayHandle()) ^= reader->ReadObjectImpl(kAsReference); |
| 2337 array.SetData(*(reader->ArrayHandle())); | 2227 array.SetData(*(reader->ArrayHandle())); |
| 2338 | 2228 |
| 2339 return array.raw(); | 2229 return array.raw(); |
| 2340 } | 2230 } |
| 2341 | 2231 |
| 2342 | |
| 2343 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, | 2232 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, |
| 2344 intptr_t object_id, | 2233 intptr_t object_id, |
| 2345 Snapshot::Kind kind, | 2234 Snapshot::Kind kind, |
| 2346 bool as_reference) { | 2235 bool as_reference) { |
| 2347 ASSERT(writer != NULL); | 2236 ASSERT(writer != NULL); |
| 2348 | 2237 |
| 2349 // Write out the serialization header value for this object. | 2238 // Write out the serialization header value for this object. |
| 2350 writer->WriteInlinedObjectHeader(object_id); | 2239 writer->WriteInlinedObjectHeader(object_id); |
| 2351 | 2240 |
| 2352 // Write out the class and tags information. | 2241 // Write out the class and tags information. |
| 2353 writer->WriteIndexedObject(kGrowableObjectArrayCid); | 2242 writer->WriteIndexedObject(kGrowableObjectArrayCid); |
| 2354 writer->WriteTags(writer->GetObjectTags(this)); | 2243 writer->WriteTags(writer->GetObjectTags(this)); |
| 2355 | 2244 |
| 2356 // Write out the type arguments field. | 2245 // Write out the type arguments field. |
| 2357 writer->WriteObjectImpl(ptr()->type_arguments_, kAsInlinedObject); | 2246 writer->WriteObjectImpl(ptr()->type_arguments_, kAsInlinedObject); |
| 2358 | 2247 |
| 2359 // Write out the used length field. | 2248 // Write out the used length field. |
| 2360 writer->Write<RawObject*>(ptr()->length_); | 2249 writer->Write<RawObject*>(ptr()->length_); |
| 2361 | 2250 |
| 2362 // Write out the Array object. | 2251 // Write out the Array object. |
| 2363 writer->WriteObjectImpl(ptr()->data_, kAsReference); | 2252 writer->WriteObjectImpl(ptr()->data_, kAsReference); |
| 2364 } | 2253 } |
| 2365 | 2254 |
| 2366 | |
| 2367 RawLinkedHashMap* LinkedHashMap::ReadFrom(SnapshotReader* reader, | 2255 RawLinkedHashMap* LinkedHashMap::ReadFrom(SnapshotReader* reader, |
| 2368 intptr_t object_id, | 2256 intptr_t object_id, |
| 2369 intptr_t tags, | 2257 intptr_t tags, |
| 2370 Snapshot::Kind kind, | 2258 Snapshot::Kind kind, |
| 2371 bool as_reference) { | 2259 bool as_reference) { |
| 2372 ASSERT(reader != NULL); | 2260 ASSERT(reader != NULL); |
| 2373 | 2261 |
| 2374 LinkedHashMap& map = | 2262 LinkedHashMap& map = |
| 2375 LinkedHashMap::ZoneHandle(reader->zone(), LinkedHashMap::null()); | 2263 LinkedHashMap::ZoneHandle(reader->zone(), LinkedHashMap::null()); |
| 2376 if (kind == Snapshot::kScript) { | 2264 if (kind == Snapshot::kScript) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2413 | 2301 |
| 2414 // Read the keys and values. | 2302 // Read the keys and values. |
| 2415 bool read_as_reference = RawObject::IsCanonical(tags) ? false : true; | 2303 bool read_as_reference = RawObject::IsCanonical(tags) ? false : true; |
| 2416 for (intptr_t i = 0; i < used_data; i++) { | 2304 for (intptr_t i = 0; i < used_data; i++) { |
| 2417 *reader->PassiveObjectHandle() = reader->ReadObjectImpl(read_as_reference); | 2305 *reader->PassiveObjectHandle() = reader->ReadObjectImpl(read_as_reference); |
| 2418 data.SetAt(i, *reader->PassiveObjectHandle()); | 2306 data.SetAt(i, *reader->PassiveObjectHandle()); |
| 2419 } | 2307 } |
| 2420 return map.raw(); | 2308 return map.raw(); |
| 2421 } | 2309 } |
| 2422 | 2310 |
| 2423 | |
| 2424 void RawLinkedHashMap::WriteTo(SnapshotWriter* writer, | 2311 void RawLinkedHashMap::WriteTo(SnapshotWriter* writer, |
| 2425 intptr_t object_id, | 2312 intptr_t object_id, |
| 2426 Snapshot::Kind kind, | 2313 Snapshot::Kind kind, |
| 2427 bool as_reference) { | 2314 bool as_reference) { |
| 2428 if (kind == Snapshot::kScript) { | 2315 if (kind == Snapshot::kScript) { |
| 2429 // The immutable maps that seed map literals are not yet VM-internal, so | 2316 // The immutable maps that seed map literals are not yet VM-internal, so |
| 2430 // we don't reach this. | 2317 // we don't reach this. |
| 2431 } | 2318 } |
| 2432 ASSERT(writer != NULL); | 2319 ASSERT(writer != NULL); |
| 2433 | 2320 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2464 #endif // DEBUG | 2351 #endif // DEBUG |
| 2465 continue; | 2352 continue; |
| 2466 } | 2353 } |
| 2467 RawObject* value = data_elements[i + 1]; | 2354 RawObject* value = data_elements[i + 1]; |
| 2468 writer->WriteObjectImpl(key, write_as_reference); | 2355 writer->WriteObjectImpl(key, write_as_reference); |
| 2469 writer->WriteObjectImpl(value, write_as_reference); | 2356 writer->WriteObjectImpl(value, write_as_reference); |
| 2470 } | 2357 } |
| 2471 DEBUG_ASSERT(deleted_keys_found == deleted_keys); | 2358 DEBUG_ASSERT(deleted_keys_found == deleted_keys); |
| 2472 } | 2359 } |
| 2473 | 2360 |
| 2474 | |
| 2475 RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, | 2361 RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, |
| 2476 intptr_t object_id, | 2362 intptr_t object_id, |
| 2477 intptr_t tags, | 2363 intptr_t tags, |
| 2478 Snapshot::Kind kind, | 2364 Snapshot::Kind kind, |
| 2479 bool as_reference) { | 2365 bool as_reference) { |
| 2480 ASSERT(reader != NULL); | 2366 ASSERT(reader != NULL); |
| 2481 // Read the values. | 2367 // Read the values. |
| 2482 float value0 = reader->Read<float>(); | 2368 float value0 = reader->Read<float>(); |
| 2483 float value1 = reader->Read<float>(); | 2369 float value1 = reader->Read<float>(); |
| 2484 float value2 = reader->Read<float>(); | 2370 float value2 = reader->Read<float>(); |
| 2485 float value3 = reader->Read<float>(); | 2371 float value3 = reader->Read<float>(); |
| 2486 | 2372 |
| 2487 // Create a Float32x4 object. | 2373 // Create a Float32x4 object. |
| 2488 Float32x4& simd = Float32x4::ZoneHandle(reader->zone(), Float32x4::null()); | 2374 Float32x4& simd = Float32x4::ZoneHandle(reader->zone(), Float32x4::null()); |
| 2489 simd = Float32x4::New(value0, value1, value2, value3, HEAP_SPACE(kind)); | 2375 simd = Float32x4::New(value0, value1, value2, value3, HEAP_SPACE(kind)); |
| 2490 reader->AddBackRef(object_id, &simd, kIsDeserialized); | 2376 reader->AddBackRef(object_id, &simd, kIsDeserialized); |
| 2491 return simd.raw(); | 2377 return simd.raw(); |
| 2492 } | 2378 } |
| 2493 | 2379 |
| 2494 | |
| 2495 void RawFloat32x4::WriteTo(SnapshotWriter* writer, | 2380 void RawFloat32x4::WriteTo(SnapshotWriter* writer, |
| 2496 intptr_t object_id, | 2381 intptr_t object_id, |
| 2497 Snapshot::Kind kind, | 2382 Snapshot::Kind kind, |
| 2498 bool as_reference) { | 2383 bool as_reference) { |
| 2499 ASSERT(writer != NULL); | 2384 ASSERT(writer != NULL); |
| 2500 | 2385 |
| 2501 // Write out the serialization header value for this object. | 2386 // Write out the serialization header value for this object. |
| 2502 writer->WriteInlinedObjectHeader(object_id); | 2387 writer->WriteInlinedObjectHeader(object_id); |
| 2503 | 2388 |
| 2504 // Write out the class and tags information. | 2389 // Write out the class and tags information. |
| 2505 writer->WriteIndexedObject(kFloat32x4Cid); | 2390 writer->WriteIndexedObject(kFloat32x4Cid); |
| 2506 writer->WriteTags(writer->GetObjectTags(this)); | 2391 writer->WriteTags(writer->GetObjectTags(this)); |
| 2507 | 2392 |
| 2508 // Write out the float values. | 2393 // Write out the float values. |
| 2509 writer->Write<float>(ptr()->value_[0]); | 2394 writer->Write<float>(ptr()->value_[0]); |
| 2510 writer->Write<float>(ptr()->value_[1]); | 2395 writer->Write<float>(ptr()->value_[1]); |
| 2511 writer->Write<float>(ptr()->value_[2]); | 2396 writer->Write<float>(ptr()->value_[2]); |
| 2512 writer->Write<float>(ptr()->value_[3]); | 2397 writer->Write<float>(ptr()->value_[3]); |
| 2513 } | 2398 } |
| 2514 | 2399 |
| 2515 | |
| 2516 RawInt32x4* Int32x4::ReadFrom(SnapshotReader* reader, | 2400 RawInt32x4* Int32x4::ReadFrom(SnapshotReader* reader, |
| 2517 intptr_t object_id, | 2401 intptr_t object_id, |
| 2518 intptr_t tags, | 2402 intptr_t tags, |
| 2519 Snapshot::Kind kind, | 2403 Snapshot::Kind kind, |
| 2520 bool as_reference) { | 2404 bool as_reference) { |
| 2521 ASSERT(reader != NULL); | 2405 ASSERT(reader != NULL); |
| 2522 // Read the values. | 2406 // Read the values. |
| 2523 uint32_t value0 = reader->Read<uint32_t>(); | 2407 uint32_t value0 = reader->Read<uint32_t>(); |
| 2524 uint32_t value1 = reader->Read<uint32_t>(); | 2408 uint32_t value1 = reader->Read<uint32_t>(); |
| 2525 uint32_t value2 = reader->Read<uint32_t>(); | 2409 uint32_t value2 = reader->Read<uint32_t>(); |
| 2526 uint32_t value3 = reader->Read<uint32_t>(); | 2410 uint32_t value3 = reader->Read<uint32_t>(); |
| 2527 | 2411 |
| 2528 // Create a Float32x4 object. | 2412 // Create a Float32x4 object. |
| 2529 Int32x4& simd = Int32x4::ZoneHandle(reader->zone(), Int32x4::null()); | 2413 Int32x4& simd = Int32x4::ZoneHandle(reader->zone(), Int32x4::null()); |
| 2530 simd = Int32x4::New(value0, value1, value2, value3, HEAP_SPACE(kind)); | 2414 simd = Int32x4::New(value0, value1, value2, value3, HEAP_SPACE(kind)); |
| 2531 reader->AddBackRef(object_id, &simd, kIsDeserialized); | 2415 reader->AddBackRef(object_id, &simd, kIsDeserialized); |
| 2532 return simd.raw(); | 2416 return simd.raw(); |
| 2533 } | 2417 } |
| 2534 | 2418 |
| 2535 | |
| 2536 void RawInt32x4::WriteTo(SnapshotWriter* writer, | 2419 void RawInt32x4::WriteTo(SnapshotWriter* writer, |
| 2537 intptr_t object_id, | 2420 intptr_t object_id, |
| 2538 Snapshot::Kind kind, | 2421 Snapshot::Kind kind, |
| 2539 bool as_reference) { | 2422 bool as_reference) { |
| 2540 ASSERT(writer != NULL); | 2423 ASSERT(writer != NULL); |
| 2541 | 2424 |
| 2542 // Write out the serialization header value for this object. | 2425 // Write out the serialization header value for this object. |
| 2543 writer->WriteInlinedObjectHeader(object_id); | 2426 writer->WriteInlinedObjectHeader(object_id); |
| 2544 | 2427 |
| 2545 // Write out the class and tags information. | 2428 // Write out the class and tags information. |
| 2546 writer->WriteIndexedObject(kInt32x4Cid); | 2429 writer->WriteIndexedObject(kInt32x4Cid); |
| 2547 writer->WriteTags(writer->GetObjectTags(this)); | 2430 writer->WriteTags(writer->GetObjectTags(this)); |
| 2548 | 2431 |
| 2549 // Write out the mask values. | 2432 // Write out the mask values. |
| 2550 writer->Write<uint32_t>(ptr()->value_[0]); | 2433 writer->Write<uint32_t>(ptr()->value_[0]); |
| 2551 writer->Write<uint32_t>(ptr()->value_[1]); | 2434 writer->Write<uint32_t>(ptr()->value_[1]); |
| 2552 writer->Write<uint32_t>(ptr()->value_[2]); | 2435 writer->Write<uint32_t>(ptr()->value_[2]); |
| 2553 writer->Write<uint32_t>(ptr()->value_[3]); | 2436 writer->Write<uint32_t>(ptr()->value_[3]); |
| 2554 } | 2437 } |
| 2555 | 2438 |
| 2556 | |
| 2557 RawFloat64x2* Float64x2::ReadFrom(SnapshotReader* reader, | 2439 RawFloat64x2* Float64x2::ReadFrom(SnapshotReader* reader, |
| 2558 intptr_t object_id, | 2440 intptr_t object_id, |
| 2559 intptr_t tags, | 2441 intptr_t tags, |
| 2560 Snapshot::Kind kind, | 2442 Snapshot::Kind kind, |
| 2561 bool as_reference) { | 2443 bool as_reference) { |
| 2562 ASSERT(reader != NULL); | 2444 ASSERT(reader != NULL); |
| 2563 // Read the values. | 2445 // Read the values. |
| 2564 double value0 = reader->Read<double>(); | 2446 double value0 = reader->Read<double>(); |
| 2565 double value1 = reader->Read<double>(); | 2447 double value1 = reader->Read<double>(); |
| 2566 | 2448 |
| 2567 // Create a Float64x2 object. | 2449 // Create a Float64x2 object. |
| 2568 Float64x2& simd = Float64x2::ZoneHandle(reader->zone(), Float64x2::null()); | 2450 Float64x2& simd = Float64x2::ZoneHandle(reader->zone(), Float64x2::null()); |
| 2569 simd = Float64x2::New(value0, value1, HEAP_SPACE(kind)); | 2451 simd = Float64x2::New(value0, value1, HEAP_SPACE(kind)); |
| 2570 reader->AddBackRef(object_id, &simd, kIsDeserialized); | 2452 reader->AddBackRef(object_id, &simd, kIsDeserialized); |
| 2571 return simd.raw(); | 2453 return simd.raw(); |
| 2572 } | 2454 } |
| 2573 | 2455 |
| 2574 | |
| 2575 void RawFloat64x2::WriteTo(SnapshotWriter* writer, | 2456 void RawFloat64x2::WriteTo(SnapshotWriter* writer, |
| 2576 intptr_t object_id, | 2457 intptr_t object_id, |
| 2577 Snapshot::Kind kind, | 2458 Snapshot::Kind kind, |
| 2578 bool as_reference) { | 2459 bool as_reference) { |
| 2579 ASSERT(writer != NULL); | 2460 ASSERT(writer != NULL); |
| 2580 | 2461 |
| 2581 // Write out the serialization header value for this object. | 2462 // Write out the serialization header value for this object. |
| 2582 writer->WriteInlinedObjectHeader(object_id); | 2463 writer->WriteInlinedObjectHeader(object_id); |
| 2583 | 2464 |
| 2584 // Write out the class and tags information. | 2465 // Write out the class and tags information. |
| 2585 writer->WriteIndexedObject(kFloat64x2Cid); | 2466 writer->WriteIndexedObject(kFloat64x2Cid); |
| 2586 writer->WriteTags(writer->GetObjectTags(this)); | 2467 writer->WriteTags(writer->GetObjectTags(this)); |
| 2587 | 2468 |
| 2588 // Write out the float values. | 2469 // Write out the float values. |
| 2589 writer->Write<double>(ptr()->value_[0]); | 2470 writer->Write<double>(ptr()->value_[0]); |
| 2590 writer->Write<double>(ptr()->value_[1]); | 2471 writer->Write<double>(ptr()->value_[1]); |
| 2591 } | 2472 } |
| 2592 | 2473 |
| 2593 | |
| 2594 #define TYPED_DATA_READ(setter, type) \ | 2474 #define TYPED_DATA_READ(setter, type) \ |
| 2595 for (intptr_t i = 0; i < length_in_bytes; i += element_size) { \ | 2475 for (intptr_t i = 0; i < length_in_bytes; i += element_size) { \ |
| 2596 result.Set##setter(i, reader->Read<type>()); \ | 2476 result.Set##setter(i, reader->Read<type>()); \ |
| 2597 } | 2477 } |
| 2598 | 2478 |
| 2599 | |
| 2600 RawTypedData* TypedData::ReadFrom(SnapshotReader* reader, | 2479 RawTypedData* TypedData::ReadFrom(SnapshotReader* reader, |
| 2601 intptr_t object_id, | 2480 intptr_t object_id, |
| 2602 intptr_t tags, | 2481 intptr_t tags, |
| 2603 Snapshot::Kind kind, | 2482 Snapshot::Kind kind, |
| 2604 bool as_reference) { | 2483 bool as_reference) { |
| 2605 ASSERT(reader != NULL); | 2484 ASSERT(reader != NULL); |
| 2606 | 2485 |
| 2607 intptr_t cid = RawObject::ClassIdTag::decode(tags); | 2486 intptr_t cid = RawObject::ClassIdTag::decode(tags); |
| 2608 intptr_t len = reader->ReadSmiValue(); | 2487 intptr_t len = reader->ReadSmiValue(); |
| 2609 TypedData& result = TypedData::ZoneHandle( | 2488 TypedData& result = TypedData::ZoneHandle( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2656 // to canonicalize the object. | 2535 // to canonicalize the object. |
| 2657 if (RawObject::IsCanonical(tags)) { | 2536 if (RawObject::IsCanonical(tags)) { |
| 2658 result ^= result.CheckAndCanonicalize(reader->thread(), NULL); | 2537 result ^= result.CheckAndCanonicalize(reader->thread(), NULL); |
| 2659 ASSERT(!result.IsNull()); | 2538 ASSERT(!result.IsNull()); |
| 2660 ASSERT(result.IsCanonical()); | 2539 ASSERT(result.IsCanonical()); |
| 2661 } | 2540 } |
| 2662 return result.raw(); | 2541 return result.raw(); |
| 2663 } | 2542 } |
| 2664 #undef TYPED_DATA_READ | 2543 #undef TYPED_DATA_READ |
| 2665 | 2544 |
| 2666 | |
| 2667 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, | 2545 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, |
| 2668 intptr_t object_id, | 2546 intptr_t object_id, |
| 2669 intptr_t tags, | 2547 intptr_t tags, |
| 2670 Snapshot::Kind kind, | 2548 Snapshot::Kind kind, |
| 2671 bool as_reference) { | 2549 bool as_reference) { |
| 2672 ASSERT(!Snapshot::IsFull(kind)); | 2550 ASSERT(!Snapshot::IsFull(kind)); |
| 2673 intptr_t cid = RawObject::ClassIdTag::decode(tags); | 2551 intptr_t cid = RawObject::ClassIdTag::decode(tags); |
| 2674 intptr_t length = reader->ReadSmiValue(); | 2552 intptr_t length = reader->ReadSmiValue(); |
| 2675 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue()); | 2553 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue()); |
| 2676 ExternalTypedData& obj = | 2554 ExternalTypedData& obj = |
| 2677 ExternalTypedData::ZoneHandle(ExternalTypedData::New(cid, data, length)); | 2555 ExternalTypedData::ZoneHandle(ExternalTypedData::New(cid, data, length)); |
| 2678 reader->AddBackRef(object_id, &obj, kIsDeserialized); | 2556 reader->AddBackRef(object_id, &obj, kIsDeserialized); |
| 2679 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue()); | 2557 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue()); |
| 2680 Dart_WeakPersistentHandleFinalizer callback = | 2558 Dart_WeakPersistentHandleFinalizer callback = |
| 2681 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( | 2559 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( |
| 2682 reader->ReadRawPointerValue()); | 2560 reader->ReadRawPointerValue()); |
| 2683 intptr_t external_size = obj.LengthInBytes(); | 2561 intptr_t external_size = obj.LengthInBytes(); |
| 2684 obj.AddFinalizer(peer, callback, external_size); | 2562 obj.AddFinalizer(peer, callback, external_size); |
| 2685 return obj.raw(); | 2563 return obj.raw(); |
| 2686 } | 2564 } |
| 2687 | 2565 |
| 2688 | |
| 2689 #define TYPED_DATA_WRITE(type) \ | 2566 #define TYPED_DATA_WRITE(type) \ |
| 2690 { \ | 2567 { \ |
| 2691 type* data = reinterpret_cast<type*>(ptr()->data()); \ | 2568 type* data = reinterpret_cast<type*>(ptr()->data()); \ |
| 2692 for (intptr_t i = 0; i < len; i++) { \ | 2569 for (intptr_t i = 0; i < len; i++) { \ |
| 2693 writer->Write(data[i]); \ | 2570 writer->Write(data[i]); \ |
| 2694 } \ | 2571 } \ |
| 2695 } | 2572 } |
| 2696 | 2573 |
| 2697 | |
| 2698 void RawTypedData::WriteTo(SnapshotWriter* writer, | 2574 void RawTypedData::WriteTo(SnapshotWriter* writer, |
| 2699 intptr_t object_id, | 2575 intptr_t object_id, |
| 2700 Snapshot::Kind kind, | 2576 Snapshot::Kind kind, |
| 2701 bool as_reference) { | 2577 bool as_reference) { |
| 2702 ASSERT(writer != NULL); | 2578 ASSERT(writer != NULL); |
| 2703 intptr_t cid = this->GetClassId(); | 2579 intptr_t cid = this->GetClassId(); |
| 2704 intptr_t len = Smi::Value(ptr()->length_); | 2580 intptr_t len = Smi::Value(ptr()->length_); |
| 2705 | 2581 |
| 2706 // Write out the serialization header value for this object. | 2582 // Write out the serialization header value for this object. |
| 2707 writer->WriteInlinedObjectHeader(object_id); | 2583 writer->WriteInlinedObjectHeader(object_id); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 TYPED_DATA_WRITE(float); // NOLINT. | 2620 TYPED_DATA_WRITE(float); // NOLINT. |
| 2745 break; | 2621 break; |
| 2746 case kTypedDataFloat64ArrayCid: | 2622 case kTypedDataFloat64ArrayCid: |
| 2747 TYPED_DATA_WRITE(double); // NOLINT. | 2623 TYPED_DATA_WRITE(double); // NOLINT. |
| 2748 break; | 2624 break; |
| 2749 default: | 2625 default: |
| 2750 UNREACHABLE(); | 2626 UNREACHABLE(); |
| 2751 } | 2627 } |
| 2752 } | 2628 } |
| 2753 | 2629 |
| 2754 | |
| 2755 #define TYPED_EXT_DATA_WRITE(type) \ | 2630 #define TYPED_EXT_DATA_WRITE(type) \ |
| 2756 { \ | 2631 { \ |
| 2757 type* data = reinterpret_cast<type*>(ptr()->data_); \ | 2632 type* data = reinterpret_cast<type*>(ptr()->data_); \ |
| 2758 for (intptr_t i = 0; i < len; i++) { \ | 2633 for (intptr_t i = 0; i < len; i++) { \ |
| 2759 writer->Write(data[i]); \ | 2634 writer->Write(data[i]); \ |
| 2760 } \ | 2635 } \ |
| 2761 } | 2636 } |
| 2762 | 2637 |
| 2763 | |
| 2764 #define EXT_TYPED_DATA_WRITE(cid, type) \ | 2638 #define EXT_TYPED_DATA_WRITE(cid, type) \ |
| 2765 writer->WriteIndexedObject(cid); \ | 2639 writer->WriteIndexedObject(cid); \ |
| 2766 writer->WriteTags(writer->GetObjectTags(this)); \ | 2640 writer->WriteTags(writer->GetObjectTags(this)); \ |
| 2767 writer->Write<RawObject*>(ptr()->length_); \ | 2641 writer->Write<RawObject*>(ptr()->length_); \ |
| 2768 TYPED_EXT_DATA_WRITE(type) | 2642 TYPED_EXT_DATA_WRITE(type) |
| 2769 | 2643 |
| 2770 | |
| 2771 void RawExternalTypedData::WriteTo(SnapshotWriter* writer, | 2644 void RawExternalTypedData::WriteTo(SnapshotWriter* writer, |
| 2772 intptr_t object_id, | 2645 intptr_t object_id, |
| 2773 Snapshot::Kind kind, | 2646 Snapshot::Kind kind, |
| 2774 bool as_reference) { | 2647 bool as_reference) { |
| 2775 ASSERT(writer != NULL); | 2648 ASSERT(writer != NULL); |
| 2776 intptr_t cid = this->GetClassId(); | 2649 intptr_t cid = this->GetClassId(); |
| 2777 intptr_t len = Smi::Value(ptr()->length_); | 2650 intptr_t len = Smi::Value(ptr()->length_); |
| 2778 | 2651 |
| 2779 // Write out the serialization header value for this object. | 2652 // Write out the serialization header value for this object. |
| 2780 writer->WriteInlinedObjectHeader(object_id); | 2653 writer->WriteInlinedObjectHeader(object_id); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2813 case kExternalTypedDataFloat64ArrayCid: | 2686 case kExternalTypedDataFloat64ArrayCid: |
| 2814 EXT_TYPED_DATA_WRITE(kTypedDataFloat64ArrayCid, double); // NOLINT. | 2687 EXT_TYPED_DATA_WRITE(kTypedDataFloat64ArrayCid, double); // NOLINT. |
| 2815 break; | 2688 break; |
| 2816 default: | 2689 default: |
| 2817 UNREACHABLE(); | 2690 UNREACHABLE(); |
| 2818 } | 2691 } |
| 2819 } | 2692 } |
| 2820 #undef TYPED_DATA_WRITE | 2693 #undef TYPED_DATA_WRITE |
| 2821 #undef EXT_TYPED_DATA_WRITE | 2694 #undef EXT_TYPED_DATA_WRITE |
| 2822 | 2695 |
| 2823 | |
| 2824 RawCapability* Capability::ReadFrom(SnapshotReader* reader, | 2696 RawCapability* Capability::ReadFrom(SnapshotReader* reader, |
| 2825 intptr_t object_id, | 2697 intptr_t object_id, |
| 2826 intptr_t tags, | 2698 intptr_t tags, |
| 2827 Snapshot::Kind kind, | 2699 Snapshot::Kind kind, |
| 2828 bool as_reference) { | 2700 bool as_reference) { |
| 2829 uint64_t id = reader->Read<uint64_t>(); | 2701 uint64_t id = reader->Read<uint64_t>(); |
| 2830 | 2702 |
| 2831 Capability& result = | 2703 Capability& result = |
| 2832 Capability::ZoneHandle(reader->zone(), Capability::New(id)); | 2704 Capability::ZoneHandle(reader->zone(), Capability::New(id)); |
| 2833 reader->AddBackRef(object_id, &result, kIsDeserialized); | 2705 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 2834 return result.raw(); | 2706 return result.raw(); |
| 2835 } | 2707 } |
| 2836 | 2708 |
| 2837 | |
| 2838 void RawCapability::WriteTo(SnapshotWriter* writer, | 2709 void RawCapability::WriteTo(SnapshotWriter* writer, |
| 2839 intptr_t object_id, | 2710 intptr_t object_id, |
| 2840 Snapshot::Kind kind, | 2711 Snapshot::Kind kind, |
| 2841 bool as_reference) { | 2712 bool as_reference) { |
| 2842 // Write out the serialization header value for this object. | 2713 // Write out the serialization header value for this object. |
| 2843 writer->WriteInlinedObjectHeader(object_id); | 2714 writer->WriteInlinedObjectHeader(object_id); |
| 2844 | 2715 |
| 2845 // Write out the class and tags information. | 2716 // Write out the class and tags information. |
| 2846 writer->WriteIndexedObject(kCapabilityCid); | 2717 writer->WriteIndexedObject(kCapabilityCid); |
| 2847 writer->WriteTags(writer->GetObjectTags(this)); | 2718 writer->WriteTags(writer->GetObjectTags(this)); |
| 2848 | 2719 |
| 2849 writer->Write<uint64_t>(ptr()->id_); | 2720 writer->Write<uint64_t>(ptr()->id_); |
| 2850 } | 2721 } |
| 2851 | 2722 |
| 2852 | |
| 2853 RawReceivePort* ReceivePort::ReadFrom(SnapshotReader* reader, | 2723 RawReceivePort* ReceivePort::ReadFrom(SnapshotReader* reader, |
| 2854 intptr_t object_id, | 2724 intptr_t object_id, |
| 2855 intptr_t tags, | 2725 intptr_t tags, |
| 2856 Snapshot::Kind kind, | 2726 Snapshot::Kind kind, |
| 2857 bool as_reference) { | 2727 bool as_reference) { |
| 2858 UNREACHABLE(); | 2728 UNREACHABLE(); |
| 2859 return ReceivePort::null(); | 2729 return ReceivePort::null(); |
| 2860 } | 2730 } |
| 2861 | 2731 |
| 2862 | |
| 2863 void RawReceivePort::WriteTo(SnapshotWriter* writer, | 2732 void RawReceivePort::WriteTo(SnapshotWriter* writer, |
| 2864 intptr_t object_id, | 2733 intptr_t object_id, |
| 2865 Snapshot::Kind kind, | 2734 Snapshot::Kind kind, |
| 2866 bool as_reference) { | 2735 bool as_reference) { |
| 2867 if (kind == Snapshot::kMessage) { | 2736 if (kind == Snapshot::kMessage) { |
| 2868 // We do not allow objects with native fields in an isolate message. | 2737 // We do not allow objects with native fields in an isolate message. |
| 2869 writer->SetWriteException(Exceptions::kArgument, | 2738 writer->SetWriteException(Exceptions::kArgument, |
| 2870 "Illegal argument in isolate message" | 2739 "Illegal argument in isolate message" |
| 2871 " : (object is a RawReceivePort)"); | 2740 " : (object is a RawReceivePort)"); |
| 2872 } else { | 2741 } else { |
| 2873 UNREACHABLE(); | 2742 UNREACHABLE(); |
| 2874 } | 2743 } |
| 2875 } | 2744 } |
| 2876 | 2745 |
| 2877 | |
| 2878 RawSendPort* SendPort::ReadFrom(SnapshotReader* reader, | 2746 RawSendPort* SendPort::ReadFrom(SnapshotReader* reader, |
| 2879 intptr_t object_id, | 2747 intptr_t object_id, |
| 2880 intptr_t tags, | 2748 intptr_t tags, |
| 2881 Snapshot::Kind kind, | 2749 Snapshot::Kind kind, |
| 2882 bool as_reference) { | 2750 bool as_reference) { |
| 2883 ASSERT(kind == Snapshot::kMessage); | 2751 ASSERT(kind == Snapshot::kMessage); |
| 2884 | 2752 |
| 2885 uint64_t id = reader->Read<uint64_t>(); | 2753 uint64_t id = reader->Read<uint64_t>(); |
| 2886 uint64_t origin_id = reader->Read<uint64_t>(); | 2754 uint64_t origin_id = reader->Read<uint64_t>(); |
| 2887 | 2755 |
| 2888 SendPort& result = | 2756 SendPort& result = |
| 2889 SendPort::ZoneHandle(reader->zone(), SendPort::New(id, origin_id)); | 2757 SendPort::ZoneHandle(reader->zone(), SendPort::New(id, origin_id)); |
| 2890 reader->AddBackRef(object_id, &result, kIsDeserialized); | 2758 reader->AddBackRef(object_id, &result, kIsDeserialized); |
| 2891 return result.raw(); | 2759 return result.raw(); |
| 2892 } | 2760 } |
| 2893 | 2761 |
| 2894 | |
| 2895 void RawSendPort::WriteTo(SnapshotWriter* writer, | 2762 void RawSendPort::WriteTo(SnapshotWriter* writer, |
| 2896 intptr_t object_id, | 2763 intptr_t object_id, |
| 2897 Snapshot::Kind kind, | 2764 Snapshot::Kind kind, |
| 2898 bool as_reference) { | 2765 bool as_reference) { |
| 2899 // Write out the serialization header value for this object. | 2766 // Write out the serialization header value for this object. |
| 2900 writer->WriteInlinedObjectHeader(object_id); | 2767 writer->WriteInlinedObjectHeader(object_id); |
| 2901 | 2768 |
| 2902 // Write out the class and tags information. | 2769 // Write out the class and tags information. |
| 2903 writer->WriteIndexedObject(kSendPortCid); | 2770 writer->WriteIndexedObject(kSendPortCid); |
| 2904 writer->WriteTags(writer->GetObjectTags(this)); | 2771 writer->WriteTags(writer->GetObjectTags(this)); |
| 2905 | 2772 |
| 2906 writer->Write<uint64_t>(ptr()->id_); | 2773 writer->Write<uint64_t>(ptr()->id_); |
| 2907 writer->Write<uint64_t>(ptr()->origin_id_); | 2774 writer->Write<uint64_t>(ptr()->origin_id_); |
| 2908 } | 2775 } |
| 2909 | 2776 |
| 2910 | |
| 2911 RawStackTrace* StackTrace::ReadFrom(SnapshotReader* reader, | 2777 RawStackTrace* StackTrace::ReadFrom(SnapshotReader* reader, |
| 2912 intptr_t object_id, | 2778 intptr_t object_id, |
| 2913 intptr_t tags, | 2779 intptr_t tags, |
| 2914 Snapshot::Kind kind, | 2780 Snapshot::Kind kind, |
| 2915 bool as_reference) { | 2781 bool as_reference) { |
| 2916 UNREACHABLE(); // StackTraces are not sent in a snapshot. | 2782 UNREACHABLE(); // StackTraces are not sent in a snapshot. |
| 2917 return StackTrace::null(); | 2783 return StackTrace::null(); |
| 2918 } | 2784 } |
| 2919 | 2785 |
| 2920 | |
| 2921 void RawStackTrace::WriteTo(SnapshotWriter* writer, | 2786 void RawStackTrace::WriteTo(SnapshotWriter* writer, |
| 2922 intptr_t object_id, | 2787 intptr_t object_id, |
| 2923 Snapshot::Kind kind, | 2788 Snapshot::Kind kind, |
| 2924 bool as_reference) { | 2789 bool as_reference) { |
| 2925 ASSERT(kind == Snapshot::kMessage); | 2790 ASSERT(kind == Snapshot::kMessage); |
| 2926 writer->SetWriteException(Exceptions::kArgument, | 2791 writer->SetWriteException(Exceptions::kArgument, |
| 2927 "Illegal argument in isolate message" | 2792 "Illegal argument in isolate message" |
| 2928 " : (object is a stacktrace)"); | 2793 " : (object is a stacktrace)"); |
| 2929 } | 2794 } |
| 2930 | 2795 |
| 2931 | |
| 2932 RawRegExp* RegExp::ReadFrom(SnapshotReader* reader, | 2796 RawRegExp* RegExp::ReadFrom(SnapshotReader* reader, |
| 2933 intptr_t object_id, | 2797 intptr_t object_id, |
| 2934 intptr_t tags, | 2798 intptr_t tags, |
| 2935 Snapshot::Kind kind, | 2799 Snapshot::Kind kind, |
| 2936 bool as_reference) { | 2800 bool as_reference) { |
| 2937 ASSERT(reader != NULL); | 2801 ASSERT(reader != NULL); |
| 2938 | 2802 |
| 2939 // Allocate RegExp object. | 2803 // Allocate RegExp object. |
| 2940 RegExp& regex = RegExp::ZoneHandle(reader->zone(), RegExp::New()); | 2804 RegExp& regex = RegExp::ZoneHandle(reader->zone(), RegExp::New()); |
| 2941 reader->AddBackRef(object_id, ®ex, kIsDeserialized); | 2805 reader->AddBackRef(object_id, ®ex, kIsDeserialized); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2952 const Function& no_function = Function::Handle(reader->zone()); | 2816 const Function& no_function = Function::Handle(reader->zone()); |
| 2953 for (intptr_t cid = kOneByteStringCid; cid <= kExternalTwoByteStringCid; | 2817 for (intptr_t cid = kOneByteStringCid; cid <= kExternalTwoByteStringCid; |
| 2954 cid++) { | 2818 cid++) { |
| 2955 regex.set_function(cid, /*sticky=*/false, no_function); | 2819 regex.set_function(cid, /*sticky=*/false, no_function); |
| 2956 regex.set_function(cid, /*sticky=*/true, no_function); | 2820 regex.set_function(cid, /*sticky=*/true, no_function); |
| 2957 } | 2821 } |
| 2958 | 2822 |
| 2959 return regex.raw(); | 2823 return regex.raw(); |
| 2960 } | 2824 } |
| 2961 | 2825 |
| 2962 | |
| 2963 void RawRegExp::WriteTo(SnapshotWriter* writer, | 2826 void RawRegExp::WriteTo(SnapshotWriter* writer, |
| 2964 intptr_t object_id, | 2827 intptr_t object_id, |
| 2965 Snapshot::Kind kind, | 2828 Snapshot::Kind kind, |
| 2966 bool as_reference) { | 2829 bool as_reference) { |
| 2967 ASSERT(writer != NULL); | 2830 ASSERT(writer != NULL); |
| 2968 | 2831 |
| 2969 // Write out the serialization header value for this object. | 2832 // Write out the serialization header value for this object. |
| 2970 writer->WriteInlinedObjectHeader(object_id); | 2833 writer->WriteInlinedObjectHeader(object_id); |
| 2971 | 2834 |
| 2972 // Write out the class and tags information. | 2835 // Write out the class and tags information. |
| 2973 writer->WriteIndexedObject(kRegExpCid); | 2836 writer->WriteIndexedObject(kRegExpCid); |
| 2974 writer->WriteTags(writer->GetObjectTags(this)); | 2837 writer->WriteTags(writer->GetObjectTags(this)); |
| 2975 | 2838 |
| 2976 // Write out all the other fields. | 2839 // Write out all the other fields. |
| 2977 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 2840 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 2978 writer->WriteObjectImpl(ptr()->pattern_, kAsInlinedObject); | 2841 writer->WriteObjectImpl(ptr()->pattern_, kAsInlinedObject); |
| 2979 writer->Write<int32_t>(ptr()->num_registers_); | 2842 writer->Write<int32_t>(ptr()->num_registers_); |
| 2980 writer->Write<int8_t>(ptr()->type_flags_); | 2843 writer->Write<int8_t>(ptr()->type_flags_); |
| 2981 } | 2844 } |
| 2982 | 2845 |
| 2983 | |
| 2984 RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, | 2846 RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, |
| 2985 intptr_t object_id, | 2847 intptr_t object_id, |
| 2986 intptr_t tags, | 2848 intptr_t tags, |
| 2987 Snapshot::Kind kind, | 2849 Snapshot::Kind kind, |
| 2988 bool as_reference) { | 2850 bool as_reference) { |
| 2989 ASSERT(reader != NULL); | 2851 ASSERT(reader != NULL); |
| 2990 | 2852 |
| 2991 // Allocate the weak property object. | 2853 // Allocate the weak property object. |
| 2992 WeakProperty& weak_property = | 2854 WeakProperty& weak_property = |
| 2993 WeakProperty::ZoneHandle(reader->zone(), WeakProperty::New()); | 2855 WeakProperty::ZoneHandle(reader->zone(), WeakProperty::New()); |
| 2994 reader->AddBackRef(object_id, &weak_property, kIsDeserialized); | 2856 reader->AddBackRef(object_id, &weak_property, kIsDeserialized); |
| 2995 | 2857 |
| 2996 // Set all the object fields. | 2858 // Set all the object fields. |
| 2997 READ_OBJECT_FIELDS(weak_property, weak_property.raw()->from(), | 2859 READ_OBJECT_FIELDS(weak_property, weak_property.raw()->from(), |
| 2998 weak_property.raw()->to(), kAsReference); | 2860 weak_property.raw()->to(), kAsReference); |
| 2999 | 2861 |
| 3000 return weak_property.raw(); | 2862 return weak_property.raw(); |
| 3001 } | 2863 } |
| 3002 | 2864 |
| 3003 | |
| 3004 void RawWeakProperty::WriteTo(SnapshotWriter* writer, | 2865 void RawWeakProperty::WriteTo(SnapshotWriter* writer, |
| 3005 intptr_t object_id, | 2866 intptr_t object_id, |
| 3006 Snapshot::Kind kind, | 2867 Snapshot::Kind kind, |
| 3007 bool as_reference) { | 2868 bool as_reference) { |
| 3008 ASSERT(writer != NULL); | 2869 ASSERT(writer != NULL); |
| 3009 | 2870 |
| 3010 // Write out the serialization header value for this object. | 2871 // Write out the serialization header value for this object. |
| 3011 writer->WriteInlinedObjectHeader(object_id); | 2872 writer->WriteInlinedObjectHeader(object_id); |
| 3012 | 2873 |
| 3013 // Write out the class and tags information. | 2874 // Write out the class and tags information. |
| 3014 writer->WriteIndexedObject(kWeakPropertyCid); | 2875 writer->WriteIndexedObject(kWeakPropertyCid); |
| 3015 writer->WriteTags(writer->GetObjectTags(this)); | 2876 writer->WriteTags(writer->GetObjectTags(this)); |
| 3016 | 2877 |
| 3017 // Write out all the object pointer fields. | 2878 // Write out all the object pointer fields. |
| 3018 SnapshotWriterVisitor visitor(writer, kAsReference); | 2879 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 3019 visitor.VisitPointers(from(), to()); | 2880 visitor.VisitPointers(from(), to()); |
| 3020 } | 2881 } |
| 3021 | 2882 |
| 3022 | |
| 3023 RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, | 2883 RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, |
| 3024 intptr_t object_id, | 2884 intptr_t object_id, |
| 3025 intptr_t tags, | 2885 intptr_t tags, |
| 3026 Snapshot::Kind kind, | 2886 Snapshot::Kind kind, |
| 3027 bool as_referenec) { | 2887 bool as_referenec) { |
| 3028 UNREACHABLE(); | 2888 UNREACHABLE(); |
| 3029 return MirrorReference::null(); | 2889 return MirrorReference::null(); |
| 3030 } | 2890 } |
| 3031 | 2891 |
| 3032 | |
| 3033 void RawMirrorReference::WriteTo(SnapshotWriter* writer, | 2892 void RawMirrorReference::WriteTo(SnapshotWriter* writer, |
| 3034 intptr_t object_id, | 2893 intptr_t object_id, |
| 3035 Snapshot::Kind kind, | 2894 Snapshot::Kind kind, |
| 3036 bool as_reference) { | 2895 bool as_reference) { |
| 3037 if (kind == Snapshot::kMessage) { | 2896 if (kind == Snapshot::kMessage) { |
| 3038 // We do not allow objects with native fields in an isolate message. | 2897 // We do not allow objects with native fields in an isolate message. |
| 3039 writer->SetWriteException(Exceptions::kArgument, | 2898 writer->SetWriteException(Exceptions::kArgument, |
| 3040 "Illegal argument in isolate message" | 2899 "Illegal argument in isolate message" |
| 3041 " : (object is a MirrorReference)"); | 2900 " : (object is a MirrorReference)"); |
| 3042 } else { | 2901 } else { |
| 3043 UNREACHABLE(); | 2902 UNREACHABLE(); |
| 3044 } | 2903 } |
| 3045 } | 2904 } |
| 3046 | 2905 |
| 3047 | |
| 3048 RawUserTag* UserTag::ReadFrom(SnapshotReader* reader, | 2906 RawUserTag* UserTag::ReadFrom(SnapshotReader* reader, |
| 3049 intptr_t object_id, | 2907 intptr_t object_id, |
| 3050 intptr_t tags, | 2908 intptr_t tags, |
| 3051 Snapshot::Kind kind, | 2909 Snapshot::Kind kind, |
| 3052 bool as_reference) { | 2910 bool as_reference) { |
| 3053 UNREACHABLE(); | 2911 UNREACHABLE(); |
| 3054 return UserTag::null(); | 2912 return UserTag::null(); |
| 3055 } | 2913 } |
| 3056 | 2914 |
| 3057 | |
| 3058 void RawUserTag::WriteTo(SnapshotWriter* writer, | 2915 void RawUserTag::WriteTo(SnapshotWriter* writer, |
| 3059 intptr_t object_id, | 2916 intptr_t object_id, |
| 3060 Snapshot::Kind kind, | 2917 Snapshot::Kind kind, |
| 3061 bool as_reference) { | 2918 bool as_reference) { |
| 3062 if (kind == Snapshot::kMessage) { | 2919 if (kind == Snapshot::kMessage) { |
| 3063 // We do not allow objects with native fields in an isolate message. | 2920 // We do not allow objects with native fields in an isolate message. |
| 3064 writer->SetWriteException(Exceptions::kArgument, | 2921 writer->SetWriteException(Exceptions::kArgument, |
| 3065 "Illegal argument in isolate message" | 2922 "Illegal argument in isolate message" |
| 3066 " : (object is a UserTag)"); | 2923 " : (object is a UserTag)"); |
| 3067 } else { | 2924 } else { |
| 3068 UNREACHABLE(); | 2925 UNREACHABLE(); |
| 3069 } | 2926 } |
| 3070 } | 2927 } |
| 3071 | 2928 |
| 3072 } // namespace dart | 2929 } // namespace dart |
| OLD | NEW |