| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/bigint_operations.h" | 5 #include "vm/bigint_operations.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 RawClass* Class::ReadFrom(SnapshotReader* reader, | 27 RawClass* Class::ReadFrom(SnapshotReader* reader, |
| 28 intptr_t object_id, | 28 intptr_t object_id, |
| 29 intptr_t tags, | 29 intptr_t tags, |
| 30 Snapshot::Kind kind) { | 30 Snapshot::Kind kind) { |
| 31 ASSERT(reader != NULL); | 31 ASSERT(reader != NULL); |
| 32 | 32 |
| 33 Class& cls = Class::ZoneHandle(reader->isolate(), Class::null()); | 33 Class& cls = Class::ZoneHandle(reader->isolate(), Class::null()); |
| 34 if ((kind == Snapshot::kFull) || | 34 if ((kind == Snapshot::kFull) || |
| 35 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { | 35 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { |
| 36 // Read in the base information. | 36 // Read in the base information. |
| 37 ObjectKind object_kind = reader->Read<ObjectKind>(); | 37 intptr_t class_id = reader->ReadIntptrValue(); |
| 38 bool is_signature_class = reader->Read<bool>(); |
| 38 | 39 |
| 39 // Allocate class object of specified kind. | 40 // Allocate class object of specified kind. |
| 40 if (kind == Snapshot::kFull) { | 41 if (kind == Snapshot::kFull) { |
| 41 cls = reader->NewClass(object_kind); | 42 cls = reader->NewClass(class_id, is_signature_class); |
| 42 } else { | 43 } else { |
| 43 cls = Class::GetClass(object_kind); | 44 cls = Class::GetClass(class_id, is_signature_class); |
| 44 } | 45 } |
| 45 reader->AddBackRef(object_id, &cls, kIsDeserialized); | 46 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
| 46 | 47 |
| 47 // Set the object tags. | 48 // Set the object tags. |
| 48 cls.set_tags(tags); | 49 cls.set_tags(tags); |
| 49 | 50 |
| 50 // Set all non object fields. | 51 // Set all non object fields. |
| 51 cls.set_instance_size(reader->ReadIntptrValue()); | 52 cls.set_instance_size(reader->ReadIntptrValue()); |
| 52 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); | 53 cls.set_type_arguments_instance_field_offset(reader->ReadIntptrValue()); |
| 53 cls.set_next_field_offset(reader->ReadIntptrValue()); | 54 cls.set_next_field_offset(reader->ReadIntptrValue()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 80 Snapshot::Kind kind) { | 81 Snapshot::Kind kind) { |
| 81 ASSERT(writer != NULL); | 82 ASSERT(writer != NULL); |
| 82 | 83 |
| 83 // Write out the serialization header value for this object. | 84 // Write out the serialization header value for this object. |
| 84 writer->WriteInlinedObjectHeader(object_id); | 85 writer->WriteInlinedObjectHeader(object_id); |
| 85 | 86 |
| 86 if ((kind == Snapshot::kFull) || | 87 if ((kind == Snapshot::kFull) || |
| 87 (kind == Snapshot::kScript && | 88 (kind == Snapshot::kScript && |
| 88 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { | 89 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { |
| 89 // Write out the class and tags information. | 90 // Write out the class and tags information. |
| 90 writer->WriteVMIsolateObject(Object::kClassClass); | 91 writer->WriteVMIsolateObject(kClassCid); |
| 91 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 92 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 92 | 93 |
| 93 // Write out all the non object pointer fields. | 94 // Write out all the non object pointer fields. |
| 94 // NOTE: cpp_vtable_ is not written. | 95 // NOTE: cpp_vtable_ is not written. |
| 95 writer->Write<ObjectKind>(ptr()->instance_kind_); | 96 writer->WriteIntptrValue(ptr()->id_); |
| 97 writer->Write<bool>(Class::IsSignatureClass(this) ? true : false); |
| 96 writer->WriteIntptrValue(ptr()->instance_size_); | 98 writer->WriteIntptrValue(ptr()->instance_size_); |
| 97 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); | 99 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); |
| 98 writer->WriteIntptrValue(ptr()->next_field_offset_); | 100 writer->WriteIntptrValue(ptr()->next_field_offset_); |
| 99 writer->WriteIntptrValue(ptr()->num_native_fields_); | 101 writer->WriteIntptrValue(ptr()->num_native_fields_); |
| 100 writer->WriteIntptrValue(ptr()->token_pos_); | 102 writer->WriteIntptrValue(ptr()->token_pos_); |
| 101 writer->Write<int8_t>(ptr()->class_state_); | 103 writer->Write<int8_t>(ptr()->class_state_); |
| 102 writer->Write<bool>(ptr()->is_const_); | 104 writer->Write<bool>(ptr()->is_const_); |
| 103 writer->Write<bool>(ptr()->is_interface_); | 105 writer->Write<bool>(ptr()->is_interface_); |
| 104 | 106 |
| 105 // Write out all the object pointer fields. | 107 // Write out all the object pointer fields. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 | 144 |
| 143 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, | 145 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, |
| 144 intptr_t object_id, | 146 intptr_t object_id, |
| 145 Snapshot::Kind kind) { | 147 Snapshot::Kind kind) { |
| 146 ASSERT(writer != NULL); | 148 ASSERT(writer != NULL); |
| 147 | 149 |
| 148 // Write out the serialization header value for this object. | 150 // Write out the serialization header value for this object. |
| 149 writer->WriteInlinedObjectHeader(object_id); | 151 writer->WriteInlinedObjectHeader(object_id); |
| 150 | 152 |
| 151 // Write out the class and tags information. | 153 // Write out the class and tags information. |
| 152 writer->WriteVMIsolateObject(Object::kUnresolvedClassClass); | 154 writer->WriteVMIsolateObject(kUnresolvedClassCid); |
| 153 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 155 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 154 | 156 |
| 155 // Write out all the non object pointer fields. | 157 // Write out all the non object pointer fields. |
| 156 writer->WriteIntptrValue(ptr()->token_pos_); | 158 writer->WriteIntptrValue(ptr()->token_pos_); |
| 157 | 159 |
| 158 // Write out all the object pointer fields. | 160 // Write out all the object pointer fields. |
| 159 SnapshotWriterVisitor visitor(writer); | 161 SnapshotWriterVisitor visitor(writer); |
| 160 visitor.VisitPointers(from(), to()); | 162 visitor.VisitPointers(from(), to()); |
| 161 } | 163 } |
| 162 | 164 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 216 |
| 215 void RawType::WriteTo(SnapshotWriter* writer, | 217 void RawType::WriteTo(SnapshotWriter* writer, |
| 216 intptr_t object_id, | 218 intptr_t object_id, |
| 217 Snapshot::Kind kind) { | 219 Snapshot::Kind kind) { |
| 218 ASSERT(writer != NULL); | 220 ASSERT(writer != NULL); |
| 219 | 221 |
| 220 // Write out the serialization header value for this object. | 222 // Write out the serialization header value for this object. |
| 221 writer->WriteInlinedObjectHeader(object_id); | 223 writer->WriteInlinedObjectHeader(object_id); |
| 222 | 224 |
| 223 // Write out the class and tags information. | 225 // Write out the class and tags information. |
| 224 writer->WriteVMIsolateObject(Object::kTypeClass); | 226 writer->WriteVMIsolateObject(kTypeCid); |
| 225 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 227 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 226 | 228 |
| 227 // Write out all the non object pointer fields. | 229 // Write out all the non object pointer fields. |
| 228 writer->WriteIntptrValue(ptr()->token_pos_); | 230 writer->WriteIntptrValue(ptr()->token_pos_); |
| 229 writer->Write<int8_t>(ptr()->type_state_); | 231 writer->Write<int8_t>(ptr()->type_state_); |
| 230 | 232 |
| 231 // Write out all the object pointer fields. | 233 // Write out all the object pointer fields. |
| 232 SnapshotWriterVisitor visitor(writer, false); | 234 SnapshotWriterVisitor visitor(writer, false); |
| 233 visitor.VisitPointers(from(), to()); | 235 visitor.VisitPointers(from(), to()); |
| 234 } | 236 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 | 270 |
| 269 void RawTypeParameter::WriteTo(SnapshotWriter* writer, | 271 void RawTypeParameter::WriteTo(SnapshotWriter* writer, |
| 270 intptr_t object_id, | 272 intptr_t object_id, |
| 271 Snapshot::Kind kind) { | 273 Snapshot::Kind kind) { |
| 272 ASSERT(writer != NULL); | 274 ASSERT(writer != NULL); |
| 273 | 275 |
| 274 // Write out the serialization header value for this object. | 276 // Write out the serialization header value for this object. |
| 275 writer->WriteInlinedObjectHeader(object_id); | 277 writer->WriteInlinedObjectHeader(object_id); |
| 276 | 278 |
| 277 // Write out the class and tags information. | 279 // Write out the class and tags information. |
| 278 writer->WriteVMIsolateObject(Object::kTypeParameterClass); | 280 writer->WriteVMIsolateObject(kTypeParameterCid); |
| 279 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 281 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 280 | 282 |
| 281 // Write out all the non object pointer fields. | 283 // Write out all the non object pointer fields. |
| 282 writer->WriteIntptrValue(ptr()->index_); | 284 writer->WriteIntptrValue(ptr()->index_); |
| 283 writer->WriteIntptrValue(ptr()->token_pos_); | 285 writer->WriteIntptrValue(ptr()->token_pos_); |
| 284 writer->Write<int8_t>(ptr()->type_state_); | 286 writer->Write<int8_t>(ptr()->type_state_); |
| 285 | 287 |
| 286 // Write out all the object pointer fields. | 288 // Write out all the object pointer fields. |
| 287 SnapshotWriterVisitor visitor(writer, false); | 289 SnapshotWriterVisitor visitor(writer, false); |
| 288 visitor.VisitPointers(from(), to()); | 290 visitor.VisitPointers(from(), to()); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 342 |
| 341 void RawTypeArguments::WriteTo(SnapshotWriter* writer, | 343 void RawTypeArguments::WriteTo(SnapshotWriter* writer, |
| 342 intptr_t object_id, | 344 intptr_t object_id, |
| 343 Snapshot::Kind kind) { | 345 Snapshot::Kind kind) { |
| 344 ASSERT(writer != NULL); | 346 ASSERT(writer != NULL); |
| 345 | 347 |
| 346 // Write out the serialization header value for this object. | 348 // Write out the serialization header value for this object. |
| 347 writer->WriteInlinedObjectHeader(object_id); | 349 writer->WriteInlinedObjectHeader(object_id); |
| 348 | 350 |
| 349 // Write out the class and tags information. | 351 // Write out the class and tags information. |
| 350 writer->WriteVMIsolateObject(Object::kTypeArgumentsClass); | 352 writer->WriteVMIsolateObject(kTypeArgumentsCid); |
| 351 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 353 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 352 | 354 |
| 353 // Write out the length field. | 355 // Write out the length field. |
| 354 writer->Write<RawObject*>(ptr()->length_); | 356 writer->Write<RawObject*>(ptr()->length_); |
| 355 | 357 |
| 356 // Write out the individual types. | 358 // Write out the individual types. |
| 357 intptr_t len = Smi::Value(ptr()->length_); | 359 intptr_t len = Smi::Value(ptr()->length_); |
| 358 for (intptr_t i = 0; i < len; i++) { | 360 for (intptr_t i = 0; i < len; i++) { |
| 359 writer->WriteObjectImpl(ptr()->types_[i]); | 361 writer->WriteObjectImpl(ptr()->types_[i]); |
| 360 } | 362 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer, | 395 void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer, |
| 394 intptr_t object_id, | 396 intptr_t object_id, |
| 395 Snapshot::Kind kind) { | 397 Snapshot::Kind kind) { |
| 396 ASSERT(writer != NULL); | 398 ASSERT(writer != NULL); |
| 397 ASSERT(kind == Snapshot::kMessage); | 399 ASSERT(kind == Snapshot::kMessage); |
| 398 | 400 |
| 399 // Write out the serialization header value for this object. | 401 // Write out the serialization header value for this object. |
| 400 writer->WriteInlinedObjectHeader(object_id); | 402 writer->WriteInlinedObjectHeader(object_id); |
| 401 | 403 |
| 402 // Write out the class and tags information. | 404 // Write out the class and tags information. |
| 403 writer->WriteVMIsolateObject(Object::kInstantiatedTypeArgumentsClass); | 405 writer->WriteVMIsolateObject(kInstantiatedTypeArgumentsCid); |
| 404 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 406 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 405 | 407 |
| 406 // Write out all the object pointer fields. | 408 // Write out all the object pointer fields. |
| 407 SnapshotWriterVisitor visitor(writer, false); | 409 SnapshotWriterVisitor visitor(writer, false); |
| 408 visitor.VisitPointers(from(), to()); | 410 visitor.VisitPointers(from(), to()); |
| 409 } | 411 } |
| 410 | 412 |
| 411 | 413 |
| 412 RawFunction* Function::ReadFrom(SnapshotReader* reader, | 414 RawFunction* Function::ReadFrom(SnapshotReader* reader, |
| 413 intptr_t object_id, | 415 intptr_t object_id, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 intptr_t object_id, | 456 intptr_t object_id, |
| 455 Snapshot::Kind kind) { | 457 Snapshot::Kind kind) { |
| 456 ASSERT(writer != NULL); | 458 ASSERT(writer != NULL); |
| 457 ASSERT(kind != Snapshot::kMessage && | 459 ASSERT(kind != Snapshot::kMessage && |
| 458 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 460 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 459 | 461 |
| 460 // Write out the serialization header value for this object. | 462 // Write out the serialization header value for this object. |
| 461 writer->WriteInlinedObjectHeader(object_id); | 463 writer->WriteInlinedObjectHeader(object_id); |
| 462 | 464 |
| 463 // Write out the class and tags information. | 465 // Write out the class and tags information. |
| 464 writer->WriteVMIsolateObject(Object::kFunctionClass); | 466 writer->WriteVMIsolateObject(kFunctionCid); |
| 465 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 467 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 466 | 468 |
| 467 // Write out all the non object fields. | 469 // Write out all the non object fields. |
| 468 writer->WriteIntptrValue(ptr()->token_pos_); | 470 writer->WriteIntptrValue(ptr()->token_pos_); |
| 469 writer->WriteIntptrValue(ptr()->end_token_pos_); | 471 writer->WriteIntptrValue(ptr()->end_token_pos_); |
| 470 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); | 472 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); |
| 471 writer->WriteIntptrValue(ptr()->num_optional_parameters_); | 473 writer->WriteIntptrValue(ptr()->num_optional_parameters_); |
| 472 writer->WriteIntptrValue(ptr()->usage_counter_); | 474 writer->WriteIntptrValue(ptr()->usage_counter_); |
| 473 writer->WriteIntptrValue(ptr()->deoptimization_counter_); | 475 writer->WriteIntptrValue(ptr()->deoptimization_counter_); |
| 474 writer->WriteIntptrValue(GetKind()); | 476 writer->WriteIntptrValue(GetKind()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 intptr_t object_id, | 523 intptr_t object_id, |
| 522 Snapshot::Kind kind) { | 524 Snapshot::Kind kind) { |
| 523 ASSERT(writer != NULL); | 525 ASSERT(writer != NULL); |
| 524 ASSERT(kind != Snapshot::kMessage && | 526 ASSERT(kind != Snapshot::kMessage && |
| 525 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 527 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 526 | 528 |
| 527 // Write out the serialization header value for this object. | 529 // Write out the serialization header value for this object. |
| 528 writer->WriteInlinedObjectHeader(object_id); | 530 writer->WriteInlinedObjectHeader(object_id); |
| 529 | 531 |
| 530 // Write out the class and tags information. | 532 // Write out the class and tags information. |
| 531 writer->WriteVMIsolateObject(Object::kFieldClass); | 533 writer->WriteVMIsolateObject(kFieldCid); |
| 532 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 534 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 533 | 535 |
| 534 // Write out all the non object fields. | 536 // Write out all the non object fields. |
| 535 writer->WriteIntptrValue(ptr()->token_pos_); | 537 writer->WriteIntptrValue(ptr()->token_pos_); |
| 536 writer->Write<bool>(ptr()->is_static_); | 538 writer->Write<bool>(ptr()->is_static_); |
| 537 writer->Write<bool>(ptr()->is_final_); | 539 writer->Write<bool>(ptr()->is_final_); |
| 538 writer->Write<bool>(ptr()->is_const_); | 540 writer->Write<bool>(ptr()->is_const_); |
| 539 writer->Write<bool>(ptr()->has_initializer_); | 541 writer->Write<bool>(ptr()->has_initializer_); |
| 540 | 542 |
| 541 // Write out all the object pointer fields. | 543 // Write out all the object pointer fields. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 void RawLiteralToken::WriteTo(SnapshotWriter* writer, | 576 void RawLiteralToken::WriteTo(SnapshotWriter* writer, |
| 575 intptr_t object_id, | 577 intptr_t object_id, |
| 576 Snapshot::Kind kind) { | 578 Snapshot::Kind kind) { |
| 577 ASSERT(writer != NULL); | 579 ASSERT(writer != NULL); |
| 578 ASSERT(kind != Snapshot::kMessage); | 580 ASSERT(kind != Snapshot::kMessage); |
| 579 | 581 |
| 580 // Write out the serialization header value for this object. | 582 // Write out the serialization header value for this object. |
| 581 writer->WriteInlinedObjectHeader(object_id); | 583 writer->WriteInlinedObjectHeader(object_id); |
| 582 | 584 |
| 583 // Write out the class and tags information. | 585 // Write out the class and tags information. |
| 584 writer->WriteVMIsolateObject(Object::kLiteralTokenClass); | 586 writer->WriteVMIsolateObject(kLiteralTokenCid); |
| 585 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 587 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 586 | 588 |
| 587 // Write out the kind field. | 589 // Write out the kind field. |
| 588 writer->Write<intptr_t>(ptr()->kind_); | 590 writer->Write<intptr_t>(ptr()->kind_); |
| 589 | 591 |
| 590 // Write out literal and value fields. | 592 // Write out literal and value fields. |
| 591 writer->WriteObjectImpl(ptr()->literal_); | 593 writer->WriteObjectImpl(ptr()->literal_); |
| 592 writer->WriteObjectImpl(ptr()->value_); | 594 writer->WriteObjectImpl(ptr()->value_); |
| 593 } | 595 } |
| 594 | 596 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 intptr_t object_id, | 632 intptr_t object_id, |
| 631 Snapshot::Kind kind) { | 633 Snapshot::Kind kind) { |
| 632 ASSERT(writer != NULL); | 634 ASSERT(writer != NULL); |
| 633 ASSERT(kind != Snapshot::kMessage && | 635 ASSERT(kind != Snapshot::kMessage && |
| 634 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 636 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 635 | 637 |
| 636 // Write out the serialization header value for this object. | 638 // Write out the serialization header value for this object. |
| 637 writer->WriteInlinedObjectHeader(object_id); | 639 writer->WriteInlinedObjectHeader(object_id); |
| 638 | 640 |
| 639 // Write out the class and tags information. | 641 // Write out the class and tags information. |
| 640 writer->WriteVMIsolateObject(Object::kTokenStreamClass); | 642 writer->WriteVMIsolateObject(kTokenStreamCid); |
| 641 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 643 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 642 | 644 |
| 643 // Write out the length field and the token stream. | 645 // Write out the length field and the token stream. |
| 644 intptr_t len = Smi::Value(ptr()->length_); | 646 intptr_t len = Smi::Value(ptr()->length_); |
| 645 writer->Write<RawObject*>(ptr()->length_); | 647 writer->Write<RawObject*>(ptr()->length_); |
| 646 writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len); | 648 writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len); |
| 647 | 649 |
| 648 // Write out the literal/identifier token array. | 650 // Write out the literal/identifier token array. |
| 649 writer->WriteObjectImpl(ptr()->token_objects_); | 651 writer->WriteObjectImpl(ptr()->token_objects_); |
| 650 } | 652 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 Snapshot::Kind kind) { | 686 Snapshot::Kind kind) { |
| 685 ASSERT(writer != NULL); | 687 ASSERT(writer != NULL); |
| 686 ASSERT(tokens_ != TokenStream::null()); | 688 ASSERT(tokens_ != TokenStream::null()); |
| 687 ASSERT(kind != Snapshot::kMessage && | 689 ASSERT(kind != Snapshot::kMessage && |
| 688 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 690 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 689 | 691 |
| 690 // Write out the serialization header value for this object. | 692 // Write out the serialization header value for this object. |
| 691 writer->WriteInlinedObjectHeader(object_id); | 693 writer->WriteInlinedObjectHeader(object_id); |
| 692 | 694 |
| 693 // Write out the class and tags information. | 695 // Write out the class and tags information. |
| 694 writer->WriteVMIsolateObject(Object::kScriptClass); | 696 writer->WriteVMIsolateObject(kScriptCid); |
| 695 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 697 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 696 | 698 |
| 697 // Write out all the object pointer fields. | 699 // Write out all the object pointer fields. |
| 698 writer->WriteObjectImpl(ptr()->url_); | 700 writer->WriteObjectImpl(ptr()->url_); |
| 699 writer->WriteObjectImpl(ptr()->tokens_); | 701 writer->WriteObjectImpl(ptr()->tokens_); |
| 700 } | 702 } |
| 701 | 703 |
| 702 | 704 |
| 703 RawLibrary* Library::ReadFrom(SnapshotReader* reader, | 705 RawLibrary* Library::ReadFrom(SnapshotReader* reader, |
| 704 intptr_t object_id, | 706 intptr_t object_id, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 void RawLibrary::WriteTo(SnapshotWriter* writer, | 758 void RawLibrary::WriteTo(SnapshotWriter* writer, |
| 757 intptr_t object_id, | 759 intptr_t object_id, |
| 758 Snapshot::Kind kind) { | 760 Snapshot::Kind kind) { |
| 759 ASSERT(writer != NULL); | 761 ASSERT(writer != NULL); |
| 760 ASSERT(kind != Snapshot::kMessage); | 762 ASSERT(kind != Snapshot::kMessage); |
| 761 | 763 |
| 762 // Write out the serialization header value for this object. | 764 // Write out the serialization header value for this object. |
| 763 writer->WriteInlinedObjectHeader(object_id); | 765 writer->WriteInlinedObjectHeader(object_id); |
| 764 | 766 |
| 765 // Write out the class and tags information. | 767 // Write out the class and tags information. |
| 766 writer->WriteVMIsolateObject(Object::kLibraryClass); | 768 writer->WriteVMIsolateObject(kLibraryCid); |
| 767 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 769 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 768 | 770 |
| 769 if (RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { | 771 if (RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { |
| 770 ASSERT(kind != Snapshot::kFull); | 772 ASSERT(kind != Snapshot::kFull); |
| 771 // Write out library URL so that it can be looked up when reading. | 773 // Write out library URL so that it can be looked up when reading. |
| 772 writer->WriteObjectImpl(ptr()->url_); | 774 writer->WriteObjectImpl(ptr()->url_); |
| 773 } else { | 775 } else { |
| 774 // Write out all non object fields. | 776 // Write out all non object fields. |
| 775 writer->WriteIntptrValue(ptr()->index_); | 777 writer->WriteIntptrValue(ptr()->index_); |
| 776 writer->WriteIntptrValue(ptr()->num_imports_); | 778 writer->WriteIntptrValue(ptr()->num_imports_); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 intptr_t object_id, | 829 intptr_t object_id, |
| 828 Snapshot::Kind kind) { | 830 Snapshot::Kind kind) { |
| 829 ASSERT(writer != NULL); | 831 ASSERT(writer != NULL); |
| 830 ASSERT(kind != Snapshot::kMessage && | 832 ASSERT(kind != Snapshot::kMessage && |
| 831 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 833 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 832 | 834 |
| 833 // Write out the serialization header value for this object. | 835 // Write out the serialization header value for this object. |
| 834 writer->WriteInlinedObjectHeader(object_id); | 836 writer->WriteInlinedObjectHeader(object_id); |
| 835 | 837 |
| 836 // Write out the class and tags information. | 838 // Write out the class and tags information. |
| 837 writer->WriteVMIsolateObject(Object::kLibraryPrefixClass); | 839 writer->WriteVMIsolateObject(kLibraryPrefixCid); |
| 838 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 840 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 839 | 841 |
| 840 // Write out all non object fields. | 842 // Write out all non object fields. |
| 841 writer->WriteIntptrValue(ptr()->num_libs_); | 843 writer->WriteIntptrValue(ptr()->num_libs_); |
| 842 | 844 |
| 843 // Write out all the object pointer fields. | 845 // Write out all the object pointer fields. |
| 844 SnapshotWriterVisitor visitor(writer); | 846 SnapshotWriterVisitor visitor(writer); |
| 845 visitor.VisitPointers(from(), to()); | 847 visitor.VisitPointers(from(), to()); |
| 846 } | 848 } |
| 847 | 849 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 998 |
| 997 void RawContext::WriteTo(SnapshotWriter* writer, | 999 void RawContext::WriteTo(SnapshotWriter* writer, |
| 998 intptr_t object_id, | 1000 intptr_t object_id, |
| 999 Snapshot::Kind kind) { | 1001 Snapshot::Kind kind) { |
| 1000 ASSERT(writer != NULL); | 1002 ASSERT(writer != NULL); |
| 1001 | 1003 |
| 1002 // Write out the serialization header value for this object. | 1004 // Write out the serialization header value for this object. |
| 1003 writer->WriteInlinedObjectHeader(object_id); | 1005 writer->WriteInlinedObjectHeader(object_id); |
| 1004 | 1006 |
| 1005 // Write out the class and tags information. | 1007 // Write out the class and tags information. |
| 1006 writer->WriteVMIsolateObject(Object::kContextClass); | 1008 writer->WriteVMIsolateObject(kContextCid); |
| 1007 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1009 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1008 | 1010 |
| 1009 // Write out num of variables in the context. | 1011 // Write out num of variables in the context. |
| 1010 writer->WriteIntptrValue(ptr()->num_variables_); | 1012 writer->WriteIntptrValue(ptr()->num_variables_); |
| 1011 | 1013 |
| 1012 // Can't serialize the isolate pointer, we set it implicitly on read. | 1014 // Can't serialize the isolate pointer, we set it implicitly on read. |
| 1013 | 1015 |
| 1014 // Write out all the object pointer fields. | 1016 // Write out all the object pointer fields. |
| 1015 SnapshotWriterVisitor visitor(writer); | 1017 SnapshotWriterVisitor visitor(writer); |
| 1016 visitor.VisitPointers(from(), to(ptr()->num_variables_)); | 1018 visitor.VisitPointers(from(), to(ptr()->num_variables_)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1048 void RawContextScope::WriteTo(SnapshotWriter* writer, | 1050 void RawContextScope::WriteTo(SnapshotWriter* writer, |
| 1049 intptr_t object_id, | 1051 intptr_t object_id, |
| 1050 Snapshot::Kind kind) { | 1052 Snapshot::Kind kind) { |
| 1051 ASSERT(writer != NULL); | 1053 ASSERT(writer != NULL); |
| 1052 ASSERT(kind == Snapshot::kMessage); | 1054 ASSERT(kind == Snapshot::kMessage); |
| 1053 | 1055 |
| 1054 // Write out the serialization header value for this object. | 1056 // Write out the serialization header value for this object. |
| 1055 writer->WriteInlinedObjectHeader(object_id); | 1057 writer->WriteInlinedObjectHeader(object_id); |
| 1056 | 1058 |
| 1057 // Write out the class and tags information. | 1059 // Write out the class and tags information. |
| 1058 writer->WriteVMIsolateObject(Object::kContextScopeClass); | 1060 writer->WriteVMIsolateObject(kContextScopeCid); |
| 1059 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1061 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1060 | 1062 |
| 1061 // Serialize number of variables. | 1063 // Serialize number of variables. |
| 1062 writer->WriteIntptrValue(ptr()->num_variables_); | 1064 writer->WriteIntptrValue(ptr()->num_variables_); |
| 1063 | 1065 |
| 1064 // Write out all the object pointer fields. | 1066 // Write out all the object pointer fields. |
| 1065 SnapshotWriterVisitor visitor(writer); | 1067 SnapshotWriterVisitor visitor(writer); |
| 1066 visitor.VisitPointers(from(), to(ptr()->num_variables_)); | 1068 visitor.VisitPointers(from(), to(ptr()->num_variables_)); |
| 1067 } | 1069 } |
| 1068 | 1070 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 | 1228 |
| 1227 void RawMint::WriteTo(SnapshotWriter* writer, | 1229 void RawMint::WriteTo(SnapshotWriter* writer, |
| 1228 intptr_t object_id, | 1230 intptr_t object_id, |
| 1229 Snapshot::Kind kind) { | 1231 Snapshot::Kind kind) { |
| 1230 ASSERT(writer != NULL); | 1232 ASSERT(writer != NULL); |
| 1231 | 1233 |
| 1232 // Write out the serialization header value for this object. | 1234 // Write out the serialization header value for this object. |
| 1233 writer->WriteInlinedObjectHeader(object_id); | 1235 writer->WriteInlinedObjectHeader(object_id); |
| 1234 | 1236 |
| 1235 // Write out the class and tags information. | 1237 // Write out the class and tags information. |
| 1236 writer->WriteIndexedObject(ObjectStore::kMintClass); | 1238 writer->WriteIndexedObject(kMintCid); |
| 1237 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1239 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1238 | 1240 |
| 1239 // Write out the 64 bit value. | 1241 // Write out the 64 bit value. |
| 1240 writer->Write<int64_t>(ptr()->value_); | 1242 writer->Write<int64_t>(ptr()->value_); |
| 1241 } | 1243 } |
| 1242 | 1244 |
| 1243 | 1245 |
| 1244 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, | 1246 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, |
| 1245 intptr_t object_id, | 1247 intptr_t object_id, |
| 1246 intptr_t tags, | 1248 intptr_t tags, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1274 | 1276 |
| 1275 void RawBigint::WriteTo(SnapshotWriter* writer, | 1277 void RawBigint::WriteTo(SnapshotWriter* writer, |
| 1276 intptr_t object_id, | 1278 intptr_t object_id, |
| 1277 Snapshot::Kind kind) { | 1279 Snapshot::Kind kind) { |
| 1278 ASSERT(writer != NULL); | 1280 ASSERT(writer != NULL); |
| 1279 | 1281 |
| 1280 // Write out the serialization header value for this object. | 1282 // Write out the serialization header value for this object. |
| 1281 writer->WriteInlinedObjectHeader(object_id); | 1283 writer->WriteInlinedObjectHeader(object_id); |
| 1282 | 1284 |
| 1283 // Write out the class and tags information. | 1285 // Write out the class and tags information. |
| 1284 writer->WriteIndexedObject(ObjectStore::kBigintClass); | 1286 writer->WriteIndexedObject(kBigintCid); |
| 1285 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1287 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1286 | 1288 |
| 1287 // Write out the bigint value as a HEXCstring. | 1289 // Write out the bigint value as a HEXCstring. |
| 1288 intptr_t length = ptr()->signed_length_; | 1290 intptr_t length = ptr()->signed_length_; |
| 1289 bool is_negative = false; | 1291 bool is_negative = false; |
| 1290 if (length <= 0) { | 1292 if (length <= 0) { |
| 1291 length = -length; | 1293 length = -length; |
| 1292 is_negative = true; | 1294 is_negative = true; |
| 1293 } | 1295 } |
| 1294 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); | 1296 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1344 | 1346 |
| 1345 void RawDouble::WriteTo(SnapshotWriter* writer, | 1347 void RawDouble::WriteTo(SnapshotWriter* writer, |
| 1346 intptr_t object_id, | 1348 intptr_t object_id, |
| 1347 Snapshot::Kind kind) { | 1349 Snapshot::Kind kind) { |
| 1348 ASSERT(writer != NULL); | 1350 ASSERT(writer != NULL); |
| 1349 | 1351 |
| 1350 // Write out the serialization header value for this object. | 1352 // Write out the serialization header value for this object. |
| 1351 writer->WriteInlinedObjectHeader(object_id); | 1353 writer->WriteInlinedObjectHeader(object_id); |
| 1352 | 1354 |
| 1353 // Write out the class and tags information. | 1355 // Write out the class and tags information. |
| 1354 writer->WriteIndexedObject(ObjectStore::kDoubleClass); | 1356 writer->WriteIndexedObject(kDoubleCid); |
| 1355 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1357 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1356 | 1358 |
| 1357 // Write out the double value. | 1359 // Write out the double value. |
| 1358 writer->Write<double>(ptr()->value_); | 1360 writer->Write<double>(ptr()->value_); |
| 1359 } | 1361 } |
| 1360 | 1362 |
| 1361 | 1363 |
| 1362 RawString* String::ReadFrom(SnapshotReader* reader, | 1364 RawString* String::ReadFrom(SnapshotReader* reader, |
| 1363 intptr_t object_id, | 1365 intptr_t object_id, |
| 1364 intptr_t tags, | 1366 intptr_t tags, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 writer->WriteIntptrValue(tags); | 1516 writer->WriteIntptrValue(tags); |
| 1515 | 1517 |
| 1516 // Write out the length field. | 1518 // Write out the length field. |
| 1517 writer->Write<RawObject*>(length); | 1519 writer->Write<RawObject*>(length); |
| 1518 | 1520 |
| 1519 // Write out the hash field. | 1521 // Write out the hash field. |
| 1520 writer->Write<RawObject*>(hash); | 1522 writer->Write<RawObject*>(hash); |
| 1521 | 1523 |
| 1522 // Write out the string. | 1524 // Write out the string. |
| 1523 if (len > 0) { | 1525 if (len > 0) { |
| 1524 if (class_id == ObjectStore::kOneByteStringClass) { | 1526 if (class_id == kOneByteStringCid) { |
| 1525 writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len); | 1527 writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len); |
| 1526 } else { | 1528 } else { |
| 1527 for (intptr_t i = 0; i < len; i++) { | 1529 for (intptr_t i = 0; i < len; i++) { |
| 1528 writer->Write(data[i]); | 1530 writer->Write(data[i]); |
| 1529 } | 1531 } |
| 1530 } | 1532 } |
| 1531 } | 1533 } |
| 1532 } | 1534 } |
| 1533 | 1535 |
| 1534 | 1536 |
| 1535 void RawOneByteString::WriteTo(SnapshotWriter* writer, | 1537 void RawOneByteString::WriteTo(SnapshotWriter* writer, |
| 1536 intptr_t object_id, | 1538 intptr_t object_id, |
| 1537 Snapshot::Kind kind) { | 1539 Snapshot::Kind kind) { |
| 1538 StringWriteTo(writer, | 1540 StringWriteTo(writer, |
| 1539 object_id, | 1541 object_id, |
| 1540 kind, | 1542 kind, |
| 1541 ObjectStore::kOneByteStringClass, | 1543 kOneByteStringCid, |
| 1542 writer->GetObjectTags(this), | 1544 writer->GetObjectTags(this), |
| 1543 ptr()->length_, | 1545 ptr()->length_, |
| 1544 ptr()->hash_, | 1546 ptr()->hash_, |
| 1545 ptr()->data_); | 1547 ptr()->data_); |
| 1546 } | 1548 } |
| 1547 | 1549 |
| 1548 | 1550 |
| 1549 void RawTwoByteString::WriteTo(SnapshotWriter* writer, | 1551 void RawTwoByteString::WriteTo(SnapshotWriter* writer, |
| 1550 intptr_t object_id, | 1552 intptr_t object_id, |
| 1551 Snapshot::Kind kind) { | 1553 Snapshot::Kind kind) { |
| 1552 StringWriteTo(writer, | 1554 StringWriteTo(writer, |
| 1553 object_id, | 1555 object_id, |
| 1554 kind, | 1556 kind, |
| 1555 ObjectStore::kTwoByteStringClass, | 1557 kTwoByteStringCid, |
| 1556 writer->GetObjectTags(this), | 1558 writer->GetObjectTags(this), |
| 1557 ptr()->length_, | 1559 ptr()->length_, |
| 1558 ptr()->hash_, | 1560 ptr()->hash_, |
| 1559 ptr()->data_); | 1561 ptr()->data_); |
| 1560 } | 1562 } |
| 1561 | 1563 |
| 1562 | 1564 |
| 1563 void RawFourByteString::WriteTo(SnapshotWriter* writer, | 1565 void RawFourByteString::WriteTo(SnapshotWriter* writer, |
| 1564 intptr_t object_id, | 1566 intptr_t object_id, |
| 1565 Snapshot::Kind kind) { | 1567 Snapshot::Kind kind) { |
| 1566 StringWriteTo(writer, | 1568 StringWriteTo(writer, |
| 1567 object_id, | 1569 object_id, |
| 1568 kind, | 1570 kind, |
| 1569 ObjectStore::kFourByteStringClass, | 1571 kFourByteStringCid, |
| 1570 writer->GetObjectTags(this), | 1572 writer->GetObjectTags(this), |
| 1571 ptr()->length_, | 1573 ptr()->length_, |
| 1572 ptr()->hash_, | 1574 ptr()->hash_, |
| 1573 ptr()->data_); | 1575 ptr()->data_); |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 | 1578 |
| 1577 RawExternalOneByteString* ExternalOneByteString::ReadFrom( | 1579 RawExternalOneByteString* ExternalOneByteString::ReadFrom( |
| 1578 SnapshotReader* reader, | 1580 SnapshotReader* reader, |
| 1579 intptr_t object_id, | 1581 intptr_t object_id, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1604 } | 1606 } |
| 1605 | 1607 |
| 1606 | 1608 |
| 1607 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, | 1609 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, |
| 1608 intptr_t object_id, | 1610 intptr_t object_id, |
| 1609 Snapshot::Kind kind) { | 1611 Snapshot::Kind kind) { |
| 1610 // Serialize as a non-external one byte string. | 1612 // Serialize as a non-external one byte string. |
| 1611 StringWriteTo(writer, | 1613 StringWriteTo(writer, |
| 1612 object_id, | 1614 object_id, |
| 1613 kind, | 1615 kind, |
| 1614 ObjectStore::kOneByteStringClass, | 1616 kOneByteStringCid, |
| 1615 writer->GetObjectTags(this), | 1617 writer->GetObjectTags(this), |
| 1616 ptr()->length_, | 1618 ptr()->length_, |
| 1617 ptr()->hash_, | 1619 ptr()->hash_, |
| 1618 ptr()->external_data_->data()); | 1620 ptr()->external_data_->data()); |
| 1619 } | 1621 } |
| 1620 | 1622 |
| 1621 | 1623 |
| 1622 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, | 1624 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, |
| 1623 intptr_t object_id, | 1625 intptr_t object_id, |
| 1624 Snapshot::Kind kind) { | 1626 Snapshot::Kind kind) { |
| 1625 // Serialize as a non-external two byte string. | 1627 // Serialize as a non-external two byte string. |
| 1626 StringWriteTo(writer, | 1628 StringWriteTo(writer, |
| 1627 object_id, | 1629 object_id, |
| 1628 kind, | 1630 kind, |
| 1629 ObjectStore::kTwoByteStringClass, | 1631 kTwoByteStringCid, |
| 1630 writer->GetObjectTags(this), | 1632 writer->GetObjectTags(this), |
| 1631 ptr()->length_, | 1633 ptr()->length_, |
| 1632 ptr()->hash_, | 1634 ptr()->hash_, |
| 1633 ptr()->external_data_->data()); | 1635 ptr()->external_data_->data()); |
| 1634 } | 1636 } |
| 1635 | 1637 |
| 1636 | 1638 |
| 1637 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, | 1639 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, |
| 1638 intptr_t object_id, | 1640 intptr_t object_id, |
| 1639 Snapshot::Kind kind) { | 1641 Snapshot::Kind kind) { |
| 1640 // Serialize as a non-external four byte string. | 1642 // Serialize as a non-external four byte string. |
| 1641 StringWriteTo(writer, | 1643 StringWriteTo(writer, |
| 1642 object_id, | 1644 object_id, |
| 1643 kind, | 1645 kind, |
| 1644 ObjectStore::kFourByteStringClass, | 1646 kFourByteStringCid, |
| 1645 writer->GetObjectTags(this), | 1647 writer->GetObjectTags(this), |
| 1646 ptr()->length_, | 1648 ptr()->length_, |
| 1647 ptr()->hash_, | 1649 ptr()->hash_, |
| 1648 ptr()->external_data_->data()); | 1650 ptr()->external_data_->data()); |
| 1649 } | 1651 } |
| 1650 | 1652 |
| 1651 | 1653 |
| 1652 RawBool* Bool::ReadFrom(SnapshotReader* reader, | 1654 RawBool* Bool::ReadFrom(SnapshotReader* reader, |
| 1653 intptr_t object_id, | 1655 intptr_t object_id, |
| 1654 intptr_t tags, | 1656 intptr_t tags, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 } | 1704 } |
| 1703 reader->ArrayReadFrom(*array, len, tags); | 1705 reader->ArrayReadFrom(*array, len, tags); |
| 1704 return array->raw(); | 1706 return array->raw(); |
| 1705 } | 1707 } |
| 1706 | 1708 |
| 1707 | 1709 |
| 1708 void RawArray::WriteTo(SnapshotWriter* writer, | 1710 void RawArray::WriteTo(SnapshotWriter* writer, |
| 1709 intptr_t object_id, | 1711 intptr_t object_id, |
| 1710 Snapshot::Kind kind) { | 1712 Snapshot::Kind kind) { |
| 1711 writer->ArrayWriteTo(object_id, | 1713 writer->ArrayWriteTo(object_id, |
| 1712 ObjectStore::kArrayClass, | 1714 kArrayCid, |
| 1713 writer->GetObjectTags(this), | 1715 writer->GetObjectTags(this), |
| 1714 ptr()->length_, | 1716 ptr()->length_, |
| 1715 ptr()->type_arguments_, | 1717 ptr()->type_arguments_, |
| 1716 ptr()->data()); | 1718 ptr()->data()); |
| 1717 } | 1719 } |
| 1718 | 1720 |
| 1719 | 1721 |
| 1720 void RawImmutableArray::WriteTo(SnapshotWriter* writer, | 1722 void RawImmutableArray::WriteTo(SnapshotWriter* writer, |
| 1721 intptr_t object_id, | 1723 intptr_t object_id, |
| 1722 Snapshot::Kind kind) { | 1724 Snapshot::Kind kind) { |
| 1723 writer->ArrayWriteTo(object_id, | 1725 writer->ArrayWriteTo(object_id, |
| 1724 ObjectStore::kImmutableArrayClass, | 1726 kImmutableArrayCid, |
| 1725 writer->GetObjectTags(this), | 1727 writer->GetObjectTags(this), |
| 1726 ptr()->length_, | 1728 ptr()->length_, |
| 1727 ptr()->type_arguments_, | 1729 ptr()->type_arguments_, |
| 1728 ptr()->data()); | 1730 ptr()->data()); |
| 1729 } | 1731 } |
| 1730 | 1732 |
| 1731 | 1733 |
| 1732 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, | 1734 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, |
| 1733 intptr_t object_id, | 1735 intptr_t object_id, |
| 1734 intptr_t tags, | 1736 intptr_t tags, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1758 | 1760 |
| 1759 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, | 1761 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, |
| 1760 intptr_t object_id, | 1762 intptr_t object_id, |
| 1761 Snapshot::Kind kind) { | 1763 Snapshot::Kind kind) { |
| 1762 ASSERT(writer != NULL); | 1764 ASSERT(writer != NULL); |
| 1763 | 1765 |
| 1764 // Write out the serialization header value for this object. | 1766 // Write out the serialization header value for this object. |
| 1765 writer->WriteInlinedObjectHeader(object_id); | 1767 writer->WriteInlinedObjectHeader(object_id); |
| 1766 | 1768 |
| 1767 // Write out the class and tags information. | 1769 // Write out the class and tags information. |
| 1768 writer->WriteIndexedObject(ObjectStore::kGrowableObjectArrayClass); | 1770 writer->WriteIndexedObject(kGrowableObjectArrayCid); |
| 1769 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 1771 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 1770 | 1772 |
| 1771 // Write out the used length field. | 1773 // Write out the used length field. |
| 1772 writer->Write<RawObject*>(ptr()->length_); | 1774 writer->Write<RawObject*>(ptr()->length_); |
| 1773 | 1775 |
| 1774 // Write out the Array object. | 1776 // Write out the Array object. |
| 1775 writer->WriteObjectImpl(ptr()->data_); | 1777 writer->WriteObjectImpl(ptr()->data_); |
| 1776 } | 1778 } |
| 1777 | 1779 |
| 1778 | 1780 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 } | 1897 } |
| 1896 | 1898 |
| 1897 | 1899 |
| 1898 #define BYTEARRAY_WRITE_TO(name, lname, type) \ | 1900 #define BYTEARRAY_WRITE_TO(name, lname, type) \ |
| 1899 void Raw##name##Array::WriteTo(SnapshotWriter* writer, \ | 1901 void Raw##name##Array::WriteTo(SnapshotWriter* writer, \ |
| 1900 intptr_t object_id, \ | 1902 intptr_t object_id, \ |
| 1901 Snapshot::Kind kind) { \ | 1903 Snapshot::Kind kind) { \ |
| 1902 ByteArrayWriteTo(writer, \ | 1904 ByteArrayWriteTo(writer, \ |
| 1903 object_id, \ | 1905 object_id, \ |
| 1904 kind, \ | 1906 kind, \ |
| 1905 ObjectStore::k##name##ArrayClass, \ | 1907 k##name##ArrayCid, \ |
| 1906 writer->GetObjectTags(this), \ | 1908 writer->GetObjectTags(this), \ |
| 1907 ptr()->length_, \ | 1909 ptr()->length_, \ |
| 1908 reinterpret_cast<uint8_t*>(ptr()->data_)); \ | 1910 reinterpret_cast<uint8_t*>(ptr()->data_)); \ |
| 1909 } \ | 1911 } \ |
| 1910 | 1912 |
| 1911 | 1913 |
| 1912 BYTEARRAY_TYPE_LIST(BYTEARRAY_WRITE_TO) | 1914 BYTEARRAY_TYPE_LIST(BYTEARRAY_WRITE_TO) |
| 1913 #undef BYTEARRAY_WRITE_TO | 1915 #undef BYTEARRAY_WRITE_TO |
| 1914 | 1916 |
| 1915 | 1917 |
| 1916 #define EXTERNALARRAY_WRITE_TO(name, lname, type) \ | 1918 #define EXTERNALARRAY_WRITE_TO(name, lname, type) \ |
| 1917 void RawExternal##name##Array::WriteTo(SnapshotWriter* writer, \ | 1919 void RawExternal##name##Array::WriteTo(SnapshotWriter* writer, \ |
| 1918 intptr_t object_id, \ | 1920 intptr_t object_id, \ |
| 1919 Snapshot::Kind kind) { \ | 1921 Snapshot::Kind kind) { \ |
| 1920 ByteArrayWriteTo(writer, \ | 1922 ByteArrayWriteTo(writer, \ |
| 1921 object_id, \ | 1923 object_id, \ |
| 1922 kind, \ | 1924 kind, \ |
| 1923 ObjectStore::k##name##ArrayClass, \ | 1925 k##name##ArrayCid, \ |
| 1924 writer->GetObjectTags(this), \ | 1926 writer->GetObjectTags(this), \ |
| 1925 ptr()->length_, \ | 1927 ptr()->length_, \ |
| 1926 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ | 1928 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ |
| 1927 } \ | 1929 } \ |
| 1928 | 1930 |
| 1929 | 1931 |
| 1930 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) | 1932 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) |
| 1931 #undef BYTEARRAY_WRITE_TO | 1933 #undef BYTEARRAY_WRITE_TO |
| 1932 #undef BYTEARRAY_TYPE_LIST | 1934 #undef BYTEARRAY_TYPE_LIST |
| 1933 | 1935 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 void RawJSRegExp::WriteTo(SnapshotWriter* writer, | 2001 void RawJSRegExp::WriteTo(SnapshotWriter* writer, |
| 2000 intptr_t object_id, | 2002 intptr_t object_id, |
| 2001 Snapshot::Kind kind) { | 2003 Snapshot::Kind kind) { |
| 2002 ASSERT(writer != NULL); | 2004 ASSERT(writer != NULL); |
| 2003 ASSERT(kind == Snapshot::kMessage); | 2005 ASSERT(kind == Snapshot::kMessage); |
| 2004 | 2006 |
| 2005 // Write out the serialization header value for this object. | 2007 // Write out the serialization header value for this object. |
| 2006 writer->WriteInlinedObjectHeader(object_id); | 2008 writer->WriteInlinedObjectHeader(object_id); |
| 2007 | 2009 |
| 2008 // Write out the class and tags information. | 2010 // Write out the class and tags information. |
| 2009 writer->WriteIndexedObject(ObjectStore::kJSRegExpClass); | 2011 writer->WriteIndexedObject(kJSRegExpCid); |
| 2010 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2012 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2011 | 2013 |
| 2012 // Write out the data length field. | 2014 // Write out the data length field. |
| 2013 writer->Write<RawObject*>(ptr()->data_length_); | 2015 writer->Write<RawObject*>(ptr()->data_length_); |
| 2014 | 2016 |
| 2015 // Write out all the other fields. | 2017 // Write out all the other fields. |
| 2016 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 2018 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 2017 writer->WriteObjectImpl(ptr()->pattern_); | 2019 writer->WriteObjectImpl(ptr()->pattern_); |
| 2018 writer->WriteIntptrValue(ptr()->type_); | 2020 writer->WriteIntptrValue(ptr()->type_); |
| 2019 writer->WriteIntptrValue(ptr()->flags_); | 2021 writer->WriteIntptrValue(ptr()->flags_); |
| 2020 | 2022 |
| 2021 // Do not write out the data part which is native. | 2023 // Do not write out the data part which is native. |
| 2022 } | 2024 } |
| 2023 | 2025 |
| 2024 | 2026 |
| 2025 } // namespace dart | 2027 } // namespace dart |
| OLD | NEW |