Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 10450014: Request for comments on overall approach. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix scavenger and freelist handling Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 void RawClass::WriteTo(SnapshotWriter* writer, 77 void RawClass::WriteTo(SnapshotWriter* writer,
78 intptr_t object_id, 78 intptr_t object_id,
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 && !IsCreatedFromSnapshot())) { 86 (kind == Snapshot::kScript &&
87 !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)))) {
87 // Write out the class and tags information. 88 // Write out the class and tags information.
88 writer->WriteObjectHeader(Object::kClassClass, ptr()->tags_); 89 writer->WriteObjectHeader(Object::kClassClass, writer->GetObjectTags(this));
89 90
90 // Write out all the non object pointer fields. 91 // Write out all the non object pointer fields.
91 // NOTE: cpp_vtable_ is not written. 92 // NOTE: cpp_vtable_ is not written.
92 writer->Write<ObjectKind>(ptr()->instance_kind_); 93 writer->Write<ObjectKind>(ptr()->instance_kind_);
93 writer->WriteIntptrValue(ptr()->instance_size_); 94 writer->WriteIntptrValue(ptr()->instance_size_);
94 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_); 95 writer->WriteIntptrValue(ptr()->type_arguments_instance_field_offset_);
95 writer->WriteIntptrValue(ptr()->next_field_offset_); 96 writer->WriteIntptrValue(ptr()->next_field_offset_);
96 writer->WriteIntptrValue(ptr()->num_native_fields_); 97 writer->WriteIntptrValue(ptr()->num_native_fields_);
97 writer->WriteIntptrValue(ptr()->token_index_); 98 writer->WriteIntptrValue(ptr()->token_index_);
98 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
139 140
140 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, 141 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer,
141 intptr_t object_id, 142 intptr_t object_id,
142 Snapshot::Kind kind) { 143 Snapshot::Kind kind) {
143 ASSERT(writer != NULL); 144 ASSERT(writer != NULL);
144 145
145 // Write out the serialization header value for this object. 146 // Write out the serialization header value for this object.
146 writer->WriteSerializationMarker(kInlined, object_id); 147 writer->WriteSerializationMarker(kInlined, object_id);
147 148
148 // Write out the class and tags information. 149 // Write out the class and tags information.
149 writer->WriteObjectHeader(Object::kUnresolvedClassClass, ptr()->tags_); 150 writer->WriteObjectHeader(Object::kUnresolvedClassClass,
151 writer->GetObjectTags(this));
150 152
151 // Write out all the non object pointer fields. 153 // Write out all the non object pointer fields.
152 writer->WriteIntptrValue(ptr()->token_index_); 154 writer->WriteIntptrValue(ptr()->token_index_);
153 155
154 // Write out all the object pointer fields. 156 // Write out all the object pointer fields.
155 SnapshotWriterVisitor visitor(writer); 157 SnapshotWriterVisitor visitor(writer);
156 visitor.VisitPointers(from(), to()); 158 visitor.VisitPointers(from(), to());
157 } 159 }
158 160
159 161
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 212
211 void RawType::WriteTo(SnapshotWriter* writer, 213 void RawType::WriteTo(SnapshotWriter* writer,
212 intptr_t object_id, 214 intptr_t object_id,
213 Snapshot::Kind kind) { 215 Snapshot::Kind kind) {
214 ASSERT(writer != NULL); 216 ASSERT(writer != NULL);
215 217
216 // Write out the serialization header value for this object. 218 // Write out the serialization header value for this object.
217 writer->WriteSerializationMarker(kInlined, object_id); 219 writer->WriteSerializationMarker(kInlined, object_id);
218 220
219 // Write out the class and tags information. 221 // Write out the class and tags information.
220 writer->WriteObjectHeader(Object::kTypeClass, ptr()->tags_); 222 writer->WriteObjectHeader(Object::kTypeClass, writer->GetObjectTags(this));
221 223
222 // Write out all the non object pointer fields. 224 // Write out all the non object pointer fields.
223 writer->WriteIntptrValue(ptr()->token_index_); 225 writer->WriteIntptrValue(ptr()->token_index_);
224 writer->Write<int8_t>(ptr()->type_state_); 226 writer->Write<int8_t>(ptr()->type_state_);
225 227
226 // Write out all the object pointer fields. 228 // Write out all the object pointer fields.
227 SnapshotWriterVisitor visitor(writer); 229 SnapshotWriterVisitor visitor(writer);
228 visitor.VisitPointers(from(), to()); 230 visitor.VisitPointers(from(), to());
229 } 231 }
230 232
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 265
264 void RawTypeParameter::WriteTo(SnapshotWriter* writer, 266 void RawTypeParameter::WriteTo(SnapshotWriter* writer,
265 intptr_t object_id, 267 intptr_t object_id,
266 Snapshot::Kind kind) { 268 Snapshot::Kind kind) {
267 ASSERT(writer != NULL); 269 ASSERT(writer != NULL);
268 270
269 // Write out the serialization header value for this object. 271 // Write out the serialization header value for this object.
270 writer->WriteSerializationMarker(kInlined, object_id); 272 writer->WriteSerializationMarker(kInlined, object_id);
271 273
272 // Write out the class and tags information. 274 // Write out the class and tags information.
273 writer->WriteObjectHeader(Object::kTypeParameterClass, ptr()->tags_); 275 writer->WriteObjectHeader(Object::kTypeParameterClass,
276 writer->GetObjectTags(this));
274 277
275 // Write out all the non object pointer fields. 278 // Write out all the non object pointer fields.
276 writer->WriteIntptrValue(ptr()->index_); 279 writer->WriteIntptrValue(ptr()->index_);
277 writer->WriteIntptrValue(ptr()->token_index_); 280 writer->WriteIntptrValue(ptr()->token_index_);
278 writer->Write<int8_t>(ptr()->type_state_); 281 writer->Write<int8_t>(ptr()->type_state_);
279 282
280 // Write out all the object pointer fields. 283 // Write out all the object pointer fields.
281 SnapshotWriterVisitor visitor(writer); 284 SnapshotWriterVisitor visitor(writer);
282 visitor.VisitPointers(from(), to()); 285 visitor.VisitPointers(from(), to());
283 } 286 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 337
335 void RawTypeArguments::WriteTo(SnapshotWriter* writer, 338 void RawTypeArguments::WriteTo(SnapshotWriter* writer,
336 intptr_t object_id, 339 intptr_t object_id,
337 Snapshot::Kind kind) { 340 Snapshot::Kind kind) {
338 ASSERT(writer != NULL); 341 ASSERT(writer != NULL);
339 342
340 // Write out the serialization header value for this object. 343 // Write out the serialization header value for this object.
341 writer->WriteSerializationMarker(kInlined, object_id); 344 writer->WriteSerializationMarker(kInlined, object_id);
342 345
343 // Write out the class and tags information. 346 // Write out the class and tags information.
344 writer->WriteObjectHeader(Object::kTypeArgumentsClass, ptr()->tags_); 347 writer->WriteObjectHeader(Object::kTypeArgumentsClass,
348 writer->GetObjectTags(this));
345 349
346 // Write out the length field. 350 // Write out the length field.
347 writer->Write<RawObject*>(ptr()->length_); 351 writer->Write<RawObject*>(ptr()->length_);
348 352
349 // Write out the individual types. 353 // Write out the individual types.
350 intptr_t len = Smi::Value(ptr()->length_); 354 intptr_t len = Smi::Value(ptr()->length_);
351 for (intptr_t i = 0; i < len; i++) { 355 for (intptr_t i = 0; i < len; i++) {
352 writer->WriteObject(ptr()->types_[i]); 356 writer->WriteObject(ptr()->types_[i]);
353 } 357 }
354 } 358 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 intptr_t object_id, 391 intptr_t object_id,
388 Snapshot::Kind kind) { 392 Snapshot::Kind kind) {
389 ASSERT(writer != NULL); 393 ASSERT(writer != NULL);
390 ASSERT(kind == Snapshot::kMessage); 394 ASSERT(kind == Snapshot::kMessage);
391 395
392 // Write out the serialization header value for this object. 396 // Write out the serialization header value for this object.
393 writer->WriteSerializationMarker(kInlined, object_id); 397 writer->WriteSerializationMarker(kInlined, object_id);
394 398
395 // Write out the class and tags information. 399 // Write out the class and tags information.
396 writer->WriteObjectHeader(Object::kInstantiatedTypeArgumentsClass, 400 writer->WriteObjectHeader(Object::kInstantiatedTypeArgumentsClass,
397 ptr()->tags_); 401 writer->GetObjectTags(this));
398 402
399 // Write out all the object pointer fields. 403 // Write out all the object pointer fields.
400 SnapshotWriterVisitor visitor(writer); 404 SnapshotWriterVisitor visitor(writer);
401 visitor.VisitPointers(from(), to()); 405 visitor.VisitPointers(from(), to());
402 } 406 }
403 407
404 408
405 RawFunction* Function::ReadFrom(SnapshotReader* reader, 409 RawFunction* Function::ReadFrom(SnapshotReader* reader,
406 intptr_t object_id, 410 intptr_t object_id,
407 intptr_t tags, 411 intptr_t tags,
(...skipping 30 matching lines...) Expand all
438 } 442 }
439 443
440 return func.raw(); 444 return func.raw();
441 } 445 }
442 446
443 447
444 void RawFunction::WriteTo(SnapshotWriter* writer, 448 void RawFunction::WriteTo(SnapshotWriter* writer,
445 intptr_t object_id, 449 intptr_t object_id,
446 Snapshot::Kind kind) { 450 Snapshot::Kind kind) {
447 ASSERT(writer != NULL); 451 ASSERT(writer != NULL);
448 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 452 ASSERT(kind != Snapshot::kMessage &&
453 !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
449 454
450 // Write out the serialization header value for this object. 455 // Write out the serialization header value for this object.
451 writer->WriteSerializationMarker(kInlined, object_id); 456 writer->WriteSerializationMarker(kInlined, object_id);
452 457
453 // Write out the class and tags information. 458 // Write out the class and tags information.
454 writer->WriteObjectHeader(Object::kFunctionClass, ptr()->tags_); 459 writer->WriteObjectHeader(Object::kFunctionClass,
460 writer->GetObjectTags(this));
455 461
456 // Write out all the non object fields. 462 // Write out all the non object fields.
457 writer->WriteIntptrValue(ptr()->token_index_); 463 writer->WriteIntptrValue(ptr()->token_index_);
458 writer->WriteIntptrValue(ptr()->end_token_index_); 464 writer->WriteIntptrValue(ptr()->end_token_index_);
459 writer->WriteIntptrValue(ptr()->num_fixed_parameters_); 465 writer->WriteIntptrValue(ptr()->num_fixed_parameters_);
460 writer->WriteIntptrValue(ptr()->num_optional_parameters_); 466 writer->WriteIntptrValue(ptr()->num_optional_parameters_);
461 writer->WriteIntptrValue(ptr()->usage_counter_); 467 writer->WriteIntptrValue(ptr()->usage_counter_);
462 writer->WriteIntptrValue(ptr()->deoptimization_counter_); 468 writer->WriteIntptrValue(ptr()->deoptimization_counter_);
463 writer->WriteIntptrValue(ptr()->kind_); 469 writer->WriteIntptrValue(ptr()->kind_);
464 writer->Write<bool>(ptr()->is_static_); 470 writer->Write<bool>(ptr()->is_static_);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 506 }
501 507
502 return field.raw(); 508 return field.raw();
503 } 509 }
504 510
505 511
506 void RawField::WriteTo(SnapshotWriter* writer, 512 void RawField::WriteTo(SnapshotWriter* writer,
507 intptr_t object_id, 513 intptr_t object_id,
508 Snapshot::Kind kind) { 514 Snapshot::Kind kind) {
509 ASSERT(writer != NULL); 515 ASSERT(writer != NULL);
510 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 516 ASSERT(kind != Snapshot::kMessage &&
517 !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
511 518
512 // Write out the serialization header value for this object. 519 // Write out the serialization header value for this object.
513 writer->WriteSerializationMarker(kInlined, object_id); 520 writer->WriteSerializationMarker(kInlined, object_id);
514 521
515 // Write out the class and tags information. 522 // Write out the class and tags information.
516 writer->WriteObjectHeader(Object::kFieldClass, ptr()->tags_); 523 writer->WriteObjectHeader(Object::kFieldClass, writer->GetObjectTags(this));
517 524
518 // Write out all the non object fields. 525 // Write out all the non object fields.
519 writer->WriteIntptrValue(ptr()->token_index_); 526 writer->WriteIntptrValue(ptr()->token_index_);
520 writer->Write<bool>(ptr()->is_static_); 527 writer->Write<bool>(ptr()->is_static_);
521 writer->Write<bool>(ptr()->is_final_); 528 writer->Write<bool>(ptr()->is_final_);
522 writer->Write<bool>(ptr()->has_initializer_); 529 writer->Write<bool>(ptr()->has_initializer_);
523 530
524 // Write out all the object pointer fields. 531 // Write out all the object pointer fields.
525 SnapshotWriterVisitor visitor(writer); 532 SnapshotWriterVisitor visitor(writer);
526 visitor.VisitPointers(from(), to()); 533 visitor.VisitPointers(from(), to());
(...skipping 30 matching lines...) Expand all
557 void RawLiteralToken::WriteTo(SnapshotWriter* writer, 564 void RawLiteralToken::WriteTo(SnapshotWriter* writer,
558 intptr_t object_id, 565 intptr_t object_id,
559 Snapshot::Kind kind) { 566 Snapshot::Kind kind) {
560 ASSERT(writer != NULL); 567 ASSERT(writer != NULL);
561 ASSERT(kind != Snapshot::kMessage); 568 ASSERT(kind != Snapshot::kMessage);
562 569
563 // Write out the serialization header value for this object. 570 // Write out the serialization header value for this object.
564 writer->WriteSerializationMarker(kInlined, object_id); 571 writer->WriteSerializationMarker(kInlined, object_id);
565 572
566 // Write out the class and tags information. 573 // Write out the class and tags information.
567 writer->WriteObjectHeader(Object::kLiteralTokenClass, ptr()->tags_); 574 writer->WriteObjectHeader(Object::kLiteralTokenClass,
575 writer->GetObjectTags(this));
568 576
569 // Write out the kind field. 577 // Write out the kind field.
570 writer->Write<intptr_t>(ptr()->kind_); 578 writer->Write<intptr_t>(ptr()->kind_);
571 579
572 // Write out literal and value fields. 580 // Write out literal and value fields.
573 writer->WriteObject(ptr()->literal_); 581 writer->WriteObject(ptr()->literal_);
574 writer->WriteObject(ptr()->value_); 582 writer->WriteObject(ptr()->value_);
575 } 583 }
576 584
577 585
(...skipping 21 matching lines...) Expand all
599 token_stream.SetTokenAt(i, *reader->ObjectHandle()); 607 token_stream.SetTokenAt(i, *reader->ObjectHandle());
600 } 608 }
601 return token_stream.raw(); 609 return token_stream.raw();
602 } 610 }
603 611
604 612
605 void RawTokenStream::WriteTo(SnapshotWriter* writer, 613 void RawTokenStream::WriteTo(SnapshotWriter* writer,
606 intptr_t object_id, 614 intptr_t object_id,
607 Snapshot::Kind kind) { 615 Snapshot::Kind kind) {
608 ASSERT(writer != NULL); 616 ASSERT(writer != NULL);
609 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 617 ASSERT(kind != Snapshot::kMessage &&
618 !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
610 619
611 // Write out the serialization header value for this object. 620 // Write out the serialization header value for this object.
612 writer->WriteSerializationMarker(kInlined, object_id); 621 writer->WriteSerializationMarker(kInlined, object_id);
613 622
614 // Write out the class and tags information. 623 // Write out the class and tags information.
615 writer->WriteObjectHeader(Object::kTokenStreamClass, ptr()->tags_); 624 writer->WriteObjectHeader(Object::kTokenStreamClass,
625 writer->GetObjectTags(this));
616 626
617 // Write out the length field. 627 // Write out the length field.
618 writer->Write<RawObject*>(ptr()->length_); 628 writer->Write<RawObject*>(ptr()->length_);
619 629
620 // Write out the token stream (token kind and literal). 630 // Write out the token stream (token kind and literal).
621 intptr_t len = Smi::Value(ptr()->length_); 631 intptr_t len = Smi::Value(ptr()->length_);
622 for (intptr_t i = 0; i < TokenStream::StreamLength(len); i++) { 632 for (intptr_t i = 0; i < TokenStream::StreamLength(len); i++) {
623 writer->WriteObject(ptr()->data_[i]); 633 writer->WriteObject(ptr()->data_[i]);
624 } 634 }
625 } 635 }
(...skipping 26 matching lines...) Expand all
652 662
653 return script.raw(); 663 return script.raw();
654 } 664 }
655 665
656 666
657 void RawScript::WriteTo(SnapshotWriter* writer, 667 void RawScript::WriteTo(SnapshotWriter* writer,
658 intptr_t object_id, 668 intptr_t object_id,
659 Snapshot::Kind kind) { 669 Snapshot::Kind kind) {
660 ASSERT(writer != NULL); 670 ASSERT(writer != NULL);
661 ASSERT(tokens_ != TokenStream::null()); 671 ASSERT(tokens_ != TokenStream::null());
662 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 672 ASSERT(kind != Snapshot::kMessage &&
673 !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
663 674
664 // Write out the serialization header value for this object. 675 // Write out the serialization header value for this object.
665 writer->WriteSerializationMarker(kInlined, object_id); 676 writer->WriteSerializationMarker(kInlined, object_id);
666 677
667 // Write out the class and tags information. 678 // Write out the class and tags information.
668 writer->WriteObjectHeader(Object::kScriptClass, ptr()->tags_); 679 writer->WriteObjectHeader(Object::kScriptClass, writer->GetObjectTags(this));
669 680
670 // Write out all the object pointer fields. 681 // Write out all the object pointer fields.
671 writer->WriteObject(ptr()->url_); 682 writer->WriteObject(ptr()->url_);
672 writer->WriteObject(ptr()->tokens_); 683 writer->WriteObject(ptr()->tokens_);
673 } 684 }
674 685
675 686
676 RawLibrary* Library::ReadFrom(SnapshotReader* reader, 687 RawLibrary* Library::ReadFrom(SnapshotReader* reader,
677 intptr_t object_id, 688 intptr_t object_id,
678 intptr_t tags, 689 intptr_t tags,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 void RawLibrary::WriteTo(SnapshotWriter* writer, 738 void RawLibrary::WriteTo(SnapshotWriter* writer,
728 intptr_t object_id, 739 intptr_t object_id,
729 Snapshot::Kind kind) { 740 Snapshot::Kind kind) {
730 ASSERT(writer != NULL); 741 ASSERT(writer != NULL);
731 ASSERT(kind != Snapshot::kMessage); 742 ASSERT(kind != Snapshot::kMessage);
732 743
733 // Write out the serialization header value for this object. 744 // Write out the serialization header value for this object.
734 writer->WriteSerializationMarker(kInlined, object_id); 745 writer->WriteSerializationMarker(kInlined, object_id);
735 746
736 // Write out the class and tags information. 747 // Write out the class and tags information.
737 writer->WriteObjectHeader(Object::kLibraryClass, ptr()->tags_); 748 writer->WriteObjectHeader(Object::kLibraryClass, writer->GetObjectTags(this));
738 749
739 if (IsCreatedFromSnapshot()) { 750 if (CreatedFromSnapshotTag::decode(writer->GetObjectTags(this))) {
740 ASSERT(kind != Snapshot::kFull); 751 ASSERT(kind != Snapshot::kFull);
741 // Write out library URL so that it can be looked up when reading. 752 // Write out library URL so that it can be looked up when reading.
742 writer->WriteObject(ptr()->url_); 753 writer->WriteObject(ptr()->url_);
743 } else { 754 } else {
744 // Write out all non object fields. 755 // Write out all non object fields.
745 writer->WriteIntptrValue(ptr()->num_imports_); 756 writer->WriteIntptrValue(ptr()->num_imports_);
746 writer->WriteIntptrValue(ptr()->num_imported_into_); 757 writer->WriteIntptrValue(ptr()->num_imported_into_);
747 writer->WriteIntptrValue(ptr()->num_anonymous_); 758 writer->WriteIntptrValue(ptr()->num_anonymous_);
748 writer->Write<bool>(ptr()->corelib_imported_); 759 writer->Write<bool>(ptr()->corelib_imported_);
749 writer->Write<int8_t>(ptr()->load_state_); 760 writer->Write<int8_t>(ptr()->load_state_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 799 }
789 800
790 return prefix.raw(); 801 return prefix.raw();
791 } 802 }
792 803
793 804
794 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer, 805 void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
795 intptr_t object_id, 806 intptr_t object_id,
796 Snapshot::Kind kind) { 807 Snapshot::Kind kind) {
797 ASSERT(writer != NULL); 808 ASSERT(writer != NULL);
798 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 809 ASSERT(kind != Snapshot::kMessage &&
810 !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
799 811
800 // Write out the serialization header value for this object. 812 // Write out the serialization header value for this object.
801 writer->WriteSerializationMarker(kInlined, object_id); 813 writer->WriteSerializationMarker(kInlined, object_id);
802 814
803 // Write out the class and tags information. 815 // Write out the class and tags information.
804 writer->WriteObjectHeader(Object::kLibraryPrefixClass, ptr()->tags_); 816 writer->WriteObjectHeader(Object::kLibraryPrefixClass,
817 writer->GetObjectTags(this));
805 818
806 // Write out all non object fields. 819 // Write out all non object fields.
807 writer->WriteIntptrValue(ptr()->num_libs_); 820 writer->WriteIntptrValue(ptr()->num_libs_);
808 821
809 // Write out all the object pointer fields. 822 // Write out all the object pointer fields.
810 SnapshotWriterVisitor visitor(writer); 823 SnapshotWriterVisitor visitor(writer);
811 visitor.VisitPointers(from(), to()); 824 visitor.VisitPointers(from(), to());
812 } 825 }
813 826
814 827
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 959
947 void RawContext::WriteTo(SnapshotWriter* writer, 960 void RawContext::WriteTo(SnapshotWriter* writer,
948 intptr_t object_id, 961 intptr_t object_id,
949 Snapshot::Kind kind) { 962 Snapshot::Kind kind) {
950 ASSERT(writer != NULL); 963 ASSERT(writer != NULL);
951 964
952 // Write out the serialization header value for this object. 965 // Write out the serialization header value for this object.
953 writer->WriteSerializationMarker(kInlined, object_id); 966 writer->WriteSerializationMarker(kInlined, object_id);
954 967
955 // Write out the class and tags information. 968 // Write out the class and tags information.
956 writer->WriteObjectHeader(Object::kContextClass, ptr()->tags_); 969 writer->WriteObjectHeader(Object::kContextClass, writer->GetObjectTags(this));
957 970
958 // Write out num of variables in the context. 971 // Write out num of variables in the context.
959 writer->WriteIntptrValue(ptr()->num_variables_); 972 writer->WriteIntptrValue(ptr()->num_variables_);
960 973
961 // Can't serialize the isolate pointer, we set it implicitly on read. 974 // Can't serialize the isolate pointer, we set it implicitly on read.
962 975
963 // Write out all the object pointer fields. 976 // Write out all the object pointer fields.
964 SnapshotWriterVisitor visitor(writer); 977 SnapshotWriterVisitor visitor(writer);
965 visitor.VisitPointers(from(), to(ptr()->num_variables_)); 978 visitor.VisitPointers(from(), to(ptr()->num_variables_));
966 } 979 }
(...skipping 30 matching lines...) Expand all
997 void RawContextScope::WriteTo(SnapshotWriter* writer, 1010 void RawContextScope::WriteTo(SnapshotWriter* writer,
998 intptr_t object_id, 1011 intptr_t object_id,
999 Snapshot::Kind kind) { 1012 Snapshot::Kind kind) {
1000 ASSERT(writer != NULL); 1013 ASSERT(writer != NULL);
1001 ASSERT(kind == Snapshot::kMessage); 1014 ASSERT(kind == Snapshot::kMessage);
1002 1015
1003 // Write out the serialization header value for this object. 1016 // Write out the serialization header value for this object.
1004 writer->WriteSerializationMarker(kInlined, object_id); 1017 writer->WriteSerializationMarker(kInlined, object_id);
1005 1018
1006 // Write out the class and tags information. 1019 // Write out the class and tags information.
1007 writer->WriteObjectHeader(Object::kContextScopeClass, ptr()->tags_); 1020 writer->WriteObjectHeader(Object::kContextScopeClass,
1021 writer->GetObjectTags(this));
1008 1022
1009 // Serialize number of variables. 1023 // Serialize number of variables.
1010 writer->WriteIntptrValue(ptr()->num_variables_); 1024 writer->WriteIntptrValue(ptr()->num_variables_);
1011 1025
1012 // Write out all the object pointer fields. 1026 // Write out all the object pointer fields.
1013 SnapshotWriterVisitor visitor(writer); 1027 SnapshotWriterVisitor visitor(writer);
1014 visitor.VisitPointers(from(), to(ptr()->num_variables_)); 1028 visitor.VisitPointers(from(), to(ptr()->num_variables_));
1015 } 1029 }
1016 1030
1017 1031
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1188
1175 void RawMint::WriteTo(SnapshotWriter* writer, 1189 void RawMint::WriteTo(SnapshotWriter* writer,
1176 intptr_t object_id, 1190 intptr_t object_id,
1177 Snapshot::Kind kind) { 1191 Snapshot::Kind kind) {
1178 ASSERT(writer != NULL); 1192 ASSERT(writer != NULL);
1179 1193
1180 // Write out the serialization header value for this object. 1194 // Write out the serialization header value for this object.
1181 writer->WriteSerializationMarker(kInlined, object_id); 1195 writer->WriteSerializationMarker(kInlined, object_id);
1182 1196
1183 // Write out the class and tags information. 1197 // Write out the class and tags information.
1184 writer->WriteObjectHeader(ObjectStore::kMintClass, ptr()->tags_); 1198 writer->WriteObjectHeader(ObjectStore::kMintClass,
1199 writer->GetObjectTags(this));
1185 1200
1186 // Write out the 64 bit value. 1201 // Write out the 64 bit value.
1187 writer->Write<int64_t>(ptr()->value_); 1202 writer->Write<int64_t>(ptr()->value_);
1188 } 1203 }
1189 1204
1190 1205
1191 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, 1206 RawBigint* Bigint::ReadFrom(SnapshotReader* reader,
1192 intptr_t object_id, 1207 intptr_t object_id,
1193 intptr_t tags, 1208 intptr_t tags,
1194 Snapshot::Kind kind) { 1209 Snapshot::Kind kind) {
(...skipping 28 matching lines...) Expand all
1223 1238
1224 void RawBigint::WriteTo(SnapshotWriter* writer, 1239 void RawBigint::WriteTo(SnapshotWriter* writer,
1225 intptr_t object_id, 1240 intptr_t object_id,
1226 Snapshot::Kind kind) { 1241 Snapshot::Kind kind) {
1227 ASSERT(writer != NULL); 1242 ASSERT(writer != NULL);
1228 1243
1229 // Write out the serialization header value for this object. 1244 // Write out the serialization header value for this object.
1230 writer->WriteSerializationMarker(kInlined, object_id); 1245 writer->WriteSerializationMarker(kInlined, object_id);
1231 1246
1232 // Write out the class and tags information. 1247 // Write out the class and tags information.
1233 writer->WriteObjectHeader(ObjectStore::kBigintClass, ptr()->tags_); 1248 writer->WriteObjectHeader(ObjectStore::kBigintClass,
1249 writer->GetObjectTags(this));
1234 1250
1235 // Write out the bigint value as a HEXCstring. 1251 // Write out the bigint value as a HEXCstring.
1236 intptr_t length = ptr()->signed_length_; 1252 intptr_t length = ptr()->signed_length_;
1237 bool is_negative = false; 1253 bool is_negative = false;
1238 if (length <= 0) { 1254 if (length <= 0) {
1239 length = -length; 1255 length = -length;
1240 is_negative = true; 1256 is_negative = true;
1241 } 1257 }
1242 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); 1258 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint);
1243 const char* str = BigintOperations::ToHexCString( 1259 const char* str = BigintOperations::ToHexCString(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1310
1295 void RawDouble::WriteTo(SnapshotWriter* writer, 1311 void RawDouble::WriteTo(SnapshotWriter* writer,
1296 intptr_t object_id, 1312 intptr_t object_id,
1297 Snapshot::Kind kind) { 1313 Snapshot::Kind kind) {
1298 ASSERT(writer != NULL); 1314 ASSERT(writer != NULL);
1299 1315
1300 // Write out the serialization header value for this object. 1316 // Write out the serialization header value for this object.
1301 writer->WriteSerializationMarker(kInlined, object_id); 1317 writer->WriteSerializationMarker(kInlined, object_id);
1302 1318
1303 // Write out the class and tags information. 1319 // Write out the class and tags information.
1304 writer->WriteObjectHeader(ObjectStore::kDoubleClass, ptr()->tags_); 1320 writer->WriteObjectHeader(ObjectStore::kDoubleClass,
1321 writer->GetObjectTags(this));
1305 1322
1306 // Write out the double value. 1323 // Write out the double value.
1307 writer->Write<double>(ptr()->value_); 1324 writer->Write<double>(ptr()->value_);
1308 } 1325 }
1309 1326
1310 1327
1311 RawString* String::ReadFrom(SnapshotReader* reader, 1328 RawString* String::ReadFrom(SnapshotReader* reader,
1312 intptr_t object_id, 1329 intptr_t object_id,
1313 intptr_t tags, 1330 intptr_t tags,
1314 Snapshot::Kind kind) { 1331 Snapshot::Kind kind) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 } 1492 }
1476 1493
1477 1494
1478 void RawOneByteString::WriteTo(SnapshotWriter* writer, 1495 void RawOneByteString::WriteTo(SnapshotWriter* writer,
1479 intptr_t object_id, 1496 intptr_t object_id,
1480 Snapshot::Kind kind) { 1497 Snapshot::Kind kind) {
1481 StringWriteTo(writer, 1498 StringWriteTo(writer,
1482 object_id, 1499 object_id,
1483 kind, 1500 kind,
1484 ObjectStore::kOneByteStringClass, 1501 ObjectStore::kOneByteStringClass,
1485 ptr()->tags_, 1502 writer->GetObjectTags(this),
1486 ptr()->length_, 1503 ptr()->length_,
1487 ptr()->hash_, 1504 ptr()->hash_,
1488 ptr()->data_); 1505 ptr()->data_);
1489 } 1506 }
1490 1507
1491 1508
1492 void RawTwoByteString::WriteTo(SnapshotWriter* writer, 1509 void RawTwoByteString::WriteTo(SnapshotWriter* writer,
1493 intptr_t object_id, 1510 intptr_t object_id,
1494 Snapshot::Kind kind) { 1511 Snapshot::Kind kind) {
1495 StringWriteTo(writer, 1512 StringWriteTo(writer,
1496 object_id, 1513 object_id,
1497 kind, 1514 kind,
1498 ObjectStore::kTwoByteStringClass, 1515 ObjectStore::kTwoByteStringClass,
1499 ptr()->tags_, 1516 writer->GetObjectTags(this),
1500 ptr()->length_, 1517 ptr()->length_,
1501 ptr()->hash_, 1518 ptr()->hash_,
1502 ptr()->data_); 1519 ptr()->data_);
1503 } 1520 }
1504 1521
1505 1522
1506 void RawFourByteString::WriteTo(SnapshotWriter* writer, 1523 void RawFourByteString::WriteTo(SnapshotWriter* writer,
1507 intptr_t object_id, 1524 intptr_t object_id,
1508 Snapshot::Kind kind) { 1525 Snapshot::Kind kind) {
1509 StringWriteTo(writer, 1526 StringWriteTo(writer,
1510 object_id, 1527 object_id,
1511 kind, 1528 kind,
1512 ObjectStore::kFourByteStringClass, 1529 ObjectStore::kFourByteStringClass,
1513 ptr()->tags_, 1530 writer->GetObjectTags(this),
1514 ptr()->length_, 1531 ptr()->length_,
1515 ptr()->hash_, 1532 ptr()->hash_,
1516 ptr()->data_); 1533 ptr()->data_);
1517 } 1534 }
1518 1535
1519 1536
1520 RawExternalOneByteString* ExternalOneByteString::ReadFrom( 1537 RawExternalOneByteString* ExternalOneByteString::ReadFrom(
1521 SnapshotReader* reader, 1538 SnapshotReader* reader,
1522 intptr_t object_id, 1539 intptr_t object_id,
1523 intptr_t tags, 1540 intptr_t tags,
(...skipping 24 matching lines...) Expand all
1548 1565
1549 1566
1550 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer, 1567 void RawExternalOneByteString::WriteTo(SnapshotWriter* writer,
1551 intptr_t object_id, 1568 intptr_t object_id,
1552 Snapshot::Kind kind) { 1569 Snapshot::Kind kind) {
1553 // Serialize as a non-external one byte string. 1570 // Serialize as a non-external one byte string.
1554 StringWriteTo(writer, 1571 StringWriteTo(writer,
1555 object_id, 1572 object_id,
1556 kind, 1573 kind,
1557 ObjectStore::kOneByteStringClass, 1574 ObjectStore::kOneByteStringClass,
1558 ptr()->tags_, 1575 writer->GetObjectTags(this),
1559 ptr()->length_, 1576 ptr()->length_,
1560 ptr()->hash_, 1577 ptr()->hash_,
1561 ptr()->external_data_->data()); 1578 ptr()->external_data_->data());
1562 } 1579 }
1563 1580
1564 1581
1565 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer, 1582 void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer,
1566 intptr_t object_id, 1583 intptr_t object_id,
1567 Snapshot::Kind kind) { 1584 Snapshot::Kind kind) {
1568 // Serialize as a non-external two byte string. 1585 // Serialize as a non-external two byte string.
1569 StringWriteTo(writer, 1586 StringWriteTo(writer,
1570 object_id, 1587 object_id,
1571 kind, 1588 kind,
1572 ObjectStore::kTwoByteStringClass, 1589 ObjectStore::kTwoByteStringClass,
1573 ptr()->tags_, 1590 writer->GetObjectTags(this),
1574 ptr()->length_, 1591 ptr()->length_,
1575 ptr()->hash_, 1592 ptr()->hash_,
1576 ptr()->external_data_->data()); 1593 ptr()->external_data_->data());
1577 } 1594 }
1578 1595
1579 1596
1580 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer, 1597 void RawExternalFourByteString::WriteTo(SnapshotWriter* writer,
1581 intptr_t object_id, 1598 intptr_t object_id,
1582 Snapshot::Kind kind) { 1599 Snapshot::Kind kind) {
1583 // Serialize as a non-external four byte string. 1600 // Serialize as a non-external four byte string.
1584 StringWriteTo(writer, 1601 StringWriteTo(writer,
1585 object_id, 1602 object_id,
1586 kind, 1603 kind,
1587 ObjectStore::kFourByteStringClass, 1604 ObjectStore::kFourByteStringClass,
1588 ptr()->tags_, 1605 writer->GetObjectTags(this),
1589 ptr()->length_, 1606 ptr()->length_,
1590 ptr()->hash_, 1607 ptr()->hash_,
1591 ptr()->external_data_->data()); 1608 ptr()->external_data_->data());
1592 } 1609 }
1593 1610
1594 1611
1595 RawBool* Bool::ReadFrom(SnapshotReader* reader, 1612 RawBool* Bool::ReadFrom(SnapshotReader* reader,
1596 intptr_t object_id, 1613 intptr_t object_id,
1597 intptr_t tags, 1614 intptr_t tags,
1598 Snapshot::Kind kind) { 1615 Snapshot::Kind kind) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 } 1707 }
1691 1708
1692 1709
1693 void RawArray::WriteTo(SnapshotWriter* writer, 1710 void RawArray::WriteTo(SnapshotWriter* writer,
1694 intptr_t object_id, 1711 intptr_t object_id,
1695 Snapshot::Kind kind) { 1712 Snapshot::Kind kind) {
1696 ArrayWriteTo(writer, 1713 ArrayWriteTo(writer,
1697 object_id, 1714 object_id,
1698 kind, 1715 kind,
1699 ObjectStore::kArrayClass, 1716 ObjectStore::kArrayClass,
1700 ptr()->tags_, 1717 writer->GetObjectTags(this),
1701 ptr()->length_, 1718 ptr()->length_,
1702 ptr()->type_arguments_, 1719 ptr()->type_arguments_,
1703 ptr()->data()); 1720 ptr()->data());
1704 } 1721 }
1705 1722
1706 1723
1707 void RawImmutableArray::WriteTo(SnapshotWriter* writer, 1724 void RawImmutableArray::WriteTo(SnapshotWriter* writer,
1708 intptr_t object_id, 1725 intptr_t object_id,
1709 Snapshot::Kind kind) { 1726 Snapshot::Kind kind) {
1710 ArrayWriteTo(writer, 1727 ArrayWriteTo(writer,
1711 object_id, 1728 object_id,
1712 kind, 1729 kind,
1713 ObjectStore::kImmutableArrayClass, 1730 ObjectStore::kImmutableArrayClass,
1714 ptr()->tags_, 1731 writer->GetObjectTags(this),
1715 ptr()->length_, 1732 ptr()->length_,
1716 ptr()->type_arguments_, 1733 ptr()->type_arguments_,
1717 ptr()->data()); 1734 ptr()->data());
1718 } 1735 }
1719 1736
1720 1737
1721 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, 1738 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader,
1722 intptr_t object_id, 1739 intptr_t object_id,
1723 intptr_t tags, 1740 intptr_t tags,
1724 Snapshot::Kind kind) { 1741 Snapshot::Kind kind) {
(...skipping 23 matching lines...) Expand all
1748 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, 1765 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer,
1749 intptr_t object_id, 1766 intptr_t object_id,
1750 Snapshot::Kind kind) { 1767 Snapshot::Kind kind) {
1751 ASSERT(writer != NULL); 1768 ASSERT(writer != NULL);
1752 1769
1753 // Write out the serialization header value for this object. 1770 // Write out the serialization header value for this object.
1754 writer->WriteSerializationMarker(kInlined, object_id); 1771 writer->WriteSerializationMarker(kInlined, object_id);
1755 1772
1756 // Write out the class and tags information. 1773 // Write out the class and tags information.
1757 writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass, 1774 writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass,
1758 ptr()->tags_); 1775 writer->GetObjectTags(this));
1759 1776
1760 // Write out the used length field. 1777 // Write out the used length field.
1761 writer->Write<RawObject*>(ptr()->length_); 1778 writer->Write<RawObject*>(ptr()->length_);
1762 1779
1763 // Write out the Array object. 1780 // Write out the Array object.
1764 writer->WriteObject(ptr()->data_); 1781 writer->WriteObject(ptr()->data_);
1765 } 1782 }
1766 1783
1767 1784
1768 RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader, 1785 RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 } 2048 }
2032 2049
2033 2050
2034 void RawInt8Array::WriteTo(SnapshotWriter* writer, 2051 void RawInt8Array::WriteTo(SnapshotWriter* writer,
2035 intptr_t object_id, 2052 intptr_t object_id,
2036 Snapshot::Kind kind) { 2053 Snapshot::Kind kind) {
2037 ByteArrayWriteTo(writer, 2054 ByteArrayWriteTo(writer,
2038 object_id, 2055 object_id,
2039 kind, 2056 kind,
2040 ObjectStore::kInt8ArrayClass, 2057 ObjectStore::kInt8ArrayClass,
2041 ptr()->tags_, 2058 writer->GetObjectTags(this),
2042 ptr()->length_, 2059 ptr()->length_,
2043 reinterpret_cast<uint8_t*>(ptr()->data_)); 2060 reinterpret_cast<uint8_t*>(ptr()->data_));
2044 } 2061 }
2045 2062
2046 2063
2047 void RawUint8Array::WriteTo(SnapshotWriter* writer, 2064 void RawUint8Array::WriteTo(SnapshotWriter* writer,
2048 intptr_t object_id, 2065 intptr_t object_id,
2049 Snapshot::Kind kind) { 2066 Snapshot::Kind kind) {
2050 ByteArrayWriteTo(writer, 2067 ByteArrayWriteTo(writer,
2051 object_id, 2068 object_id,
2052 kind, 2069 kind,
2053 ObjectStore::kUint8ArrayClass, 2070 ObjectStore::kUint8ArrayClass,
2054 ptr()->tags_, 2071 writer->GetObjectTags(this),
2055 ptr()->length_, 2072 ptr()->length_,
2056 reinterpret_cast<uint8_t*>(ptr()->data_)); 2073 reinterpret_cast<uint8_t*>(ptr()->data_));
2057 } 2074 }
2058 2075
2059 2076
2060 void RawInt16Array::WriteTo(SnapshotWriter* writer, 2077 void RawInt16Array::WriteTo(SnapshotWriter* writer,
2061 intptr_t object_id, 2078 intptr_t object_id,
2062 Snapshot::Kind kind) { 2079 Snapshot::Kind kind) {
2063 ByteArrayWriteTo(writer, 2080 ByteArrayWriteTo(writer,
2064 object_id, 2081 object_id,
2065 kind, 2082 kind,
2066 ObjectStore::kInt16ArrayClass, 2083 ObjectStore::kInt16ArrayClass,
2067 ptr()->tags_, 2084 writer->GetObjectTags(this),
2068 ptr()->length_, 2085 ptr()->length_,
2069 reinterpret_cast<uint8_t*>(ptr()->data_)); 2086 reinterpret_cast<uint8_t*>(ptr()->data_));
2070 } 2087 }
2071 2088
2072 2089
2073 void RawUint16Array::WriteTo(SnapshotWriter* writer, 2090 void RawUint16Array::WriteTo(SnapshotWriter* writer,
2074 intptr_t object_id, 2091 intptr_t object_id,
2075 Snapshot::Kind kind) { 2092 Snapshot::Kind kind) {
2076 ByteArrayWriteTo(writer, 2093 ByteArrayWriteTo(writer,
2077 object_id, 2094 object_id,
2078 kind, 2095 kind,
2079 ObjectStore::kUint16ArrayClass, 2096 ObjectStore::kUint16ArrayClass,
2080 ptr()->tags_, 2097 writer->GetObjectTags(this),
2081 ptr()->length_, 2098 ptr()->length_,
2082 reinterpret_cast<uint8_t*>(ptr()->data_)); 2099 reinterpret_cast<uint8_t*>(ptr()->data_));
2083 } 2100 }
2084 2101
2085 2102
2086 void RawInt32Array::WriteTo(SnapshotWriter* writer, 2103 void RawInt32Array::WriteTo(SnapshotWriter* writer,
2087 intptr_t object_id, 2104 intptr_t object_id,
2088 Snapshot::Kind kind) { 2105 Snapshot::Kind kind) {
2089 ByteArrayWriteTo(writer, 2106 ByteArrayWriteTo(writer,
2090 object_id, 2107 object_id,
2091 kind, 2108 kind,
2092 ObjectStore::kInt32ArrayClass, 2109 ObjectStore::kInt32ArrayClass,
2093 ptr()->tags_, 2110 writer->GetObjectTags(this),
2094 ptr()->length_, 2111 ptr()->length_,
2095 reinterpret_cast<uint8_t*>(ptr()->data_)); 2112 reinterpret_cast<uint8_t*>(ptr()->data_));
2096 } 2113 }
2097 2114
2098 2115
2099 void RawUint32Array::WriteTo(SnapshotWriter* writer, 2116 void RawUint32Array::WriteTo(SnapshotWriter* writer,
2100 intptr_t object_id, 2117 intptr_t object_id,
2101 Snapshot::Kind kind) { 2118 Snapshot::Kind kind) {
2102 ByteArrayWriteTo(writer, 2119 ByteArrayWriteTo(writer,
2103 object_id, 2120 object_id,
2104 kind, 2121 kind,
2105 ObjectStore::kUint32ArrayClass, 2122 ObjectStore::kUint32ArrayClass,
2106 ptr()->tags_, 2123 writer->GetObjectTags(this),
2107 ptr()->length_, 2124 ptr()->length_,
2108 reinterpret_cast<uint8_t*>(ptr()->data_)); 2125 reinterpret_cast<uint8_t*>(ptr()->data_));
2109 } 2126 }
2110 2127
2111 2128
2112 void RawInt64Array::WriteTo(SnapshotWriter* writer, 2129 void RawInt64Array::WriteTo(SnapshotWriter* writer,
2113 intptr_t object_id, 2130 intptr_t object_id,
2114 Snapshot::Kind kind) { 2131 Snapshot::Kind kind) {
2115 ByteArrayWriteTo(writer, 2132 ByteArrayWriteTo(writer,
2116 object_id, 2133 object_id,
2117 kind, 2134 kind,
2118 ObjectStore::kInt64ArrayClass, 2135 ObjectStore::kInt64ArrayClass,
2119 ptr()->tags_, 2136 writer->GetObjectTags(this),
2120 ptr()->length_, 2137 ptr()->length_,
2121 reinterpret_cast<uint8_t*>(ptr()->data_)); 2138 reinterpret_cast<uint8_t*>(ptr()->data_));
2122 } 2139 }
2123 2140
2124 2141
2125 void RawUint64Array::WriteTo(SnapshotWriter* writer, 2142 void RawUint64Array::WriteTo(SnapshotWriter* writer,
2126 intptr_t object_id, 2143 intptr_t object_id,
2127 Snapshot::Kind kind) { 2144 Snapshot::Kind kind) {
2128 ByteArrayWriteTo(writer, 2145 ByteArrayWriteTo(writer,
2129 object_id, 2146 object_id,
2130 kind, 2147 kind,
2131 ObjectStore::kUint64ArrayClass, 2148 ObjectStore::kUint64ArrayClass,
2132 ptr()->tags_, 2149 writer->GetObjectTags(this),
2133 ptr()->length_, 2150 ptr()->length_,
2134 reinterpret_cast<uint8_t*>(ptr()->data_)); 2151 reinterpret_cast<uint8_t*>(ptr()->data_));
2135 } 2152 }
2136 2153
2137 2154
2138 void RawFloat32Array::WriteTo(SnapshotWriter* writer, 2155 void RawFloat32Array::WriteTo(SnapshotWriter* writer,
2139 intptr_t object_id, 2156 intptr_t object_id,
2140 Snapshot::Kind kind) { 2157 Snapshot::Kind kind) {
2141 ByteArrayWriteTo(writer, 2158 ByteArrayWriteTo(writer,
2142 object_id, 2159 object_id,
2143 kind, 2160 kind,
2144 ObjectStore::kFloat32ArrayClass, 2161 ObjectStore::kFloat32ArrayClass,
2145 ptr()->tags_, 2162 writer->GetObjectTags(this),
2146 ptr()->length_, 2163 ptr()->length_,
2147 reinterpret_cast<uint8_t*>(ptr()->data_)); 2164 reinterpret_cast<uint8_t*>(ptr()->data_));
2148 } 2165 }
2149 2166
2150 2167
2151 void RawFloat64Array::WriteTo(SnapshotWriter* writer, 2168 void RawFloat64Array::WriteTo(SnapshotWriter* writer,
2152 intptr_t object_id, 2169 intptr_t object_id,
2153 Snapshot::Kind kind) { 2170 Snapshot::Kind kind) {
2154 ByteArrayWriteTo(writer, 2171 ByteArrayWriteTo(writer,
2155 object_id, 2172 object_id,
2156 kind, 2173 kind,
2157 ObjectStore::kFloat64ArrayClass, 2174 ObjectStore::kFloat64ArrayClass,
2158 ptr()->tags_, 2175 writer->GetObjectTags(this),
2159 ptr()->length_, 2176 ptr()->length_,
2160 reinterpret_cast<uint8_t*>(ptr()->data_)); 2177 reinterpret_cast<uint8_t*>(ptr()->data_));
2161 } 2178 }
2162 2179
2163 2180
2164 void RawExternalInt8Array::WriteTo(SnapshotWriter* writer, 2181 void RawExternalInt8Array::WriteTo(SnapshotWriter* writer,
2165 intptr_t object_id, 2182 intptr_t object_id,
2166 Snapshot::Kind kind) { 2183 Snapshot::Kind kind) {
2167 ByteArrayWriteTo(writer, 2184 ByteArrayWriteTo(writer,
2168 object_id, 2185 object_id,
2169 kind, 2186 kind,
2170 ObjectStore::kInt8ArrayClass, 2187 ObjectStore::kInt8ArrayClass,
2171 ptr()->tags_, 2188 writer->GetObjectTags(this),
2172 ptr()->length_, 2189 ptr()->length_,
2173 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2190 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2174 } 2191 }
2175 2192
2176 2193
2177 void RawExternalUint8Array::WriteTo(SnapshotWriter* writer, 2194 void RawExternalUint8Array::WriteTo(SnapshotWriter* writer,
2178 intptr_t object_id, 2195 intptr_t object_id,
2179 Snapshot::Kind kind) { 2196 Snapshot::Kind kind) {
2180 // Serialize as a non-external int8 array. 2197 // Serialize as a non-external int8 array.
2181 ByteArrayWriteTo(writer, 2198 ByteArrayWriteTo(writer,
2182 object_id, 2199 object_id,
2183 kind, 2200 kind,
2184 ObjectStore::kUint8ArrayClass, 2201 ObjectStore::kUint8ArrayClass,
2185 ptr()->tags_, 2202 writer->GetObjectTags(this),
2186 ptr()->length_, 2203 ptr()->length_,
2187 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2204 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2188 } 2205 }
2189 2206
2190 2207
2191 void RawExternalInt16Array::WriteTo(SnapshotWriter* writer, 2208 void RawExternalInt16Array::WriteTo(SnapshotWriter* writer,
2192 intptr_t object_id, 2209 intptr_t object_id,
2193 Snapshot::Kind kind) { 2210 Snapshot::Kind kind) {
2194 // Serialize as a non-external int16 array. 2211 // Serialize as a non-external int16 array.
2195 ByteArrayWriteTo(writer, 2212 ByteArrayWriteTo(writer,
2196 object_id, 2213 object_id,
2197 kind, 2214 kind,
2198 ObjectStore::kInt16ArrayClass, 2215 ObjectStore::kInt16ArrayClass,
2199 ptr()->tags_, 2216 writer->GetObjectTags(this),
2200 ptr()->length_, 2217 ptr()->length_,
2201 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2218 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2202 } 2219 }
2203 2220
2204 2221
2205 void RawExternalUint16Array::WriteTo(SnapshotWriter* writer, 2222 void RawExternalUint16Array::WriteTo(SnapshotWriter* writer,
2206 intptr_t object_id, 2223 intptr_t object_id,
2207 Snapshot::Kind kind) { 2224 Snapshot::Kind kind) {
2208 // Serialize as a non-external uint16 array. 2225 // Serialize as a non-external uint16 array.
2209 ByteArrayWriteTo(writer, 2226 ByteArrayWriteTo(writer,
2210 object_id, 2227 object_id,
2211 kind, 2228 kind,
2212 ObjectStore::kUint16ArrayClass, 2229 ObjectStore::kUint16ArrayClass,
2213 ptr()->tags_, 2230 writer->GetObjectTags(this),
2214 ptr()->length_, 2231 ptr()->length_,
2215 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2232 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2216 } 2233 }
2217 2234
2218 2235
2219 void RawExternalInt32Array::WriteTo(SnapshotWriter* writer, 2236 void RawExternalInt32Array::WriteTo(SnapshotWriter* writer,
2220 intptr_t object_id, 2237 intptr_t object_id,
2221 Snapshot::Kind kind) { 2238 Snapshot::Kind kind) {
2222 // Serialize as a non-external int32 array. 2239 // Serialize as a non-external int32 array.
2223 ByteArrayWriteTo(writer, 2240 ByteArrayWriteTo(writer,
2224 object_id, 2241 object_id,
2225 kind, 2242 kind,
2226 ObjectStore::kInt32ArrayClass, 2243 ObjectStore::kInt32ArrayClass,
2227 ptr()->tags_, 2244 writer->GetObjectTags(this),
2228 ptr()->length_, 2245 ptr()->length_,
2229 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2246 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2230 } 2247 }
2231 2248
2232 2249
2233 void RawExternalUint32Array::WriteTo(SnapshotWriter* writer, 2250 void RawExternalUint32Array::WriteTo(SnapshotWriter* writer,
2234 intptr_t object_id, 2251 intptr_t object_id,
2235 Snapshot::Kind kind) { 2252 Snapshot::Kind kind) {
2236 // Serialize as a non-external uint32 array. 2253 // Serialize as a non-external uint32 array.
2237 ByteArrayWriteTo(writer, 2254 ByteArrayWriteTo(writer,
2238 object_id, 2255 object_id,
2239 kind, 2256 kind,
2240 ObjectStore::kUint32ArrayClass, 2257 ObjectStore::kUint32ArrayClass,
2241 ptr()->tags_, 2258 writer->GetObjectTags(this),
2242 ptr()->length_, 2259 ptr()->length_,
2243 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2260 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2244 } 2261 }
2245 2262
2246 2263
2247 void RawExternalInt64Array::WriteTo(SnapshotWriter* writer, 2264 void RawExternalInt64Array::WriteTo(SnapshotWriter* writer,
2248 intptr_t object_id, 2265 intptr_t object_id,
2249 Snapshot::Kind kind) { 2266 Snapshot::Kind kind) {
2250 // Serialize as a non-external int64 array. 2267 // Serialize as a non-external int64 array.
2251 ByteArrayWriteTo(writer, 2268 ByteArrayWriteTo(writer,
2252 object_id, 2269 object_id,
2253 kind, 2270 kind,
2254 ObjectStore::kInt64ArrayClass, 2271 ObjectStore::kInt64ArrayClass,
2255 ptr()->tags_, 2272 writer->GetObjectTags(this),
2256 ptr()->length_, 2273 ptr()->length_,
2257 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2274 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2258 } 2275 }
2259 2276
2260 2277
2261 void RawExternalUint64Array::WriteTo(SnapshotWriter* writer, 2278 void RawExternalUint64Array::WriteTo(SnapshotWriter* writer,
2262 intptr_t object_id, 2279 intptr_t object_id,
2263 Snapshot::Kind kind) { 2280 Snapshot::Kind kind) {
2264 // Serialize as a non-external uint64 array. 2281 // Serialize as a non-external uint64 array.
2265 ByteArrayWriteTo(writer, 2282 ByteArrayWriteTo(writer,
2266 object_id, 2283 object_id,
2267 kind, 2284 kind,
2268 ObjectStore::kUint64ArrayClass, 2285 ObjectStore::kUint64ArrayClass,
2269 ptr()->tags_, 2286 writer->GetObjectTags(this),
2270 ptr()->length_, 2287 ptr()->length_,
2271 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2288 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2272 } 2289 }
2273 2290
2274 2291
2275 void RawExternalFloat32Array::WriteTo(SnapshotWriter* writer, 2292 void RawExternalFloat32Array::WriteTo(SnapshotWriter* writer,
2276 intptr_t object_id, 2293 intptr_t object_id,
2277 Snapshot::Kind kind) { 2294 Snapshot::Kind kind) {
2278 // Serialize as a non-external float32 array. 2295 // Serialize as a non-external float32 array.
2279 ByteArrayWriteTo(writer, 2296 ByteArrayWriteTo(writer,
2280 object_id, 2297 object_id,
2281 kind, 2298 kind,
2282 ObjectStore::kFloat32ArrayClass, 2299 ObjectStore::kFloat32ArrayClass,
2283 ptr()->tags_, 2300 writer->GetObjectTags(this),
2284 ptr()->length_, 2301 ptr()->length_,
2285 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2302 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2286 } 2303 }
2287 2304
2288 2305
2289 void RawExternalFloat64Array::WriteTo(SnapshotWriter* writer, 2306 void RawExternalFloat64Array::WriteTo(SnapshotWriter* writer,
2290 intptr_t object_id, 2307 intptr_t object_id,
2291 Snapshot::Kind kind) { 2308 Snapshot::Kind kind) {
2292 // Serialize as a non-external float64 array. 2309 // Serialize as a non-external float64 array.
2293 ByteArrayWriteTo(writer, 2310 ByteArrayWriteTo(writer,
2294 object_id, 2311 object_id,
2295 kind, 2312 kind,
2296 ObjectStore::kFloat64ArrayClass, 2313 ObjectStore::kFloat64ArrayClass,
2297 ptr()->tags_, 2314 writer->GetObjectTags(this),
2298 ptr()->length_, 2315 ptr()->length_,
2299 reinterpret_cast<uint8_t*>(ptr()->external_data_->data())); 2316 reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
2300 } 2317 }
2301 2318
2302 2319
2303 RawClosure* Closure::ReadFrom(SnapshotReader* reader, 2320 RawClosure* Closure::ReadFrom(SnapshotReader* reader,
2304 intptr_t object_id, 2321 intptr_t object_id,
2305 intptr_t tags, 2322 intptr_t tags,
2306 Snapshot::Kind kind) { 2323 Snapshot::Kind kind) {
2307 UNIMPLEMENTED(); 2324 UNIMPLEMENTED();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 void RawJSRegExp::WriteTo(SnapshotWriter* writer, 2384 void RawJSRegExp::WriteTo(SnapshotWriter* writer,
2368 intptr_t object_id, 2385 intptr_t object_id,
2369 Snapshot::Kind kind) { 2386 Snapshot::Kind kind) {
2370 ASSERT(writer != NULL); 2387 ASSERT(writer != NULL);
2371 ASSERT(kind == Snapshot::kMessage); 2388 ASSERT(kind == Snapshot::kMessage);
2372 2389
2373 // Write out the serialization header value for this object. 2390 // Write out the serialization header value for this object.
2374 writer->WriteSerializationMarker(kInlined, object_id); 2391 writer->WriteSerializationMarker(kInlined, object_id);
2375 2392
2376 // Write out the class and tags information. 2393 // Write out the class and tags information.
2377 writer->WriteObjectHeader(ObjectStore::kJSRegExpClass, ptr()->tags_); 2394 writer->WriteObjectHeader(ObjectStore::kJSRegExpClass,
2395 writer->GetObjectTags(this));
2378 2396
2379 // Write out the data length field. 2397 // Write out the data length field.
2380 writer->Write<RawObject*>(ptr()->data_length_); 2398 writer->Write<RawObject*>(ptr()->data_length_);
2381 2399
2382 // Write out all the other fields. 2400 // Write out all the other fields.
2383 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 2401 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
2384 writer->WriteObject(ptr()->pattern_); 2402 writer->WriteObject(ptr()->pattern_);
2385 writer->WriteIntptrValue(ptr()->type_); 2403 writer->WriteIntptrValue(ptr()->type_);
2386 writer->WriteIntptrValue(ptr()->flags_); 2404 writer->WriteIntptrValue(ptr()->flags_);
2387 2405
2388 // Do not write out the data part which is native. 2406 // Do not write out the data part which is native.
2389 } 2407 }
2390 2408
2391 2409
2392 } // namespace dart 2410 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698