OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/native_entry.h" | 5 #include "vm/native_entry.h" |
6 #include "vm/object.h" | 6 #include "vm/object.h" |
7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
9 #include "vm/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 writer->Write<int32_t>(ptr()->next_field_offset_in_words_); | 122 writer->Write<int32_t>(ptr()->next_field_offset_in_words_); |
123 } | 123 } |
124 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_); | 124 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_); |
125 writer->Write<uint16_t>(ptr()->num_type_arguments_); | 125 writer->Write<uint16_t>(ptr()->num_type_arguments_); |
126 writer->Write<uint16_t>(ptr()->num_own_type_arguments_); | 126 writer->Write<uint16_t>(ptr()->num_own_type_arguments_); |
127 writer->Write<uint16_t>(ptr()->num_native_fields_); | 127 writer->Write<uint16_t>(ptr()->num_native_fields_); |
128 writer->Write<int32_t>(ptr()->token_pos_); | 128 writer->Write<int32_t>(ptr()->token_pos_); |
129 writer->Write<uint16_t>(ptr()->state_bits_); | 129 writer->Write<uint16_t>(ptr()->state_bits_); |
130 | 130 |
131 // Write out all the object pointer fields. | 131 // Write out all the object pointer fields. |
132 SnapshotWriterVisitor visitor(writer); | 132 SnapshotWriterVisitor visitor(writer, kAsReference); |
133 visitor.VisitPointers(from(), to()); | 133 visitor.VisitPointers(from(), to()); |
134 } else { | 134 } else { |
135 if (writer->can_send_any_object() || | 135 if (writer->can_send_any_object() || |
136 writer->AllowObjectsInDartLibrary(ptr()->library_)) { | 136 writer->AllowObjectsInDartLibrary(ptr()->library_)) { |
137 writer->WriteClassId(this); | 137 writer->WriteClassId(this); |
138 } else { | 138 } else { |
139 // We do not allow regular dart instances in isolate messages. | 139 // We do not allow regular dart instances in isolate messages. |
140 writer->SetWriteException(Exceptions::kArgument, | 140 writer->SetWriteException(Exceptions::kArgument, |
141 "Illegal argument in isolate message" | 141 "Illegal argument in isolate message" |
142 " : (object is a regular Dart Instance)"); | 142 " : (object is a regular Dart Instance)"); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 writer->WriteInlinedObjectHeader(object_id); | 178 writer->WriteInlinedObjectHeader(object_id); |
179 | 179 |
180 // Write out the class and tags information. | 180 // Write out the class and tags information. |
181 writer->WriteVMIsolateObject(kUnresolvedClassCid); | 181 writer->WriteVMIsolateObject(kUnresolvedClassCid); |
182 writer->WriteTags(writer->GetObjectTags(this)); | 182 writer->WriteTags(writer->GetObjectTags(this)); |
183 | 183 |
184 // Write out all the non object pointer fields. | 184 // Write out all the non object pointer fields. |
185 writer->Write<int32_t>(ptr()->token_pos_); | 185 writer->Write<int32_t>(ptr()->token_pos_); |
186 | 186 |
187 // Write out all the object pointer fields. | 187 // Write out all the object pointer fields. |
188 SnapshotWriterVisitor visitor(writer); | 188 SnapshotWriterVisitor visitor(writer, kAsReference); |
189 visitor.VisitPointers(from(), to()); | 189 visitor.VisitPointers(from(), to()); |
190 } | 190 } |
191 | 191 |
192 | 192 |
193 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, | 193 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader, |
194 intptr_t object_id, | 194 intptr_t object_id, |
195 intptr_t tags, | 195 intptr_t tags, |
196 Snapshot::Kind kind) { | 196 Snapshot::Kind kind) { |
197 UNREACHABLE(); // AbstractType is an abstract class. | 197 UNREACHABLE(); // AbstractType is an abstract class. |
198 return NULL; | 198 return NULL; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 writer->Write<bool>(typeclass_is_in_fullsnapshot); | 264 writer->Write<bool>(typeclass_is_in_fullsnapshot); |
265 | 265 |
266 // Write out all the non object pointer fields. | 266 // Write out all the non object pointer fields. |
267 writer->Write<int32_t>(ptr()->token_pos_); | 267 writer->Write<int32_t>(ptr()->token_pos_); |
268 writer->Write<int8_t>(ptr()->type_state_); | 268 writer->Write<int8_t>(ptr()->type_state_); |
269 | 269 |
270 // Write out all the object pointer fields. Since we will be canonicalizing | 270 // Write out all the object pointer fields. Since we will be canonicalizing |
271 // the type object when reading it back we should write out all the fields | 271 // the type object when reading it back we should write out all the fields |
272 // inline and not as references. | 272 // inline and not as references. |
273 ASSERT(ptr()->type_class_ != Object::null()); | 273 ASSERT(ptr()->type_class_ != Object::null()); |
274 SnapshotWriterVisitor visitor(writer); | 274 SnapshotWriterVisitor visitor(writer, kAsReference); |
275 visitor.VisitPointers(from(), to()); | 275 visitor.VisitPointers(from(), to()); |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 RawTypeRef* TypeRef::ReadFrom(SnapshotReader* reader, | 279 RawTypeRef* TypeRef::ReadFrom(SnapshotReader* reader, |
280 intptr_t object_id, | 280 intptr_t object_id, |
281 intptr_t tags, | 281 intptr_t tags, |
282 Snapshot::Kind kind) { | 282 Snapshot::Kind kind) { |
283 ASSERT(reader != NULL); | 283 ASSERT(reader != NULL); |
284 | 284 |
(...skipping 17 matching lines...) Expand all Loading... |
302 ASSERT(writer != NULL); | 302 ASSERT(writer != NULL); |
303 | 303 |
304 // Write out the serialization header value for this object. | 304 // Write out the serialization header value for this object. |
305 writer->WriteInlinedObjectHeader(object_id); | 305 writer->WriteInlinedObjectHeader(object_id); |
306 | 306 |
307 // Write out the class and tags information. | 307 // Write out the class and tags information. |
308 writer->WriteIndexedObject(kTypeRefCid); | 308 writer->WriteIndexedObject(kTypeRefCid); |
309 writer->WriteTags(writer->GetObjectTags(this)); | 309 writer->WriteTags(writer->GetObjectTags(this)); |
310 | 310 |
311 // Write out all the object pointer fields. | 311 // Write out all the object pointer fields. |
312 SnapshotWriterVisitor visitor(writer); | 312 SnapshotWriterVisitor visitor(writer, kAsReference); |
313 visitor.VisitPointers(from(), to()); | 313 visitor.VisitPointers(from(), to()); |
314 } | 314 } |
315 | 315 |
316 | 316 |
317 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, | 317 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, |
318 intptr_t object_id, | 318 intptr_t object_id, |
319 intptr_t tags, | 319 intptr_t tags, |
320 Snapshot::Kind kind) { | 320 Snapshot::Kind kind) { |
321 ASSERT(reader != NULL); | 321 ASSERT(reader != NULL); |
322 | 322 |
(...skipping 30 matching lines...) Expand all Loading... |
353 // Write out the class and tags information. | 353 // Write out the class and tags information. |
354 writer->WriteIndexedObject(kTypeParameterCid); | 354 writer->WriteIndexedObject(kTypeParameterCid); |
355 writer->WriteTags(writer->GetObjectTags(this)); | 355 writer->WriteTags(writer->GetObjectTags(this)); |
356 | 356 |
357 // Write out all the non object pointer fields. | 357 // Write out all the non object pointer fields. |
358 writer->Write<int32_t>(ptr()->token_pos_); | 358 writer->Write<int32_t>(ptr()->token_pos_); |
359 writer->Write<int16_t>(ptr()->index_); | 359 writer->Write<int16_t>(ptr()->index_); |
360 writer->Write<int8_t>(ptr()->type_state_); | 360 writer->Write<int8_t>(ptr()->type_state_); |
361 | 361 |
362 // Write out all the object pointer fields. | 362 // Write out all the object pointer fields. |
363 SnapshotWriterVisitor visitor(writer); | 363 SnapshotWriterVisitor visitor(writer, kAsReference); |
364 visitor.VisitPointers(from(), to()); | 364 visitor.VisitPointers(from(), to()); |
365 } | 365 } |
366 | 366 |
367 | 367 |
368 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, | 368 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, |
369 intptr_t object_id, | 369 intptr_t object_id, |
370 intptr_t tags, | 370 intptr_t tags, |
371 Snapshot::Kind kind) { | 371 Snapshot::Kind kind) { |
372 ASSERT(reader != NULL); | 372 ASSERT(reader != NULL); |
373 | 373 |
(...skipping 17 matching lines...) Expand all Loading... |
391 ASSERT(writer != NULL); | 391 ASSERT(writer != NULL); |
392 | 392 |
393 // Write out the serialization header value for this object. | 393 // Write out the serialization header value for this object. |
394 writer->WriteInlinedObjectHeader(object_id); | 394 writer->WriteInlinedObjectHeader(object_id); |
395 | 395 |
396 // Write out the class and tags information. | 396 // Write out the class and tags information. |
397 writer->WriteIndexedObject(kBoundedTypeCid); | 397 writer->WriteIndexedObject(kBoundedTypeCid); |
398 writer->WriteTags(writer->GetObjectTags(this)); | 398 writer->WriteTags(writer->GetObjectTags(this)); |
399 | 399 |
400 // Write out all the object pointer fields. | 400 // Write out all the object pointer fields. |
401 SnapshotWriterVisitor visitor(writer); | 401 SnapshotWriterVisitor visitor(writer, kAsReference); |
402 visitor.VisitPointers(from(), to()); | 402 visitor.VisitPointers(from(), to()); |
403 } | 403 } |
404 | 404 |
405 | 405 |
406 RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, | 406 RawMixinAppType* MixinAppType::ReadFrom(SnapshotReader* reader, |
407 intptr_t object_id, | 407 intptr_t object_id, |
408 intptr_t tags, | 408 intptr_t tags, |
409 Snapshot::Kind kind) { | 409 Snapshot::Kind kind) { |
410 UNREACHABLE(); // MixinAppType objects do not survive finalization. | 410 UNREACHABLE(); // MixinAppType objects do not survive finalization. |
411 return MixinAppType::null(); | 411 return MixinAppType::null(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 ASSERT(writer != NULL); | 516 ASSERT(writer != NULL); |
517 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 517 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
518 | 518 |
519 // Write out the serialization header value for this object. | 519 // Write out the serialization header value for this object. |
520 writer->WriteInlinedObjectHeader(object_id); | 520 writer->WriteInlinedObjectHeader(object_id); |
521 | 521 |
522 // Write out the class and tags information. | 522 // Write out the class and tags information. |
523 writer->WriteVMIsolateObject(kPatchClassCid); | 523 writer->WriteVMIsolateObject(kPatchClassCid); |
524 writer->WriteTags(writer->GetObjectTags(this)); | 524 writer->WriteTags(writer->GetObjectTags(this)); |
525 // Write out all the object pointer fields. | 525 // Write out all the object pointer fields. |
526 SnapshotWriterVisitor visitor(writer); | 526 SnapshotWriterVisitor visitor(writer, kAsReference); |
527 visitor.VisitPointers(from(), to()); | 527 visitor.VisitPointers(from(), to()); |
528 } | 528 } |
529 | 529 |
530 | 530 |
531 RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, | 531 RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader, |
532 intptr_t object_id, | 532 intptr_t object_id, |
533 intptr_t tags, | 533 intptr_t tags, |
534 Snapshot::Kind kind) { | 534 Snapshot::Kind kind) { |
535 ASSERT(reader != NULL); | 535 ASSERT(reader != NULL); |
536 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 536 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
537 | 537 |
538 // Allocate closure data object. | 538 // Allocate closure data object. |
539 ClosureData& data = ClosureData::ZoneHandle( | 539 ClosureData& data = ClosureData::ZoneHandle( |
540 reader->zone(), NEW_OBJECT(ClosureData)); | 540 reader->zone(), NEW_OBJECT(ClosureData)); |
541 reader->AddBackRef(object_id, &data, kIsDeserialized); | 541 reader->AddBackRef(object_id, &data, kIsDeserialized); |
542 | 542 |
543 // Set all the object fields. | 543 // Set all the object fields. |
544 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), kAsReference); | 544 READ_OBJECT_FIELDS(data, |
| 545 data.raw()->from(), data.raw()->to(), |
| 546 kAsInlinedObject); |
545 | 547 |
546 return data.raw(); | 548 return data.raw(); |
547 } | 549 } |
548 | 550 |
549 | 551 |
550 void RawClosureData::WriteTo(SnapshotWriter* writer, | 552 void RawClosureData::WriteTo(SnapshotWriter* writer, |
551 intptr_t object_id, | 553 intptr_t object_id, |
552 Snapshot::Kind kind) { | 554 Snapshot::Kind kind) { |
553 ASSERT(writer != NULL); | 555 ASSERT(writer != NULL); |
554 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 556 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 Snapshot::Kind kind) { | 592 Snapshot::Kind kind) { |
591 ASSERT(reader != NULL); | 593 ASSERT(reader != NULL); |
592 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 594 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
593 | 595 |
594 // Allocate redirection data object. | 596 // Allocate redirection data object. |
595 RedirectionData& data = RedirectionData::ZoneHandle( | 597 RedirectionData& data = RedirectionData::ZoneHandle( |
596 reader->zone(), NEW_OBJECT(RedirectionData)); | 598 reader->zone(), NEW_OBJECT(RedirectionData)); |
597 reader->AddBackRef(object_id, &data, kIsDeserialized); | 599 reader->AddBackRef(object_id, &data, kIsDeserialized); |
598 | 600 |
599 // Set all the object fields. | 601 // Set all the object fields. |
600 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), kAsReference); | 602 READ_OBJECT_FIELDS(data, |
| 603 data.raw()->from(), data.raw()->to(), |
| 604 kAsReference); |
601 | 605 |
602 return data.raw(); | 606 return data.raw(); |
603 } | 607 } |
604 | 608 |
605 | 609 |
606 void RawRedirectionData::WriteTo(SnapshotWriter* writer, | 610 void RawRedirectionData::WriteTo(SnapshotWriter* writer, |
607 intptr_t object_id, | 611 intptr_t object_id, |
608 Snapshot::Kind kind) { | 612 Snapshot::Kind kind) { |
609 ASSERT(writer != NULL); | 613 ASSERT(writer != NULL); |
610 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 614 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
611 | 615 |
612 // Write out the serialization header value for this object. | 616 // Write out the serialization header value for this object. |
613 writer->WriteInlinedObjectHeader(object_id); | 617 writer->WriteInlinedObjectHeader(object_id); |
614 | 618 |
615 // Write out the class and tags information. | 619 // Write out the class and tags information. |
616 writer->WriteVMIsolateObject(kRedirectionDataCid); | 620 writer->WriteVMIsolateObject(kRedirectionDataCid); |
617 writer->WriteTags(writer->GetObjectTags(this)); | 621 writer->WriteTags(writer->GetObjectTags(this)); |
618 | 622 |
619 // Write out all the object pointer fields. | 623 // Write out all the object pointer fields. |
620 SnapshotWriterVisitor visitor(writer); | 624 SnapshotWriterVisitor visitor(writer, kAsReference); |
621 visitor.VisitPointers(from(), to()); | 625 visitor.VisitPointers(from(), to()); |
622 } | 626 } |
623 | 627 |
624 | 628 |
625 RawFunction* Function::ReadFrom(SnapshotReader* reader, | 629 RawFunction* Function::ReadFrom(SnapshotReader* reader, |
626 intptr_t object_id, | 630 intptr_t object_id, |
627 intptr_t tags, | 631 intptr_t tags, |
628 Snapshot::Kind kind) { | 632 Snapshot::Kind kind) { |
629 ASSERT(reader != NULL); | 633 ASSERT(reader != NULL); |
630 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 634 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
(...skipping 16 matching lines...) Expand all Loading... |
647 func.set_optimized_instruction_count(reader->Read<uint16_t>()); | 651 func.set_optimized_instruction_count(reader->Read<uint16_t>()); |
648 func.set_optimized_call_site_count(reader->Read<uint16_t>()); | 652 func.set_optimized_call_site_count(reader->Read<uint16_t>()); |
649 | 653 |
650 // Set all the object fields. | 654 // Set all the object fields. |
651 bool is_optimized = func.usage_counter() != 0; | 655 bool is_optimized = func.usage_counter() != 0; |
652 RawObject** toobj = reader->snapshot_code() ? func.raw()->to() : | 656 RawObject** toobj = reader->snapshot_code() ? func.raw()->to() : |
653 (is_optimized ? func.raw()->to_optimized_snapshot() : | 657 (is_optimized ? func.raw()->to_optimized_snapshot() : |
654 func.raw()->to_snapshot()); | 658 func.raw()->to_snapshot()); |
655 READ_OBJECT_FIELDS(func, | 659 READ_OBJECT_FIELDS(func, |
656 func.raw()->from(), toobj, | 660 func.raw()->from(), toobj, |
657 kAsInlinedObject); | 661 kAsReference); |
658 if (!reader->snapshot_code()) { | 662 if (!reader->snapshot_code()) { |
659 // Initialize all fields that are not part of the snapshot. | 663 // Initialize all fields that are not part of the snapshot. |
660 if (!is_optimized) { | 664 if (!is_optimized) { |
661 func.ClearICDataArray(); | 665 func.ClearICDataArray(); |
662 } | 666 } |
663 func.ClearCode(); | 667 func.ClearCode(); |
664 } else { | 668 } else { |
665 // Fix entry point. | 669 // Fix entry point. |
666 (*reader->CodeHandle()) = func.CurrentCode(); | 670 (*reader->CodeHandle()) = func.CurrentCode(); |
667 uword new_entry = (*reader->CodeHandle()).EntryPoint(); | 671 uword new_entry = (*reader->CodeHandle()).EntryPoint(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 writer->Write<int16_t>(ptr()->num_optional_parameters_); | 723 writer->Write<int16_t>(ptr()->num_optional_parameters_); |
720 writer->Write<int16_t>(ptr()->deoptimization_counter_); | 724 writer->Write<int16_t>(ptr()->deoptimization_counter_); |
721 writer->Write<uint32_t>(ptr()->kind_tag_); | 725 writer->Write<uint32_t>(ptr()->kind_tag_); |
722 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); | 726 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); |
723 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); | 727 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
724 | 728 |
725 // Write out all the object pointer fields. | 729 // Write out all the object pointer fields. |
726 RawObject** toobj = | 730 RawObject** toobj = |
727 writer->snapshot_code() ? to() : | 731 writer->snapshot_code() ? to() : |
728 (is_optimized ? to_optimized_snapshot() : to_snapshot()); | 732 (is_optimized ? to_optimized_snapshot() : to_snapshot()); |
729 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); | 733 SnapshotWriterVisitor visitor(writer, kAsReference); |
730 visitor.VisitPointers(from(), toobj); | 734 visitor.VisitPointers(from(), toobj); |
731 } else { | 735 } else { |
732 writer->WriteFunctionId(this, owner_is_class); | 736 writer->WriteFunctionId(this, owner_is_class); |
733 } | 737 } |
734 } | 738 } |
735 | 739 |
736 | 740 |
737 RawField* Field::ReadFrom(SnapshotReader* reader, | 741 RawField* Field::ReadFrom(SnapshotReader* reader, |
738 intptr_t object_id, | 742 intptr_t object_id, |
739 intptr_t tags, | 743 intptr_t tags, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 writer->WriteInlinedObjectHeader(object_id); | 852 writer->WriteInlinedObjectHeader(object_id); |
849 | 853 |
850 // Write out the class and tags information. | 854 // Write out the class and tags information. |
851 writer->WriteVMIsolateObject(kLiteralTokenCid); | 855 writer->WriteVMIsolateObject(kLiteralTokenCid); |
852 writer->WriteTags(writer->GetObjectTags(this)); | 856 writer->WriteTags(writer->GetObjectTags(this)); |
853 | 857 |
854 // Write out the kind field. | 858 // Write out the kind field. |
855 writer->Write<int32_t>(ptr()->kind_); | 859 writer->Write<int32_t>(ptr()->kind_); |
856 | 860 |
857 // Write out all the object pointer fields. | 861 // Write out all the object pointer fields. |
858 SnapshotWriterVisitor visitor(writer); | 862 SnapshotWriterVisitor visitor(writer, kAsReference); |
859 visitor.VisitPointers(from(), to()); | 863 visitor.VisitPointers(from(), to()); |
860 } | 864 } |
861 | 865 |
862 | 866 |
863 RawTokenStream* TokenStream::ReadFrom(SnapshotReader* reader, | 867 RawTokenStream* TokenStream::ReadFrom(SnapshotReader* reader, |
864 intptr_t object_id, | 868 intptr_t object_id, |
865 intptr_t tags, | 869 intptr_t tags, |
866 Snapshot::Kind kind) { | 870 Snapshot::Kind kind) { |
867 ASSERT(reader != NULL); | 871 ASSERT(reader != NULL); |
868 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 872 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 // Write out the class and tags information. | 972 // Write out the class and tags information. |
969 writer->WriteVMIsolateObject(kScriptCid); | 973 writer->WriteVMIsolateObject(kScriptCid); |
970 writer->WriteTags(writer->GetObjectTags(this)); | 974 writer->WriteTags(writer->GetObjectTags(this)); |
971 | 975 |
972 // Write out all the non object fields. | 976 // Write out all the non object fields. |
973 writer->Write<int32_t>(ptr()->line_offset_); | 977 writer->Write<int32_t>(ptr()->line_offset_); |
974 writer->Write<int32_t>(ptr()->col_offset_); | 978 writer->Write<int32_t>(ptr()->col_offset_); |
975 writer->Write<int8_t>(ptr()->kind_); | 979 writer->Write<int8_t>(ptr()->kind_); |
976 | 980 |
977 // Write out all the object pointer fields. | 981 // Write out all the object pointer fields. |
978 SnapshotWriterVisitor visitor(writer); | 982 SnapshotWriterVisitor visitor(writer, kAsReference); |
979 visitor.VisitPointers(from(), to_snapshot()); | 983 visitor.VisitPointers(from(), to_snapshot()); |
980 } | 984 } |
981 | 985 |
982 | 986 |
983 RawLibrary* Library::ReadFrom(SnapshotReader* reader, | 987 RawLibrary* Library::ReadFrom(SnapshotReader* reader, |
984 intptr_t object_id, | 988 intptr_t object_id, |
985 intptr_t tags, | 989 intptr_t tags, |
986 Snapshot::Kind kind) { | 990 Snapshot::Kind kind) { |
987 ASSERT(reader != NULL); | 991 ASSERT(reader != NULL); |
988 ASSERT(kind != Snapshot::kMessage); | 992 ASSERT(kind != Snapshot::kMessage); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 writer->Write<bool>(ptr()->is_dart_scheme_); | 1084 writer->Write<bool>(ptr()->is_dart_scheme_); |
1081 writer->Write<bool>(ptr()->debuggable_); | 1085 writer->Write<bool>(ptr()->debuggable_); |
1082 // We do not serialize the native resolver or symbolizer. These need to be | 1086 // We do not serialize the native resolver or symbolizer. These need to be |
1083 // explicitly set after deserialization. | 1087 // explicitly set after deserialization. |
1084 // We do not write the loaded_scripts_ cache to the snapshot. It gets | 1088 // We do not write the loaded_scripts_ cache to the snapshot. It gets |
1085 // set to NULL when reading the library from the snapshot, and will | 1089 // set to NULL when reading the library from the snapshot, and will |
1086 // be rebuilt lazily. | 1090 // be rebuilt lazily. |
1087 | 1091 |
1088 // Write out all the object pointer fields. | 1092 // Write out all the object pointer fields. |
1089 RawObject** toobj = (kind == Snapshot::kFull) ? to() : to_snapshot(); | 1093 RawObject** toobj = (kind == Snapshot::kFull) ? to() : to_snapshot(); |
1090 SnapshotWriterVisitor visitor(writer); | 1094 SnapshotWriterVisitor visitor(writer, kAsReference); |
1091 visitor.VisitPointers(from(), toobj); | 1095 visitor.VisitPointers(from(), toobj); |
1092 } | 1096 } |
1093 } | 1097 } |
1094 | 1098 |
1095 | 1099 |
1096 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, | 1100 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, |
1097 intptr_t object_id, | 1101 intptr_t object_id, |
1098 intptr_t tags, | 1102 intptr_t tags, |
1099 Snapshot::Kind kind) { | 1103 Snapshot::Kind kind) { |
1100 ASSERT(reader != NULL); | 1104 ASSERT(reader != NULL); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 // Write out the class and tags information. | 1137 // Write out the class and tags information. |
1134 writer->WriteIndexedObject(kLibraryPrefixCid); | 1138 writer->WriteIndexedObject(kLibraryPrefixCid); |
1135 writer->WriteTags(writer->GetObjectTags(this)); | 1139 writer->WriteTags(writer->GetObjectTags(this)); |
1136 | 1140 |
1137 // Write out all non object fields. | 1141 // Write out all non object fields. |
1138 writer->Write<int16_t>(ptr()->num_imports_); | 1142 writer->Write<int16_t>(ptr()->num_imports_); |
1139 writer->Write<bool>(ptr()->is_deferred_load_); | 1143 writer->Write<bool>(ptr()->is_deferred_load_); |
1140 writer->Write<bool>(ptr()->is_loaded_); | 1144 writer->Write<bool>(ptr()->is_loaded_); |
1141 | 1145 |
1142 // Write out all the object pointer fields. | 1146 // Write out all the object pointer fields. |
1143 SnapshotWriterVisitor visitor(writer); | 1147 SnapshotWriterVisitor visitor(writer, kAsReference); |
1144 visitor.VisitPointers(from(), to()); | 1148 visitor.VisitPointers(from(), to()); |
1145 } | 1149 } |
1146 | 1150 |
1147 | 1151 |
1148 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, | 1152 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, |
1149 intptr_t object_id, | 1153 intptr_t object_id, |
1150 intptr_t tags, | 1154 intptr_t tags, |
1151 Snapshot::Kind kind) { | 1155 Snapshot::Kind kind) { |
1152 ASSERT(reader != NULL); | 1156 ASSERT(reader != NULL); |
1153 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 1157 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
(...skipping 17 matching lines...) Expand all Loading... |
1171 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 1175 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
1172 | 1176 |
1173 // Write out the serialization header value for this object. | 1177 // Write out the serialization header value for this object. |
1174 writer->WriteInlinedObjectHeader(object_id); | 1178 writer->WriteInlinedObjectHeader(object_id); |
1175 | 1179 |
1176 // Write out the class and tags information. | 1180 // Write out the class and tags information. |
1177 writer->WriteVMIsolateObject(kNamespaceCid); | 1181 writer->WriteVMIsolateObject(kNamespaceCid); |
1178 writer->WriteTags(writer->GetObjectTags(this)); | 1182 writer->WriteTags(writer->GetObjectTags(this)); |
1179 | 1183 |
1180 // Write out all the object pointer fields. | 1184 // Write out all the object pointer fields. |
1181 SnapshotWriterVisitor visitor(writer); | 1185 SnapshotWriterVisitor visitor(writer, kAsReference); |
1182 visitor.VisitPointers(from(), to()); | 1186 visitor.VisitPointers(from(), to()); |
1183 } | 1187 } |
1184 | 1188 |
1185 | 1189 |
1186 RawCode* Code::ReadFrom(SnapshotReader* reader, | 1190 RawCode* Code::ReadFrom(SnapshotReader* reader, |
1187 intptr_t object_id, | 1191 intptr_t object_id, |
1188 intptr_t tags, | 1192 intptr_t tags, |
1189 Snapshot::Kind kind) { | 1193 Snapshot::Kind kind) { |
1190 ASSERT(reader->snapshot_code()); | 1194 ASSERT(reader->snapshot_code()); |
1191 ASSERT(kind == Snapshot::kFull); | 1195 ASSERT(kind == Snapshot::kFull); |
1192 | 1196 |
1193 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); | 1197 Code& result = Code::ZoneHandle(reader->zone(), NEW_OBJECT_WITH_LEN(Code, 0)); |
1194 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1198 reader->AddBackRef(object_id, &result, kIsDeserialized); |
1195 | 1199 |
1196 result.set_compile_timestamp(reader->Read<int64_t>()); | 1200 result.set_compile_timestamp(reader->Read<int64_t>()); |
1197 result.set_state_bits(reader->Read<int32_t>()); | 1201 result.set_state_bits(reader->Read<int32_t>()); |
1198 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); | 1202 result.set_lazy_deopt_pc_offset(reader->Read<int32_t>()); |
1199 | 1203 |
1200 // Set all the object fields. | 1204 // Set all the object fields. |
1201 READ_OBJECT_FIELDS(result, | 1205 READ_OBJECT_FIELDS(result, |
1202 result.raw()->from(), result.raw()->to(), | 1206 result.raw()->from(), result.raw()->to(), |
1203 kAsInlinedObject); | 1207 kAsReference); |
1204 | 1208 |
1205 // Fix entry point. | 1209 // Fix entry point. |
1206 uword new_entry = result.EntryPoint(); | 1210 uword new_entry = result.EntryPoint(); |
1207 ASSERT(Dart::vm_isolate()->heap()->CodeContains(new_entry)); | 1211 ASSERT(Dart::vm_isolate()->heap()->CodeContains(new_entry)); |
1208 result.StoreNonPointer(&result.raw_ptr()->entry_point_, new_entry); | 1212 result.StoreNonPointer(&result.raw_ptr()->entry_point_, new_entry); |
1209 | 1213 |
1210 return result.raw(); | 1214 return result.raw(); |
1211 } | 1215 } |
1212 | 1216 |
1213 | 1217 |
(...skipping 16 matching lines...) Expand all Loading... |
1230 // Write out the class and tags information. | 1234 // Write out the class and tags information. |
1231 writer->WriteVMIsolateObject(kCodeCid); | 1235 writer->WriteVMIsolateObject(kCodeCid); |
1232 writer->WriteTags(writer->GetObjectTags(this)); | 1236 writer->WriteTags(writer->GetObjectTags(this)); |
1233 | 1237 |
1234 // Write out all the non object fields. | 1238 // Write out all the non object fields. |
1235 writer->Write<int64_t>(ptr()->compile_timestamp_); | 1239 writer->Write<int64_t>(ptr()->compile_timestamp_); |
1236 writer->Write<int32_t>(ptr()->state_bits_); | 1240 writer->Write<int32_t>(ptr()->state_bits_); |
1237 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); | 1241 writer->Write<int32_t>(ptr()->lazy_deopt_pc_offset_); |
1238 | 1242 |
1239 // Write out all the object pointer fields. | 1243 // Write out all the object pointer fields. |
1240 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); | 1244 SnapshotWriterVisitor visitor(writer, kAsReference); |
1241 visitor.VisitPointers(from(), to()); | 1245 visitor.VisitPointers(from(), to()); |
1242 | 1246 |
1243 writer->SetInstructionsCode(ptr()->instructions_, this); | 1247 writer->SetInstructionsCode(ptr()->instructions_, this); |
1244 } | 1248 } |
1245 | 1249 |
1246 | 1250 |
1247 RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, | 1251 RawInstructions* Instructions::ReadFrom(SnapshotReader* reader, |
1248 intptr_t object_id, | 1252 intptr_t object_id, |
1249 intptr_t tags, | 1253 intptr_t tags, |
1250 Snapshot::Kind kind) { | 1254 Snapshot::Kind kind) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1302 TypedData::Handle(reader->NewTypedData(kTypedDataInt8ArrayCid, length)); | 1306 TypedData::Handle(reader->NewTypedData(kTypedDataInt8ArrayCid, length)); |
1303 result.set_info_array(info_array); | 1307 result.set_info_array(info_array); |
1304 | 1308 |
1305 NoSafepointScope no_safepoint; | 1309 NoSafepointScope no_safepoint; |
1306 for (intptr_t i = 0; i < length; i++) { | 1310 for (intptr_t i = 0; i < length; i++) { |
1307 ObjectPool::EntryType entry_type = | 1311 ObjectPool::EntryType entry_type = |
1308 static_cast<ObjectPool::EntryType>(reader->Read<int8_t>()); | 1312 static_cast<ObjectPool::EntryType>(reader->Read<int8_t>()); |
1309 *reinterpret_cast<int8_t*>(info_array.DataAddr(i)) = entry_type; | 1313 *reinterpret_cast<int8_t*>(info_array.DataAddr(i)) = entry_type; |
1310 switch (entry_type) { | 1314 switch (entry_type) { |
1311 case ObjectPool::kTaggedObject: { | 1315 case ObjectPool::kTaggedObject: { |
1312 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); | 1316 (*reader->PassiveObjectHandle()) = |
| 1317 reader->ReadObjectImpl(kAsInlinedObject); |
1313 result.SetObjectAt(i, *(reader->PassiveObjectHandle())); | 1318 result.SetObjectAt(i, *(reader->PassiveObjectHandle())); |
1314 break; | 1319 break; |
1315 } | 1320 } |
1316 case ObjectPool::kImmediate: { | 1321 case ObjectPool::kImmediate: { |
1317 intptr_t raw_value = reader->Read<intptr_t>(); | 1322 intptr_t raw_value = reader->Read<intptr_t>(); |
1318 result.SetRawValueAt(i, raw_value); | 1323 result.SetRawValueAt(i, raw_value); |
1319 break; | 1324 break; |
1320 } | 1325 } |
1321 case ObjectPool::kNativeEntry: { | 1326 case ObjectPool::kNativeEntry: { |
1322 // Read nothing. Initialize with the lazy link entry. | 1327 // Read nothing. Initialize with the lazy link entry. |
(...skipping 28 matching lines...) Expand all Loading... |
1351 ASSERT(info_array != TypedData::null()); | 1356 ASSERT(info_array != TypedData::null()); |
1352 | 1357 |
1353 writer->Write<intptr_t>(length); | 1358 writer->Write<intptr_t>(length); |
1354 for (intptr_t i = 0; i < length; i++) { | 1359 for (intptr_t i = 0; i < length; i++) { |
1355 ObjectPool::EntryType entry_type = | 1360 ObjectPool::EntryType entry_type = |
1356 static_cast<ObjectPool::EntryType>(info_array->data()[i]); | 1361 static_cast<ObjectPool::EntryType>(info_array->data()[i]); |
1357 writer->Write<int8_t>(entry_type); | 1362 writer->Write<int8_t>(entry_type); |
1358 Entry& entry = ptr()->data()[i]; | 1363 Entry& entry = ptr()->data()[i]; |
1359 switch (entry_type) { | 1364 switch (entry_type) { |
1360 case ObjectPool::kTaggedObject: { | 1365 case ObjectPool::kTaggedObject: { |
1361 writer->WriteObjectImpl(entry.raw_obj_, kAsReference); | 1366 writer->WriteObjectImpl(entry.raw_obj_, kAsInlinedObject); |
1362 break; | 1367 break; |
1363 } | 1368 } |
1364 case ObjectPool::kImmediate: { | 1369 case ObjectPool::kImmediate: { |
1365 writer->Write<intptr_t>(entry.raw_value_); | 1370 writer->Write<intptr_t>(entry.raw_value_); |
1366 break; | 1371 break; |
1367 } | 1372 } |
1368 case ObjectPool::kNativeEntry: { | 1373 case ObjectPool::kNativeEntry: { |
1369 // Write nothing. Will initialize with the lazy link entry. | 1374 // Write nothing. Will initialize with the lazy link entry. |
1370 break; | 1375 break; |
1371 } | 1376 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 | 1620 |
1616 // Write out the class and tags information. | 1621 // Write out the class and tags information. |
1617 writer->WriteVMIsolateObject(kContextCid); | 1622 writer->WriteVMIsolateObject(kContextCid); |
1618 writer->WriteTags(writer->GetObjectTags(this)); | 1623 writer->WriteTags(writer->GetObjectTags(this)); |
1619 | 1624 |
1620 // Write out num of variables in the context. | 1625 // Write out num of variables in the context. |
1621 int32_t num_variables = ptr()->num_variables_; | 1626 int32_t num_variables = ptr()->num_variables_; |
1622 writer->Write<int32_t>(num_variables); | 1627 writer->Write<int32_t>(num_variables); |
1623 if (num_variables != 0) { | 1628 if (num_variables != 0) { |
1624 // Write out all the object pointer fields. | 1629 // Write out all the object pointer fields. |
1625 SnapshotWriterVisitor visitor(writer); | 1630 SnapshotWriterVisitor visitor(writer, kAsReference); |
1626 visitor.VisitPointers(from(), to(num_variables)); | 1631 visitor.VisitPointers(from(), to(num_variables)); |
1627 } | 1632 } |
1628 } | 1633 } |
1629 | 1634 |
1630 | 1635 |
1631 RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, | 1636 RawContextScope* ContextScope::ReadFrom(SnapshotReader* reader, |
1632 intptr_t object_id, | 1637 intptr_t object_id, |
1633 intptr_t tags, | 1638 intptr_t tags, |
1634 Snapshot::Kind kind) { | 1639 Snapshot::Kind kind) { |
1635 ASSERT(reader != NULL); | 1640 ASSERT(reader != NULL); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 | 1704 |
1700 ICData& result = ICData::ZoneHandle(reader->zone(), NEW_OBJECT(ICData)); | 1705 ICData& result = ICData::ZoneHandle(reader->zone(), NEW_OBJECT(ICData)); |
1701 reader->AddBackRef(object_id, &result, kIsDeserialized); | 1706 reader->AddBackRef(object_id, &result, kIsDeserialized); |
1702 | 1707 |
1703 result.set_deopt_id(reader->Read<int32_t>()); | 1708 result.set_deopt_id(reader->Read<int32_t>()); |
1704 result.set_state_bits(reader->Read<uint32_t>()); | 1709 result.set_state_bits(reader->Read<uint32_t>()); |
1705 | 1710 |
1706 // Set all the object fields. | 1711 // Set all the object fields. |
1707 READ_OBJECT_FIELDS(result, | 1712 READ_OBJECT_FIELDS(result, |
1708 result.raw()->from(), result.raw()->to(), | 1713 result.raw()->from(), result.raw()->to(), |
1709 kAsReference); | 1714 kAsInlinedObject); |
1710 | 1715 |
1711 return result.raw(); | 1716 return result.raw(); |
1712 } | 1717 } |
1713 | 1718 |
1714 | 1719 |
1715 void RawICData::WriteTo(SnapshotWriter* writer, | 1720 void RawICData::WriteTo(SnapshotWriter* writer, |
1716 intptr_t object_id, | 1721 intptr_t object_id, |
1717 Snapshot::Kind kind) { | 1722 Snapshot::Kind kind) { |
1718 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); | 1723 ASSERT((kind == Snapshot::kScript) || (kind == Snapshot::kFull)); |
1719 | 1724 |
1720 // Write out the serialization header value for this object. | 1725 // Write out the serialization header value for this object. |
1721 writer->WriteInlinedObjectHeader(object_id); | 1726 writer->WriteInlinedObjectHeader(object_id); |
1722 | 1727 |
1723 // Write out the class and tags information. | 1728 // Write out the class and tags information. |
1724 writer->WriteVMIsolateObject(kICDataCid); | 1729 writer->WriteVMIsolateObject(kICDataCid); |
1725 writer->WriteTags(writer->GetObjectTags(this)); | 1730 writer->WriteTags(writer->GetObjectTags(this)); |
1726 | 1731 |
1727 // Write out all the non object fields. | 1732 // Write out all the non object fields. |
1728 writer->Write<int32_t>(ptr()->deopt_id_); | 1733 writer->Write<int32_t>(ptr()->deopt_id_); |
1729 writer->Write<uint32_t>(ptr()->state_bits_); | 1734 writer->Write<uint32_t>(ptr()->state_bits_); |
1730 | 1735 |
1731 // Write out all the object pointer fields. | 1736 // Write out all the object pointer fields. |
1732 SnapshotWriterVisitor visitor(writer); | 1737 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
1733 visitor.VisitPointers(from(), to()); | 1738 visitor.VisitPointers(from(), to()); |
1734 } | 1739 } |
1735 | 1740 |
1736 | 1741 |
1737 RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, | 1742 RawMegamorphicCache* MegamorphicCache::ReadFrom(SnapshotReader* reader, |
1738 intptr_t object_id, | 1743 intptr_t object_id, |
1739 intptr_t tags, | 1744 intptr_t tags, |
1740 Snapshot::Kind kind) { | 1745 Snapshot::Kind kind) { |
1741 ASSERT(reader->snapshot_code()); | 1746 ASSERT(reader->snapshot_code()); |
1742 ASSERT(kind == Snapshot::kFull); | 1747 ASSERT(kind == Snapshot::kFull); |
(...skipping 24 matching lines...) Expand all Loading... |
1767 writer->WriteInlinedObjectHeader(object_id); | 1772 writer->WriteInlinedObjectHeader(object_id); |
1768 | 1773 |
1769 // Write out the class and tags information. | 1774 // Write out the class and tags information. |
1770 writer->WriteVMIsolateObject(kMegamorphicCacheCid); | 1775 writer->WriteVMIsolateObject(kMegamorphicCacheCid); |
1771 writer->WriteTags(writer->GetObjectTags(this)); | 1776 writer->WriteTags(writer->GetObjectTags(this)); |
1772 | 1777 |
1773 // Write out all the non object fields. | 1778 // Write out all the non object fields. |
1774 writer->Write<int32_t>(ptr()->filled_entry_count_); | 1779 writer->Write<int32_t>(ptr()->filled_entry_count_); |
1775 | 1780 |
1776 // Write out all the object pointer fields. | 1781 // Write out all the object pointer fields. |
1777 SnapshotWriterVisitor visitor(writer); | 1782 SnapshotWriterVisitor visitor(writer, kAsReference); |
1778 visitor.VisitPointers(from(), to()); | 1783 visitor.VisitPointers(from(), to()); |
1779 } | 1784 } |
1780 | 1785 |
1781 | 1786 |
1782 RawSubtypeTestCache* SubtypeTestCache::ReadFrom(SnapshotReader* reader, | 1787 RawSubtypeTestCache* SubtypeTestCache::ReadFrom(SnapshotReader* reader, |
1783 intptr_t object_id, | 1788 intptr_t object_id, |
1784 intptr_t tags, | 1789 intptr_t tags, |
1785 Snapshot::Kind kind) { | 1790 Snapshot::Kind kind) { |
1786 ASSERT(reader->snapshot_code()); | 1791 ASSERT(reader->snapshot_code()); |
1787 ASSERT(kind == Snapshot::kFull); | 1792 ASSERT(kind == Snapshot::kFull); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 ASSERT(writer != NULL); | 1867 ASSERT(writer != NULL); |
1863 | 1868 |
1864 // Write out the serialization header value for this object. | 1869 // Write out the serialization header value for this object. |
1865 writer->WriteInlinedObjectHeader(object_id); | 1870 writer->WriteInlinedObjectHeader(object_id); |
1866 | 1871 |
1867 // Write out the class and tags information. | 1872 // Write out the class and tags information. |
1868 writer->WriteVMIsolateObject(kApiErrorCid); | 1873 writer->WriteVMIsolateObject(kApiErrorCid); |
1869 writer->WriteTags(writer->GetObjectTags(this)); | 1874 writer->WriteTags(writer->GetObjectTags(this)); |
1870 | 1875 |
1871 // Write out all the object pointer fields. | 1876 // Write out all the object pointer fields. |
1872 SnapshotWriterVisitor visitor(writer); | 1877 SnapshotWriterVisitor visitor(writer, kAsReference); |
1873 visitor.VisitPointers(from(), to()); | 1878 visitor.VisitPointers(from(), to()); |
1874 } | 1879 } |
1875 | 1880 |
1876 | 1881 |
1877 RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, | 1882 RawLanguageError* LanguageError::ReadFrom(SnapshotReader* reader, |
1878 intptr_t object_id, | 1883 intptr_t object_id, |
1879 intptr_t tags, | 1884 intptr_t tags, |
1880 Snapshot::Kind kind) { | 1885 Snapshot::Kind kind) { |
1881 ASSERT(reader != NULL); | 1886 ASSERT(reader != NULL); |
1882 | 1887 |
(...skipping 25 matching lines...) Expand all Loading... |
1908 | 1913 |
1909 // Write out the class and tags information. | 1914 // Write out the class and tags information. |
1910 writer->WriteVMIsolateObject(kLanguageErrorCid); | 1915 writer->WriteVMIsolateObject(kLanguageErrorCid); |
1911 writer->WriteTags(writer->GetObjectTags(this)); | 1916 writer->WriteTags(writer->GetObjectTags(this)); |
1912 | 1917 |
1913 // Write out all the non object fields. | 1918 // Write out all the non object fields. |
1914 writer->Write<int32_t>(ptr()->token_pos_); | 1919 writer->Write<int32_t>(ptr()->token_pos_); |
1915 writer->Write<uint8_t>(ptr()->kind_); | 1920 writer->Write<uint8_t>(ptr()->kind_); |
1916 | 1921 |
1917 // Write out all the object pointer fields. | 1922 // Write out all the object pointer fields. |
1918 SnapshotWriterVisitor visitor(writer); | 1923 SnapshotWriterVisitor visitor(writer, kAsReference); |
1919 visitor.VisitPointers(from(), to()); | 1924 visitor.VisitPointers(from(), to()); |
1920 } | 1925 } |
1921 | 1926 |
1922 | 1927 |
1923 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, | 1928 RawUnhandledException* UnhandledException::ReadFrom(SnapshotReader* reader, |
1924 intptr_t object_id, | 1929 intptr_t object_id, |
1925 intptr_t tags, | 1930 intptr_t tags, |
1926 Snapshot::Kind kind) { | 1931 Snapshot::Kind kind) { |
1927 UnhandledException& result = UnhandledException::ZoneHandle( | 1932 UnhandledException& result = UnhandledException::ZoneHandle( |
1928 reader->zone(), NEW_OBJECT(UnhandledException)); | 1933 reader->zone(), NEW_OBJECT(UnhandledException)); |
(...skipping 11 matching lines...) Expand all Loading... |
1940 void RawUnhandledException::WriteTo(SnapshotWriter* writer, | 1945 void RawUnhandledException::WriteTo(SnapshotWriter* writer, |
1941 intptr_t object_id, | 1946 intptr_t object_id, |
1942 Snapshot::Kind kind) { | 1947 Snapshot::Kind kind) { |
1943 // Write out the serialization header value for this object. | 1948 // Write out the serialization header value for this object. |
1944 writer->WriteInlinedObjectHeader(object_id); | 1949 writer->WriteInlinedObjectHeader(object_id); |
1945 | 1950 |
1946 // Write out the class and tags information. | 1951 // Write out the class and tags information. |
1947 writer->WriteVMIsolateObject(kUnhandledExceptionCid); | 1952 writer->WriteVMIsolateObject(kUnhandledExceptionCid); |
1948 writer->WriteTags(writer->GetObjectTags(this)); | 1953 writer->WriteTags(writer->GetObjectTags(this)); |
1949 // Write out all the object pointer fields. | 1954 // Write out all the object pointer fields. |
1950 SnapshotWriterVisitor visitor(writer); | 1955 SnapshotWriterVisitor visitor(writer, kAsReference); |
1951 visitor.VisitPointers(from(), to()); | 1956 visitor.VisitPointers(from(), to()); |
1952 } | 1957 } |
1953 | 1958 |
1954 | 1959 |
1955 RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, | 1960 RawUnwindError* UnwindError::ReadFrom(SnapshotReader* reader, |
1956 intptr_t object_id, | 1961 intptr_t object_id, |
1957 intptr_t tags, | 1962 intptr_t tags, |
1958 Snapshot::Kind kind) { | 1963 Snapshot::Kind kind) { |
1959 UNREACHABLE(); | 1964 UNREACHABLE(); |
1960 return UnwindError::null(); | 1965 return UnwindError::null(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 ASSERT(writer != NULL); | 2115 ASSERT(writer != NULL); |
2111 | 2116 |
2112 // Write out the serialization header value for this object. | 2117 // Write out the serialization header value for this object. |
2113 writer->WriteInlinedObjectHeader(object_id); | 2118 writer->WriteInlinedObjectHeader(object_id); |
2114 | 2119 |
2115 // Write out the class and tags information. | 2120 // Write out the class and tags information. |
2116 writer->WriteIndexedObject(kBigintCid); | 2121 writer->WriteIndexedObject(kBigintCid); |
2117 writer->WriteTags(writer->GetObjectTags(this)); | 2122 writer->WriteTags(writer->GetObjectTags(this)); |
2118 | 2123 |
2119 // Write out all the object pointer fields. | 2124 // Write out all the object pointer fields. |
2120 SnapshotWriterVisitor visitor(writer, false); | 2125 SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
2121 visitor.VisitPointers(from(), to()); | 2126 visitor.VisitPointers(from(), to()); |
2122 } | 2127 } |
2123 | 2128 |
2124 | 2129 |
2125 RawDouble* Double::ReadFrom(SnapshotReader* reader, | 2130 RawDouble* Double::ReadFrom(SnapshotReader* reader, |
2126 intptr_t object_id, | 2131 intptr_t object_id, |
2127 intptr_t tags, | 2132 intptr_t tags, |
2128 Snapshot::Kind kind) { | 2133 Snapshot::Kind kind) { |
2129 ASSERT(reader != NULL); | 2134 ASSERT(reader != NULL); |
2130 ASSERT(kind != Snapshot::kMessage); | 2135 ASSERT(kind != Snapshot::kMessage); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2223 | 2228 |
2224 | 2229 |
2225 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, | 2230 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, |
2226 intptr_t object_id, | 2231 intptr_t object_id, |
2227 intptr_t tags, | 2232 intptr_t tags, |
2228 Snapshot::Kind kind) { | 2233 Snapshot::Kind kind) { |
2229 // Read the length so that we can determine instance size to allocate. | 2234 // Read the length so that we can determine instance size to allocate. |
2230 ASSERT(reader != NULL); | 2235 ASSERT(reader != NULL); |
2231 intptr_t len = reader->ReadSmiValue(); | 2236 intptr_t len = reader->ReadSmiValue(); |
2232 intptr_t hash = reader->ReadSmiValue(); | 2237 intptr_t hash = reader->ReadSmiValue(); |
2233 String& str_obj = String::Handle(reader->zone(), String::null()); | 2238 String& str_obj = String::ZoneHandle(reader->zone(), String::null()); |
2234 | 2239 |
2235 if (kind == Snapshot::kFull) { | 2240 if (kind == Snapshot::kFull) { |
2236 // We currently only expect the Dart mutator to read snapshots. | 2241 // We currently only expect the Dart mutator to read snapshots. |
2237 reader->isolate()->AssertCurrentThreadIsMutator(); | 2242 reader->isolate()->AssertCurrentThreadIsMutator(); |
2238 ASSERT(Thread::Current()->no_safepoint_scope_depth() != 0); | 2243 ASSERT(Thread::Current()->no_safepoint_scope_depth() != 0); |
2239 RawOneByteString* obj = reader->NewOneByteString(len); | 2244 RawOneByteString* obj = reader->NewOneByteString(len); |
2240 str_obj = obj; | 2245 str_obj = obj; |
2241 if (RawObject::IsCanonical(tags)) { | 2246 if (RawObject::IsCanonical(tags)) { |
2242 str_obj.SetCanonical(); | 2247 str_obj.SetCanonical(); |
2243 } | 2248 } |
(...skipping 13 matching lines...) Expand all Loading... |
2257 | 2262 |
2258 | 2263 |
2259 RawTwoByteString* TwoByteString::ReadFrom(SnapshotReader* reader, | 2264 RawTwoByteString* TwoByteString::ReadFrom(SnapshotReader* reader, |
2260 intptr_t object_id, | 2265 intptr_t object_id, |
2261 intptr_t tags, | 2266 intptr_t tags, |
2262 Snapshot::Kind kind) { | 2267 Snapshot::Kind kind) { |
2263 // Read the length so that we can determine instance size to allocate. | 2268 // Read the length so that we can determine instance size to allocate. |
2264 ASSERT(reader != NULL); | 2269 ASSERT(reader != NULL); |
2265 intptr_t len = reader->ReadSmiValue(); | 2270 intptr_t len = reader->ReadSmiValue(); |
2266 intptr_t hash = reader->ReadSmiValue(); | 2271 intptr_t hash = reader->ReadSmiValue(); |
2267 String& str_obj = String::Handle(reader->zone(), String::null()); | 2272 String& str_obj = String::ZoneHandle(reader->zone(), String::null()); |
2268 | 2273 |
2269 if (kind == Snapshot::kFull) { | 2274 if (kind == Snapshot::kFull) { |
2270 RawTwoByteString* obj = reader->NewTwoByteString(len); | 2275 RawTwoByteString* obj = reader->NewTwoByteString(len); |
2271 str_obj = obj; | 2276 str_obj = obj; |
2272 if (RawObject::IsCanonical(tags)) { | 2277 if (RawObject::IsCanonical(tags)) { |
2273 str_obj.SetCanonical(); | 2278 str_obj.SetCanonical(); |
2274 } | 2279 } |
2275 str_obj.SetHash(hash); | 2280 str_obj.SetHash(hash); |
2276 NoSafepointScope no_safepoint; | 2281 NoSafepointScope no_safepoint; |
2277 uint16_t* raw_ptr = (len > 0)? CharAddr(str_obj, 0) : NULL; | 2282 uint16_t* raw_ptr = (len > 0)? CharAddr(str_obj, 0) : NULL; |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 | 2865 |
2861 | 2866 |
2862 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, | 2867 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, |
2863 intptr_t object_id, | 2868 intptr_t object_id, |
2864 intptr_t tags, | 2869 intptr_t tags, |
2865 Snapshot::Kind kind) { | 2870 Snapshot::Kind kind) { |
2866 ASSERT(kind != Snapshot::kFull); | 2871 ASSERT(kind != Snapshot::kFull); |
2867 intptr_t cid = RawObject::ClassIdTag::decode(tags); | 2872 intptr_t cid = RawObject::ClassIdTag::decode(tags); |
2868 intptr_t length = reader->ReadSmiValue(); | 2873 intptr_t length = reader->ReadSmiValue(); |
2869 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue()); | 2874 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadRawPointerValue()); |
2870 ExternalTypedData& obj = ExternalTypedData::Handle( | 2875 ExternalTypedData& obj = ExternalTypedData::ZoneHandle( |
2871 ExternalTypedData::New(cid, data, length)); | 2876 ExternalTypedData::New(cid, data, length)); |
2872 reader->AddBackRef(object_id, &obj, kIsDeserialized); | 2877 reader->AddBackRef(object_id, &obj, kIsDeserialized); |
2873 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue()); | 2878 void* peer = reinterpret_cast<void*>(reader->ReadRawPointerValue()); |
2874 Dart_WeakPersistentHandleFinalizer callback = | 2879 Dart_WeakPersistentHandleFinalizer callback = |
2875 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( | 2880 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( |
2876 reader->ReadRawPointerValue()); | 2881 reader->ReadRawPointerValue()); |
2877 obj.AddFinalizer(peer, callback); | 2882 obj.AddFinalizer(peer, callback); |
2878 return obj.raw(); | 2883 return obj.raw(); |
2879 } | 2884 } |
2880 | 2885 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3135 // Write out the serialization header value for this object. | 3140 // Write out the serialization header value for this object. |
3136 writer->WriteInlinedObjectHeader(object_id); | 3141 writer->WriteInlinedObjectHeader(object_id); |
3137 | 3142 |
3138 // Write out the class and tags information. | 3143 // Write out the class and tags information. |
3139 writer->WriteIndexedObject(kStacktraceCid); | 3144 writer->WriteIndexedObject(kStacktraceCid); |
3140 writer->WriteTags(writer->GetObjectTags(this)); | 3145 writer->WriteTags(writer->GetObjectTags(this)); |
3141 | 3146 |
3142 writer->Write(ptr()->expand_inlined_); | 3147 writer->Write(ptr()->expand_inlined_); |
3143 | 3148 |
3144 // Write out all the object pointer fields. | 3149 // Write out all the object pointer fields. |
3145 SnapshotWriterVisitor visitor(writer); | 3150 SnapshotWriterVisitor visitor(writer, kAsReference); |
3146 visitor.VisitPointers(from(), to()); | 3151 visitor.VisitPointers(from(), to()); |
3147 } else { | 3152 } else { |
3148 // Stacktraces are not allowed in other snapshot forms. | 3153 // Stacktraces are not allowed in other snapshot forms. |
3149 writer->SetWriteException(Exceptions::kArgument, | 3154 writer->SetWriteException(Exceptions::kArgument, |
3150 "Illegal argument in isolate message" | 3155 "Illegal argument in isolate message" |
3151 " : (object is a stacktrace)"); | 3156 " : (object is a stacktrace)"); |
3152 } | 3157 } |
3153 } | 3158 } |
3154 | 3159 |
3155 | 3160 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3227 ASSERT(writer != NULL); | 3232 ASSERT(writer != NULL); |
3228 | 3233 |
3229 // Write out the serialization header value for this object. | 3234 // Write out the serialization header value for this object. |
3230 writer->WriteInlinedObjectHeader(object_id); | 3235 writer->WriteInlinedObjectHeader(object_id); |
3231 | 3236 |
3232 // Write out the class and tags information. | 3237 // Write out the class and tags information. |
3233 writer->WriteIndexedObject(kWeakPropertyCid); | 3238 writer->WriteIndexedObject(kWeakPropertyCid); |
3234 writer->WriteTags(writer->GetObjectTags(this)); | 3239 writer->WriteTags(writer->GetObjectTags(this)); |
3235 | 3240 |
3236 // Write out all the object pointer fields. | 3241 // Write out all the object pointer fields. |
3237 SnapshotWriterVisitor visitor(writer); | 3242 SnapshotWriterVisitor visitor(writer, kAsReference); |
3238 visitor.VisitPointers(from(), to()); | 3243 visitor.VisitPointers(from(), to()); |
3239 } | 3244 } |
3240 | 3245 |
3241 | 3246 |
3242 RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, | 3247 RawMirrorReference* MirrorReference::ReadFrom(SnapshotReader* reader, |
3243 intptr_t object_id, | 3248 intptr_t object_id, |
3244 intptr_t tags, | 3249 intptr_t tags, |
3245 Snapshot::Kind kind) { | 3250 Snapshot::Kind kind) { |
3246 UNREACHABLE(); | 3251 UNREACHABLE(); |
3247 return MirrorReference::null(); | 3252 return MirrorReference::null(); |
(...skipping 30 matching lines...) Expand all Loading... |
3278 // We do not allow objects with native fields in an isolate message. | 3283 // We do not allow objects with native fields in an isolate message. |
3279 writer->SetWriteException(Exceptions::kArgument, | 3284 writer->SetWriteException(Exceptions::kArgument, |
3280 "Illegal argument in isolate message" | 3285 "Illegal argument in isolate message" |
3281 " : (object is a UserTag)"); | 3286 " : (object is a UserTag)"); |
3282 } else { | 3287 } else { |
3283 UNREACHABLE(); | 3288 UNREACHABLE(); |
3284 } | 3289 } |
3285 } | 3290 } |
3286 | 3291 |
3287 } // namespace dart | 3292 } // namespace dart |
OLD | NEW |