| 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/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 Snapshot::Kind kind) { | 79 Snapshot::Kind kind) { |
| 80 ASSERT(writer != NULL); | 80 ASSERT(writer != NULL); |
| 81 | 81 |
| 82 // Write out the serialization header value for this object. | 82 // Write out the serialization header value for this object. |
| 83 writer->WriteSerializationMarker(kInlined, object_id); | 83 writer->WriteSerializationMarker(kInlined, object_id); |
| 84 | 84 |
| 85 if ((kind == Snapshot::kFull) || | 85 if ((kind == Snapshot::kFull) || |
| 86 (kind == Snapshot::kScript && | 86 (kind == Snapshot::kScript && |
| 87 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { | 87 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { |
| 88 // Write out the class and tags information. | 88 // Write out the class and tags information. |
| 89 writer->WriteObjectHeader(Object::kClassClass, writer->GetObjectTags(this)); | 89 writer->WriteObjectHeader(kClass, writer->GetObjectTags(this)); |
| 90 | 90 |
| 91 // Write out all the non object pointer fields. | 91 // Write out all the non object pointer fields. |
| 92 // NOTE: cpp_vtable_ is not written. | 92 // NOTE: cpp_vtable_ is not written. |
| 93 writer->Write<ObjectKind>(ptr()->instance_kind_); | 93 writer->Write<ObjectKind>(ptr()->instance_kind_); |
| 94 writer->WriteIntptrValue(ptr()->instance_size_); | 94 writer->WriteIntptrValue(ptr()->instance_size_); |
| 95 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); | 95 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); |
| 96 writer->WriteIntptrValue(ptr()->next_field_offset_); | 96 writer->WriteIntptrValue(ptr()->next_field_offset_); |
| 97 writer->WriteIntptrValue(ptr()->num_native_fields_); | 97 writer->WriteIntptrValue(ptr()->num_native_fields_); |
| 98 writer->WriteIntptrValue(ptr()->token_pos_); | 98 writer->WriteIntptrValue(ptr()->token_pos_); |
| 99 writer->Write<int8_t>(ptr()->class_state_); | 99 writer->Write<int8_t>(ptr()->class_state_); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, | 141 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, |
| 142 intptr_t object_id, | 142 intptr_t object_id, |
| 143 Snapshot::Kind kind) { | 143 Snapshot::Kind kind) { |
| 144 ASSERT(writer != NULL); | 144 ASSERT(writer != NULL); |
| 145 | 145 |
| 146 // Write out the serialization header value for this object. | 146 // Write out the serialization header value for this object. |
| 147 writer->WriteSerializationMarker(kInlined, object_id); | 147 writer->WriteSerializationMarker(kInlined, object_id); |
| 148 | 148 |
| 149 // Write out the class and tags information. | 149 // Write out the class and tags information. |
| 150 writer->WriteObjectHeader(Object::kUnresolvedClassClass, | 150 writer->WriteObjectHeader(kUnresolvedClass, writer->GetObjectTags(this)); |
| 151 writer->GetObjectTags(this)); | |
| 152 | 151 |
| 153 // Write out all the non object pointer fields. | 152 // Write out all the non object pointer fields. |
| 154 writer->WriteIntptrValue(ptr()->token_pos_); | 153 writer->WriteIntptrValue(ptr()->token_pos_); |
| 155 | 154 |
| 156 // Write out all the object pointer fields. | 155 // Write out all the object pointer fields. |
| 157 SnapshotWriterVisitor visitor(writer); | 156 SnapshotWriterVisitor visitor(writer); |
| 158 visitor.VisitPointers(from(), to()); | 157 visitor.VisitPointers(from(), to()); |
| 159 } | 158 } |
| 160 | 159 |
| 161 | 160 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 211 |
| 213 void RawType::WriteTo(SnapshotWriter* writer, | 212 void RawType::WriteTo(SnapshotWriter* writer, |
| 214 intptr_t object_id, | 213 intptr_t object_id, |
| 215 Snapshot::Kind kind) { | 214 Snapshot::Kind kind) { |
| 216 ASSERT(writer != NULL); | 215 ASSERT(writer != NULL); |
| 217 | 216 |
| 218 // Write out the serialization header value for this object. | 217 // Write out the serialization header value for this object. |
| 219 writer->WriteSerializationMarker(kInlined, object_id); | 218 writer->WriteSerializationMarker(kInlined, object_id); |
| 220 | 219 |
| 221 // Write out the class and tags information. | 220 // Write out the class and tags information. |
| 222 writer->WriteObjectHeader(Object::kTypeClass, writer->GetObjectTags(this)); | 221 writer->WriteObjectHeader(kType, writer->GetObjectTags(this)); |
| 223 | 222 |
| 224 // Write out all the non object pointer fields. | 223 // Write out all the non object pointer fields. |
| 225 writer->WriteIntptrValue(ptr()->token_pos_); | 224 writer->WriteIntptrValue(ptr()->token_pos_); |
| 226 writer->Write<int8_t>(ptr()->type_state_); | 225 writer->Write<int8_t>(ptr()->type_state_); |
| 227 | 226 |
| 228 // Write out all the object pointer fields. | 227 // Write out all the object pointer fields. |
| 229 SnapshotWriterVisitor visitor(writer, false); | 228 SnapshotWriterVisitor visitor(writer, false); |
| 230 visitor.VisitPointers(from(), to()); | 229 visitor.VisitPointers(from(), to()); |
| 231 } | 230 } |
| 232 | 231 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 264 |
| 266 void RawTypeParameter::WriteTo(SnapshotWriter* writer, | 265 void RawTypeParameter::WriteTo(SnapshotWriter* writer, |
| 267 intptr_t object_id, | 266 intptr_t object_id, |
| 268 Snapshot::Kind kind) { | 267 Snapshot::Kind kind) { |
| 269 ASSERT(writer != NULL); | 268 ASSERT(writer != NULL); |
| 270 | 269 |
| 271 // Write out the serialization header value for this object. | 270 // Write out the serialization header value for this object. |
| 272 writer->WriteSerializationMarker(kInlined, object_id); | 271 writer->WriteSerializationMarker(kInlined, object_id); |
| 273 | 272 |
| 274 // Write out the class and tags information. | 273 // Write out the class and tags information. |
| 275 writer->WriteObjectHeader(Object::kTypeParameterClass, | 274 writer->WriteObjectHeader(kTypeParameter, writer->GetObjectTags(this)); |
| 276 writer->GetObjectTags(this)); | |
| 277 | 275 |
| 278 // Write out all the non object pointer fields. | 276 // Write out all the non object pointer fields. |
| 279 writer->WriteIntptrValue(ptr()->index_); | 277 writer->WriteIntptrValue(ptr()->index_); |
| 280 writer->WriteIntptrValue(ptr()->token_pos_); | 278 writer->WriteIntptrValue(ptr()->token_pos_); |
| 281 writer->Write<int8_t>(ptr()->type_state_); | 279 writer->Write<int8_t>(ptr()->type_state_); |
| 282 | 280 |
| 283 // Write out all the object pointer fields. | 281 // Write out all the object pointer fields. |
| 284 SnapshotWriterVisitor visitor(writer, false); | 282 SnapshotWriterVisitor visitor(writer, false); |
| 285 visitor.VisitPointers(from(), to()); | 283 visitor.VisitPointers(from(), to()); |
| 286 } | 284 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 335 |
| 338 void RawTypeArguments::WriteTo(SnapshotWriter* writer, | 336 void RawTypeArguments::WriteTo(SnapshotWriter* writer, |
| 339 intptr_t object_id, | 337 intptr_t object_id, |
| 340 Snapshot::Kind kind) { | 338 Snapshot::Kind kind) { |
| 341 ASSERT(writer != NULL); | 339 ASSERT(writer != NULL); |
| 342 | 340 |
| 343 // Write out the serialization header value for this object. | 341 // Write out the serialization header value for this object. |
| 344 writer->WriteSerializationMarker(kInlined, object_id); | 342 writer->WriteSerializationMarker(kInlined, object_id); |
| 345 | 343 |
| 346 // Write out the class and tags information. | 344 // Write out the class and tags information. |
| 347 writer->WriteObjectHeader(Object::kTypeArgumentsClass, | 345 writer->WriteObjectHeader(kTypeArguments, writer->GetObjectTags(this)); |
| 348 writer->GetObjectTags(this)); | |
| 349 | 346 |
| 350 // Write out the length field. | 347 // Write out the length field. |
| 351 writer->Write<RawObject*>(ptr()->length_); | 348 writer->Write<RawObject*>(ptr()->length_); |
| 352 | 349 |
| 353 // Write out the individual types. | 350 // Write out the individual types. |
| 354 intptr_t len = Smi::Value(ptr()->length_); | 351 intptr_t len = Smi::Value(ptr()->length_); |
| 355 for (intptr_t i = 0; i < len; i++) { | 352 for (intptr_t i = 0; i < len; i++) { |
| 356 writer->WriteObjectImpl(ptr()->types_[i]); | 353 writer->WriteObjectImpl(ptr()->types_[i]); |
| 357 } | 354 } |
| 358 } | 355 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer, | 387 void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer, |
| 391 intptr_t object_id, | 388 intptr_t object_id, |
| 392 Snapshot::Kind kind) { | 389 Snapshot::Kind kind) { |
| 393 ASSERT(writer != NULL); | 390 ASSERT(writer != NULL); |
| 394 ASSERT(kind == Snapshot::kMessage); | 391 ASSERT(kind == Snapshot::kMessage); |
| 395 | 392 |
| 396 // Write out the serialization header value for this object. | 393 // Write out the serialization header value for this object. |
| 397 writer->WriteSerializationMarker(kInlined, object_id); | 394 writer->WriteSerializationMarker(kInlined, object_id); |
| 398 | 395 |
| 399 // Write out the class and tags information. | 396 // Write out the class and tags information. |
| 400 writer->WriteObjectHeader(Object::kInstantiatedTypeArgumentsClass, | 397 writer->WriteObjectHeader(kInstantiatedTypeArguments, |
| 401 writer->GetObjectTags(this)); | 398 writer->GetObjectTags(this)); |
| 402 | 399 |
| 403 // Write out all the object pointer fields. | 400 // Write out all the object pointer fields. |
| 404 SnapshotWriterVisitor visitor(writer, false); | 401 SnapshotWriterVisitor visitor(writer, false); |
| 405 visitor.VisitPointers(from(), to()); | 402 visitor.VisitPointers(from(), to()); |
| 406 } | 403 } |
| 407 | 404 |
| 408 | 405 |
| 409 RawFunction* Function::ReadFrom(SnapshotReader* reader, | 406 RawFunction* Function::ReadFrom(SnapshotReader* reader, |
| 410 intptr_t object_id, | 407 intptr_t object_id, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 intptr_t object_id, | 447 intptr_t object_id, |
| 451 Snapshot::Kind kind) { | 448 Snapshot::Kind kind) { |
| 452 ASSERT(writer != NULL); | 449 ASSERT(writer != NULL); |
| 453 ASSERT(kind != Snapshot::kMessage && | 450 ASSERT(kind != Snapshot::kMessage && |
| 454 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 451 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 455 | 452 |
| 456 // Write out the serialization header value for this object. | 453 // Write out the serialization header value for this object. |
| 457 writer->WriteSerializationMarker(kInlined, object_id); | 454 writer->WriteSerializationMarker(kInlined, object_id); |
| 458 | 455 |
| 459 // Write out the class and tags information. | 456 // Write out the class and tags information. |
| 460 writer->WriteObjectHeader(Object::kFunctionClass, | 457 writer->WriteObjectHeader(kFunction, writer->GetObjectTags(this)); |
| 461 writer->GetObjectTags(this)); | |
| 462 | 458 |
| 463 // Write out all the non object fields. | 459 // Write out all the non object fields. |
| 464 writer->WriteIntptrValue(ptr()->token_pos_); | 460 writer->WriteIntptrValue(ptr()->token_pos_); |
| 465 writer->WriteIntptrValue(ptr()->end_token_pos_); | 461 writer->WriteIntptrValue(ptr()->end_token_pos_); |
| 466 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); | 462 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); |
| 467 writer->WriteIntptrValue(ptr()->num_optional_parameters_); | 463 writer->WriteIntptrValue(ptr()->num_optional_parameters_); |
| 468 writer->WriteIntptrValue(ptr()->usage_counter_); | 464 writer->WriteIntptrValue(ptr()->usage_counter_); |
| 469 writer->WriteIntptrValue(ptr()->deoptimization_counter_); | 465 writer->WriteIntptrValue(ptr()->deoptimization_counter_); |
| 470 writer->WriteIntptrValue(ptr()->kind_); | 466 writer->WriteIntptrValue(ptr()->kind_); |
| 471 writer->Write<bool>(ptr()->is_static_); | 467 writer->Write<bool>(ptr()->is_static_); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 intptr_t object_id, | 511 intptr_t object_id, |
| 516 Snapshot::Kind kind) { | 512 Snapshot::Kind kind) { |
| 517 ASSERT(writer != NULL); | 513 ASSERT(writer != NULL); |
| 518 ASSERT(kind != Snapshot::kMessage && | 514 ASSERT(kind != Snapshot::kMessage && |
| 519 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 515 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 520 | 516 |
| 521 // Write out the serialization header value for this object. | 517 // Write out the serialization header value for this object. |
| 522 writer->WriteSerializationMarker(kInlined, object_id); | 518 writer->WriteSerializationMarker(kInlined, object_id); |
| 523 | 519 |
| 524 // Write out the class and tags information. | 520 // Write out the class and tags information. |
| 525 writer->WriteObjectHeader(Object::kFieldClass, writer->GetObjectTags(this)); | 521 writer->WriteObjectHeader(kField, writer->GetObjectTags(this)); |
| 526 | 522 |
| 527 // Write out all the non object fields. | 523 // Write out all the non object fields. |
| 528 writer->WriteIntptrValue(ptr()->token_pos_); | 524 writer->WriteIntptrValue(ptr()->token_pos_); |
| 529 writer->Write<bool>(ptr()->is_static_); | 525 writer->Write<bool>(ptr()->is_static_); |
| 530 writer->Write<bool>(ptr()->is_final_); | 526 writer->Write<bool>(ptr()->is_final_); |
| 531 writer->Write<bool>(ptr()->has_initializer_); | 527 writer->Write<bool>(ptr()->has_initializer_); |
| 532 | 528 |
| 533 // Write out all the object pointer fields. | 529 // Write out all the object pointer fields. |
| 534 SnapshotWriterVisitor visitor(writer); | 530 SnapshotWriterVisitor visitor(writer); |
| 535 visitor.VisitPointers(from(), to()); | 531 visitor.VisitPointers(from(), to()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 566 void RawLiteralToken::WriteTo(SnapshotWriter* writer, | 562 void RawLiteralToken::WriteTo(SnapshotWriter* writer, |
| 567 intptr_t object_id, | 563 intptr_t object_id, |
| 568 Snapshot::Kind kind) { | 564 Snapshot::Kind kind) { |
| 569 ASSERT(writer != NULL); | 565 ASSERT(writer != NULL); |
| 570 ASSERT(kind != Snapshot::kMessage); | 566 ASSERT(kind != Snapshot::kMessage); |
| 571 | 567 |
| 572 // Write out the serialization header value for this object. | 568 // Write out the serialization header value for this object. |
| 573 writer->WriteSerializationMarker(kInlined, object_id); | 569 writer->WriteSerializationMarker(kInlined, object_id); |
| 574 | 570 |
| 575 // Write out the class and tags information. | 571 // Write out the class and tags information. |
| 576 writer->WriteObjectHeader(Object::kLiteralTokenClass, | 572 writer->WriteObjectHeader(kLiteralToken, writer->GetObjectTags(this)); |
| 577 writer->GetObjectTags(this)); | |
| 578 | 573 |
| 579 // Write out the kind field. | 574 // Write out the kind field. |
| 580 writer->Write<intptr_t>(ptr()->kind_); | 575 writer->Write<intptr_t>(ptr()->kind_); |
| 581 | 576 |
| 582 // Write out literal and value fields. | 577 // Write out literal and value fields. |
| 583 writer->WriteObjectImpl(ptr()->literal_); | 578 writer->WriteObjectImpl(ptr()->literal_); |
| 584 writer->WriteObjectImpl(ptr()->value_); | 579 writer->WriteObjectImpl(ptr()->value_); |
| 585 } | 580 } |
| 586 | 581 |
| 587 | 582 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 intptr_t object_id, | 617 intptr_t object_id, |
| 623 Snapshot::Kind kind) { | 618 Snapshot::Kind kind) { |
| 624 ASSERT(writer != NULL); | 619 ASSERT(writer != NULL); |
| 625 ASSERT(kind != Snapshot::kMessage && | 620 ASSERT(kind != Snapshot::kMessage && |
| 626 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 621 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 627 | 622 |
| 628 // Write out the serialization header value for this object. | 623 // Write out the serialization header value for this object. |
| 629 writer->WriteSerializationMarker(kInlined, object_id); | 624 writer->WriteSerializationMarker(kInlined, object_id); |
| 630 | 625 |
| 631 // Write out the class and tags information. | 626 // Write out the class and tags information. |
| 632 writer->WriteObjectHeader(Object::kTokenStreamClass, | 627 writer->WriteObjectHeader(kTokenStream, writer->GetObjectTags(this)); |
| 633 writer->GetObjectTags(this)); | |
| 634 | 628 |
| 635 // Write out the length field and the token stream. | 629 // Write out the length field and the token stream. |
| 636 intptr_t len = Smi::Value(ptr()->length_); | 630 intptr_t len = Smi::Value(ptr()->length_); |
| 637 writer->Write<RawObject*>(ptr()->length_); | 631 writer->Write<RawObject*>(ptr()->length_); |
| 638 writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len); | 632 writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len); |
| 639 | 633 |
| 640 // Write out the literal/identifier token array. | 634 // Write out the literal/identifier token array. |
| 641 writer->WriteObjectImpl(ptr()->token_objects_); | 635 writer->WriteObjectImpl(ptr()->token_objects_); |
| 642 } | 636 } |
| 643 | 637 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 Snapshot::Kind kind) { | 670 Snapshot::Kind kind) { |
| 677 ASSERT(writer != NULL); | 671 ASSERT(writer != NULL); |
| 678 ASSERT(tokens_ != TokenStream::null()); | 672 ASSERT(tokens_ != TokenStream::null()); |
| 679 ASSERT(kind != Snapshot::kMessage && | 673 ASSERT(kind != Snapshot::kMessage && |
| 680 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 674 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 681 | 675 |
| 682 // Write out the serialization header value for this object. | 676 // Write out the serialization header value for this object. |
| 683 writer->WriteSerializationMarker(kInlined, object_id); | 677 writer->WriteSerializationMarker(kInlined, object_id); |
| 684 | 678 |
| 685 // Write out the class and tags information. | 679 // Write out the class and tags information. |
| 686 writer->WriteObjectHeader(Object::kScriptClass, writer->GetObjectTags(this)); | 680 writer->WriteObjectHeader(kScript, writer->GetObjectTags(this)); |
| 687 | 681 |
| 688 // Write out all the object pointer fields. | 682 // Write out all the object pointer fields. |
| 689 writer->WriteObjectImpl(ptr()->url_); | 683 writer->WriteObjectImpl(ptr()->url_); |
| 690 writer->WriteObjectImpl(ptr()->tokens_); | 684 writer->WriteObjectImpl(ptr()->tokens_); |
| 691 } | 685 } |
| 692 | 686 |
| 693 | 687 |
| 694 RawLibrary* Library::ReadFrom(SnapshotReader* reader, | 688 RawLibrary* Library::ReadFrom(SnapshotReader* reader, |
| 695 intptr_t object_id, | 689 intptr_t object_id, |
| 696 intptr_t tags, | 690 intptr_t tags, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 void RawLibrary::WriteTo(SnapshotWriter* writer, | 741 void RawLibrary::WriteTo(SnapshotWriter* writer, |
| 748 intptr_t object_id, | 742 intptr_t object_id, |
| 749 Snapshot::Kind kind) { | 743 Snapshot::Kind kind) { |
| 750 ASSERT(writer != NULL); | 744 ASSERT(writer != NULL); |
| 751 ASSERT(kind != Snapshot::kMessage); | 745 ASSERT(kind != Snapshot::kMessage); |
| 752 | 746 |
| 753 // Write out the serialization header value for this object. | 747 // Write out the serialization header value for this object. |
| 754 writer->WriteSerializationMarker(kInlined, object_id); | 748 writer->WriteSerializationMarker(kInlined, object_id); |
| 755 | 749 |
| 756 // Write out the class and tags information. | 750 // Write out the class and tags information. |
| 757 writer->WriteObjectHeader(Object::kLibraryClass, writer->GetObjectTags(this)); | 751 writer->WriteObjectHeader(kLibrary, writer->GetObjectTags(this)); |
| 758 | 752 |
| 759 if (RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { | 753 if (RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { |
| 760 ASSERT(kind != Snapshot::kFull); | 754 ASSERT(kind != Snapshot::kFull); |
| 761 // Write out library URL so that it can be looked up when reading. | 755 // Write out library URL so that it can be looked up when reading. |
| 762 writer->WriteObjectImpl(ptr()->url_); | 756 writer->WriteObjectImpl(ptr()->url_); |
| 763 } else { | 757 } else { |
| 764 // Write out all non object fields. | 758 // Write out all non object fields. |
| 765 writer->WriteIntptrValue(ptr()->index_); | 759 writer->WriteIntptrValue(ptr()->index_); |
| 766 writer->WriteIntptrValue(ptr()->num_imports_); | 760 writer->WriteIntptrValue(ptr()->num_imports_); |
| 767 writer->WriteIntptrValue(ptr()->num_imported_into_); | 761 writer->WriteIntptrValue(ptr()->num_imported_into_); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 intptr_t object_id, | 811 intptr_t object_id, |
| 818 Snapshot::Kind kind) { | 812 Snapshot::Kind kind) { |
| 819 ASSERT(writer != NULL); | 813 ASSERT(writer != NULL); |
| 820 ASSERT(kind != Snapshot::kMessage && | 814 ASSERT(kind != Snapshot::kMessage && |
| 821 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); | 815 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 822 | 816 |
| 823 // Write out the serialization header value for this object. | 817 // Write out the serialization header value for this object. |
| 824 writer->WriteSerializationMarker(kInlined, object_id); | 818 writer->WriteSerializationMarker(kInlined, object_id); |
| 825 | 819 |
| 826 // Write out the class and tags information. | 820 // Write out the class and tags information. |
| 827 writer->WriteObjectHeader(Object::kLibraryPrefixClass, | 821 writer->WriteObjectHeader(kLibraryPrefix, writer->GetObjectTags(this)); |
| 828 writer->GetObjectTags(this)); | |
| 829 | 822 |
| 830 // Write out all non object fields. | 823 // Write out all non object fields. |
| 831 writer->WriteIntptrValue(ptr()->num_libs_); | 824 writer->WriteIntptrValue(ptr()->num_libs_); |
| 832 | 825 |
| 833 // Write out all the object pointer fields. | 826 // Write out all the object pointer fields. |
| 834 SnapshotWriterVisitor visitor(writer); | 827 SnapshotWriterVisitor visitor(writer); |
| 835 visitor.VisitPointers(from(), to()); | 828 visitor.VisitPointers(from(), to()); |
| 836 } | 829 } |
| 837 | 830 |
| 838 | 831 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 | 963 |
| 971 void RawContext::WriteTo(SnapshotWriter* writer, | 964 void RawContext::WriteTo(SnapshotWriter* writer, |
| 972 intptr_t object_id, | 965 intptr_t object_id, |
| 973 Snapshot::Kind kind) { | 966 Snapshot::Kind kind) { |
| 974 ASSERT(writer != NULL); | 967 ASSERT(writer != NULL); |
| 975 | 968 |
| 976 // Write out the serialization header value for this object. | 969 // Write out the serialization header value for this object. |
| 977 writer->WriteSerializationMarker(kInlined, object_id); | 970 writer->WriteSerializationMarker(kInlined, object_id); |
| 978 | 971 |
| 979 // Write out the class and tags information. | 972 // Write out the class and tags information. |
| 980 writer->WriteObjectHeader(Object::kContextClass, writer->GetObjectTags(this)); | 973 writer->WriteObjectHeader(kContext, writer->GetObjectTags(this)); |
| 981 | 974 |
| 982 // Write out num of variables in the context. | 975 // Write out num of variables in the context. |
| 983 writer->WriteIntptrValue(ptr()->num_variables_); | 976 writer->WriteIntptrValue(ptr()->num_variables_); |
| 984 | 977 |
| 985 // Can't serialize the isolate pointer, we set it implicitly on read. | 978 // Can't serialize the isolate pointer, we set it implicitly on read. |
| 986 | 979 |
| 987 // Write out all the object pointer fields. | 980 // Write out all the object pointer fields. |
| 988 SnapshotWriterVisitor visitor(writer); | 981 SnapshotWriterVisitor visitor(writer); |
| 989 visitor.VisitPointers(from(), to(ptr()->num_variables_)); | 982 visitor.VisitPointers(from(), to(ptr()->num_variables_)); |
| 990 } | 983 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1021 void RawContextScope::WriteTo(SnapshotWriter* writer, | 1014 void RawContextScope::WriteTo(SnapshotWriter* writer, |
| 1022 intptr_t object_id, | 1015 intptr_t object_id, |
| 1023 Snapshot::Kind kind) { | 1016 Snapshot::Kind kind) { |
| 1024 ASSERT(writer != NULL); | 1017 ASSERT(writer != NULL); |
| 1025 ASSERT(kind == Snapshot::kMessage); | 1018 ASSERT(kind == Snapshot::kMessage); |
| 1026 | 1019 |
| 1027 // Write out the serialization header value for this object. | 1020 // Write out the serialization header value for this object. |
| 1028 writer->WriteSerializationMarker(kInlined, object_id); | 1021 writer->WriteSerializationMarker(kInlined, object_id); |
| 1029 | 1022 |
| 1030 // Write out the class and tags information. | 1023 // Write out the class and tags information. |
| 1031 writer->WriteObjectHeader(Object::kContextScopeClass, | 1024 writer->WriteObjectHeader(kContextScope, writer->GetObjectTags(this)); |
| 1032 writer->GetObjectTags(this)); | |
| 1033 | 1025 |
| 1034 // Serialize number of variables. | 1026 // Serialize number of variables. |
| 1035 writer->WriteIntptrValue(ptr()->num_variables_); | 1027 writer->WriteIntptrValue(ptr()->num_variables_); |
| 1036 | 1028 |
| 1037 // Write out all the object pointer fields. | 1029 // Write out all the object pointer fields. |
| 1038 SnapshotWriterVisitor visitor(writer); | 1030 SnapshotWriterVisitor visitor(writer); |
| 1039 visitor.VisitPointers(from(), to(ptr()->num_variables_)); | 1031 visitor.VisitPointers(from(), to(ptr()->num_variables_)); |
| 1040 } | 1032 } |
| 1041 | 1033 |
| 1042 | 1034 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 | 1191 |
| 1200 void RawMint::WriteTo(SnapshotWriter* writer, | 1192 void RawMint::WriteTo(SnapshotWriter* writer, |
| 1201 intptr_t object_id, | 1193 intptr_t object_id, |
| 1202 Snapshot::Kind kind) { | 1194 Snapshot::Kind kind) { |
| 1203 ASSERT(writer != NULL); | 1195 ASSERT(writer != NULL); |
| 1204 | 1196 |
| 1205 // Write out the serialization header value for this object. | 1197 // Write out the serialization header value for this object. |
| 1206 writer->WriteSerializationMarker(kInlined, object_id); | 1198 writer->WriteSerializationMarker(kInlined, object_id); |
| 1207 | 1199 |
| 1208 // Write out the class and tags information. | 1200 // Write out the class and tags information. |
| 1209 writer->WriteObjectHeader(ObjectStore::kMintClass, | 1201 writer->WriteObjectHeader(kMint, writer->GetObjectTags(this)); |
| 1210 writer->GetObjectTags(this)); | |
| 1211 | 1202 |
| 1212 // Write out the 64 bit value. | 1203 // Write out the 64 bit value. |
| 1213 writer->Write<int64_t>(ptr()->value_); | 1204 writer->Write<int64_t>(ptr()->value_); |
| 1214 } | 1205 } |
| 1215 | 1206 |
| 1216 | 1207 |
| 1217 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, | 1208 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, |
| 1218 intptr_t object_id, | 1209 intptr_t object_id, |
| 1219 intptr_t tags, | 1210 intptr_t tags, |
| 1220 Snapshot::Kind kind) { | 1211 Snapshot::Kind kind) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1247 | 1238 |
| 1248 void RawBigint::WriteTo(SnapshotWriter* writer, | 1239 void RawBigint::WriteTo(SnapshotWriter* writer, |
| 1249 intptr_t object_id, | 1240 intptr_t object_id, |
| 1250 Snapshot::Kind kind) { | 1241 Snapshot::Kind kind) { |
| 1251 ASSERT(writer != NULL); | 1242 ASSERT(writer != NULL); |
| 1252 | 1243 |
| 1253 // Write out the serialization header value for this object. | 1244 // Write out the serialization header value for this object. |
| 1254 writer->WriteSerializationMarker(kInlined, object_id); | 1245 writer->WriteSerializationMarker(kInlined, object_id); |
| 1255 | 1246 |
| 1256 // Write out the class and tags information. | 1247 // Write out the class and tags information. |
| 1257 writer->WriteObjectHeader(ObjectStore::kBigintClass, | 1248 writer->WriteObjectHeader(kBigint, writer->GetObjectTags(this)); |
| 1258 writer->GetObjectTags(this)); | |
| 1259 | 1249 |
| 1260 // Write out the bigint value as a HEXCstring. | 1250 // Write out the bigint value as a HEXCstring. |
| 1261 intptr_t length = ptr()->signed_length_; | 1251 intptr_t length = ptr()->signed_length_; |
| 1262 bool is_negative = false; | 1252 bool is_negative = false; |
| 1263 if (length <= 0) { | 1253 if (length <= 0) { |
| 1264 length = -length; | 1254 length = -length; |
| 1265 is_negative = true; | 1255 is_negative = true; |
| 1266 } | 1256 } |
| 1267 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); | 1257 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); |
| 1268 const char* str = BigintOperations::ToHexCString( | 1258 const char* str = BigintOperations::ToHexCString( |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 | 1307 |
| 1318 void RawDouble::WriteTo(SnapshotWriter* writer, | 1308 void RawDouble::WriteTo(SnapshotWriter* writer, |
| 1319 intptr_t object_id, | 1309 intptr_t object_id, |
| 1320 Snapshot::Kind kind) { | 1310 Snapshot::Kind kind) { |
| 1321 ASSERT(writer != NULL); | 1311 ASSERT(writer != NULL); |
| 1322 | 1312 |
| 1323 // Write out the serialization header value for this object. | 1313 // Write out the serialization header value for this object. |
| 1324 writer->WriteSerializationMarker(kInlined, object_id); | 1314 writer->WriteSerializationMarker(kInlined, object_id); |
| 1325 | 1315 |
| 1326 // Write out the class and tags information. | 1316 // Write out the class and tags information. |
| 1327 writer->WriteObjectHeader(ObjectStore::kDoubleClass, | 1317 writer->WriteObjectHeader(kDouble, writer->GetObjectTags(this)); |
| 1328 writer->GetObjectTags(this)); | |
| 1329 | 1318 |
| 1330 // Write out the double value. | 1319 // Write out the double value. |
| 1331 writer->Write<double>(ptr()->value_); | 1320 writer->Write<double>(ptr()->value_); |
| 1332 } | 1321 } |
| 1333 | 1322 |
| 1334 | 1323 |
| 1335 RawString* String::ReadFrom(SnapshotReader* reader, | 1324 RawString* String::ReadFrom(SnapshotReader* reader, |
| 1336 intptr_t object_id, | 1325 intptr_t object_id, |
| 1337 intptr_t tags, | 1326 intptr_t tags, |
| 1338 Snapshot::Kind kind) { | 1327 Snapshot::Kind kind) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 writer->WriteObjectHeader(class_id, tags); | 1474 writer->WriteObjectHeader(class_id, tags); |
| 1486 | 1475 |
| 1487 // Write out the length field. | 1476 // Write out the length field. |
| 1488 writer->Write<RawObject*>(length); | 1477 writer->Write<RawObject*>(length); |
| 1489 | 1478 |
| 1490 // Write out the hash field. | 1479 // Write out the hash field. |
| 1491 writer->Write<RawObject*>(hash); | 1480 writer->Write<RawObject*>(hash); |
| 1492 | 1481 |
| 1493 // Write out the string. | 1482 // Write out the string. |
| 1494 if (len > 0) { | 1483 if (len > 0) { |
| 1495 if (class_id == ObjectStore::kOneByteStringClass) { | 1484 if (class_id == kOneByteString) { |
| 1496 writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len); | 1485 writer->WriteBytes(reinterpret_cast<const uint8_t*>(data), len); |
| 1497 } else { | 1486 } else { |
| 1498 for (intptr_t i = 0; i < len; i++) { | 1487 for (intptr_t i = 0; i < len; i++) { |
| 1499 writer->Write(data[i]); | 1488 writer->Write(data[i]); |
| 1500 } | 1489 } |
| 1501 } | 1490 } |
| 1502 } | 1491 } |
| 1503 } | 1492 } |
| 1504 | 1493 |
| 1505 | 1494 |
| 1506 void RawOneByteString::WriteTo(SnapshotWriter* writer, | 1495 void RawOneByteString::WriteTo(SnapshotWriter* writer, |
| 1507 intptr_t object_id, | 1496 intptr_t object_id, |
| 1508 Snapshot::Kind kind) { | 1497 Snapshot::Kind kind) { |
| 1509 StringWriteTo(writer, | 1498 StringWriteTo(writer, |
| 1510 object_id, | 1499 object_id, |
| 1511 kind, | 1500 kind, |
| 1512 ObjectStore::kOneByteStringClass, | 1501 kOneByteString, |
| 1513 writer->GetObjectTags(this), | 1502 writer->GetObjectTags(this), |
| 1514 ptr()->length_, | 1503 ptr()->length_, |
| 1515 ptr()->hash_, | 1504 ptr()->hash_, |
| 1516 ptr()->data_); | 1505 ptr()->data_); |
| 1517 } | 1506 } |
| 1518 | 1507 |
| 1519 | 1508 |
| 1520 void RawTwoByteString::WriteTo(SnapshotWriter* writer, | 1509 void RawTwoByteString::WriteTo(SnapshotWriter* writer, |
| 1521 intptr_t object_id, | 1510 intptr_t object_id, |
| 1522 Snapshot::Kind kind) { | 1511 Snapshot::Kind kind) { |
| 1523 StringWriteTo(writer, | 1512 StringWriteTo(writer, |
| 1524 object_id, | 1513 object_id, |
| 1525 kind, | 1514 kind, |
| 1526 ObjectStore::kTwoByteStringClass, | 1515 kTwoByteString, |
| 1527 writer->GetObjectTags(this), | 1516 writer->GetObjectTags(this), |
| 1528 ptr()->length_, | 1517 ptr()->length_, |
| 1529 ptr()->hash_, | 1518 ptr()->hash_, |
| 1530 ptr()->data_); | 1519 ptr()->data_); |
| 1531 } | 1520 } |
| 1532 | 1521 |
| 1533 | 1522 |
| 1534 void RawFourByteString::WriteTo(SnapshotWriter* writer, | 1523 void RawFourByteString::WriteTo(SnapshotWriter* writer, |
| 1535 intptr_t object_id, | 1524 intptr_t object_id, |
| 1536 Snapshot::Kind kind) { | 1525 Snapshot::Kind kind) { |
| 1537 StringWriteTo(writer, | 1526 StringWriteTo(writer, |
| 1538 object_id, | 1527 object_id, |
| 1539 kind, | 1528 kind, |
| 1540 ObjectStore::kFourByteStringClass, | 1529 kFourByteString, |
| 1541 writer->GetObjectTags(this), | 1530 writer->GetObjectTags(this), |
| 1542 ptr()->length_, | 1531 ptr()->length_, |
| 1543 ptr()->hash_, | 1532 ptr()->hash_, |
| 1544 ptr()->data_); | 1533 ptr()->data_); |
| 1545 } | 1534 } |
| 1546 | 1535 |
| 1547 | 1536 |
| 1548 RawExternalOneByteString* ExternalOneByteString::ReadFrom( | 1537 RawExternalOneByteString* ExternalOneByteString::ReadFrom( |
| 1549 SnapshotReader* reader, | 1538 SnapshotReader* reader, |
| 1550 intptr_t object_id, | 1539 intptr_t object_id, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1575 } | 1564 } |
| 1576 | 1565 |
| 1577 | 1566 |
| 1578 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, | 1567 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, |
| 1579 intptr_t object_id, | 1568 intptr_t object_id, |
| 1580 Snapshot::Kind kind) { | 1569 Snapshot::Kind kind) { |
| 1581 // Serialize as a non-external one byte string. | 1570 // Serialize as a non-external one byte string. |
| 1582 StringWriteTo(writer, | 1571 StringWriteTo(writer, |
| 1583 object_id, | 1572 object_id, |
| 1584 kind, | 1573 kind, |
| 1585 ObjectStore::kOneByteStringClass, | 1574 kOneByteString, |
| 1586 writer->GetObjectTags(this), | 1575 writer->GetObjectTags(this), |
| 1587 ptr()->length_, | 1576 ptr()->length_, |
| 1588 ptr()->hash_, | 1577 ptr()->hash_, |
| 1589 ptr()->external_data_->data()); | 1578 ptr()->external_data_->data()); |
| 1590 } | 1579 } |
| 1591 | 1580 |
| 1592 | 1581 |
| 1593 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, | 1582 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, |
| 1594 intptr_t object_id, | 1583 intptr_t object_id, |
| 1595 Snapshot::Kind kind) { | 1584 Snapshot::Kind kind) { |
| 1596 // Serialize as a non-external two byte string. | 1585 // Serialize as a non-external two byte string. |
| 1597 StringWriteTo(writer, | 1586 StringWriteTo(writer, |
| 1598 object_id, | 1587 object_id, |
| 1599 kind, | 1588 kind, |
| 1600 ObjectStore::kTwoByteStringClass, | 1589 kTwoByteString, |
| 1601 writer->GetObjectTags(this), | 1590 writer->GetObjectTags(this), |
| 1602 ptr()->length_, | 1591 ptr()->length_, |
| 1603 ptr()->hash_, | 1592 ptr()->hash_, |
| 1604 ptr()->external_data_->data()); | 1593 ptr()->external_data_->data()); |
| 1605 } | 1594 } |
| 1606 | 1595 |
| 1607 | 1596 |
| 1608 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, | 1597 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, |
| 1609 intptr_t object_id, | 1598 intptr_t object_id, |
| 1610 Snapshot::Kind kind) { | 1599 Snapshot::Kind kind) { |
| 1611 // Serialize as a non-external four byte string. | 1600 // Serialize as a non-external four byte string. |
| 1612 StringWriteTo(writer, | 1601 StringWriteTo(writer, |
| 1613 object_id, | 1602 object_id, |
| 1614 kind, | 1603 kind, |
| 1615 ObjectStore::kFourByteStringClass, | 1604 kFourByteString, |
| 1616 writer->GetObjectTags(this), | 1605 writer->GetObjectTags(this), |
| 1617 ptr()->length_, | 1606 ptr()->length_, |
| 1618 ptr()->hash_, | 1607 ptr()->hash_, |
| 1619 ptr()->external_data_->data()); | 1608 ptr()->external_data_->data()); |
| 1620 } | 1609 } |
| 1621 | 1610 |
| 1622 | 1611 |
| 1623 RawBool* Bool::ReadFrom(SnapshotReader* reader, | 1612 RawBool* Bool::ReadFrom(SnapshotReader* reader, |
| 1624 intptr_t object_id, | 1613 intptr_t object_id, |
| 1625 intptr_t tags, | 1614 intptr_t tags, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 } | 1662 } |
| 1674 reader->ArrayReadFrom(*array, len, tags); | 1663 reader->ArrayReadFrom(*array, len, tags); |
| 1675 return array->raw(); | 1664 return array->raw(); |
| 1676 } | 1665 } |
| 1677 | 1666 |
| 1678 | 1667 |
| 1679 void RawArray::WriteTo(SnapshotWriter* writer, | 1668 void RawArray::WriteTo(SnapshotWriter* writer, |
| 1680 intptr_t object_id, | 1669 intptr_t object_id, |
| 1681 Snapshot::Kind kind) { | 1670 Snapshot::Kind kind) { |
| 1682 writer->ArrayWriteTo(object_id, | 1671 writer->ArrayWriteTo(object_id, |
| 1683 ObjectStore::kArrayClass, | 1672 kArray, |
| 1684 writer->GetObjectTags(this), | 1673 writer->GetObjectTags(this), |
| 1685 ptr()->length_, | 1674 ptr()->length_, |
| 1686 ptr()->type_arguments_, | 1675 ptr()->type_arguments_, |
| 1687 ptr()->data()); | 1676 ptr()->data()); |
| 1688 } | 1677 } |
| 1689 | 1678 |
| 1690 | 1679 |
| 1691 void RawImmutableArray::WriteTo(SnapshotWriter* writer, | 1680 void RawImmutableArray::WriteTo(SnapshotWriter* writer, |
| 1692 intptr_t object_id, | 1681 intptr_t object_id, |
| 1693 Snapshot::Kind kind) { | 1682 Snapshot::Kind kind) { |
| 1694 writer->ArrayWriteTo(object_id, | 1683 writer->ArrayWriteTo(object_id, |
| 1695 ObjectStore::kImmutableArrayClass, | 1684 kImmutableArray, |
| 1696 writer->GetObjectTags(this), | 1685 writer->GetObjectTags(this), |
| 1697 ptr()->length_, | 1686 ptr()->length_, |
| 1698 ptr()->type_arguments_, | 1687 ptr()->type_arguments_, |
| 1699 ptr()->data()); | 1688 ptr()->data()); |
| 1700 } | 1689 } |
| 1701 | 1690 |
| 1702 | 1691 |
| 1703 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, | 1692 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, |
| 1704 intptr_t object_id, | 1693 intptr_t object_id, |
| 1705 intptr_t tags, | 1694 intptr_t tags, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1729 | 1718 |
| 1730 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, | 1719 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, |
| 1731 intptr_t object_id, | 1720 intptr_t object_id, |
| 1732 Snapshot::Kind kind) { | 1721 Snapshot::Kind kind) { |
| 1733 ASSERT(writer != NULL); | 1722 ASSERT(writer != NULL); |
| 1734 | 1723 |
| 1735 // Write out the serialization header value for this object. | 1724 // Write out the serialization header value for this object. |
| 1736 writer->WriteSerializationMarker(kInlined, object_id); | 1725 writer->WriteSerializationMarker(kInlined, object_id); |
| 1737 | 1726 |
| 1738 // Write out the class and tags information. | 1727 // Write out the class and tags information. |
| 1739 writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass, | 1728 writer->WriteObjectHeader(kGrowableObjectArray, |
| 1740 writer->GetObjectTags(this)); | 1729 writer->GetObjectTags(this)); |
| 1741 | 1730 |
| 1742 // Write out the used length field. | 1731 // Write out the used length field. |
| 1743 writer->Write<RawObject*>(ptr()->length_); | 1732 writer->Write<RawObject*>(ptr()->length_); |
| 1744 | 1733 |
| 1745 // Write out the Array object. | 1734 // Write out the Array object. |
| 1746 writer->WriteObjectImpl(ptr()->data_); | 1735 writer->WriteObjectImpl(ptr()->data_); |
| 1747 } | 1736 } |
| 1748 | 1737 |
| 1749 | 1738 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 } | 1854 } |
| 1866 | 1855 |
| 1867 | 1856 |
| 1868 #define BYTEARRAY_WRITE_TO(name, lname, type) \ | 1857 #define BYTEARRAY_WRITE_TO(name, lname, type) \ |
| 1869 void Raw##name##Array::WriteTo(SnapshotWriter* writer, \ | 1858 void Raw##name##Array::WriteTo(SnapshotWriter* writer, \ |
| 1870 intptr_t object_id, \ | 1859 intptr_t object_id, \ |
| 1871 Snapshot::Kind kind) { \ | 1860 Snapshot::Kind kind) { \ |
| 1872 ByteArrayWriteTo(writer, \ | 1861 ByteArrayWriteTo(writer, \ |
| 1873 object_id, \ | 1862 object_id, \ |
| 1874 kind, \ | 1863 kind, \ |
| 1875 ObjectStore::k##name##ArrayClass, \ | 1864 k##name##Array, \ |
| 1876 writer->GetObjectTags(this), \ | 1865 writer->GetObjectTags(this), \ |
| 1877 ptr()->length_, \ | 1866 ptr()->length_, \ |
| 1878 reinterpret_cast<uint8_t*>(ptr()->data_)); \ | 1867 reinterpret_cast<uint8_t*>(ptr()->data_)); \ |
| 1879 } \ | 1868 } \ |
| 1880 | 1869 |
| 1881 | 1870 |
| 1882 BYTEARRAY_TYPE_LIST(BYTEARRAY_WRITE_TO) | 1871 BYTEARRAY_TYPE_LIST(BYTEARRAY_WRITE_TO) |
| 1883 #undef BYTEARRAY_WRITE_TO | 1872 #undef BYTEARRAY_WRITE_TO |
| 1884 | 1873 |
| 1885 | 1874 |
| 1886 #define EXTERNALARRAY_WRITE_TO(name, lname, type) \ | 1875 #define EXTERNALARRAY_WRITE_TO(name, lname, type) \ |
| 1887 void RawExternal##name##Array::WriteTo(SnapshotWriter* writer, \ | 1876 void RawExternal##name##Array::WriteTo(SnapshotWriter* writer, \ |
| 1888 intptr_t object_id, \ | 1877 intptr_t object_id, \ |
| 1889 Snapshot::Kind kind) { \ | 1878 Snapshot::Kind kind) { \ |
| 1890 ByteArrayWriteTo(writer, \ | 1879 ByteArrayWriteTo(writer, \ |
| 1891 object_id, \ | 1880 object_id, \ |
| 1892 kind, \ | 1881 kind, \ |
| 1893 ObjectStore::k##name##ArrayClass, \ | 1882 k##name##Array, \ |
| 1894 writer->GetObjectTags(this), \ | 1883 writer->GetObjectTags(this), \ |
| 1895 ptr()->length_, \ | 1884 ptr()->length_, \ |
| 1896 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ | 1885 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); \ |
| 1897 } \ | 1886 } \ |
| 1898 | 1887 |
| 1899 | 1888 |
| 1900 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) | 1889 BYTEARRAY_TYPE_LIST(EXTERNALARRAY_WRITE_TO) |
| 1901 #undef BYTEARRAY_WRITE_TO | 1890 #undef BYTEARRAY_WRITE_TO |
| 1902 #undef BYTEARRAY_TYPE_LIST | 1891 #undef BYTEARRAY_TYPE_LIST |
| 1903 | 1892 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 void RawJSRegExp::WriteTo(SnapshotWriter* writer, | 1958 void RawJSRegExp::WriteTo(SnapshotWriter* writer, |
| 1970 intptr_t object_id, | 1959 intptr_t object_id, |
| 1971 Snapshot::Kind kind) { | 1960 Snapshot::Kind kind) { |
| 1972 ASSERT(writer != NULL); | 1961 ASSERT(writer != NULL); |
| 1973 ASSERT(kind == Snapshot::kMessage); | 1962 ASSERT(kind == Snapshot::kMessage); |
| 1974 | 1963 |
| 1975 // Write out the serialization header value for this object. | 1964 // Write out the serialization header value for this object. |
| 1976 writer->WriteSerializationMarker(kInlined, object_id); | 1965 writer->WriteSerializationMarker(kInlined, object_id); |
| 1977 | 1966 |
| 1978 // Write out the class and tags information. | 1967 // Write out the class and tags information. |
| 1979 writer->WriteObjectHeader(ObjectStore::kJSRegExpClass, | 1968 writer->WriteObjectHeader(kJSRegExp, writer->GetObjectTags(this)); |
| 1980 writer->GetObjectTags(this)); | |
| 1981 | 1969 |
| 1982 // Write out the data length field. | 1970 // Write out the data length field. |
| 1983 writer->Write<RawObject*>(ptr()->data_length_); | 1971 writer->Write<RawObject*>(ptr()->data_length_); |
| 1984 | 1972 |
| 1985 // Write out all the other fields. | 1973 // Write out all the other fields. |
| 1986 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1974 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1987 writer->WriteObjectImpl(ptr()->pattern_); | 1975 writer->WriteObjectImpl(ptr()->pattern_); |
| 1988 writer->WriteIntptrValue(ptr()->type_); | 1976 writer->WriteIntptrValue(ptr()->type_); |
| 1989 writer->WriteIntptrValue(ptr()->flags_); | 1977 writer->WriteIntptrValue(ptr()->flags_); |
| 1990 | 1978 |
| 1991 // Do not write out the data part which is native. | 1979 // Do not write out the data part which is native. |
| 1992 } | 1980 } |
| 1993 | 1981 |
| 1994 | 1982 |
| 1995 } // namespace dart | 1983 } // namespace dart |
| OLD | NEW |