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

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

Issue 349293002: Omits size bits when writing RawObject tags to a snapshot. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ASSERT(writer != NULL); 90 ASSERT(writer != NULL);
91 91
92 // Write out the serialization header value for this object. 92 // Write out the serialization header value for this object.
93 writer->WriteInlinedObjectHeader(object_id); 93 writer->WriteInlinedObjectHeader(object_id);
94 94
95 if ((kind == Snapshot::kFull) || 95 if ((kind == Snapshot::kFull) ||
96 (kind == Snapshot::kScript && 96 (kind == Snapshot::kScript &&
97 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { 97 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) {
98 // Write out the class and tags information. 98 // Write out the class and tags information.
99 writer->WriteVMIsolateObject(kClassCid); 99 writer->WriteVMIsolateObject(kClassCid);
100 writer->WriteIntptrValue(writer->GetObjectTags(this)); 100 writer->WriteTags(writer->GetObjectTags(this));
101 101
102 // Write out all the non object pointer fields. 102 // Write out all the non object pointer fields.
103 // NOTE: cpp_vtable_ is not written. 103 // NOTE: cpp_vtable_ is not written.
104 int32_t class_id = ptr()->id_; 104 int32_t class_id = ptr()->id_;
105 writer->Write<int32_t>(class_id); 105 writer->Write<int32_t>(class_id);
106 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { 106 if (!RawObject::IsInternalVMdefinedClassId(class_id)) {
107 // We don't write the instance size of VM defined classes as they 107 // We don't write the instance size of VM defined classes as they
108 // are already setup during initialization as part of pre populating 108 // are already setup during initialization as part of pre populating
109 // the class table. 109 // the class table.
110 writer->Write<int32_t>(ptr()->instance_size_in_words_); 110 writer->Write<int32_t>(ptr()->instance_size_in_words_);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer, 160 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer,
161 intptr_t object_id, 161 intptr_t object_id,
162 Snapshot::Kind kind) { 162 Snapshot::Kind kind) {
163 ASSERT(writer != NULL); 163 ASSERT(writer != NULL);
164 164
165 // Write out the serialization header value for this object. 165 // Write out the serialization header value for this object.
166 writer->WriteInlinedObjectHeader(object_id); 166 writer->WriteInlinedObjectHeader(object_id);
167 167
168 // Write out the class and tags information. 168 // Write out the class and tags information.
169 writer->WriteVMIsolateObject(kUnresolvedClassCid); 169 writer->WriteVMIsolateObject(kUnresolvedClassCid);
170 writer->WriteIntptrValue(writer->GetObjectTags(this)); 170 writer->WriteTags(writer->GetObjectTags(this));
171 171
172 // Write out all the non object pointer fields. 172 // Write out all the non object pointer fields.
173 writer->Write<int32_t>(ptr()->token_pos_); 173 writer->Write<int32_t>(ptr()->token_pos_);
174 174
175 // Write out all the object pointer fields. 175 // Write out all the object pointer fields.
176 SnapshotWriterVisitor visitor(writer); 176 SnapshotWriterVisitor visitor(writer);
177 visitor.VisitPointers(from(), to()); 177 visitor.VisitPointers(from(), to());
178 } 178 }
179 179
180 180
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 246
247 // Only resolved and finalized types should be written to a snapshot. 247 // Only resolved and finalized types should be written to a snapshot.
248 ASSERT((ptr()->type_state_ == RawType::kFinalizedInstantiated) || 248 ASSERT((ptr()->type_state_ == RawType::kFinalizedInstantiated) ||
249 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); 249 (ptr()->type_state_ == RawType::kFinalizedUninstantiated));
250 250
251 // Write out the serialization header value for this object. 251 // Write out the serialization header value for this object.
252 writer->WriteInlinedObjectHeader(object_id); 252 writer->WriteInlinedObjectHeader(object_id);
253 253
254 // Write out the class and tags information. 254 // Write out the class and tags information.
255 writer->WriteIndexedObject(kTypeCid); 255 writer->WriteIndexedObject(kTypeCid);
256 writer->WriteIntptrValue(writer->GetObjectTags(this)); 256 writer->WriteTags(writer->GetObjectTags(this));
257 257
258 // Write out all the non object pointer fields. 258 // Write out all the non object pointer fields.
259 writer->Write<int32_t>(ptr()->token_pos_); 259 writer->Write<int32_t>(ptr()->token_pos_);
260 writer->Write<int8_t>(ptr()->type_state_); 260 writer->Write<int8_t>(ptr()->type_state_);
261 261
262 // Write out all the object pointer fields. Since we will be canonicalizing 262 // Write out all the object pointer fields. Since we will be canonicalizing
263 // the type object when reading it back we should write out all the fields 263 // the type object when reading it back we should write out all the fields
264 // inline and not as references. 264 // inline and not as references.
265 SnapshotWriterVisitor visitor(writer, false); 265 SnapshotWriterVisitor visitor(writer, false);
266 visitor.VisitPointers(from(), to()); 266 visitor.VisitPointers(from(), to());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 void RawTypeRef::WriteTo(SnapshotWriter* writer, 298 void RawTypeRef::WriteTo(SnapshotWriter* writer,
299 intptr_t object_id, 299 intptr_t object_id,
300 Snapshot::Kind kind) { 300 Snapshot::Kind kind) {
301 ASSERT(writer != NULL); 301 ASSERT(writer != NULL);
302 302
303 // Write out the serialization header value for this object. 303 // Write out the serialization header value for this object.
304 writer->WriteInlinedObjectHeader(object_id); 304 writer->WriteInlinedObjectHeader(object_id);
305 305
306 // Write out the class and tags information. 306 // Write out the class and tags information.
307 writer->WriteIndexedObject(kTypeRefCid); 307 writer->WriteIndexedObject(kTypeRefCid);
308 writer->WriteIntptrValue(writer->GetObjectTags(this)); 308 writer->WriteTags(writer->GetObjectTags(this));
309 309
310 // Write out all the object pointer fields. 310 // Write out all the object pointer fields.
311 SnapshotWriterVisitor visitor(writer); 311 SnapshotWriterVisitor visitor(writer);
312 visitor.VisitPointers(from(), to()); 312 visitor.VisitPointers(from(), to());
313 } 313 }
314 314
315 315
316 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, 316 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader,
317 intptr_t object_id, 317 intptr_t object_id,
318 intptr_t tags, 318 intptr_t tags,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 ASSERT(writer != NULL); 353 ASSERT(writer != NULL);
354 354
355 // Only finalized type parameters should be written to a snapshot. 355 // Only finalized type parameters should be written to a snapshot.
356 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); 356 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated);
357 357
358 // Write out the serialization header value for this object. 358 // Write out the serialization header value for this object.
359 writer->WriteInlinedObjectHeader(object_id); 359 writer->WriteInlinedObjectHeader(object_id);
360 360
361 // Write out the class and tags information. 361 // Write out the class and tags information.
362 writer->WriteIndexedObject(kTypeParameterCid); 362 writer->WriteIndexedObject(kTypeParameterCid);
363 writer->WriteIntptrValue(writer->GetObjectTags(this)); 363 writer->WriteTags(writer->GetObjectTags(this));
364 364
365 // Write out all the non object pointer fields. 365 // Write out all the non object pointer fields.
366 writer->Write<int32_t>(ptr()->index_); 366 writer->Write<int32_t>(ptr()->index_);
367 writer->Write<int32_t>(ptr()->token_pos_); 367 writer->Write<int32_t>(ptr()->token_pos_);
368 writer->Write<int8_t>(ptr()->type_state_); 368 writer->Write<int8_t>(ptr()->type_state_);
369 369
370 // Write out all the object pointer fields. 370 // Write out all the object pointer fields.
371 SnapshotWriterVisitor visitor(writer); 371 SnapshotWriterVisitor visitor(writer);
372 visitor.VisitPointers(from(), to()); 372 visitor.VisitPointers(from(), to());
373 } 373 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 void RawBoundedType::WriteTo(SnapshotWriter* writer, 405 void RawBoundedType::WriteTo(SnapshotWriter* writer,
406 intptr_t object_id, 406 intptr_t object_id,
407 Snapshot::Kind kind) { 407 Snapshot::Kind kind) {
408 ASSERT(writer != NULL); 408 ASSERT(writer != NULL);
409 409
410 // Write out the serialization header value for this object. 410 // Write out the serialization header value for this object.
411 writer->WriteInlinedObjectHeader(object_id); 411 writer->WriteInlinedObjectHeader(object_id);
412 412
413 // Write out the class and tags information. 413 // Write out the class and tags information.
414 writer->WriteIndexedObject(kBoundedTypeCid); 414 writer->WriteIndexedObject(kBoundedTypeCid);
415 writer->WriteIntptrValue(writer->GetObjectTags(this)); 415 writer->WriteTags(writer->GetObjectTags(this));
416 416
417 // Write out all the object pointer fields. 417 // Write out all the object pointer fields.
418 SnapshotWriterVisitor visitor(writer); 418 SnapshotWriterVisitor visitor(writer);
419 visitor.VisitPointers(from(), to()); 419 visitor.VisitPointers(from(), to());
420 } 420 }
421 421
422 422
423 RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, 423 RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader,
424 intptr_t object_id, 424 intptr_t object_id,
425 intptr_t tags, 425 intptr_t tags,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 void RawTypeArguments::WriteTo(SnapshotWriter* writer, 490 void RawTypeArguments::WriteTo(SnapshotWriter* writer,
491 intptr_t object_id, 491 intptr_t object_id,
492 Snapshot::Kind kind) { 492 Snapshot::Kind kind) {
493 ASSERT(writer != NULL); 493 ASSERT(writer != NULL);
494 494
495 // Write out the serialization header value for this object. 495 // Write out the serialization header value for this object.
496 writer->WriteInlinedObjectHeader(object_id); 496 writer->WriteInlinedObjectHeader(object_id);
497 497
498 // Write out the class and tags information. 498 // Write out the class and tags information.
499 writer->WriteVMIsolateObject(kTypeArgumentsCid); 499 writer->WriteVMIsolateObject(kTypeArgumentsCid);
500 writer->WriteIntptrValue(writer->GetObjectTags(this)); 500 writer->WriteTags(writer->GetObjectTags(this));
501 501
502 // Write out the length field. 502 // Write out the length field.
503 writer->Write<RawObject*>(ptr()->length_); 503 writer->Write<RawObject*>(ptr()->length_);
504 504
505 // Write out the instantiations field, but only in a full snapshot. 505 // Write out the instantiations field, but only in a full snapshot.
506 if (kind == Snapshot::kFull) { 506 if (kind == Snapshot::kFull) {
507 writer->WriteObjectImpl(ptr()->instantiations_); 507 writer->WriteObjectImpl(ptr()->instantiations_);
508 } 508 }
509 509
510 // Write out the individual types. 510 // Write out the individual types.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 ASSERT(writer != NULL); 550 ASSERT(writer != NULL);
551 ASSERT(((kind == Snapshot::kScript) && 551 ASSERT(((kind == Snapshot::kScript) &&
552 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 552 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
553 (kind == Snapshot::kFull)); 553 (kind == Snapshot::kFull));
554 554
555 // Write out the serialization header value for this object. 555 // Write out the serialization header value for this object.
556 writer->WriteInlinedObjectHeader(object_id); 556 writer->WriteInlinedObjectHeader(object_id);
557 557
558 // Write out the class and tags information. 558 // Write out the class and tags information.
559 writer->WriteVMIsolateObject(kPatchClassCid); 559 writer->WriteVMIsolateObject(kPatchClassCid);
560 writer->WriteIntptrValue(writer->GetObjectTags(this)); 560 writer->WriteTags(writer->GetObjectTags(this));
561 // Write out all the object pointer fields. 561 // Write out all the object pointer fields.
562 SnapshotWriterVisitor visitor(writer); 562 SnapshotWriterVisitor visitor(writer);
563 visitor.VisitPointers(from(), to()); 563 visitor.VisitPointers(from(), to());
564 } 564 }
565 565
566 566
567 RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, 567 RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader,
568 intptr_t object_id, 568 intptr_t object_id,
569 intptr_t tags, 569 intptr_t tags,
570 Snapshot::Kind kind) { 570 Snapshot::Kind kind) {
(...skipping 28 matching lines...) Expand all
599 ASSERT(writer != NULL); 599 ASSERT(writer != NULL);
600 ASSERT(((kind == Snapshot::kScript) && 600 ASSERT(((kind == Snapshot::kScript) &&
601 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 601 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
602 (kind == Snapshot::kFull)); 602 (kind == Snapshot::kFull));
603 603
604 // Write out the serialization header value for this object. 604 // Write out the serialization header value for this object.
605 writer->WriteInlinedObjectHeader(object_id); 605 writer->WriteInlinedObjectHeader(object_id);
606 606
607 // Write out the class and tags information. 607 // Write out the class and tags information.
608 writer->WriteVMIsolateObject(kClosureDataCid); 608 writer->WriteVMIsolateObject(kClosureDataCid);
609 writer->WriteIntptrValue(writer->GetObjectTags(this)); 609 writer->WriteTags(writer->GetObjectTags(this));
610 610
611 // Context scope. 611 // Context scope.
612 // We don't write the context scope in the snapshot. 612 // We don't write the context scope in the snapshot.
613 writer->WriteObjectImpl(Object::null()); 613 writer->WriteObjectImpl(Object::null());
614 614
615 // Parent function. 615 // Parent function.
616 writer->WriteObjectImpl(ptr()->parent_function_); 616 writer->WriteObjectImpl(ptr()->parent_function_);
617 617
618 // Signature class. 618 // Signature class.
619 writer->WriteObjectImpl(ptr()->signature_class_); 619 writer->WriteObjectImpl(ptr()->signature_class_);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 ASSERT(writer != NULL); 659 ASSERT(writer != NULL);
660 ASSERT(((kind == Snapshot::kScript) && 660 ASSERT(((kind == Snapshot::kScript) &&
661 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 661 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
662 (kind == Snapshot::kFull)); 662 (kind == Snapshot::kFull));
663 663
664 // Write out the serialization header value for this object. 664 // Write out the serialization header value for this object.
665 writer->WriteInlinedObjectHeader(object_id); 665 writer->WriteInlinedObjectHeader(object_id);
666 666
667 // Write out the class and tags information. 667 // Write out the class and tags information.
668 writer->WriteVMIsolateObject(kRedirectionDataCid); 668 writer->WriteVMIsolateObject(kRedirectionDataCid);
669 writer->WriteIntptrValue(writer->GetObjectTags(this)); 669 writer->WriteTags(writer->GetObjectTags(this));
670 670
671 // Write out all the object pointer fields. 671 // Write out all the object pointer fields.
672 SnapshotWriterVisitor visitor(writer); 672 SnapshotWriterVisitor visitor(writer);
673 visitor.VisitPointers(from(), to()); 673 visitor.VisitPointers(from(), to());
674 } 674 }
675 675
676 676
677 RawFunction* Function::ReadFrom(SnapshotReader* reader, 677 RawFunction* Function::ReadFrom(SnapshotReader* reader,
678 intptr_t object_id, 678 intptr_t object_id,
679 intptr_t tags, 679 intptr_t tags,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 ASSERT(writer != NULL); 723 ASSERT(writer != NULL);
724 ASSERT(((kind == Snapshot::kScript) && 724 ASSERT(((kind == Snapshot::kScript) &&
725 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 725 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
726 (kind == Snapshot::kFull)); 726 (kind == Snapshot::kFull));
727 727
728 // Write out the serialization header value for this object. 728 // Write out the serialization header value for this object.
729 writer->WriteInlinedObjectHeader(object_id); 729 writer->WriteInlinedObjectHeader(object_id);
730 730
731 // Write out the class and tags information. 731 // Write out the class and tags information.
732 writer->WriteVMIsolateObject(kFunctionCid); 732 writer->WriteVMIsolateObject(kFunctionCid);
733 writer->WriteIntptrValue(writer->GetObjectTags(this)); 733 writer->WriteTags(writer->GetObjectTags(this));
734 734
735 // Write out all the non object fields. 735 // Write out all the non object fields.
736 writer->Write<int32_t>(ptr()->token_pos_); 736 writer->Write<int32_t>(ptr()->token_pos_);
737 writer->Write<int32_t>(ptr()->end_token_pos_); 737 writer->Write<int32_t>(ptr()->end_token_pos_);
738 writer->Write<int32_t>(ptr()->usage_counter_); 738 writer->Write<int32_t>(ptr()->usage_counter_);
739 writer->Write<int16_t>(ptr()->num_fixed_parameters_); 739 writer->Write<int16_t>(ptr()->num_fixed_parameters_);
740 writer->Write<int16_t>(ptr()->num_optional_parameters_); 740 writer->Write<int16_t>(ptr()->num_optional_parameters_);
741 writer->Write<int16_t>(ptr()->deoptimization_counter_); 741 writer->Write<int16_t>(ptr()->deoptimization_counter_);
742 writer->Write<uint16_t>(ptr()->kind_tag_); 742 writer->Write<uint16_t>(ptr()->kind_tag_);
743 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); 743 writer->Write<uint16_t>(ptr()->optimized_instruction_count_);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 ASSERT(writer != NULL); 791 ASSERT(writer != NULL);
792 ASSERT(((kind == Snapshot::kScript) && 792 ASSERT(((kind == Snapshot::kScript) &&
793 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 793 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
794 (kind == Snapshot::kFull)); 794 (kind == Snapshot::kFull));
795 795
796 // Write out the serialization header value for this object. 796 // Write out the serialization header value for this object.
797 writer->WriteInlinedObjectHeader(object_id); 797 writer->WriteInlinedObjectHeader(object_id);
798 798
799 // Write out the class and tags information. 799 // Write out the class and tags information.
800 writer->WriteVMIsolateObject(kFieldCid); 800 writer->WriteVMIsolateObject(kFieldCid);
801 writer->WriteIntptrValue(writer->GetObjectTags(this)); 801 writer->WriteTags(writer->GetObjectTags(this));
802 802
803 // Write out all the non object fields. 803 // Write out all the non object fields.
804 writer->Write<int32_t>(ptr()->token_pos_); 804 writer->Write<int32_t>(ptr()->token_pos_);
805 writer->Write<int32_t>(ptr()->guarded_cid_); 805 writer->Write<int32_t>(ptr()->guarded_cid_);
806 writer->Write<int32_t>(ptr()->is_nullable_); 806 writer->Write<int32_t>(ptr()->is_nullable_);
807 writer->Write<uint8_t>(ptr()->kind_bits_); 807 writer->Write<uint8_t>(ptr()->kind_bits_);
808 808
809 // Write out all the object pointer fields. 809 // Write out all the object pointer fields.
810 SnapshotWriterVisitor visitor(writer); 810 SnapshotWriterVisitor visitor(writer);
811 visitor.VisitPointers(from(), to()); 811 visitor.VisitPointers(from(), to());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 intptr_t object_id, 843 intptr_t object_id,
844 Snapshot::Kind kind) { 844 Snapshot::Kind kind) {
845 ASSERT(writer != NULL); 845 ASSERT(writer != NULL);
846 ASSERT(kind != Snapshot::kMessage); 846 ASSERT(kind != Snapshot::kMessage);
847 847
848 // Write out the serialization header value for this object. 848 // Write out the serialization header value for this object.
849 writer->WriteInlinedObjectHeader(object_id); 849 writer->WriteInlinedObjectHeader(object_id);
850 850
851 // Write out the class and tags information. 851 // Write out the class and tags information.
852 writer->WriteVMIsolateObject(kLiteralTokenCid); 852 writer->WriteVMIsolateObject(kLiteralTokenCid);
853 writer->WriteIntptrValue(writer->GetObjectTags(this)); 853 writer->WriteTags(writer->GetObjectTags(this));
854 854
855 // Write out the kind field. 855 // Write out the kind field.
856 writer->Write<intptr_t>(ptr()->kind_); 856 writer->Write<intptr_t>(ptr()->kind_);
857 857
858 // Write out literal and value fields. 858 // Write out literal and value fields.
859 writer->WriteObjectImpl(ptr()->literal_); 859 writer->WriteObjectImpl(ptr()->literal_);
860 writer->WriteObjectImpl(ptr()->value_); 860 writer->WriteObjectImpl(ptr()->value_);
861 } 861 }
862 862
863 863
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 ASSERT(writer != NULL); 906 ASSERT(writer != NULL);
907 ASSERT(((kind == Snapshot::kScript) && 907 ASSERT(((kind == Snapshot::kScript) &&
908 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 908 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
909 (kind == Snapshot::kFull)); 909 (kind == Snapshot::kFull));
910 910
911 // Write out the serialization header value for this object. 911 // Write out the serialization header value for this object.
912 writer->WriteInlinedObjectHeader(object_id); 912 writer->WriteInlinedObjectHeader(object_id);
913 913
914 // Write out the class and tags information. 914 // Write out the class and tags information.
915 writer->WriteVMIsolateObject(kTokenStreamCid); 915 writer->WriteVMIsolateObject(kTokenStreamCid);
916 writer->WriteIntptrValue(writer->GetObjectTags(this)); 916 writer->WriteTags(writer->GetObjectTags(this));
917 917
918 // Write out the length field and the token stream. 918 // Write out the length field and the token stream.
919 RawExternalTypedData* stream = ptr()->stream_; 919 RawExternalTypedData* stream = ptr()->stream_;
920 intptr_t len = Smi::Value(stream->ptr()->length_); 920 intptr_t len = Smi::Value(stream->ptr()->length_);
921 writer->Write<RawObject*>(stream->ptr()->length_); 921 writer->Write<RawObject*>(stream->ptr()->length_);
922 writer->WriteBytes(stream->ptr()->data_, len); 922 writer->WriteBytes(stream->ptr()->data_, len);
923 923
924 // Write out the literal/identifier token array. 924 // Write out the literal/identifier token array.
925 writer->WriteObjectImpl(ptr()->token_objects_); 925 writer->WriteObjectImpl(ptr()->token_objects_);
926 // Write out the private key in use by the token stream. 926 // Write out the private key in use by the token stream.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 ASSERT(tokens_ != TokenStream::null()); 970 ASSERT(tokens_ != TokenStream::null());
971 ASSERT(((kind == Snapshot::kScript) && 971 ASSERT(((kind == Snapshot::kScript) &&
972 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 972 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
973 (kind == Snapshot::kFull)); 973 (kind == Snapshot::kFull));
974 974
975 // Write out the serialization header value for this object. 975 // Write out the serialization header value for this object.
976 writer->WriteInlinedObjectHeader(object_id); 976 writer->WriteInlinedObjectHeader(object_id);
977 977
978 // Write out the class and tags information. 978 // Write out the class and tags information.
979 writer->WriteVMIsolateObject(kScriptCid); 979 writer->WriteVMIsolateObject(kScriptCid);
980 writer->WriteIntptrValue(writer->GetObjectTags(this)); 980 writer->WriteTags(writer->GetObjectTags(this));
981 981
982 // Write out all the object pointer fields. 982 // Write out all the object pointer fields.
983 writer->WriteObjectImpl(ptr()->url_); 983 writer->WriteObjectImpl(ptr()->url_);
984 writer->WriteObjectImpl(ptr()->tokens_); 984 writer->WriteObjectImpl(ptr()->tokens_);
985 985
986 writer->Write<int32_t>(ptr()->line_offset_); 986 writer->Write<int32_t>(ptr()->line_offset_);
987 writer->Write<int32_t>(ptr()->col_offset_); 987 writer->Write<int32_t>(ptr()->col_offset_);
988 writer->Write<int8_t>(ptr()->kind_); 988 writer->Write<int8_t>(ptr()->kind_);
989 } 989 }
990 990
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 intptr_t object_id, 1051 intptr_t object_id,
1052 Snapshot::Kind kind) { 1052 Snapshot::Kind kind) {
1053 ASSERT(writer != NULL); 1053 ASSERT(writer != NULL);
1054 ASSERT(kind != Snapshot::kMessage); 1054 ASSERT(kind != Snapshot::kMessage);
1055 1055
1056 // Write out the serialization header value for this object. 1056 // Write out the serialization header value for this object.
1057 writer->WriteInlinedObjectHeader(object_id); 1057 writer->WriteInlinedObjectHeader(object_id);
1058 1058
1059 // Write out the class and tags information. 1059 // Write out the class and tags information.
1060 writer->WriteVMIsolateObject(kLibraryCid); 1060 writer->WriteVMIsolateObject(kLibraryCid);
1061 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1061 writer->WriteTags(writer->GetObjectTags(this));
1062 1062
1063 if ((kind == Snapshot::kScript) && 1063 if ((kind == Snapshot::kScript) &&
1064 RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { 1064 RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) {
1065 ASSERT(kind != Snapshot::kFull); 1065 ASSERT(kind != Snapshot::kFull);
1066 // Write out library URL so that it can be looked up when reading. 1066 // Write out library URL so that it can be looked up when reading.
1067 writer->WriteObjectImpl(ptr()->url_); 1067 writer->WriteObjectImpl(ptr()->url_);
1068 } else { 1068 } else {
1069 // Write out all non object fields. 1069 // Write out all non object fields.
1070 writer->Write<int32_t>(ptr()->index_); 1070 writer->Write<int32_t>(ptr()->index_);
1071 writer->Write<int32_t>(ptr()->num_imports_); 1071 writer->Write<int32_t>(ptr()->num_imports_);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 ASSERT(writer != NULL); 1131 ASSERT(writer != NULL);
1132 ASSERT(((kind == Snapshot::kScript) && 1132 ASSERT(((kind == Snapshot::kScript) &&
1133 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 1133 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
1134 (kind == Snapshot::kFull)); 1134 (kind == Snapshot::kFull));
1135 1135
1136 // Write out the serialization header value for this object. 1136 // Write out the serialization header value for this object.
1137 writer->WriteInlinedObjectHeader(object_id); 1137 writer->WriteInlinedObjectHeader(object_id);
1138 1138
1139 // Write out the class and tags information. 1139 // Write out the class and tags information.
1140 writer->WriteIndexedObject(kLibraryPrefixCid); 1140 writer->WriteIndexedObject(kLibraryPrefixCid);
1141 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1141 writer->WriteTags(writer->GetObjectTags(this));
1142 1142
1143 // Write out all non object fields. 1143 // Write out all non object fields.
1144 writer->Write<int32_t>(ptr()->num_imports_); 1144 writer->Write<int32_t>(ptr()->num_imports_);
1145 writer->Write<bool>(ptr()->is_deferred_load_); 1145 writer->Write<bool>(ptr()->is_deferred_load_);
1146 writer->Write<bool>(ptr()->is_loaded_); 1146 writer->Write<bool>(ptr()->is_loaded_);
1147 1147
1148 // Write out all the object pointer fields. 1148 // Write out all the object pointer fields.
1149 SnapshotWriterVisitor visitor(writer); 1149 SnapshotWriterVisitor visitor(writer);
1150 visitor.VisitPointers(from(), to()); 1150 visitor.VisitPointers(from(), to());
1151 } 1151 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 ASSERT(writer != NULL); 1186 ASSERT(writer != NULL);
1187 ASSERT(((kind == Snapshot::kScript) && 1187 ASSERT(((kind == Snapshot::kScript) &&
1188 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) || 1188 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) ||
1189 (kind == Snapshot::kFull)); 1189 (kind == Snapshot::kFull));
1190 1190
1191 // Write out the serialization header value for this object. 1191 // Write out the serialization header value for this object.
1192 writer->WriteInlinedObjectHeader(object_id); 1192 writer->WriteInlinedObjectHeader(object_id);
1193 1193
1194 // Write out the class and tags information. 1194 // Write out the class and tags information.
1195 writer->WriteVMIsolateObject(kNamespaceCid); 1195 writer->WriteVMIsolateObject(kNamespaceCid);
1196 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1196 writer->WriteTags(writer->GetObjectTags(this));
1197 1197
1198 // Write out all the object pointer fields. 1198 // Write out all the object pointer fields.
1199 SnapshotWriterVisitor visitor(writer); 1199 SnapshotWriterVisitor visitor(writer);
1200 visitor.VisitPointers(from(), to()); 1200 visitor.VisitPointers(from(), to());
1201 } 1201 }
1202 1202
1203 1203
1204 RawCode* Code::ReadFrom(SnapshotReader* reader, 1204 RawCode* Code::ReadFrom(SnapshotReader* reader,
1205 intptr_t object_id, 1205 intptr_t object_id,
1206 intptr_t tags, 1206 intptr_t tags,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 void RawContext::WriteTo(SnapshotWriter* writer, 1354 void RawContext::WriteTo(SnapshotWriter* writer,
1355 intptr_t object_id, 1355 intptr_t object_id,
1356 Snapshot::Kind kind) { 1356 Snapshot::Kind kind) {
1357 ASSERT(writer != NULL); 1357 ASSERT(writer != NULL);
1358 1358
1359 // Write out the serialization header value for this object. 1359 // Write out the serialization header value for this object.
1360 writer->WriteInlinedObjectHeader(object_id); 1360 writer->WriteInlinedObjectHeader(object_id);
1361 1361
1362 // Write out the class and tags information. 1362 // Write out the class and tags information.
1363 writer->WriteVMIsolateObject(kContextCid); 1363 writer->WriteVMIsolateObject(kContextCid);
1364 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1364 writer->WriteTags(writer->GetObjectTags(this));
1365 1365
1366 // Write out num of variables in the context. 1366 // Write out num of variables in the context.
1367 writer->WriteIntptrValue(ptr()->num_variables_); 1367 writer->WriteIntptrValue(ptr()->num_variables_);
1368 1368
1369 // Can't serialize the isolate pointer, we set it implicitly on read. 1369 // Can't serialize the isolate pointer, we set it implicitly on read.
1370 1370
1371 // Write out all the object pointer fields. 1371 // Write out all the object pointer fields.
1372 SnapshotWriterVisitor visitor(writer); 1372 SnapshotWriterVisitor visitor(writer);
1373 visitor.VisitPointers(from(), to(ptr()->num_variables_)); 1373 visitor.VisitPointers(from(), to(ptr()->num_variables_));
1374 } 1374 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1485 void RawApiError::WriteTo(SnapshotWriter* writer, 1485 void RawApiError::WriteTo(SnapshotWriter* writer,
1486 intptr_t object_id, 1486 intptr_t object_id,
1487 Snapshot::Kind kind) { 1487 Snapshot::Kind kind) {
1488 ASSERT(writer != NULL); 1488 ASSERT(writer != NULL);
1489 1489
1490 // Write out the serialization header value for this object. 1490 // Write out the serialization header value for this object.
1491 writer->WriteInlinedObjectHeader(object_id); 1491 writer->WriteInlinedObjectHeader(object_id);
1492 1492
1493 // Write out the class and tags information. 1493 // Write out the class and tags information.
1494 writer->WriteVMIsolateObject(kApiErrorCid); 1494 writer->WriteVMIsolateObject(kApiErrorCid);
1495 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1495 writer->WriteTags(writer->GetObjectTags(this));
1496 1496
1497 // Write out all the object pointer fields. 1497 // Write out all the object pointer fields.
1498 SnapshotWriterVisitor visitor(writer); 1498 SnapshotWriterVisitor visitor(writer);
1499 visitor.VisitPointers(from(), to()); 1499 visitor.VisitPointers(from(), to());
1500 } 1500 }
1501 1501
1502 1502
1503 RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, 1503 RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader,
1504 intptr_t object_id, 1504 intptr_t object_id,
1505 intptr_t tags, 1505 intptr_t tags,
(...skipping 30 matching lines...) Expand all
1536 void RawLanguageError::WriteTo(SnapshotWriter* writer, 1536 void RawLanguageError::WriteTo(SnapshotWriter* writer,
1537 intptr_t object_id, 1537 intptr_t object_id,
1538 Snapshot::Kind kind) { 1538 Snapshot::Kind kind) {
1539 ASSERT(writer != NULL); 1539 ASSERT(writer != NULL);
1540 1540
1541 // Write out the serialization header value for this object. 1541 // Write out the serialization header value for this object.
1542 writer->WriteInlinedObjectHeader(object_id); 1542 writer->WriteInlinedObjectHeader(object_id);
1543 1543
1544 // Write out the class and tags information. 1544 // Write out the class and tags information.
1545 writer->WriteVMIsolateObject(kLanguageErrorCid); 1545 writer->WriteVMIsolateObject(kLanguageErrorCid);
1546 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1546 writer->WriteTags(writer->GetObjectTags(this));
1547 1547
1548 // Write out all the non object fields. 1548 // Write out all the non object fields.
1549 writer->Write<int32_t>(ptr()->token_pos_); 1549 writer->Write<int32_t>(ptr()->token_pos_);
1550 writer->Write<uint8_t>(ptr()->kind_); 1550 writer->Write<uint8_t>(ptr()->kind_);
1551 1551
1552 // Write out all the object pointer fields. 1552 // Write out all the object pointer fields.
1553 SnapshotWriterVisitor visitor(writer); 1553 SnapshotWriterVisitor visitor(writer);
1554 visitor.VisitPointers(from(), to()); 1554 visitor.VisitPointers(from(), to());
1555 } 1555 }
1556 1556
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 void RawInstance::WriteTo(SnapshotWriter* writer, 1625 void RawInstance::WriteTo(SnapshotWriter* writer,
1626 intptr_t object_id, 1626 intptr_t object_id,
1627 Snapshot::Kind kind) { 1627 Snapshot::Kind kind) {
1628 ASSERT(writer != NULL); 1628 ASSERT(writer != NULL);
1629 1629
1630 // Write out the serialization header value for this object. 1630 // Write out the serialization header value for this object.
1631 writer->WriteInlinedObjectHeader(object_id); 1631 writer->WriteInlinedObjectHeader(object_id);
1632 1632
1633 // Write out the class and tags information. 1633 // Write out the class and tags information.
1634 writer->WriteIndexedObject(kInstanceCid); 1634 writer->WriteIndexedObject(kInstanceCid);
1635 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1635 writer->WriteTags(writer->GetObjectTags(this));
1636 } 1636 }
1637 1637
1638 1638
1639 RawMint* Mint::ReadFrom(SnapshotReader* reader, 1639 RawMint* Mint::ReadFrom(SnapshotReader* reader,
1640 intptr_t object_id, 1640 intptr_t object_id,
1641 intptr_t tags, 1641 intptr_t tags,
1642 Snapshot::Kind kind) { 1642 Snapshot::Kind kind) {
1643 ASSERT(reader != NULL); 1643 ASSERT(reader != NULL);
1644 1644
1645 // Read the 64 bit value for the object. 1645 // Read the 64 bit value for the object.
(...skipping 29 matching lines...) Expand all
1675 void RawMint::WriteTo(SnapshotWriter* writer, 1675 void RawMint::WriteTo(SnapshotWriter* writer,
1676 intptr_t object_id, 1676 intptr_t object_id,
1677 Snapshot::Kind kind) { 1677 Snapshot::Kind kind) {
1678 ASSERT(writer != NULL); 1678 ASSERT(writer != NULL);
1679 1679
1680 // Write out the serialization header value for this object. 1680 // Write out the serialization header value for this object.
1681 writer->WriteInlinedObjectHeader(object_id); 1681 writer->WriteInlinedObjectHeader(object_id);
1682 1682
1683 // Write out the class and tags information. 1683 // Write out the class and tags information.
1684 writer->WriteIndexedObject(kMintCid); 1684 writer->WriteIndexedObject(kMintCid);
1685 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1685 writer->WriteTags(writer->GetObjectTags(this));
1686 1686
1687 // Write out the 64 bit value. 1687 // Write out the 64 bit value.
1688 writer->Write<int64_t>(ptr()->value_); 1688 writer->Write<int64_t>(ptr()->value_);
1689 } 1689 }
1690 1690
1691 1691
1692 RawBigint* Bigint::ReadFrom(SnapshotReader* reader, 1692 RawBigint* Bigint::ReadFrom(SnapshotReader* reader,
1693 intptr_t object_id, 1693 intptr_t object_id,
1694 intptr_t tags, 1694 intptr_t tags,
1695 Snapshot::Kind kind) { 1695 Snapshot::Kind kind) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 void RawBigint::WriteTo(SnapshotWriter* writer, 1733 void RawBigint::WriteTo(SnapshotWriter* writer,
1734 intptr_t object_id, 1734 intptr_t object_id,
1735 Snapshot::Kind kind) { 1735 Snapshot::Kind kind) {
1736 ASSERT(writer != NULL); 1736 ASSERT(writer != NULL);
1737 1737
1738 // Write out the serialization header value for this object. 1738 // Write out the serialization header value for this object.
1739 writer->WriteInlinedObjectHeader(object_id); 1739 writer->WriteInlinedObjectHeader(object_id);
1740 1740
1741 // Write out the class and tags information. 1741 // Write out the class and tags information.
1742 writer->WriteIndexedObject(kBigintCid); 1742 writer->WriteIndexedObject(kBigintCid);
1743 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1743 writer->WriteTags(writer->GetObjectTags(this));
1744 1744
1745 // Write out the bigint value as a HEXCstring. 1745 // Write out the bigint value as a HEXCstring.
1746 intptr_t length = ptr()->signed_length_; 1746 intptr_t length = ptr()->signed_length_;
1747 bool is_negative = false; 1747 bool is_negative = false;
1748 if (length <= 0) { 1748 if (length <= 0) {
1749 length = -length; 1749 length = -length;
1750 is_negative = true; 1750 is_negative = true;
1751 } 1751 }
1752 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint); 1752 uword data_start = reinterpret_cast<uword>(ptr()) + sizeof(RawBigint);
1753 const char* str = BigintOperations::ToHexCString( 1753 const char* str = BigintOperations::ToHexCString(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 void RawDouble::WriteTo(SnapshotWriter* writer, 1809 void RawDouble::WriteTo(SnapshotWriter* writer,
1810 intptr_t object_id, 1810 intptr_t object_id,
1811 Snapshot::Kind kind) { 1811 Snapshot::Kind kind) {
1812 ASSERT(writer != NULL); 1812 ASSERT(writer != NULL);
1813 1813
1814 // Write out the serialization header value for this object. 1814 // Write out the serialization header value for this object.
1815 writer->WriteInlinedObjectHeader(object_id); 1815 writer->WriteInlinedObjectHeader(object_id);
1816 1816
1817 // Write out the class and tags information. 1817 // Write out the class and tags information.
1818 writer->WriteIndexedObject(kDoubleCid); 1818 writer->WriteIndexedObject(kDoubleCid);
1819 writer->WriteIntptrValue(writer->GetObjectTags(this)); 1819 writer->WriteTags(writer->GetObjectTags(this));
1820 1820
1821 // Write out the double value. 1821 // Write out the double value.
1822 writer->WriteDouble(ptr()->value_); 1822 writer->WriteDouble(ptr()->value_);
1823 } 1823 }
1824 1824
1825 1825
1826 RawString* String::ReadFrom(SnapshotReader* reader, 1826 RawString* String::ReadFrom(SnapshotReader* reader,
1827 intptr_t object_id, 1827 intptr_t object_id,
1828 intptr_t tags, 1828 intptr_t tags,
1829 Snapshot::Kind kind) { 1829 Snapshot::Kind kind) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 RawSmi* hash, 1939 RawSmi* hash,
1940 T* data) { 1940 T* data) {
1941 ASSERT(writer != NULL); 1941 ASSERT(writer != NULL);
1942 intptr_t len = Smi::Value(length); 1942 intptr_t len = Smi::Value(length);
1943 1943
1944 // Write out the serialization header value for this object. 1944 // Write out the serialization header value for this object.
1945 writer->WriteInlinedObjectHeader(object_id); 1945 writer->WriteInlinedObjectHeader(object_id);
1946 1946
1947 // Write out the class and tags information. 1947 // Write out the class and tags information.
1948 writer->WriteIndexedObject(class_id); 1948 writer->WriteIndexedObject(class_id);
1949 writer->WriteIntptrValue(tags); 1949 writer->WriteTags(tags);
1950 1950
1951 // Write out the length field. 1951 // Write out the length field.
1952 writer->Write<RawObject*>(length); 1952 writer->Write<RawObject*>(length);
1953 1953
1954 // Write out the hash field. 1954 // Write out the hash field.
1955 writer->Write<RawObject*>(hash); 1955 writer->Write<RawObject*>(hash);
1956 1956
1957 // Write out the string. 1957 // Write out the string.
1958 if (len > 0) { 1958 if (len > 0) {
1959 if (class_id == kOneByteStringCid) { 1959 if (class_id == kOneByteStringCid) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, 2155 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer,
2156 intptr_t object_id, 2156 intptr_t object_id,
2157 Snapshot::Kind kind) { 2157 Snapshot::Kind kind) {
2158 ASSERT(writer != NULL); 2158 ASSERT(writer != NULL);
2159 2159
2160 // Write out the serialization header value for this object. 2160 // Write out the serialization header value for this object.
2161 writer->WriteInlinedObjectHeader(object_id); 2161 writer->WriteInlinedObjectHeader(object_id);
2162 2162
2163 // Write out the class and tags information. 2163 // Write out the class and tags information.
2164 writer->WriteIndexedObject(kGrowableObjectArrayCid); 2164 writer->WriteIndexedObject(kGrowableObjectArrayCid);
2165 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2165 writer->WriteTags(writer->GetObjectTags(this));
2166 2166
2167 // Write out the used length field. 2167 // Write out the used length field.
2168 writer->Write<RawObject*>(ptr()->length_); 2168 writer->Write<RawObject*>(ptr()->length_);
2169 2169
2170 // Write out the Array object. 2170 // Write out the Array object.
2171 writer->WriteObjectImpl(ptr()->data_); 2171 writer->WriteObjectImpl(ptr()->data_);
2172 } 2172 }
2173 2173
2174 2174
2175 RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, 2175 RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader,
(...skipping 25 matching lines...) Expand all
2201 void RawFloat32x4::WriteTo(SnapshotWriter* writer, 2201 void RawFloat32x4::WriteTo(SnapshotWriter* writer,
2202 intptr_t object_id, 2202 intptr_t object_id,
2203 Snapshot::Kind kind) { 2203 Snapshot::Kind kind) {
2204 ASSERT(writer != NULL); 2204 ASSERT(writer != NULL);
2205 2205
2206 // Write out the serialization header value for this object. 2206 // Write out the serialization header value for this object.
2207 writer->WriteInlinedObjectHeader(object_id); 2207 writer->WriteInlinedObjectHeader(object_id);
2208 2208
2209 // Write out the class and tags information. 2209 // Write out the class and tags information.
2210 writer->WriteIndexedObject(kFloat32x4Cid); 2210 writer->WriteIndexedObject(kFloat32x4Cid);
2211 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2211 writer->WriteTags(writer->GetObjectTags(this));
2212 2212
2213 // Write out the float values. 2213 // Write out the float values.
2214 writer->Write<float>(ptr()->value_[0]); 2214 writer->Write<float>(ptr()->value_[0]);
2215 writer->Write<float>(ptr()->value_[1]); 2215 writer->Write<float>(ptr()->value_[1]);
2216 writer->Write<float>(ptr()->value_[2]); 2216 writer->Write<float>(ptr()->value_[2]);
2217 writer->Write<float>(ptr()->value_[3]); 2217 writer->Write<float>(ptr()->value_[3]);
2218 } 2218 }
2219 2219
2220 2220
2221 RawInt32x4* Int32x4::ReadFrom(SnapshotReader* reader, 2221 RawInt32x4* Int32x4::ReadFrom(SnapshotReader* reader,
(...skipping 25 matching lines...) Expand all
2247 void RawInt32x4::WriteTo(SnapshotWriter* writer, 2247 void RawInt32x4::WriteTo(SnapshotWriter* writer,
2248 intptr_t object_id, 2248 intptr_t object_id,
2249 Snapshot::Kind kind) { 2249 Snapshot::Kind kind) {
2250 ASSERT(writer != NULL); 2250 ASSERT(writer != NULL);
2251 2251
2252 // Write out the serialization header value for this object. 2252 // Write out the serialization header value for this object.
2253 writer->WriteInlinedObjectHeader(object_id); 2253 writer->WriteInlinedObjectHeader(object_id);
2254 2254
2255 // Write out the class and tags information. 2255 // Write out the class and tags information.
2256 writer->WriteIndexedObject(kInt32x4Cid); 2256 writer->WriteIndexedObject(kInt32x4Cid);
2257 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2257 writer->WriteTags(writer->GetObjectTags(this));
2258 2258
2259 // Write out the mask values. 2259 // Write out the mask values.
2260 writer->Write<uint32_t>(ptr()->value_[0]); 2260 writer->Write<uint32_t>(ptr()->value_[0]);
2261 writer->Write<uint32_t>(ptr()->value_[1]); 2261 writer->Write<uint32_t>(ptr()->value_[1]);
2262 writer->Write<uint32_t>(ptr()->value_[2]); 2262 writer->Write<uint32_t>(ptr()->value_[2]);
2263 writer->Write<uint32_t>(ptr()->value_[3]); 2263 writer->Write<uint32_t>(ptr()->value_[3]);
2264 } 2264 }
2265 2265
2266 2266
2267 RawFloat64x2* Float64x2::ReadFrom(SnapshotReader* reader, 2267 RawFloat64x2* Float64x2::ReadFrom(SnapshotReader* reader,
(...skipping 23 matching lines...) Expand all
2291 void RawFloat64x2::WriteTo(SnapshotWriter* writer, 2291 void RawFloat64x2::WriteTo(SnapshotWriter* writer,
2292 intptr_t object_id, 2292 intptr_t object_id,
2293 Snapshot::Kind kind) { 2293 Snapshot::Kind kind) {
2294 ASSERT(writer != NULL); 2294 ASSERT(writer != NULL);
2295 2295
2296 // Write out the serialization header value for this object. 2296 // Write out the serialization header value for this object.
2297 writer->WriteInlinedObjectHeader(object_id); 2297 writer->WriteInlinedObjectHeader(object_id);
2298 2298
2299 // Write out the class and tags information. 2299 // Write out the class and tags information.
2300 writer->WriteIndexedObject(kFloat64x2Cid); 2300 writer->WriteIndexedObject(kFloat64x2Cid);
2301 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2301 writer->WriteTags(writer->GetObjectTags(this));
2302 2302
2303 // Write out the float values. 2303 // Write out the float values.
2304 writer->Write<double>(ptr()->value_[0]); 2304 writer->Write<double>(ptr()->value_[0]);
2305 writer->Write<double>(ptr()->value_[1]); 2305 writer->Write<double>(ptr()->value_[1]);
2306 } 2306 }
2307 2307
2308 2308
2309 #define TYPED_DATA_READ(setter, type) \ 2309 #define TYPED_DATA_READ(setter, type) \
2310 for (intptr_t i = 0; i < length_in_bytes; i += element_size) { \ 2310 for (intptr_t i = 0; i < length_in_bytes; i += element_size) { \
2311 result.Set##setter(i, reader->Read<type>()); \ 2311 result.Set##setter(i, reader->Read<type>()); \
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 ASSERT(writer != NULL); 2404 ASSERT(writer != NULL);
2405 intptr_t tags = writer->GetObjectTags(this); 2405 intptr_t tags = writer->GetObjectTags(this);
2406 intptr_t cid = ClassIdTag::decode(tags); 2406 intptr_t cid = ClassIdTag::decode(tags);
2407 intptr_t len = Smi::Value(ptr()->length_); 2407 intptr_t len = Smi::Value(ptr()->length_);
2408 2408
2409 // Write out the serialization header value for this object. 2409 // Write out the serialization header value for this object.
2410 writer->WriteInlinedObjectHeader(object_id); 2410 writer->WriteInlinedObjectHeader(object_id);
2411 2411
2412 // Write out the class and tags information. 2412 // Write out the class and tags information.
2413 writer->WriteIndexedObject(cid); 2413 writer->WriteIndexedObject(cid);
2414 writer->WriteIntptrValue(tags); 2414 writer->WriteTags(tags);
2415 2415
2416 // Write out the length field. 2416 // Write out the length field.
2417 writer->Write<RawObject*>(ptr()->length_); 2417 writer->Write<RawObject*>(ptr()->length_);
2418 2418
2419 // Write out the array elements. 2419 // Write out the array elements.
2420 switch (cid) { 2420 switch (cid) {
2421 case kTypedDataInt8ArrayCid: 2421 case kTypedDataInt8ArrayCid:
2422 case kTypedDataUint8ArrayCid: 2422 case kTypedDataUint8ArrayCid:
2423 case kTypedDataUint8ClampedArrayCid: { 2423 case kTypedDataUint8ClampedArrayCid: {
2424 uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data()); 2424 uint8_t* data = reinterpret_cast<uint8_t*>(ptr()->data());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 { \ 2459 { \
2460 type* data = reinterpret_cast<type*>(ptr()->data_); \ 2460 type* data = reinterpret_cast<type*>(ptr()->data_); \
2461 for (intptr_t i = 0; i < len; i++) { \ 2461 for (intptr_t i = 0; i < len; i++) { \
2462 writer->Write(data[i]); \ 2462 writer->Write(data[i]); \
2463 } \ 2463 } \
2464 } \ 2464 } \
2465 2465
2466 2466
2467 #define EXT_TYPED_DATA_WRITE(cid, type) \ 2467 #define EXT_TYPED_DATA_WRITE(cid, type) \
2468 writer->WriteIndexedObject(cid); \ 2468 writer->WriteIndexedObject(cid); \
2469 writer->WriteIntptrValue(RawObject::ClassIdTag::update(cid, tags)); \ 2469 writer->WriteTags(RawObject::ClassIdTag::update(cid, tags)); \
2470 writer->Write<RawObject*>(ptr()->length_); \ 2470 writer->Write<RawObject*>(ptr()->length_); \
2471 TYPED_EXT_DATA_WRITE(type) \ 2471 TYPED_EXT_DATA_WRITE(type) \
2472 2472
2473 2473
2474 void RawExternalTypedData::WriteTo(SnapshotWriter* writer, 2474 void RawExternalTypedData::WriteTo(SnapshotWriter* writer,
2475 intptr_t object_id, 2475 intptr_t object_id,
2476 Snapshot::Kind kind) { 2476 Snapshot::Kind kind) {
2477 ASSERT(writer != NULL); 2477 ASSERT(writer != NULL);
2478 intptr_t tags = writer->GetObjectTags(this); 2478 intptr_t tags = writer->GetObjectTags(this);
2479 intptr_t cid = ClassIdTag::decode(tags); 2479 intptr_t cid = ClassIdTag::decode(tags);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 2577
2578 2578
2579 void RawSendPort::WriteTo(SnapshotWriter* writer, 2579 void RawSendPort::WriteTo(SnapshotWriter* writer,
2580 intptr_t object_id, 2580 intptr_t object_id,
2581 Snapshot::Kind kind) { 2581 Snapshot::Kind kind) {
2582 // Write out the serialization header value for this object. 2582 // Write out the serialization header value for this object.
2583 writer->WriteInlinedObjectHeader(object_id); 2583 writer->WriteInlinedObjectHeader(object_id);
2584 2584
2585 // Write out the class and tags information. 2585 // Write out the class and tags information.
2586 writer->WriteIndexedObject(kSendPortCid); 2586 writer->WriteIndexedObject(kSendPortCid);
2587 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2587 writer->WriteTags(writer->GetObjectTags(this));
2588 2588
2589 writer->Write(ptr()->id_); 2589 writer->Write(ptr()->id_);
2590 } 2590 }
2591 2591
2592 2592
2593 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader, 2593 RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader,
2594 intptr_t object_id, 2594 intptr_t object_id,
2595 intptr_t tags, 2595 intptr_t tags,
2596 Snapshot::Kind kind) { 2596 Snapshot::Kind kind) {
2597 if (kind == Snapshot::kFull) { 2597 if (kind == Snapshot::kFull) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2629 if (kind == Snapshot::kFull) { 2629 if (kind == Snapshot::kFull) {
2630 ASSERT(writer != NULL); 2630 ASSERT(writer != NULL);
2631 ASSERT(this == Isolate::Current()->object_store()-> 2631 ASSERT(this == Isolate::Current()->object_store()->
2632 preallocated_stack_trace()); 2632 preallocated_stack_trace());
2633 2633
2634 // Write out the serialization header value for this object. 2634 // Write out the serialization header value for this object.
2635 writer->WriteInlinedObjectHeader(object_id); 2635 writer->WriteInlinedObjectHeader(object_id);
2636 2636
2637 // Write out the class and tags information. 2637 // Write out the class and tags information.
2638 writer->WriteIndexedObject(kStacktraceCid); 2638 writer->WriteIndexedObject(kStacktraceCid);
2639 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2639 writer->WriteTags(writer->GetObjectTags(this));
2640 2640
2641 // Write out all the object pointer fields. 2641 // Write out all the object pointer fields.
2642 SnapshotWriterVisitor visitor(writer); 2642 SnapshotWriterVisitor visitor(writer);
2643 visitor.VisitPointers(from(), to()); 2643 visitor.VisitPointers(from(), to());
2644 2644
2645 writer->Write(ptr()->expand_inlined_); 2645 writer->Write(ptr()->expand_inlined_);
2646 } else { 2646 } else {
2647 // Stacktraces are not allowed in other snapshot forms. 2647 // Stacktraces are not allowed in other snapshot forms.
2648 writer->SetWriteException(Exceptions::kArgument, 2648 writer->SetWriteException(Exceptions::kArgument,
2649 "Illegal argument in isolate message" 2649 "Illegal argument in isolate message"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2687 intptr_t object_id, 2687 intptr_t object_id,
2688 Snapshot::Kind kind) { 2688 Snapshot::Kind kind) {
2689 ASSERT(writer != NULL); 2689 ASSERT(writer != NULL);
2690 ASSERT(kind == Snapshot::kMessage); 2690 ASSERT(kind == Snapshot::kMessage);
2691 2691
2692 // Write out the serialization header value for this object. 2692 // Write out the serialization header value for this object.
2693 writer->WriteInlinedObjectHeader(object_id); 2693 writer->WriteInlinedObjectHeader(object_id);
2694 2694
2695 // Write out the class and tags information. 2695 // Write out the class and tags information.
2696 writer->WriteIndexedObject(kJSRegExpCid); 2696 writer->WriteIndexedObject(kJSRegExpCid);
2697 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2697 writer->WriteTags(writer->GetObjectTags(this));
2698 2698
2699 // Write out the data length field. 2699 // Write out the data length field.
2700 writer->Write<RawObject*>(ptr()->data_length_); 2700 writer->Write<RawObject*>(ptr()->data_length_);
2701 2701
2702 // Write out all the other fields. 2702 // Write out all the other fields.
2703 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 2703 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
2704 writer->WriteObjectImpl(ptr()->pattern_); 2704 writer->WriteObjectImpl(ptr()->pattern_);
2705 writer->WriteIntptrValue(ptr()->type_); 2705 writer->WriteIntptrValue(ptr()->type_);
2706 writer->WriteIntptrValue(ptr()->flags_); 2706 writer->WriteIntptrValue(ptr()->flags_);
2707 2707
(...skipping 26 matching lines...) Expand all
2734 void RawWeakProperty::WriteTo(SnapshotWriter* writer, 2734 void RawWeakProperty::WriteTo(SnapshotWriter* writer,
2735 intptr_t object_id, 2735 intptr_t object_id,
2736 Snapshot::Kind kind) { 2736 Snapshot::Kind kind) {
2737 ASSERT(writer != NULL); 2737 ASSERT(writer != NULL);
2738 2738
2739 // Write out the serialization header value for this object. 2739 // Write out the serialization header value for this object.
2740 writer->WriteInlinedObjectHeader(object_id); 2740 writer->WriteInlinedObjectHeader(object_id);
2741 2741
2742 // Write out the class and tags information. 2742 // Write out the class and tags information.
2743 writer->WriteIndexedObject(kWeakPropertyCid); 2743 writer->WriteIndexedObject(kWeakPropertyCid);
2744 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2744 writer->WriteTags(writer->GetObjectTags(this));
2745 2745
2746 // Write out all the other fields. 2746 // Write out all the other fields.
2747 writer->Write<RawObject*>(ptr()->key_); 2747 writer->Write<RawObject*>(ptr()->key_);
2748 writer->Write<RawObject*>(ptr()->value_); 2748 writer->Write<RawObject*>(ptr()->value_);
2749 } 2749 }
2750 2750
2751 2751
2752 RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, 2752 RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader,
2753 intptr_t object_id, 2753 intptr_t object_id,
2754 intptr_t tags, 2754 intptr_t tags,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2788 // We do not allow objects with native fields in an isolate message. 2788 // We do not allow objects with native fields in an isolate message.
2789 writer->SetWriteException(Exceptions::kArgument, 2789 writer->SetWriteException(Exceptions::kArgument,
2790 "Illegal argument in isolate message" 2790 "Illegal argument in isolate message"
2791 " : (object is a UserTag)"); 2791 " : (object is a UserTag)");
2792 } else { 2792 } else {
2793 UNREACHABLE(); 2793 UNREACHABLE();
2794 } 2794 }
2795 } 2795 }
2796 2796
2797 } // namespace dart 2797 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698