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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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
« no previous file with comments | « runtime/vm/clustered_snapshot.h ('k') | runtime/vm/code_descriptors.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/clustered_snapshot.h" 5 #include "vm/clustered_snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 15 matching lines...) Expand all
26 static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) { 26 static RawObject* AllocateUninitialized(PageSpace* old_space, intptr_t size) {
27 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 27 ASSERT(Utils::IsAligned(size, kObjectAlignment));
28 uword address = 28 uword address =
29 old_space->TryAllocateDataBumpLocked(size, PageSpace::kForceGrowth); 29 old_space->TryAllocateDataBumpLocked(size, PageSpace::kForceGrowth);
30 if (address == 0) { 30 if (address == 0) {
31 OUT_OF_MEMORY(); 31 OUT_OF_MEMORY();
32 } 32 }
33 return reinterpret_cast<RawObject*>(address + kHeapObjectTag); 33 return reinterpret_cast<RawObject*>(address + kHeapObjectTag);
34 } 34 }
35 35
36
37 void Deserializer::InitializeHeader(RawObject* raw, 36 void Deserializer::InitializeHeader(RawObject* raw,
38 intptr_t class_id, 37 intptr_t class_id,
39 intptr_t size, 38 intptr_t size,
40 bool is_vm_isolate, 39 bool is_vm_isolate,
41 bool is_canonical) { 40 bool is_canonical) {
42 ASSERT(Utils::IsAligned(size, kObjectAlignment)); 41 ASSERT(Utils::IsAligned(size, kObjectAlignment));
43 uint32_t tags = 0; 42 uint32_t tags = 0;
44 tags = RawObject::ClassIdTag::update(class_id, tags); 43 tags = RawObject::ClassIdTag::update(class_id, tags);
45 tags = RawObject::SizeTag::update(size, tags); 44 tags = RawObject::SizeTag::update(size, tags);
46 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate, tags); 45 tags = RawObject::VMHeapObjectTag::update(is_vm_isolate, tags);
47 tags = RawObject::CanonicalObjectTag::update(is_canonical, tags); 46 tags = RawObject::CanonicalObjectTag::update(is_canonical, tags);
48 raw->ptr()->tags_ = tags; 47 raw->ptr()->tags_ = tags;
49 #if defined(HASH_IN_OBJECT_HEADER) 48 #if defined(HASH_IN_OBJECT_HEADER)
50 raw->ptr()->hash_ = 0; 49 raw->ptr()->hash_ = 0;
51 #endif 50 #endif
52 } 51 }
53 52
54
55 #if !defined(DART_PRECOMPILED_RUNTIME) 53 #if !defined(DART_PRECOMPILED_RUNTIME)
56 class ClassSerializationCluster : public SerializationCluster { 54 class ClassSerializationCluster : public SerializationCluster {
57 public: 55 public:
58 explicit ClassSerializationCluster(intptr_t num_cids) 56 explicit ClassSerializationCluster(intptr_t num_cids)
59 : predefined_(kNumPredefinedCids), objects_(num_cids) {} 57 : predefined_(kNumPredefinedCids), objects_(num_cids) {}
60 virtual ~ClassSerializationCluster() {} 58 virtual ~ClassSerializationCluster() {}
61 59
62 void Trace(Serializer* s, RawObject* object) { 60 void Trace(Serializer* s, RawObject* object) {
63 RawClass* cls = Class::RawCast(object); 61 RawClass* cls = Class::RawCast(object);
64 intptr_t class_id = cls->ptr()->id_; 62 intptr_t class_id = cls->ptr()->id_;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 s->WriteTokenPosition(cls->ptr()->token_pos_); 127 s->WriteTokenPosition(cls->ptr()->token_pos_);
130 s->Write<uint16_t>(cls->ptr()->state_bits_); 128 s->Write<uint16_t>(cls->ptr()->state_bits_);
131 } 129 }
132 130
133 private: 131 private:
134 GrowableArray<RawClass*> predefined_; 132 GrowableArray<RawClass*> predefined_;
135 GrowableArray<RawClass*> objects_; 133 GrowableArray<RawClass*> objects_;
136 }; 134 };
137 #endif // !DART_PRECOMPILED_RUNTIME 135 #endif // !DART_PRECOMPILED_RUNTIME
138 136
139
140 class ClassDeserializationCluster : public DeserializationCluster { 137 class ClassDeserializationCluster : public DeserializationCluster {
141 public: 138 public:
142 ClassDeserializationCluster() {} 139 ClassDeserializationCluster() {}
143 virtual ~ClassDeserializationCluster() {} 140 virtual ~ClassDeserializationCluster() {}
144 141
145 void ReadAlloc(Deserializer* d) { 142 void ReadAlloc(Deserializer* d) {
146 predefined_start_index_ = d->next_index(); 143 predefined_start_index_ = d->next_index();
147 PageSpace* old_space = d->heap()->old_space(); 144 PageSpace* old_space = d->heap()->old_space();
148 intptr_t count = d->Read<int32_t>(); 145 intptr_t count = d->Read<int32_t>();
149 ClassTable* table = d->isolate()->class_table(); 146 ClassTable* table = d->isolate()->class_table();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 cls ^= refs.At(i); 241 cls ^= refs.At(i);
245 cls.RehashConstants(zone); 242 cls.RehashConstants(zone);
246 } 243 }
247 } 244 }
248 245
249 private: 246 private:
250 intptr_t predefined_start_index_; 247 intptr_t predefined_start_index_;
251 intptr_t predefined_stop_index_; 248 intptr_t predefined_stop_index_;
252 }; 249 };
253 250
254
255 #if !defined(DART_PRECOMPILED_RUNTIME) 251 #if !defined(DART_PRECOMPILED_RUNTIME)
256 class UnresolvedClassSerializationCluster : public SerializationCluster { 252 class UnresolvedClassSerializationCluster : public SerializationCluster {
257 public: 253 public:
258 UnresolvedClassSerializationCluster() {} 254 UnresolvedClassSerializationCluster() {}
259 virtual ~UnresolvedClassSerializationCluster() {} 255 virtual ~UnresolvedClassSerializationCluster() {}
260 256
261 void Trace(Serializer* s, RawObject* object) { 257 void Trace(Serializer* s, RawObject* object) {
262 RawUnresolvedClass* cls = UnresolvedClass::RawCast(object); 258 RawUnresolvedClass* cls = UnresolvedClass::RawCast(object);
263 objects_.Add(cls); 259 objects_.Add(cls);
264 260
(...skipping 26 matching lines...) Expand all
291 } 287 }
292 s->WriteTokenPosition(cls->ptr()->token_pos_); 288 s->WriteTokenPosition(cls->ptr()->token_pos_);
293 } 289 }
294 } 290 }
295 291
296 private: 292 private:
297 GrowableArray<RawUnresolvedClass*> objects_; 293 GrowableArray<RawUnresolvedClass*> objects_;
298 }; 294 };
299 #endif // !DART_PRECOMPILED_RUNTIME 295 #endif // !DART_PRECOMPILED_RUNTIME
300 296
301
302 class UnresolvedClassDeserializationCluster : public DeserializationCluster { 297 class UnresolvedClassDeserializationCluster : public DeserializationCluster {
303 public: 298 public:
304 UnresolvedClassDeserializationCluster() {} 299 UnresolvedClassDeserializationCluster() {}
305 virtual ~UnresolvedClassDeserializationCluster() {} 300 virtual ~UnresolvedClassDeserializationCluster() {}
306 301
307 void ReadAlloc(Deserializer* d) { 302 void ReadAlloc(Deserializer* d) {
308 start_index_ = d->next_index(); 303 start_index_ = d->next_index();
309 PageSpace* old_space = d->heap()->old_space(); 304 PageSpace* old_space = d->heap()->old_space();
310 intptr_t count = d->Read<int32_t>(); 305 intptr_t count = d->Read<int32_t>();
311 for (intptr_t i = 0; i < count; i++) { 306 for (intptr_t i = 0; i < count; i++) {
(...skipping 15 matching lines...) Expand all
327 RawObject** from = cls->from(); 322 RawObject** from = cls->from();
328 RawObject** to = cls->to(); 323 RawObject** to = cls->to();
329 for (RawObject** p = from; p <= to; p++) { 324 for (RawObject** p = from; p <= to; p++) {
330 *p = d->ReadRef(); 325 *p = d->ReadRef();
331 } 326 }
332 cls->ptr()->token_pos_ = d->ReadTokenPosition(); 327 cls->ptr()->token_pos_ = d->ReadTokenPosition();
333 } 328 }
334 } 329 }
335 }; 330 };
336 331
337
338 #if !defined(DART_PRECOMPILED_RUNTIME) 332 #if !defined(DART_PRECOMPILED_RUNTIME)
339 class TypeArgumentsSerializationCluster : public SerializationCluster { 333 class TypeArgumentsSerializationCluster : public SerializationCluster {
340 public: 334 public:
341 TypeArgumentsSerializationCluster() {} 335 TypeArgumentsSerializationCluster() {}
342 virtual ~TypeArgumentsSerializationCluster() {} 336 virtual ~TypeArgumentsSerializationCluster() {}
343 337
344 void Trace(Serializer* s, RawObject* object) { 338 void Trace(Serializer* s, RawObject* object) {
345 RawTypeArguments* type_args = TypeArguments::RawCast(object); 339 RawTypeArguments* type_args = TypeArguments::RawCast(object);
346 objects_.Add(type_args); 340 objects_.Add(type_args);
347 341
(...skipping 30 matching lines...) Expand all
378 s->WriteRef(type_args->ptr()->types()[j]); 372 s->WriteRef(type_args->ptr()->types()[j]);
379 } 373 }
380 } 374 }
381 } 375 }
382 376
383 private: 377 private:
384 GrowableArray<RawTypeArguments*> objects_; 378 GrowableArray<RawTypeArguments*> objects_;
385 }; 379 };
386 #endif // !DART_PRECOMPILED_RUNTIME 380 #endif // !DART_PRECOMPILED_RUNTIME
387 381
388
389 class TypeArgumentsDeserializationCluster : public DeserializationCluster { 382 class TypeArgumentsDeserializationCluster : public DeserializationCluster {
390 public: 383 public:
391 TypeArgumentsDeserializationCluster() {} 384 TypeArgumentsDeserializationCluster() {}
392 virtual ~TypeArgumentsDeserializationCluster() {} 385 virtual ~TypeArgumentsDeserializationCluster() {}
393 386
394 void ReadAlloc(Deserializer* d) { 387 void ReadAlloc(Deserializer* d) {
395 start_index_ = d->next_index(); 388 start_index_ = d->next_index();
396 PageSpace* old_space = d->heap()->old_space(); 389 PageSpace* old_space = d->heap()->old_space();
397 intptr_t count = d->Read<int32_t>(); 390 intptr_t count = d->Read<int32_t>();
398 for (intptr_t i = 0; i < count; i++) { 391 for (intptr_t i = 0; i < count; i++) {
(...skipping 20 matching lines...) Expand all
419 type_args->ptr()->instantiations_ = 412 type_args->ptr()->instantiations_ =
420 reinterpret_cast<RawArray*>(d->ReadRef()); 413 reinterpret_cast<RawArray*>(d->ReadRef());
421 for (intptr_t j = 0; j < length; j++) { 414 for (intptr_t j = 0; j < length; j++) {
422 type_args->ptr()->types()[j] = 415 type_args->ptr()->types()[j] =
423 reinterpret_cast<RawAbstractType*>(d->ReadRef()); 416 reinterpret_cast<RawAbstractType*>(d->ReadRef());
424 } 417 }
425 } 418 }
426 } 419 }
427 }; 420 };
428 421
429
430 #if !defined(DART_PRECOMPILED_RUNTIME) 422 #if !defined(DART_PRECOMPILED_RUNTIME)
431 class PatchClassSerializationCluster : public SerializationCluster { 423 class PatchClassSerializationCluster : public SerializationCluster {
432 public: 424 public:
433 PatchClassSerializationCluster() {} 425 PatchClassSerializationCluster() {}
434 virtual ~PatchClassSerializationCluster() {} 426 virtual ~PatchClassSerializationCluster() {}
435 427
436 void Trace(Serializer* s, RawObject* object) { 428 void Trace(Serializer* s, RawObject* object) {
437 RawPatchClass* cls = PatchClass::RawCast(object); 429 RawPatchClass* cls = PatchClass::RawCast(object);
438 objects_.Add(cls); 430 objects_.Add(cls);
439 431
(...skipping 24 matching lines...) Expand all
464 s->WriteRef(*p); 456 s->WriteRef(*p);
465 } 457 }
466 } 458 }
467 } 459 }
468 460
469 private: 461 private:
470 GrowableArray<RawPatchClass*> objects_; 462 GrowableArray<RawPatchClass*> objects_;
471 }; 463 };
472 #endif // !DART_PRECOMPILED_RUNTIME 464 #endif // !DART_PRECOMPILED_RUNTIME
473 465
474
475 class PatchClassDeserializationCluster : public DeserializationCluster { 466 class PatchClassDeserializationCluster : public DeserializationCluster {
476 public: 467 public:
477 PatchClassDeserializationCluster() {} 468 PatchClassDeserializationCluster() {}
478 virtual ~PatchClassDeserializationCluster() {} 469 virtual ~PatchClassDeserializationCluster() {}
479 470
480 void ReadAlloc(Deserializer* d) { 471 void ReadAlloc(Deserializer* d) {
481 start_index_ = d->next_index(); 472 start_index_ = d->next_index();
482 PageSpace* old_space = d->heap()->old_space(); 473 PageSpace* old_space = d->heap()->old_space();
483 intptr_t count = d->Read<int32_t>(); 474 intptr_t count = d->Read<int32_t>();
484 for (intptr_t i = 0; i < count; i++) { 475 for (intptr_t i = 0; i < count; i++) {
(...skipping 12 matching lines...) Expand all
497 PatchClass::InstanceSize(), is_vm_object); 488 PatchClass::InstanceSize(), is_vm_object);
498 RawObject** from = cls->from(); 489 RawObject** from = cls->from();
499 RawObject** to = cls->to(); 490 RawObject** to = cls->to();
500 for (RawObject** p = from; p <= to; p++) { 491 for (RawObject** p = from; p <= to; p++) {
501 *p = d->ReadRef(); 492 *p = d->ReadRef();
502 } 493 }
503 } 494 }
504 } 495 }
505 }; 496 };
506 497
507
508 #if !defined(DART_PRECOMPILED_RUNTIME) 498 #if !defined(DART_PRECOMPILED_RUNTIME)
509 class FunctionSerializationCluster : public SerializationCluster { 499 class FunctionSerializationCluster : public SerializationCluster {
510 public: 500 public:
511 FunctionSerializationCluster() {} 501 FunctionSerializationCluster() {}
512 virtual ~FunctionSerializationCluster() {} 502 virtual ~FunctionSerializationCluster() {}
513 503
514 void Trace(Serializer* s, RawObject* object) { 504 void Trace(Serializer* s, RawObject* object) {
515 RawFunction* func = Function::RawCast(object); 505 RawFunction* func = Function::RawCast(object);
516 objects_.Add(func); 506 objects_.Add(func);
517 507
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 #endif 569 #endif
580 } 570 }
581 } 571 }
582 } 572 }
583 573
584 private: 574 private:
585 GrowableArray<RawFunction*> objects_; 575 GrowableArray<RawFunction*> objects_;
586 }; 576 };
587 #endif // !DART_PRECOMPILED_RUNTIME 577 #endif // !DART_PRECOMPILED_RUNTIME
588 578
589
590 class FunctionDeserializationCluster : public DeserializationCluster { 579 class FunctionDeserializationCluster : public DeserializationCluster {
591 public: 580 public:
592 FunctionDeserializationCluster() {} 581 FunctionDeserializationCluster() {}
593 virtual ~FunctionDeserializationCluster() {} 582 virtual ~FunctionDeserializationCluster() {}
594 583
595 void ReadAlloc(Deserializer* d) { 584 void ReadAlloc(Deserializer* d) {
596 start_index_ = d->next_index(); 585 start_index_ = d->next_index();
597 PageSpace* old_space = d->heap()->old_space(); 586 PageSpace* old_space = d->heap()->old_space();
598 intptr_t count = d->Read<int32_t>(); 587 intptr_t count = d->Read<int32_t>();
599 for (intptr_t i = 0; i < count; i++) { 588 for (intptr_t i = 0; i < count; i++) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 for (intptr_t i = start_index_; i < stop_index_; i++) { 679 for (intptr_t i = start_index_; i < stop_index_; i++) {
691 func ^= refs.At(i); 680 func ^= refs.At(i);
692 func.ClearICDataArray(); 681 func.ClearICDataArray();
693 func.ClearCode(); 682 func.ClearCode();
694 func.set_was_compiled(false); 683 func.set_was_compiled(false);
695 } 684 }
696 } 685 }
697 } 686 }
698 }; 687 };
699 688
700
701 #if !defined(DART_PRECOMPILED_RUNTIME) 689 #if !defined(DART_PRECOMPILED_RUNTIME)
702 class ClosureDataSerializationCluster : public SerializationCluster { 690 class ClosureDataSerializationCluster : public SerializationCluster {
703 public: 691 public:
704 ClosureDataSerializationCluster() {} 692 ClosureDataSerializationCluster() {}
705 virtual ~ClosureDataSerializationCluster() {} 693 virtual ~ClosureDataSerializationCluster() {}
706 694
707 void Trace(Serializer* s, RawObject* object) { 695 void Trace(Serializer* s, RawObject* object) {
708 RawClosureData* data = ClosureData::RawCast(object); 696 RawClosureData* data = ClosureData::RawCast(object);
709 objects_.Add(data); 697 objects_.Add(data);
710 698
(...skipping 26 matching lines...) Expand all
737 s->WriteRef(data->ptr()->signature_type_); 725 s->WriteRef(data->ptr()->signature_type_);
738 s->WriteRef(data->ptr()->closure_); 726 s->WriteRef(data->ptr()->closure_);
739 } 727 }
740 } 728 }
741 729
742 private: 730 private:
743 GrowableArray<RawClosureData*> objects_; 731 GrowableArray<RawClosureData*> objects_;
744 }; 732 };
745 #endif // !DART_PRECOMPILED_RUNTIME 733 #endif // !DART_PRECOMPILED_RUNTIME
746 734
747
748 class ClosureDataDeserializationCluster : public DeserializationCluster { 735 class ClosureDataDeserializationCluster : public DeserializationCluster {
749 public: 736 public:
750 ClosureDataDeserializationCluster() {} 737 ClosureDataDeserializationCluster() {}
751 virtual ~ClosureDataDeserializationCluster() {} 738 virtual ~ClosureDataDeserializationCluster() {}
752 739
753 void ReadAlloc(Deserializer* d) { 740 void ReadAlloc(Deserializer* d) {
754 start_index_ = d->next_index(); 741 start_index_ = d->next_index();
755 PageSpace* old_space = d->heap()->old_space(); 742 PageSpace* old_space = d->heap()->old_space();
756 intptr_t count = d->Read<int32_t>(); 743 intptr_t count = d->Read<int32_t>();
757 for (intptr_t i = 0; i < count; i++) { 744 for (intptr_t i = 0; i < count; i++) {
(...skipping 17 matching lines...) Expand all
775 static_cast<RawContextScope*>(d->ReadRef()); 762 static_cast<RawContextScope*>(d->ReadRef());
776 } 763 }
777 data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef()); 764 data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef());
778 data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef()); 765 data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef());
779 data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef()); 766 data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef());
780 data->ptr()->hash_ = Object::null(); 767 data->ptr()->hash_ = Object::null();
781 } 768 }
782 } 769 }
783 }; 770 };
784 771
785
786 #if !defined(DART_PRECOMPILED_RUNTIME) 772 #if !defined(DART_PRECOMPILED_RUNTIME)
787 class SignatureDataSerializationCluster : public SerializationCluster { 773 class SignatureDataSerializationCluster : public SerializationCluster {
788 public: 774 public:
789 SignatureDataSerializationCluster() {} 775 SignatureDataSerializationCluster() {}
790 virtual ~SignatureDataSerializationCluster() {} 776 virtual ~SignatureDataSerializationCluster() {}
791 777
792 void Trace(Serializer* s, RawObject* object) { 778 void Trace(Serializer* s, RawObject* object) {
793 RawSignatureData* data = SignatureData::RawCast(object); 779 RawSignatureData* data = SignatureData::RawCast(object);
794 objects_.Add(data); 780 objects_.Add(data);
795 781
(...skipping 24 matching lines...) Expand all
820 s->WriteRef(*p); 806 s->WriteRef(*p);
821 } 807 }
822 } 808 }
823 } 809 }
824 810
825 private: 811 private:
826 GrowableArray<RawSignatureData*> objects_; 812 GrowableArray<RawSignatureData*> objects_;
827 }; 813 };
828 #endif // !DART_PRECOMPILED_RUNTIME 814 #endif // !DART_PRECOMPILED_RUNTIME
829 815
830
831 class SignatureDataDeserializationCluster : public DeserializationCluster { 816 class SignatureDataDeserializationCluster : public DeserializationCluster {
832 public: 817 public:
833 SignatureDataDeserializationCluster() {} 818 SignatureDataDeserializationCluster() {}
834 virtual ~SignatureDataDeserializationCluster() {} 819 virtual ~SignatureDataDeserializationCluster() {}
835 820
836 void ReadAlloc(Deserializer* d) { 821 void ReadAlloc(Deserializer* d) {
837 start_index_ = d->next_index(); 822 start_index_ = d->next_index();
838 PageSpace* old_space = d->heap()->old_space(); 823 PageSpace* old_space = d->heap()->old_space();
839 intptr_t count = d->Read<int32_t>(); 824 intptr_t count = d->Read<int32_t>();
840 for (intptr_t i = 0; i < count; i++) { 825 for (intptr_t i = 0; i < count; i++) {
(...skipping 12 matching lines...) Expand all
853 data, kSignatureDataCid, SignatureData::InstanceSize(), is_vm_object); 838 data, kSignatureDataCid, SignatureData::InstanceSize(), is_vm_object);
854 RawObject** from = data->from(); 839 RawObject** from = data->from();
855 RawObject** to = data->to(); 840 RawObject** to = data->to();
856 for (RawObject** p = from; p <= to; p++) { 841 for (RawObject** p = from; p <= to; p++) {
857 *p = d->ReadRef(); 842 *p = d->ReadRef();
858 } 843 }
859 } 844 }
860 } 845 }
861 }; 846 };
862 847
863
864 #if !defined(DART_PRECOMPILED_RUNTIME) 848 #if !defined(DART_PRECOMPILED_RUNTIME)
865 class RedirectionDataSerializationCluster : public SerializationCluster { 849 class RedirectionDataSerializationCluster : public SerializationCluster {
866 public: 850 public:
867 RedirectionDataSerializationCluster() {} 851 RedirectionDataSerializationCluster() {}
868 virtual ~RedirectionDataSerializationCluster() {} 852 virtual ~RedirectionDataSerializationCluster() {}
869 853
870 void Trace(Serializer* s, RawObject* object) { 854 void Trace(Serializer* s, RawObject* object) {
871 RawRedirectionData* data = RedirectionData::RawCast(object); 855 RawRedirectionData* data = RedirectionData::RawCast(object);
872 objects_.Add(data); 856 objects_.Add(data);
873 857
(...skipping 24 matching lines...) Expand all
898 s->WriteRef(*p); 882 s->WriteRef(*p);
899 } 883 }
900 } 884 }
901 } 885 }
902 886
903 private: 887 private:
904 GrowableArray<RawRedirectionData*> objects_; 888 GrowableArray<RawRedirectionData*> objects_;
905 }; 889 };
906 #endif // !DART_PRECOMPILED_RUNTIME 890 #endif // !DART_PRECOMPILED_RUNTIME
907 891
908
909 class RedirectionDataDeserializationCluster : public DeserializationCluster { 892 class RedirectionDataDeserializationCluster : public DeserializationCluster {
910 public: 893 public:
911 RedirectionDataDeserializationCluster() {} 894 RedirectionDataDeserializationCluster() {}
912 virtual ~RedirectionDataDeserializationCluster() {} 895 virtual ~RedirectionDataDeserializationCluster() {}
913 896
914 void ReadAlloc(Deserializer* d) { 897 void ReadAlloc(Deserializer* d) {
915 start_index_ = d->next_index(); 898 start_index_ = d->next_index();
916 PageSpace* old_space = d->heap()->old_space(); 899 PageSpace* old_space = d->heap()->old_space();
917 intptr_t count = d->Read<int32_t>(); 900 intptr_t count = d->Read<int32_t>();
918 for (intptr_t i = 0; i < count; i++) { 901 for (intptr_t i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
933 is_vm_object); 916 is_vm_object);
934 RawObject** from = data->from(); 917 RawObject** from = data->from();
935 RawObject** to = data->to(); 918 RawObject** to = data->to();
936 for (RawObject** p = from; p <= to; p++) { 919 for (RawObject** p = from; p <= to; p++) {
937 *p = d->ReadRef(); 920 *p = d->ReadRef();
938 } 921 }
939 } 922 }
940 } 923 }
941 }; 924 };
942 925
943
944 #if !defined(DART_PRECOMPILED_RUNTIME) 926 #if !defined(DART_PRECOMPILED_RUNTIME)
945 class FieldSerializationCluster : public SerializationCluster { 927 class FieldSerializationCluster : public SerializationCluster {
946 public: 928 public:
947 FieldSerializationCluster() {} 929 FieldSerializationCluster() {}
948 virtual ~FieldSerializationCluster() {} 930 virtual ~FieldSerializationCluster() {}
949 931
950 void Trace(Serializer* s, RawObject* object) { 932 void Trace(Serializer* s, RawObject* object) {
951 RawField* field = Field::RawCast(object); 933 RawField* field = Field::RawCast(object);
952 objects_.Add(field); 934 objects_.Add(field);
953 935
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 } 1025 }
1044 s->Write<uint8_t>(field->ptr()->kind_bits_); 1026 s->Write<uint8_t>(field->ptr()->kind_bits_);
1045 } 1027 }
1046 } 1028 }
1047 1029
1048 private: 1030 private:
1049 GrowableArray<RawField*> objects_; 1031 GrowableArray<RawField*> objects_;
1050 }; 1032 };
1051 #endif // !DART_PRECOMPILED_RUNTIME 1033 #endif // !DART_PRECOMPILED_RUNTIME
1052 1034
1053
1054 class FieldDeserializationCluster : public DeserializationCluster { 1035 class FieldDeserializationCluster : public DeserializationCluster {
1055 public: 1036 public:
1056 FieldDeserializationCluster() {} 1037 FieldDeserializationCluster() {}
1057 virtual ~FieldDeserializationCluster() {} 1038 virtual ~FieldDeserializationCluster() {}
1058 1039
1059 void ReadAlloc(Deserializer* d) { 1040 void ReadAlloc(Deserializer* d) {
1060 start_index_ = d->next_index(); 1041 start_index_ = d->next_index();
1061 PageSpace* old_space = d->heap()->old_space(); 1042 PageSpace* old_space = d->heap()->old_space();
1062 intptr_t count = d->Read<int32_t>(); 1043 intptr_t count = d->Read<int32_t>();
1063 for (intptr_t i = 0; i < count; i++) { 1044 for (intptr_t i = 0; i < count; i++) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 } 1090 }
1110 } else { 1091 } else {
1111 for (intptr_t i = start_index_; i < stop_index_; i++) { 1092 for (intptr_t i = start_index_; i < stop_index_; i++) {
1112 field ^= refs.At(i); 1093 field ^= refs.At(i);
1113 field.InitializeGuardedListLengthInObjectOffset(); 1094 field.InitializeGuardedListLengthInObjectOffset();
1114 } 1095 }
1115 } 1096 }
1116 } 1097 }
1117 }; 1098 };
1118 1099
1119
1120 #if !defined(DART_PRECOMPILED_RUNTIME) 1100 #if !defined(DART_PRECOMPILED_RUNTIME)
1121 class LiteralTokenSerializationCluster : public SerializationCluster { 1101 class LiteralTokenSerializationCluster : public SerializationCluster {
1122 public: 1102 public:
1123 LiteralTokenSerializationCluster() {} 1103 LiteralTokenSerializationCluster() {}
1124 virtual ~LiteralTokenSerializationCluster() {} 1104 virtual ~LiteralTokenSerializationCluster() {}
1125 1105
1126 void Trace(Serializer* s, RawObject* object) { 1106 void Trace(Serializer* s, RawObject* object) {
1127 RawLiteralToken* token = LiteralToken::RawCast(object); 1107 RawLiteralToken* token = LiteralToken::RawCast(object);
1128 objects_.Add(token); 1108 objects_.Add(token);
1129 1109
(...skipping 25 matching lines...) Expand all
1155 } 1135 }
1156 s->Write<int32_t>(token->ptr()->kind_); 1136 s->Write<int32_t>(token->ptr()->kind_);
1157 } 1137 }
1158 } 1138 }
1159 1139
1160 private: 1140 private:
1161 GrowableArray<RawLiteralToken*> objects_; 1141 GrowableArray<RawLiteralToken*> objects_;
1162 }; 1142 };
1163 #endif // !DART_PRECOMPILED_RUNTIME 1143 #endif // !DART_PRECOMPILED_RUNTIME
1164 1144
1165
1166 class LiteralTokenDeserializationCluster : public DeserializationCluster { 1145 class LiteralTokenDeserializationCluster : public DeserializationCluster {
1167 public: 1146 public:
1168 LiteralTokenDeserializationCluster() {} 1147 LiteralTokenDeserializationCluster() {}
1169 virtual ~LiteralTokenDeserializationCluster() {} 1148 virtual ~LiteralTokenDeserializationCluster() {}
1170 1149
1171 void ReadAlloc(Deserializer* d) { 1150 void ReadAlloc(Deserializer* d) {
1172 start_index_ = d->next_index(); 1151 start_index_ = d->next_index();
1173 PageSpace* old_space = d->heap()->old_space(); 1152 PageSpace* old_space = d->heap()->old_space();
1174 intptr_t count = d->Read<int32_t>(); 1153 intptr_t count = d->Read<int32_t>();
1175 for (intptr_t i = 0; i < count; i++) { 1154 for (intptr_t i = 0; i < count; i++) {
(...skipping 13 matching lines...) Expand all
1189 RawObject** from = token->from(); 1168 RawObject** from = token->from();
1190 RawObject** to = token->to(); 1169 RawObject** to = token->to();
1191 for (RawObject** p = from; p <= to; p++) { 1170 for (RawObject** p = from; p <= to; p++) {
1192 *p = d->ReadRef(); 1171 *p = d->ReadRef();
1193 } 1172 }
1194 token->ptr()->kind_ = static_cast<Token::Kind>(d->Read<int32_t>()); 1173 token->ptr()->kind_ = static_cast<Token::Kind>(d->Read<int32_t>());
1195 } 1174 }
1196 } 1175 }
1197 }; 1176 };
1198 1177
1199
1200 #if !defined(DART_PRECOMPILED_RUNTIME) 1178 #if !defined(DART_PRECOMPILED_RUNTIME)
1201 class TokenStreamSerializationCluster : public SerializationCluster { 1179 class TokenStreamSerializationCluster : public SerializationCluster {
1202 public: 1180 public:
1203 TokenStreamSerializationCluster() {} 1181 TokenStreamSerializationCluster() {}
1204 virtual ~TokenStreamSerializationCluster() {} 1182 virtual ~TokenStreamSerializationCluster() {}
1205 1183
1206 void Trace(Serializer* s, RawObject* object) { 1184 void Trace(Serializer* s, RawObject* object) {
1207 RawTokenStream* stream = TokenStream::RawCast(object); 1185 RawTokenStream* stream = TokenStream::RawCast(object);
1208 objects_.Add(stream); 1186 objects_.Add(stream);
1209 1187
(...skipping 24 matching lines...) Expand all
1234 s->WriteRef(*p); 1212 s->WriteRef(*p);
1235 } 1213 }
1236 } 1214 }
1237 } 1215 }
1238 1216
1239 private: 1217 private:
1240 GrowableArray<RawTokenStream*> objects_; 1218 GrowableArray<RawTokenStream*> objects_;
1241 }; 1219 };
1242 #endif // !DART_PRECOMPILED_RUNTIME 1220 #endif // !DART_PRECOMPILED_RUNTIME
1243 1221
1244
1245 class TokenStreamDeserializationCluster : public DeserializationCluster { 1222 class TokenStreamDeserializationCluster : public DeserializationCluster {
1246 public: 1223 public:
1247 TokenStreamDeserializationCluster() {} 1224 TokenStreamDeserializationCluster() {}
1248 virtual ~TokenStreamDeserializationCluster() {} 1225 virtual ~TokenStreamDeserializationCluster() {}
1249 1226
1250 void ReadAlloc(Deserializer* d) { 1227 void ReadAlloc(Deserializer* d) {
1251 start_index_ = d->next_index(); 1228 start_index_ = d->next_index();
1252 PageSpace* old_space = d->heap()->old_space(); 1229 PageSpace* old_space = d->heap()->old_space();
1253 intptr_t count = d->Read<int32_t>(); 1230 intptr_t count = d->Read<int32_t>();
1254 for (intptr_t i = 0; i < count; i++) { 1231 for (intptr_t i = 0; i < count; i++) {
(...skipping 12 matching lines...) Expand all
1267 TokenStream::InstanceSize(), is_vm_object); 1244 TokenStream::InstanceSize(), is_vm_object);
1268 RawObject** from = stream->from(); 1245 RawObject** from = stream->from();
1269 RawObject** to = stream->to(); 1246 RawObject** to = stream->to();
1270 for (RawObject** p = from; p <= to; p++) { 1247 for (RawObject** p = from; p <= to; p++) {
1271 *p = d->ReadRef(); 1248 *p = d->ReadRef();
1272 } 1249 }
1273 } 1250 }
1274 } 1251 }
1275 }; 1252 };
1276 1253
1277
1278 #if !defined(DART_PRECOMPILED_RUNTIME) 1254 #if !defined(DART_PRECOMPILED_RUNTIME)
1279 class ScriptSerializationCluster : public SerializationCluster { 1255 class ScriptSerializationCluster : public SerializationCluster {
1280 public: 1256 public:
1281 ScriptSerializationCluster() {} 1257 ScriptSerializationCluster() {}
1282 virtual ~ScriptSerializationCluster() {} 1258 virtual ~ScriptSerializationCluster() {}
1283 1259
1284 void Trace(Serializer* s, RawObject* object) { 1260 void Trace(Serializer* s, RawObject* object) {
1285 RawScript* script = Script::RawCast(object); 1261 RawScript* script = Script::RawCast(object);
1286 objects_.Add(script); 1262 objects_.Add(script);
1287 1263
(...skipping 29 matching lines...) Expand all
1317 s->Write<int32_t>(script->ptr()->col_offset_); 1293 s->Write<int32_t>(script->ptr()->col_offset_);
1318 s->Write<int8_t>(script->ptr()->kind_); 1294 s->Write<int8_t>(script->ptr()->kind_);
1319 } 1295 }
1320 } 1296 }
1321 1297
1322 private: 1298 private:
1323 GrowableArray<RawScript*> objects_; 1299 GrowableArray<RawScript*> objects_;
1324 }; 1300 };
1325 #endif // !DART_PRECOMPILED_RUNTIME 1301 #endif // !DART_PRECOMPILED_RUNTIME
1326 1302
1327
1328 class ScriptDeserializationCluster : public DeserializationCluster { 1303 class ScriptDeserializationCluster : public DeserializationCluster {
1329 public: 1304 public:
1330 ScriptDeserializationCluster() {} 1305 ScriptDeserializationCluster() {}
1331 virtual ~ScriptDeserializationCluster() {} 1306 virtual ~ScriptDeserializationCluster() {}
1332 1307
1333 void ReadAlloc(Deserializer* d) { 1308 void ReadAlloc(Deserializer* d) {
1334 start_index_ = d->next_index(); 1309 start_index_ = d->next_index();
1335 PageSpace* old_space = d->heap()->old_space(); 1310 PageSpace* old_space = d->heap()->old_space();
1336 intptr_t count = d->Read<int32_t>(); 1311 intptr_t count = d->Read<int32_t>();
1337 for (intptr_t i = 0; i < count; i++) { 1312 for (intptr_t i = 0; i < count; i++) {
(...skipping 21 matching lines...) Expand all
1359 } 1334 }
1360 1335
1361 script->ptr()->line_offset_ = d->Read<int32_t>(); 1336 script->ptr()->line_offset_ = d->Read<int32_t>();
1362 script->ptr()->col_offset_ = d->Read<int32_t>(); 1337 script->ptr()->col_offset_ = d->Read<int32_t>();
1363 script->ptr()->kind_ = d->Read<int8_t>(); 1338 script->ptr()->kind_ = d->Read<int8_t>();
1364 script->ptr()->load_timestamp_ = 0; 1339 script->ptr()->load_timestamp_ = 0;
1365 } 1340 }
1366 } 1341 }
1367 }; 1342 };
1368 1343
1369
1370 #if !defined(DART_PRECOMPILED_RUNTIME) 1344 #if !defined(DART_PRECOMPILED_RUNTIME)
1371 class LibrarySerializationCluster : public SerializationCluster { 1345 class LibrarySerializationCluster : public SerializationCluster {
1372 public: 1346 public:
1373 LibrarySerializationCluster() {} 1347 LibrarySerializationCluster() {}
1374 virtual ~LibrarySerializationCluster() {} 1348 virtual ~LibrarySerializationCluster() {}
1375 1349
1376 void Trace(Serializer* s, RawObject* object) { 1350 void Trace(Serializer* s, RawObject* object) {
1377 RawLibrary* lib = Library::RawCast(object); 1351 RawLibrary* lib = Library::RawCast(object);
1378 objects_.Add(lib); 1352 objects_.Add(lib);
1379 1353
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 s->Write<bool>(lib->ptr()->is_dart_scheme_); 1385 s->Write<bool>(lib->ptr()->is_dart_scheme_);
1412 s->Write<bool>(lib->ptr()->debuggable_); 1386 s->Write<bool>(lib->ptr()->debuggable_);
1413 } 1387 }
1414 } 1388 }
1415 1389
1416 private: 1390 private:
1417 GrowableArray<RawLibrary*> objects_; 1391 GrowableArray<RawLibrary*> objects_;
1418 }; 1392 };
1419 #endif // !DART_PRECOMPILED_RUNTIME 1393 #endif // !DART_PRECOMPILED_RUNTIME
1420 1394
1421
1422 class LibraryDeserializationCluster : public DeserializationCluster { 1395 class LibraryDeserializationCluster : public DeserializationCluster {
1423 public: 1396 public:
1424 LibraryDeserializationCluster() {} 1397 LibraryDeserializationCluster() {}
1425 virtual ~LibraryDeserializationCluster() {} 1398 virtual ~LibraryDeserializationCluster() {}
1426 1399
1427 void ReadAlloc(Deserializer* d) { 1400 void ReadAlloc(Deserializer* d) {
1428 start_index_ = d->next_index(); 1401 start_index_ = d->next_index();
1429 PageSpace* old_space = d->heap()->old_space(); 1402 PageSpace* old_space = d->heap()->old_space();
1430 intptr_t count = d->Read<int32_t>(); 1403 intptr_t count = d->Read<int32_t>();
1431 for (intptr_t i = 0; i < count; i++) { 1404 for (intptr_t i = 0; i < count; i++) {
(...skipping 25 matching lines...) Expand all
1457 lib->ptr()->num_imports_ = d->Read<uint16_t>(); 1430 lib->ptr()->num_imports_ = d->Read<uint16_t>();
1458 lib->ptr()->load_state_ = d->Read<int8_t>(); 1431 lib->ptr()->load_state_ = d->Read<int8_t>();
1459 lib->ptr()->corelib_imported_ = d->Read<bool>(); 1432 lib->ptr()->corelib_imported_ = d->Read<bool>();
1460 lib->ptr()->is_dart_scheme_ = d->Read<bool>(); 1433 lib->ptr()->is_dart_scheme_ = d->Read<bool>();
1461 lib->ptr()->debuggable_ = d->Read<bool>(); 1434 lib->ptr()->debuggable_ = d->Read<bool>();
1462 lib->ptr()->is_in_fullsnapshot_ = true; 1435 lib->ptr()->is_in_fullsnapshot_ = true;
1463 } 1436 }
1464 } 1437 }
1465 }; 1438 };
1466 1439
1467
1468 #if !defined(DART_PRECOMPILED_RUNTIME) 1440 #if !defined(DART_PRECOMPILED_RUNTIME)
1469 class NamespaceSerializationCluster : public SerializationCluster { 1441 class NamespaceSerializationCluster : public SerializationCluster {
1470 public: 1442 public:
1471 NamespaceSerializationCluster() {} 1443 NamespaceSerializationCluster() {}
1472 virtual ~NamespaceSerializationCluster() {} 1444 virtual ~NamespaceSerializationCluster() {}
1473 1445
1474 void Trace(Serializer* s, RawObject* object) { 1446 void Trace(Serializer* s, RawObject* object) {
1475 RawNamespace* ns = Namespace::RawCast(object); 1447 RawNamespace* ns = Namespace::RawCast(object);
1476 objects_.Add(ns); 1448 objects_.Add(ns);
1477 1449
(...skipping 24 matching lines...) Expand all
1502 s->WriteRef(*p); 1474 s->WriteRef(*p);
1503 } 1475 }
1504 } 1476 }
1505 } 1477 }
1506 1478
1507 private: 1479 private:
1508 GrowableArray<RawNamespace*> objects_; 1480 GrowableArray<RawNamespace*> objects_;
1509 }; 1481 };
1510 #endif // !DART_PRECOMPILED_RUNTIME 1482 #endif // !DART_PRECOMPILED_RUNTIME
1511 1483
1512
1513 class NamespaceDeserializationCluster : public DeserializationCluster { 1484 class NamespaceDeserializationCluster : public DeserializationCluster {
1514 public: 1485 public:
1515 NamespaceDeserializationCluster() {} 1486 NamespaceDeserializationCluster() {}
1516 virtual ~NamespaceDeserializationCluster() {} 1487 virtual ~NamespaceDeserializationCluster() {}
1517 1488
1518 void ReadAlloc(Deserializer* d) { 1489 void ReadAlloc(Deserializer* d) {
1519 start_index_ = d->next_index(); 1490 start_index_ = d->next_index();
1520 PageSpace* old_space = d->heap()->old_space(); 1491 PageSpace* old_space = d->heap()->old_space();
1521 intptr_t count = d->Read<int32_t>(); 1492 intptr_t count = d->Read<int32_t>();
1522 for (intptr_t i = 0; i < count; i++) { 1493 for (intptr_t i = 0; i < count; i++) {
(...skipping 11 matching lines...) Expand all
1534 Namespace::InstanceSize(), is_vm_object); 1505 Namespace::InstanceSize(), is_vm_object);
1535 RawObject** from = ns->from(); 1506 RawObject** from = ns->from();
1536 RawObject** to = ns->to(); 1507 RawObject** to = ns->to();
1537 for (RawObject** p = from; p <= to; p++) { 1508 for (RawObject** p = from; p <= to; p++) {
1538 *p = d->ReadRef(); 1509 *p = d->ReadRef();
1539 } 1510 }
1540 } 1511 }
1541 } 1512 }
1542 }; 1513 };
1543 1514
1544
1545 #if !defined(DART_PRECOMPILED_RUNTIME) 1515 #if !defined(DART_PRECOMPILED_RUNTIME)
1546 class CodeSerializationCluster : public SerializationCluster { 1516 class CodeSerializationCluster : public SerializationCluster {
1547 public: 1517 public:
1548 CodeSerializationCluster() {} 1518 CodeSerializationCluster() {}
1549 virtual ~CodeSerializationCluster() {} 1519 virtual ~CodeSerializationCluster() {}
1550 1520
1551 void Trace(Serializer* s, RawObject* object) { 1521 void Trace(Serializer* s, RawObject* object) {
1552 RawCode* code = Code::RawCast(object); 1522 RawCode* code = Code::RawCast(object);
1553 objects_.Add(code); 1523 objects_.Add(code);
1554 1524
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 1614
1645 s->Write<int32_t>(code->ptr()->state_bits_); 1615 s->Write<int32_t>(code->ptr()->state_bits_);
1646 } 1616 }
1647 } 1617 }
1648 1618
1649 private: 1619 private:
1650 GrowableArray<RawCode*> objects_; 1620 GrowableArray<RawCode*> objects_;
1651 }; 1621 };
1652 #endif // !DART_PRECOMPILED_RUNTIME 1622 #endif // !DART_PRECOMPILED_RUNTIME
1653 1623
1654
1655 class CodeDeserializationCluster : public DeserializationCluster { 1624 class CodeDeserializationCluster : public DeserializationCluster {
1656 public: 1625 public:
1657 CodeDeserializationCluster() {} 1626 CodeDeserializationCluster() {}
1658 virtual ~CodeDeserializationCluster() {} 1627 virtual ~CodeDeserializationCluster() {}
1659 1628
1660 void ReadAlloc(Deserializer* d) { 1629 void ReadAlloc(Deserializer* d) {
1661 start_index_ = d->next_index(); 1630 start_index_ = d->next_index();
1662 PageSpace* old_space = d->heap()->old_space(); 1631 PageSpace* old_space = d->heap()->old_space();
1663 intptr_t count = d->Read<int32_t>(); 1632 intptr_t count = d->Read<int32_t>();
1664 for (intptr_t i = 0; i < count; i++) { 1633 for (intptr_t i = 0; i < count; i++) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 code->ptr()->comments_ = Array::null(); 1708 code->ptr()->comments_ = Array::null();
1740 1709
1741 code->ptr()->compile_timestamp_ = 0; 1710 code->ptr()->compile_timestamp_ = 0;
1742 #endif // !DART_PRECOMPILED_RUNTIME 1711 #endif // !DART_PRECOMPILED_RUNTIME
1743 1712
1744 code->ptr()->state_bits_ = d->Read<int32_t>(); 1713 code->ptr()->state_bits_ = d->Read<int32_t>();
1745 } 1714 }
1746 } 1715 }
1747 }; 1716 };
1748 1717
1749
1750 #if !defined(DART_PRECOMPILED_RUNTIME) 1718 #if !defined(DART_PRECOMPILED_RUNTIME)
1751 class ObjectPoolSerializationCluster : public SerializationCluster { 1719 class ObjectPoolSerializationCluster : public SerializationCluster {
1752 public: 1720 public:
1753 ObjectPoolSerializationCluster() {} 1721 ObjectPoolSerializationCluster() {}
1754 virtual ~ObjectPoolSerializationCluster() {} 1722 virtual ~ObjectPoolSerializationCluster() {}
1755 1723
1756 void Trace(Serializer* s, RawObject* object) { 1724 void Trace(Serializer* s, RawObject* object) {
1757 RawObjectPool* pool = ObjectPool::RawCast(object); 1725 RawObjectPool* pool = ObjectPool::RawCast(object);
1758 objects_.Add(pool); 1726 objects_.Add(pool);
1759 1727
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 } 1796 }
1829 } 1797 }
1830 } 1798 }
1831 } 1799 }
1832 1800
1833 private: 1801 private:
1834 GrowableArray<RawObjectPool*> objects_; 1802 GrowableArray<RawObjectPool*> objects_;
1835 }; 1803 };
1836 #endif // !DART_PRECOMPILED_RUNTIME 1804 #endif // !DART_PRECOMPILED_RUNTIME
1837 1805
1838
1839 class ObjectPoolDeserializationCluster : public DeserializationCluster { 1806 class ObjectPoolDeserializationCluster : public DeserializationCluster {
1840 public: 1807 public:
1841 ObjectPoolDeserializationCluster() {} 1808 ObjectPoolDeserializationCluster() {}
1842 virtual ~ObjectPoolDeserializationCluster() {} 1809 virtual ~ObjectPoolDeserializationCluster() {}
1843 1810
1844 void ReadAlloc(Deserializer* d) { 1811 void ReadAlloc(Deserializer* d) {
1845 start_index_ = d->next_index(); 1812 start_index_ = d->next_index();
1846 PageSpace* old_space = d->heap()->old_space(); 1813 PageSpace* old_space = d->heap()->old_space();
1847 intptr_t count = d->Read<int32_t>(); 1814 intptr_t count = d->Read<int32_t>();
1848 for (intptr_t i = 0; i < count; i++) { 1815 for (intptr_t i = 0; i < count; i++) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1892 break; 1859 break;
1893 } 1860 }
1894 default: 1861 default:
1895 UNREACHABLE(); 1862 UNREACHABLE();
1896 } 1863 }
1897 } 1864 }
1898 } 1865 }
1899 } 1866 }
1900 }; 1867 };
1901 1868
1902
1903 #if !defined(DART_PRECOMPILED_RUNTIME) 1869 #if !defined(DART_PRECOMPILED_RUNTIME)
1904 // PcDescriptor, StackMap, OneByteString, TwoByteString 1870 // PcDescriptor, StackMap, OneByteString, TwoByteString
1905 class RODataSerializationCluster : public SerializationCluster { 1871 class RODataSerializationCluster : public SerializationCluster {
1906 public: 1872 public:
1907 explicit RODataSerializationCluster(intptr_t cid) : cid_(cid) {} 1873 explicit RODataSerializationCluster(intptr_t cid) : cid_(cid) {}
1908 virtual ~RODataSerializationCluster() {} 1874 virtual ~RODataSerializationCluster() {}
1909 1875
1910 void Trace(Serializer* s, RawObject* object) { 1876 void Trace(Serializer* s, RawObject* object) {
1911 objects_.Add(object); 1877 objects_.Add(object);
1912 1878
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 void WriteFill(Serializer* s) { 1912 void WriteFill(Serializer* s) {
1947 // No-op. 1913 // No-op.
1948 } 1914 }
1949 1915
1950 private: 1916 private:
1951 const intptr_t cid_; 1917 const intptr_t cid_;
1952 GrowableArray<RawObject*> objects_; 1918 GrowableArray<RawObject*> objects_;
1953 }; 1919 };
1954 #endif // !DART_PRECOMPILED_RUNTIME 1920 #endif // !DART_PRECOMPILED_RUNTIME
1955 1921
1956
1957 class RODataDeserializationCluster : public DeserializationCluster { 1922 class RODataDeserializationCluster : public DeserializationCluster {
1958 public: 1923 public:
1959 RODataDeserializationCluster() {} 1924 RODataDeserializationCluster() {}
1960 virtual ~RODataDeserializationCluster() {} 1925 virtual ~RODataDeserializationCluster() {}
1961 1926
1962 void ReadAlloc(Deserializer* d) { 1927 void ReadAlloc(Deserializer* d) {
1963 intptr_t count = d->Read<int32_t>(); 1928 intptr_t count = d->Read<int32_t>();
1964 for (intptr_t i = 0; i < count; i++) { 1929 for (intptr_t i = 0; i < count; i++) {
1965 int32_t rodata_offset = d->Read<int32_t>(); 1930 int32_t rodata_offset = d->Read<int32_t>();
1966 d->AssignRef(d->GetObjectAt(rodata_offset)); 1931 d->AssignRef(d->GetObjectAt(rodata_offset));
1967 } 1932 }
1968 } 1933 }
1969 1934
1970 void ReadFill(Deserializer* d) { 1935 void ReadFill(Deserializer* d) {
1971 // No-op. 1936 // No-op.
1972 } 1937 }
1973 }; 1938 };
1974 1939
1975
1976 #if !defined(DART_PRECOMPILED_RUNTIME) 1940 #if !defined(DART_PRECOMPILED_RUNTIME)
1977 class ExceptionHandlersSerializationCluster : public SerializationCluster { 1941 class ExceptionHandlersSerializationCluster : public SerializationCluster {
1978 public: 1942 public:
1979 ExceptionHandlersSerializationCluster() {} 1943 ExceptionHandlersSerializationCluster() {}
1980 virtual ~ExceptionHandlersSerializationCluster() {} 1944 virtual ~ExceptionHandlersSerializationCluster() {}
1981 1945
1982 void Trace(Serializer* s, RawObject* object) { 1946 void Trace(Serializer* s, RawObject* object) {
1983 RawExceptionHandlers* handlers = ExceptionHandlers::RawCast(object); 1947 RawExceptionHandlers* handlers = ExceptionHandlers::RawCast(object);
1984 objects_.Add(handlers); 1948 objects_.Add(handlers);
1985 1949
(...skipping 24 matching lines...) Expand all
2010 intptr_t length_in_bytes = length * sizeof(ExceptionHandlerInfo); 1974 intptr_t length_in_bytes = length * sizeof(ExceptionHandlerInfo);
2011 s->WriteBytes(data, length_in_bytes); 1975 s->WriteBytes(data, length_in_bytes);
2012 } 1976 }
2013 } 1977 }
2014 1978
2015 private: 1979 private:
2016 GrowableArray<RawExceptionHandlers*> objects_; 1980 GrowableArray<RawExceptionHandlers*> objects_;
2017 }; 1981 };
2018 #endif // !DART_PRECOMPILED_RUNTIME 1982 #endif // !DART_PRECOMPILED_RUNTIME
2019 1983
2020
2021 class ExceptionHandlersDeserializationCluster : public DeserializationCluster { 1984 class ExceptionHandlersDeserializationCluster : public DeserializationCluster {
2022 public: 1985 public:
2023 ExceptionHandlersDeserializationCluster() {} 1986 ExceptionHandlersDeserializationCluster() {}
2024 virtual ~ExceptionHandlersDeserializationCluster() {} 1987 virtual ~ExceptionHandlersDeserializationCluster() {}
2025 1988
2026 void ReadAlloc(Deserializer* d) { 1989 void ReadAlloc(Deserializer* d) {
2027 start_index_ = d->next_index(); 1990 start_index_ = d->next_index();
2028 PageSpace* old_space = d->heap()->old_space(); 1991 PageSpace* old_space = d->heap()->old_space();
2029 intptr_t count = d->Read<int32_t>(); 1992 intptr_t count = d->Read<int32_t>();
2030 for (intptr_t i = 0; i < count; i++) { 1993 for (intptr_t i = 0; i < count; i++) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 s->WriteRef(context->ptr()->data()[j]); 2059 s->WriteRef(context->ptr()->data()[j]);
2097 } 2060 }
2098 } 2061 }
2099 } 2062 }
2100 2063
2101 private: 2064 private:
2102 GrowableArray<RawContext*> objects_; 2065 GrowableArray<RawContext*> objects_;
2103 }; 2066 };
2104 #endif // !DART_PRECOMPILED_RUNTIME 2067 #endif // !DART_PRECOMPILED_RUNTIME
2105 2068
2106
2107 class ContextDeserializationCluster : public DeserializationCluster { 2069 class ContextDeserializationCluster : public DeserializationCluster {
2108 public: 2070 public:
2109 ContextDeserializationCluster() {} 2071 ContextDeserializationCluster() {}
2110 virtual ~ContextDeserializationCluster() {} 2072 virtual ~ContextDeserializationCluster() {}
2111 2073
2112 void ReadAlloc(Deserializer* d) { 2074 void ReadAlloc(Deserializer* d) {
2113 start_index_ = d->next_index(); 2075 start_index_ = d->next_index();
2114 PageSpace* old_space = d->heap()->old_space(); 2076 PageSpace* old_space = d->heap()->old_space();
2115 intptr_t count = d->Read<int32_t>(); 2077 intptr_t count = d->Read<int32_t>();
2116 for (intptr_t i = 0; i < count; i++) { 2078 for (intptr_t i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
2131 context, kContextCid, Context::InstanceSize(length), is_vm_object); 2093 context, kContextCid, Context::InstanceSize(length), is_vm_object);
2132 context->ptr()->num_variables_ = length; 2094 context->ptr()->num_variables_ = length;
2133 context->ptr()->parent_ = reinterpret_cast<RawContext*>(d->ReadRef()); 2095 context->ptr()->parent_ = reinterpret_cast<RawContext*>(d->ReadRef());
2134 for (intptr_t j = 0; j < length; j++) { 2096 for (intptr_t j = 0; j < length; j++) {
2135 context->ptr()->data()[j] = d->ReadRef(); 2097 context->ptr()->data()[j] = d->ReadRef();
2136 } 2098 }
2137 } 2099 }
2138 } 2100 }
2139 }; 2101 };
2140 2102
2141
2142 #if !defined(DART_PRECOMPILED_RUNTIME) 2103 #if !defined(DART_PRECOMPILED_RUNTIME)
2143 class ContextScopeSerializationCluster : public SerializationCluster { 2104 class ContextScopeSerializationCluster : public SerializationCluster {
2144 public: 2105 public:
2145 ContextScopeSerializationCluster() {} 2106 ContextScopeSerializationCluster() {}
2146 virtual ~ContextScopeSerializationCluster() {} 2107 virtual ~ContextScopeSerializationCluster() {}
2147 2108
2148 void Trace(Serializer* s, RawObject* object) { 2109 void Trace(Serializer* s, RawObject* object) {
2149 RawContextScope* scope = ContextScope::RawCast(object); 2110 RawContextScope* scope = ContextScope::RawCast(object);
2150 objects_.Add(scope); 2111 objects_.Add(scope);
2151 2112
(...skipping 30 matching lines...) Expand all
2182 s->WriteRef(*p); 2143 s->WriteRef(*p);
2183 } 2144 }
2184 } 2145 }
2185 } 2146 }
2186 2147
2187 private: 2148 private:
2188 GrowableArray<RawContextScope*> objects_; 2149 GrowableArray<RawContextScope*> objects_;
2189 }; 2150 };
2190 #endif // !DART_PRECOMPILED_RUNTIME 2151 #endif // !DART_PRECOMPILED_RUNTIME
2191 2152
2192
2193 class ContextScopeDeserializationCluster : public DeserializationCluster { 2153 class ContextScopeDeserializationCluster : public DeserializationCluster {
2194 public: 2154 public:
2195 ContextScopeDeserializationCluster() {} 2155 ContextScopeDeserializationCluster() {}
2196 virtual ~ContextScopeDeserializationCluster() {} 2156 virtual ~ContextScopeDeserializationCluster() {}
2197 2157
2198 void ReadAlloc(Deserializer* d) { 2158 void ReadAlloc(Deserializer* d) {
2199 start_index_ = d->next_index(); 2159 start_index_ = d->next_index();
2200 PageSpace* old_space = d->heap()->old_space(); 2160 PageSpace* old_space = d->heap()->old_space();
2201 intptr_t count = d->Read<int32_t>(); 2161 intptr_t count = d->Read<int32_t>();
2202 for (intptr_t i = 0; i < count; i++) { 2162 for (intptr_t i = 0; i < count; i++) {
(...skipping 17 matching lines...) Expand all
2220 scope->ptr()->is_implicit_ = d->Read<bool>(); 2180 scope->ptr()->is_implicit_ = d->Read<bool>();
2221 RawObject** from = scope->from(); 2181 RawObject** from = scope->from();
2222 RawObject** to = scope->to(length); 2182 RawObject** to = scope->to(length);
2223 for (RawObject** p = from; p <= to; p++) { 2183 for (RawObject** p = from; p <= to; p++) {
2224 *p = d->ReadRef(); 2184 *p = d->ReadRef();
2225 } 2185 }
2226 } 2186 }
2227 } 2187 }
2228 }; 2188 };
2229 2189
2230
2231 #if !defined(DART_PRECOMPILED_RUNTIME) 2190 #if !defined(DART_PRECOMPILED_RUNTIME)
2232 class UnlinkedCallSerializationCluster : public SerializationCluster { 2191 class UnlinkedCallSerializationCluster : public SerializationCluster {
2233 public: 2192 public:
2234 UnlinkedCallSerializationCluster() {} 2193 UnlinkedCallSerializationCluster() {}
2235 virtual ~UnlinkedCallSerializationCluster() {} 2194 virtual ~UnlinkedCallSerializationCluster() {}
2236 2195
2237 void Trace(Serializer* s, RawObject* object) { 2196 void Trace(Serializer* s, RawObject* object) {
2238 RawUnlinkedCall* unlinked = UnlinkedCall::RawCast(object); 2197 RawUnlinkedCall* unlinked = UnlinkedCall::RawCast(object);
2239 objects_.Add(unlinked); 2198 objects_.Add(unlinked);
2240 2199
(...skipping 24 matching lines...) Expand all
2265 s->WriteRef(*p); 2224 s->WriteRef(*p);
2266 } 2225 }
2267 } 2226 }
2268 } 2227 }
2269 2228
2270 private: 2229 private:
2271 GrowableArray<RawUnlinkedCall*> objects_; 2230 GrowableArray<RawUnlinkedCall*> objects_;
2272 }; 2231 };
2273 #endif // !DART_PRECOMPILED_RUNTIME 2232 #endif // !DART_PRECOMPILED_RUNTIME
2274 2233
2275
2276 class UnlinkedCallDeserializationCluster : public DeserializationCluster { 2234 class UnlinkedCallDeserializationCluster : public DeserializationCluster {
2277 public: 2235 public:
2278 UnlinkedCallDeserializationCluster() {} 2236 UnlinkedCallDeserializationCluster() {}
2279 virtual ~UnlinkedCallDeserializationCluster() {} 2237 virtual ~UnlinkedCallDeserializationCluster() {}
2280 2238
2281 void ReadAlloc(Deserializer* d) { 2239 void ReadAlloc(Deserializer* d) {
2282 start_index_ = d->next_index(); 2240 start_index_ = d->next_index();
2283 PageSpace* old_space = d->heap()->old_space(); 2241 PageSpace* old_space = d->heap()->old_space();
2284 intptr_t count = d->Read<int32_t>(); 2242 intptr_t count = d->Read<int32_t>();
2285 for (intptr_t i = 0; i < count; i++) { 2243 for (intptr_t i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
2300 is_vm_object); 2258 is_vm_object);
2301 RawObject** from = unlinked->from(); 2259 RawObject** from = unlinked->from();
2302 RawObject** to = unlinked->to(); 2260 RawObject** to = unlinked->to();
2303 for (RawObject** p = from; p <= to; p++) { 2261 for (RawObject** p = from; p <= to; p++) {
2304 *p = d->ReadRef(); 2262 *p = d->ReadRef();
2305 } 2263 }
2306 } 2264 }
2307 } 2265 }
2308 }; 2266 };
2309 2267
2310
2311 #if !defined(DART_PRECOMPILED_RUNTIME) 2268 #if !defined(DART_PRECOMPILED_RUNTIME)
2312 class ICDataSerializationCluster : public SerializationCluster { 2269 class ICDataSerializationCluster : public SerializationCluster {
2313 public: 2270 public:
2314 ICDataSerializationCluster() {} 2271 ICDataSerializationCluster() {}
2315 virtual ~ICDataSerializationCluster() {} 2272 virtual ~ICDataSerializationCluster() {}
2316 2273
2317 void Trace(Serializer* s, RawObject* object) { 2274 void Trace(Serializer* s, RawObject* object) {
2318 RawICData* ic = ICData::RawCast(object); 2275 RawICData* ic = ICData::RawCast(object);
2319 objects_.Add(ic); 2276 objects_.Add(ic);
2320 2277
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 s->Write<int32_t>(ic->ptr()->tag_); 2310 s->Write<int32_t>(ic->ptr()->tag_);
2354 #endif 2311 #endif
2355 } 2312 }
2356 } 2313 }
2357 2314
2358 private: 2315 private:
2359 GrowableArray<RawICData*> objects_; 2316 GrowableArray<RawICData*> objects_;
2360 }; 2317 };
2361 #endif // !DART_PRECOMPILED_RUNTIME 2318 #endif // !DART_PRECOMPILED_RUNTIME
2362 2319
2363
2364 class ICDataDeserializationCluster : public DeserializationCluster { 2320 class ICDataDeserializationCluster : public DeserializationCluster {
2365 public: 2321 public:
2366 ICDataDeserializationCluster() {} 2322 ICDataDeserializationCluster() {}
2367 virtual ~ICDataDeserializationCluster() {} 2323 virtual ~ICDataDeserializationCluster() {}
2368 2324
2369 void ReadAlloc(Deserializer* d) { 2325 void ReadAlloc(Deserializer* d) {
2370 start_index_ = d->next_index(); 2326 start_index_ = d->next_index();
2371 PageSpace* old_space = d->heap()->old_space(); 2327 PageSpace* old_space = d->heap()->old_space();
2372 intptr_t count = d->Read<int32_t>(); 2328 intptr_t count = d->Read<int32_t>();
2373 for (intptr_t i = 0; i < count; i++) { 2329 for (intptr_t i = 0; i < count; i++) {
(...skipping 21 matching lines...) Expand all
2395 } 2351 }
2396 NOT_IN_PRECOMPILED(ic->ptr()->deopt_id_ = d->Read<int32_t>()); 2352 NOT_IN_PRECOMPILED(ic->ptr()->deopt_id_ = d->Read<int32_t>());
2397 ic->ptr()->state_bits_ = d->Read<int32_t>(); 2353 ic->ptr()->state_bits_ = d->Read<int32_t>();
2398 #if defined(TAG_IC_DATA) 2354 #if defined(TAG_IC_DATA)
2399 ic->ptr()->tag_ = d->Read<int32_t>(); 2355 ic->ptr()->tag_ = d->Read<int32_t>();
2400 #endif 2356 #endif
2401 } 2357 }
2402 } 2358 }
2403 }; 2359 };
2404 2360
2405
2406 #if !defined(DART_PRECOMPILED_RUNTIME) 2361 #if !defined(DART_PRECOMPILED_RUNTIME)
2407 class MegamorphicCacheSerializationCluster : public SerializationCluster { 2362 class MegamorphicCacheSerializationCluster : public SerializationCluster {
2408 public: 2363 public:
2409 MegamorphicCacheSerializationCluster() {} 2364 MegamorphicCacheSerializationCluster() {}
2410 virtual ~MegamorphicCacheSerializationCluster() {} 2365 virtual ~MegamorphicCacheSerializationCluster() {}
2411 2366
2412 void Trace(Serializer* s, RawObject* object) { 2367 void Trace(Serializer* s, RawObject* object) {
2413 RawMegamorphicCache* cache = MegamorphicCache::RawCast(object); 2368 RawMegamorphicCache* cache = MegamorphicCache::RawCast(object);
2414 objects_.Add(cache); 2369 objects_.Add(cache);
2415 2370
(...skipping 25 matching lines...) Expand all
2441 } 2396 }
2442 s->Write<int32_t>(cache->ptr()->filled_entry_count_); 2397 s->Write<int32_t>(cache->ptr()->filled_entry_count_);
2443 } 2398 }
2444 } 2399 }
2445 2400
2446 private: 2401 private:
2447 GrowableArray<RawMegamorphicCache*> objects_; 2402 GrowableArray<RawMegamorphicCache*> objects_;
2448 }; 2403 };
2449 #endif // !DART_PRECOMPILED_RUNTIME 2404 #endif // !DART_PRECOMPILED_RUNTIME
2450 2405
2451
2452 class MegamorphicCacheDeserializationCluster : public DeserializationCluster { 2406 class MegamorphicCacheDeserializationCluster : public DeserializationCluster {
2453 public: 2407 public:
2454 MegamorphicCacheDeserializationCluster() {} 2408 MegamorphicCacheDeserializationCluster() {}
2455 virtual ~MegamorphicCacheDeserializationCluster() {} 2409 virtual ~MegamorphicCacheDeserializationCluster() {}
2456 2410
2457 void ReadAlloc(Deserializer* d) { 2411 void ReadAlloc(Deserializer* d) {
2458 start_index_ = d->next_index(); 2412 start_index_ = d->next_index();
2459 PageSpace* old_space = d->heap()->old_space(); 2413 PageSpace* old_space = d->heap()->old_space();
2460 intptr_t count = d->Read<int32_t>(); 2414 intptr_t count = d->Read<int32_t>();
2461 for (intptr_t i = 0; i < count; i++) { 2415 for (intptr_t i = 0; i < count; i++) {
(...skipping 15 matching lines...) Expand all
2477 RawObject** from = cache->from(); 2431 RawObject** from = cache->from();
2478 RawObject** to = cache->to(); 2432 RawObject** to = cache->to();
2479 for (RawObject** p = from; p <= to; p++) { 2433 for (RawObject** p = from; p <= to; p++) {
2480 *p = d->ReadRef(); 2434 *p = d->ReadRef();
2481 } 2435 }
2482 cache->ptr()->filled_entry_count_ = d->Read<int32_t>(); 2436 cache->ptr()->filled_entry_count_ = d->Read<int32_t>();
2483 } 2437 }
2484 } 2438 }
2485 }; 2439 };
2486 2440
2487
2488 #if !defined(DART_PRECOMPILED_RUNTIME) 2441 #if !defined(DART_PRECOMPILED_RUNTIME)
2489 class SubtypeTestCacheSerializationCluster : public SerializationCluster { 2442 class SubtypeTestCacheSerializationCluster : public SerializationCluster {
2490 public: 2443 public:
2491 SubtypeTestCacheSerializationCluster() {} 2444 SubtypeTestCacheSerializationCluster() {}
2492 virtual ~SubtypeTestCacheSerializationCluster() {} 2445 virtual ~SubtypeTestCacheSerializationCluster() {}
2493 2446
2494 void Trace(Serializer* s, RawObject* object) { 2447 void Trace(Serializer* s, RawObject* object) {
2495 RawSubtypeTestCache* cache = SubtypeTestCache::RawCast(object); 2448 RawSubtypeTestCache* cache = SubtypeTestCache::RawCast(object);
2496 objects_.Add(cache); 2449 objects_.Add(cache);
2497 s->Push(cache->ptr()->cache_); 2450 s->Push(cache->ptr()->cache_);
(...skipping 15 matching lines...) Expand all
2513 RawSubtypeTestCache* cache = objects_[i]; 2466 RawSubtypeTestCache* cache = objects_[i];
2514 s->WriteRef(cache->ptr()->cache_); 2467 s->WriteRef(cache->ptr()->cache_);
2515 } 2468 }
2516 } 2469 }
2517 2470
2518 private: 2471 private:
2519 GrowableArray<RawSubtypeTestCache*> objects_; 2472 GrowableArray<RawSubtypeTestCache*> objects_;
2520 }; 2473 };
2521 #endif // !DART_PRECOMPILED_RUNTIME 2474 #endif // !DART_PRECOMPILED_RUNTIME
2522 2475
2523
2524 class SubtypeTestCacheDeserializationCluster : public DeserializationCluster { 2476 class SubtypeTestCacheDeserializationCluster : public DeserializationCluster {
2525 public: 2477 public:
2526 SubtypeTestCacheDeserializationCluster() {} 2478 SubtypeTestCacheDeserializationCluster() {}
2527 virtual ~SubtypeTestCacheDeserializationCluster() {} 2479 virtual ~SubtypeTestCacheDeserializationCluster() {}
2528 2480
2529 void ReadAlloc(Deserializer* d) { 2481 void ReadAlloc(Deserializer* d) {
2530 start_index_ = d->next_index(); 2482 start_index_ = d->next_index();
2531 PageSpace* old_space = d->heap()->old_space(); 2483 PageSpace* old_space = d->heap()->old_space();
2532 intptr_t count = d->Read<int32_t>(); 2484 intptr_t count = d->Read<int32_t>();
2533 for (intptr_t i = 0; i < count; i++) { 2485 for (intptr_t i = 0; i < count; i++) {
(...skipping 10 matching lines...) Expand all
2544 RawSubtypeTestCache* cache = 2496 RawSubtypeTestCache* cache =
2545 reinterpret_cast<RawSubtypeTestCache*>(d->Ref(id)); 2497 reinterpret_cast<RawSubtypeTestCache*>(d->Ref(id));
2546 Deserializer::InitializeHeader(cache, kSubtypeTestCacheCid, 2498 Deserializer::InitializeHeader(cache, kSubtypeTestCacheCid,
2547 SubtypeTestCache::InstanceSize(), 2499 SubtypeTestCache::InstanceSize(),
2548 is_vm_object); 2500 is_vm_object);
2549 cache->ptr()->cache_ = reinterpret_cast<RawArray*>(d->ReadRef()); 2501 cache->ptr()->cache_ = reinterpret_cast<RawArray*>(d->ReadRef());
2550 } 2502 }
2551 } 2503 }
2552 }; 2504 };
2553 2505
2554
2555 #if !defined(DART_PRECOMPILED_RUNTIME) 2506 #if !defined(DART_PRECOMPILED_RUNTIME)
2556 class LanguageErrorSerializationCluster : public SerializationCluster { 2507 class LanguageErrorSerializationCluster : public SerializationCluster {
2557 public: 2508 public:
2558 LanguageErrorSerializationCluster() {} 2509 LanguageErrorSerializationCluster() {}
2559 virtual ~LanguageErrorSerializationCluster() {} 2510 virtual ~LanguageErrorSerializationCluster() {}
2560 2511
2561 void Trace(Serializer* s, RawObject* object) { 2512 void Trace(Serializer* s, RawObject* object) {
2562 RawLanguageError* error = LanguageError::RawCast(object); 2513 RawLanguageError* error = LanguageError::RawCast(object);
2563 objects_.Add(error); 2514 objects_.Add(error);
2564 2515
(...skipping 27 matching lines...) Expand all
2592 s->Write<bool>(error->ptr()->report_after_token_); 2543 s->Write<bool>(error->ptr()->report_after_token_);
2593 s->Write<int8_t>(error->ptr()->kind_); 2544 s->Write<int8_t>(error->ptr()->kind_);
2594 } 2545 }
2595 } 2546 }
2596 2547
2597 private: 2548 private:
2598 GrowableArray<RawLanguageError*> objects_; 2549 GrowableArray<RawLanguageError*> objects_;
2599 }; 2550 };
2600 #endif // !DART_PRECOMPILED_RUNTIME 2551 #endif // !DART_PRECOMPILED_RUNTIME
2601 2552
2602
2603 class LanguageErrorDeserializationCluster : public DeserializationCluster { 2553 class LanguageErrorDeserializationCluster : public DeserializationCluster {
2604 public: 2554 public:
2605 LanguageErrorDeserializationCluster() {} 2555 LanguageErrorDeserializationCluster() {}
2606 virtual ~LanguageErrorDeserializationCluster() {} 2556 virtual ~LanguageErrorDeserializationCluster() {}
2607 2557
2608 void ReadAlloc(Deserializer* d) { 2558 void ReadAlloc(Deserializer* d) {
2609 start_index_ = d->next_index(); 2559 start_index_ = d->next_index();
2610 PageSpace* old_space = d->heap()->old_space(); 2560 PageSpace* old_space = d->heap()->old_space();
2611 intptr_t count = d->Read<int32_t>(); 2561 intptr_t count = d->Read<int32_t>();
2612 for (intptr_t i = 0; i < count; i++) { 2562 for (intptr_t i = 0; i < count; i++) {
(...skipping 16 matching lines...) Expand all
2629 for (RawObject** p = from; p <= to; p++) { 2579 for (RawObject** p = from; p <= to; p++) {
2630 *p = d->ReadRef(); 2580 *p = d->ReadRef();
2631 } 2581 }
2632 error->ptr()->token_pos_ = d->ReadTokenPosition(); 2582 error->ptr()->token_pos_ = d->ReadTokenPosition();
2633 error->ptr()->report_after_token_ = d->Read<bool>(); 2583 error->ptr()->report_after_token_ = d->Read<bool>();
2634 error->ptr()->kind_ = d->Read<int8_t>(); 2584 error->ptr()->kind_ = d->Read<int8_t>();
2635 } 2585 }
2636 } 2586 }
2637 }; 2587 };
2638 2588
2639
2640 #if !defined(DART_PRECOMPILED_RUNTIME) 2589 #if !defined(DART_PRECOMPILED_RUNTIME)
2641 class UnhandledExceptionSerializationCluster : public SerializationCluster { 2590 class UnhandledExceptionSerializationCluster : public SerializationCluster {
2642 public: 2591 public:
2643 UnhandledExceptionSerializationCluster() {} 2592 UnhandledExceptionSerializationCluster() {}
2644 virtual ~UnhandledExceptionSerializationCluster() {} 2593 virtual ~UnhandledExceptionSerializationCluster() {}
2645 2594
2646 void Trace(Serializer* s, RawObject* object) { 2595 void Trace(Serializer* s, RawObject* object) {
2647 RawUnhandledException* exception = UnhandledException::RawCast(object); 2596 RawUnhandledException* exception = UnhandledException::RawCast(object);
2648 objects_.Add(exception); 2597 objects_.Add(exception);
2649 2598
(...skipping 24 matching lines...) Expand all
2674 s->WriteRef(*p); 2623 s->WriteRef(*p);
2675 } 2624 }
2676 } 2625 }
2677 } 2626 }
2678 2627
2679 private: 2628 private:
2680 GrowableArray<RawUnhandledException*> objects_; 2629 GrowableArray<RawUnhandledException*> objects_;
2681 }; 2630 };
2682 #endif // !DART_PRECOMPILED_RUNTIME 2631 #endif // !DART_PRECOMPILED_RUNTIME
2683 2632
2684
2685 class UnhandledExceptionDeserializationCluster : public DeserializationCluster { 2633 class UnhandledExceptionDeserializationCluster : public DeserializationCluster {
2686 public: 2634 public:
2687 UnhandledExceptionDeserializationCluster() {} 2635 UnhandledExceptionDeserializationCluster() {}
2688 virtual ~UnhandledExceptionDeserializationCluster() {} 2636 virtual ~UnhandledExceptionDeserializationCluster() {}
2689 2637
2690 void ReadAlloc(Deserializer* d) { 2638 void ReadAlloc(Deserializer* d) {
2691 start_index_ = d->next_index(); 2639 start_index_ = d->next_index();
2692 PageSpace* old_space = d->heap()->old_space(); 2640 PageSpace* old_space = d->heap()->old_space();
2693 intptr_t count = d->Read<int32_t>(); 2641 intptr_t count = d->Read<int32_t>();
2694 for (intptr_t i = 0; i < count; i++) { 2642 for (intptr_t i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
2709 is_vm_object); 2657 is_vm_object);
2710 RawObject** from = exception->from(); 2658 RawObject** from = exception->from();
2711 RawObject** to = exception->to(); 2659 RawObject** to = exception->to();
2712 for (RawObject** p = from; p <= to; p++) { 2660 for (RawObject** p = from; p <= to; p++) {
2713 *p = d->ReadRef(); 2661 *p = d->ReadRef();
2714 } 2662 }
2715 } 2663 }
2716 } 2664 }
2717 }; 2665 };
2718 2666
2719
2720 #if !defined(DART_PRECOMPILED_RUNTIME) 2667 #if !defined(DART_PRECOMPILED_RUNTIME)
2721 class InstanceSerializationCluster : public SerializationCluster { 2668 class InstanceSerializationCluster : public SerializationCluster {
2722 public: 2669 public:
2723 explicit InstanceSerializationCluster(intptr_t cid) : cid_(cid) { 2670 explicit InstanceSerializationCluster(intptr_t cid) : cid_(cid) {
2724 RawClass* cls = Isolate::Current()->class_table()->At(cid); 2671 RawClass* cls = Isolate::Current()->class_table()->At(cid);
2725 next_field_offset_in_words_ = cls->ptr()->next_field_offset_in_words_; 2672 next_field_offset_in_words_ = cls->ptr()->next_field_offset_in_words_;
2726 instance_size_in_words_ = cls->ptr()->instance_size_in_words_; 2673 instance_size_in_words_ = cls->ptr()->instance_size_in_words_;
2727 ASSERT(next_field_offset_in_words_ > 0); 2674 ASSERT(next_field_offset_in_words_ > 0);
2728 ASSERT(instance_size_in_words_ > 0); 2675 ASSERT(instance_size_in_words_ > 0);
2729 } 2676 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2774 } 2721 }
2775 2722
2776 private: 2723 private:
2777 const intptr_t cid_; 2724 const intptr_t cid_;
2778 intptr_t next_field_offset_in_words_; 2725 intptr_t next_field_offset_in_words_;
2779 intptr_t instance_size_in_words_; 2726 intptr_t instance_size_in_words_;
2780 GrowableArray<RawInstance*> objects_; 2727 GrowableArray<RawInstance*> objects_;
2781 }; 2728 };
2782 #endif // !DART_PRECOMPILED_RUNTIME 2729 #endif // !DART_PRECOMPILED_RUNTIME
2783 2730
2784
2785 class InstanceDeserializationCluster : public DeserializationCluster { 2731 class InstanceDeserializationCluster : public DeserializationCluster {
2786 public: 2732 public:
2787 explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) {} 2733 explicit InstanceDeserializationCluster(intptr_t cid) : cid_(cid) {}
2788 virtual ~InstanceDeserializationCluster() {} 2734 virtual ~InstanceDeserializationCluster() {}
2789 2735
2790 void ReadAlloc(Deserializer* d) { 2736 void ReadAlloc(Deserializer* d) {
2791 start_index_ = d->next_index(); 2737 start_index_ = d->next_index();
2792 PageSpace* old_space = d->heap()->old_space(); 2738 PageSpace* old_space = d->heap()->old_space();
2793 intptr_t count = d->Read<int32_t>(); 2739 intptr_t count = d->Read<int32_t>();
2794 next_field_offset_in_words_ = d->Read<int32_t>(); 2740 next_field_offset_in_words_ = d->Read<int32_t>();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2828 ASSERT(offset == instance_size); 2774 ASSERT(offset == instance_size);
2829 } 2775 }
2830 } 2776 }
2831 2777
2832 private: 2778 private:
2833 const intptr_t cid_; 2779 const intptr_t cid_;
2834 intptr_t next_field_offset_in_words_; 2780 intptr_t next_field_offset_in_words_;
2835 intptr_t instance_size_in_words_; 2781 intptr_t instance_size_in_words_;
2836 }; 2782 };
2837 2783
2838
2839 #if !defined(DART_PRECOMPILED_RUNTIME) 2784 #if !defined(DART_PRECOMPILED_RUNTIME)
2840 class LibraryPrefixSerializationCluster : public SerializationCluster { 2785 class LibraryPrefixSerializationCluster : public SerializationCluster {
2841 public: 2786 public:
2842 LibraryPrefixSerializationCluster() {} 2787 LibraryPrefixSerializationCluster() {}
2843 virtual ~LibraryPrefixSerializationCluster() {} 2788 virtual ~LibraryPrefixSerializationCluster() {}
2844 2789
2845 void Trace(Serializer* s, RawObject* object) { 2790 void Trace(Serializer* s, RawObject* object) {
2846 RawLibraryPrefix* prefix = LibraryPrefix::RawCast(object); 2791 RawLibraryPrefix* prefix = LibraryPrefix::RawCast(object);
2847 objects_.Add(prefix); 2792 objects_.Add(prefix);
2848 2793
(...skipping 27 matching lines...) Expand all
2876 s->Write<uint16_t>(prefix->ptr()->num_imports_); 2821 s->Write<uint16_t>(prefix->ptr()->num_imports_);
2877 s->Write<bool>(prefix->ptr()->is_deferred_load_); 2822 s->Write<bool>(prefix->ptr()->is_deferred_load_);
2878 } 2823 }
2879 } 2824 }
2880 2825
2881 private: 2826 private:
2882 GrowableArray<RawLibraryPrefix*> objects_; 2827 GrowableArray<RawLibraryPrefix*> objects_;
2883 }; 2828 };
2884 #endif // !DART_PRECOMPILED_RUNTIME 2829 #endif // !DART_PRECOMPILED_RUNTIME
2885 2830
2886
2887 class LibraryPrefixDeserializationCluster : public DeserializationCluster { 2831 class LibraryPrefixDeserializationCluster : public DeserializationCluster {
2888 public: 2832 public:
2889 LibraryPrefixDeserializationCluster() {} 2833 LibraryPrefixDeserializationCluster() {}
2890 virtual ~LibraryPrefixDeserializationCluster() {} 2834 virtual ~LibraryPrefixDeserializationCluster() {}
2891 2835
2892 void ReadAlloc(Deserializer* d) { 2836 void ReadAlloc(Deserializer* d) {
2893 start_index_ = d->next_index(); 2837 start_index_ = d->next_index();
2894 PageSpace* old_space = d->heap()->old_space(); 2838 PageSpace* old_space = d->heap()->old_space();
2895 intptr_t count = d->Read<int32_t>(); 2839 intptr_t count = d->Read<int32_t>();
2896 for (intptr_t i = 0; i < count; i++) { 2840 for (intptr_t i = 0; i < count; i++) {
(...skipping 23 matching lines...) Expand all
2920 *p = Object::null(); 2864 *p = Object::null();
2921 } 2865 }
2922 2866
2923 prefix->ptr()->num_imports_ = d->Read<uint16_t>(); 2867 prefix->ptr()->num_imports_ = d->Read<uint16_t>();
2924 prefix->ptr()->is_deferred_load_ = d->Read<bool>(); 2868 prefix->ptr()->is_deferred_load_ = d->Read<bool>();
2925 prefix->ptr()->is_loaded_ = !prefix->ptr()->is_deferred_load_; 2869 prefix->ptr()->is_loaded_ = !prefix->ptr()->is_deferred_load_;
2926 } 2870 }
2927 } 2871 }
2928 }; 2872 };
2929 2873
2930
2931 #if !defined(DART_PRECOMPILED_RUNTIME) 2874 #if !defined(DART_PRECOMPILED_RUNTIME)
2932 class TypeSerializationCluster : public SerializationCluster { 2875 class TypeSerializationCluster : public SerializationCluster {
2933 public: 2876 public:
2934 TypeSerializationCluster() {} 2877 TypeSerializationCluster() {}
2935 virtual ~TypeSerializationCluster() {} 2878 virtual ~TypeSerializationCluster() {}
2936 2879
2937 void Trace(Serializer* s, RawObject* object) { 2880 void Trace(Serializer* s, RawObject* object) {
2938 RawType* type = Type::RawCast(object); 2881 RawType* type = Type::RawCast(object);
2939 if (type->IsCanonical()) { 2882 if (type->IsCanonical()) {
2940 canonical_objects_.Add(type); 2883 canonical_objects_.Add(type);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 s->Write<int8_t>(type->ptr()->type_state_); 2942 s->Write<int8_t>(type->ptr()->type_state_);
3000 } 2943 }
3001 } 2944 }
3002 2945
3003 private: 2946 private:
3004 GrowableArray<RawType*> canonical_objects_; 2947 GrowableArray<RawType*> canonical_objects_;
3005 GrowableArray<RawType*> objects_; 2948 GrowableArray<RawType*> objects_;
3006 }; 2949 };
3007 #endif // !DART_PRECOMPILED_RUNTIME 2950 #endif // !DART_PRECOMPILED_RUNTIME
3008 2951
3009
3010 class TypeDeserializationCluster : public DeserializationCluster { 2952 class TypeDeserializationCluster : public DeserializationCluster {
3011 public: 2953 public:
3012 TypeDeserializationCluster() {} 2954 TypeDeserializationCluster() {}
3013 virtual ~TypeDeserializationCluster() {} 2955 virtual ~TypeDeserializationCluster() {}
3014 2956
3015 void ReadAlloc(Deserializer* d) { 2957 void ReadAlloc(Deserializer* d) {
3016 canonical_start_index_ = d->next_index(); 2958 canonical_start_index_ = d->next_index();
3017 PageSpace* old_space = d->heap()->old_space(); 2959 PageSpace* old_space = d->heap()->old_space();
3018 intptr_t count = d->Read<int32_t>(); 2960 intptr_t count = d->Read<int32_t>();
3019 for (intptr_t i = 0; i < count; i++) { 2961 for (intptr_t i = 0; i < count; i++) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3058 type->ptr()->token_pos_ = d->ReadTokenPosition(); 3000 type->ptr()->token_pos_ = d->ReadTokenPosition();
3059 type->ptr()->type_state_ = d->Read<int8_t>(); 3001 type->ptr()->type_state_ = d->Read<int8_t>();
3060 } 3002 }
3061 } 3003 }
3062 3004
3063 private: 3005 private:
3064 intptr_t canonical_start_index_; 3006 intptr_t canonical_start_index_;
3065 intptr_t canonical_stop_index_; 3007 intptr_t canonical_stop_index_;
3066 }; 3008 };
3067 3009
3068
3069 #if !defined(DART_PRECOMPILED_RUNTIME) 3010 #if !defined(DART_PRECOMPILED_RUNTIME)
3070 class TypeRefSerializationCluster : public SerializationCluster { 3011 class TypeRefSerializationCluster : public SerializationCluster {
3071 public: 3012 public:
3072 TypeRefSerializationCluster() {} 3013 TypeRefSerializationCluster() {}
3073 virtual ~TypeRefSerializationCluster() {} 3014 virtual ~TypeRefSerializationCluster() {}
3074 3015
3075 void Trace(Serializer* s, RawObject* object) { 3016 void Trace(Serializer* s, RawObject* object) {
3076 RawTypeRef* type = TypeRef::RawCast(object); 3017 RawTypeRef* type = TypeRef::RawCast(object);
3077 objects_.Add(type); 3018 objects_.Add(type);
3078 3019
(...skipping 24 matching lines...) Expand all
3103 s->WriteRef(*p); 3044 s->WriteRef(*p);
3104 } 3045 }
3105 } 3046 }
3106 } 3047 }
3107 3048
3108 private: 3049 private:
3109 GrowableArray<RawTypeRef*> objects_; 3050 GrowableArray<RawTypeRef*> objects_;
3110 }; 3051 };
3111 #endif // !DART_PRECOMPILED_RUNTIME 3052 #endif // !DART_PRECOMPILED_RUNTIME
3112 3053
3113
3114 class TypeRefDeserializationCluster : public DeserializationCluster { 3054 class TypeRefDeserializationCluster : public DeserializationCluster {
3115 public: 3055 public:
3116 TypeRefDeserializationCluster() {} 3056 TypeRefDeserializationCluster() {}
3117 virtual ~TypeRefDeserializationCluster() {} 3057 virtual ~TypeRefDeserializationCluster() {}
3118 3058
3119 void ReadAlloc(Deserializer* d) { 3059 void ReadAlloc(Deserializer* d) {
3120 start_index_ = d->next_index(); 3060 start_index_ = d->next_index();
3121 PageSpace* old_space = d->heap()->old_space(); 3061 PageSpace* old_space = d->heap()->old_space();
3122 intptr_t count = d->Read<int32_t>(); 3062 intptr_t count = d->Read<int32_t>();
3123 for (intptr_t i = 0; i < count; i++) { 3063 for (intptr_t i = 0; i < count; i++) {
(...skipping 11 matching lines...) Expand all
3135 is_vm_object); 3075 is_vm_object);
3136 RawObject** from = type->from(); 3076 RawObject** from = type->from();
3137 RawObject** to = type->to(); 3077 RawObject** to = type->to();
3138 for (RawObject** p = from; p <= to; p++) { 3078 for (RawObject** p = from; p <= to; p++) {
3139 *p = d->ReadRef(); 3079 *p = d->ReadRef();
3140 } 3080 }
3141 } 3081 }
3142 } 3082 }
3143 }; 3083 };
3144 3084
3145
3146 #if !defined(DART_PRECOMPILED_RUNTIME) 3085 #if !defined(DART_PRECOMPILED_RUNTIME)
3147 class TypeParameterSerializationCluster : public SerializationCluster { 3086 class TypeParameterSerializationCluster : public SerializationCluster {
3148 public: 3087 public:
3149 TypeParameterSerializationCluster() {} 3088 TypeParameterSerializationCluster() {}
3150 virtual ~TypeParameterSerializationCluster() {} 3089 virtual ~TypeParameterSerializationCluster() {}
3151 3090
3152 void Trace(Serializer* s, RawObject* object) { 3091 void Trace(Serializer* s, RawObject* object) {
3153 RawTypeParameter* type = TypeParameter::RawCast(object); 3092 RawTypeParameter* type = TypeParameter::RawCast(object);
3154 objects_.Add(type); 3093 objects_.Add(type);
3155 ASSERT(!type->IsCanonical()); 3094 ASSERT(!type->IsCanonical());
(...skipping 29 matching lines...) Expand all
3185 s->Write<int16_t>(type->ptr()->index_); 3124 s->Write<int16_t>(type->ptr()->index_);
3186 s->Write<int8_t>(type->ptr()->type_state_); 3125 s->Write<int8_t>(type->ptr()->type_state_);
3187 } 3126 }
3188 } 3127 }
3189 3128
3190 private: 3129 private:
3191 GrowableArray<RawTypeParameter*> objects_; 3130 GrowableArray<RawTypeParameter*> objects_;
3192 }; 3131 };
3193 #endif // !DART_PRECOMPILED_RUNTIME 3132 #endif // !DART_PRECOMPILED_RUNTIME
3194 3133
3195
3196 class TypeParameterDeserializationCluster : public DeserializationCluster { 3134 class TypeParameterDeserializationCluster : public DeserializationCluster {
3197 public: 3135 public:
3198 TypeParameterDeserializationCluster() {} 3136 TypeParameterDeserializationCluster() {}
3199 virtual ~TypeParameterDeserializationCluster() {} 3137 virtual ~TypeParameterDeserializationCluster() {}
3200 3138
3201 void ReadAlloc(Deserializer* d) { 3139 void ReadAlloc(Deserializer* d) {
3202 start_index_ = d->next_index(); 3140 start_index_ = d->next_index();
3203 PageSpace* old_space = d->heap()->old_space(); 3141 PageSpace* old_space = d->heap()->old_space();
3204 intptr_t count = d->Read<int32_t>(); 3142 intptr_t count = d->Read<int32_t>();
3205 for (intptr_t i = 0; i < count; i++) { 3143 for (intptr_t i = 0; i < count; i++) {
(...skipping 16 matching lines...) Expand all
3222 *p = d->ReadRef(); 3160 *p = d->ReadRef();
3223 } 3161 }
3224 type->ptr()->parameterized_class_id_ = d->Read<int32_t>(); 3162 type->ptr()->parameterized_class_id_ = d->Read<int32_t>();
3225 type->ptr()->token_pos_ = d->ReadTokenPosition(); 3163 type->ptr()->token_pos_ = d->ReadTokenPosition();
3226 type->ptr()->index_ = d->Read<int16_t>(); 3164 type->ptr()->index_ = d->Read<int16_t>();
3227 type->ptr()->type_state_ = d->Read<int8_t>(); 3165 type->ptr()->type_state_ = d->Read<int8_t>();
3228 } 3166 }
3229 } 3167 }
3230 }; 3168 };
3231 3169
3232
3233 #if !defined(DART_PRECOMPILED_RUNTIME) 3170 #if !defined(DART_PRECOMPILED_RUNTIME)
3234 class BoundedTypeSerializationCluster : public SerializationCluster { 3171 class BoundedTypeSerializationCluster : public SerializationCluster {
3235 public: 3172 public:
3236 BoundedTypeSerializationCluster() {} 3173 BoundedTypeSerializationCluster() {}
3237 virtual ~BoundedTypeSerializationCluster() {} 3174 virtual ~BoundedTypeSerializationCluster() {}
3238 3175
3239 void Trace(Serializer* s, RawObject* object) { 3176 void Trace(Serializer* s, RawObject* object) {
3240 RawBoundedType* type = BoundedType::RawCast(object); 3177 RawBoundedType* type = BoundedType::RawCast(object);
3241 objects_.Add(type); 3178 objects_.Add(type);
3242 3179
(...skipping 24 matching lines...) Expand all
3267 s->WriteRef(*p); 3204 s->WriteRef(*p);
3268 } 3205 }
3269 } 3206 }
3270 } 3207 }
3271 3208
3272 private: 3209 private:
3273 GrowableArray<RawBoundedType*> objects_; 3210 GrowableArray<RawBoundedType*> objects_;
3274 }; 3211 };
3275 #endif // !DART_PRECOMPILED_RUNTIME 3212 #endif // !DART_PRECOMPILED_RUNTIME
3276 3213
3277
3278 class BoundedTypeDeserializationCluster : public DeserializationCluster { 3214 class BoundedTypeDeserializationCluster : public DeserializationCluster {
3279 public: 3215 public:
3280 BoundedTypeDeserializationCluster() {} 3216 BoundedTypeDeserializationCluster() {}
3281 virtual ~BoundedTypeDeserializationCluster() {} 3217 virtual ~BoundedTypeDeserializationCluster() {}
3282 3218
3283 void ReadAlloc(Deserializer* d) { 3219 void ReadAlloc(Deserializer* d) {
3284 start_index_ = d->next_index(); 3220 start_index_ = d->next_index();
3285 PageSpace* old_space = d->heap()->old_space(); 3221 PageSpace* old_space = d->heap()->old_space();
3286 intptr_t count = d->Read<int32_t>(); 3222 intptr_t count = d->Read<int32_t>();
3287 for (intptr_t i = 0; i < count; i++) { 3223 for (intptr_t i = 0; i < count; i++) {
(...skipping 12 matching lines...) Expand all
3300 BoundedType::InstanceSize(), is_vm_object); 3236 BoundedType::InstanceSize(), is_vm_object);
3301 RawObject** from = type->from(); 3237 RawObject** from = type->from();
3302 RawObject** to = type->to(); 3238 RawObject** to = type->to();
3303 for (RawObject** p = from; p <= to; p++) { 3239 for (RawObject** p = from; p <= to; p++) {
3304 *p = d->ReadRef(); 3240 *p = d->ReadRef();
3305 } 3241 }
3306 } 3242 }
3307 } 3243 }
3308 }; 3244 };
3309 3245
3310
3311 #if !defined(DART_PRECOMPILED_RUNTIME) 3246 #if !defined(DART_PRECOMPILED_RUNTIME)
3312 class ClosureSerializationCluster : public SerializationCluster { 3247 class ClosureSerializationCluster : public SerializationCluster {
3313 public: 3248 public:
3314 ClosureSerializationCluster() {} 3249 ClosureSerializationCluster() {}
3315 virtual ~ClosureSerializationCluster() {} 3250 virtual ~ClosureSerializationCluster() {}
3316 3251
3317 void Trace(Serializer* s, RawObject* object) { 3252 void Trace(Serializer* s, RawObject* object) {
3318 RawClosure* closure = Closure::RawCast(object); 3253 RawClosure* closure = Closure::RawCast(object);
3319 objects_.Add(closure); 3254 objects_.Add(closure);
3320 3255
(...skipping 25 matching lines...) Expand all
3346 s->WriteRef(*p); 3281 s->WriteRef(*p);
3347 } 3282 }
3348 } 3283 }
3349 } 3284 }
3350 3285
3351 private: 3286 private:
3352 GrowableArray<RawClosure*> objects_; 3287 GrowableArray<RawClosure*> objects_;
3353 }; 3288 };
3354 #endif // !DART_PRECOMPILED_RUNTIME 3289 #endif // !DART_PRECOMPILED_RUNTIME
3355 3290
3356
3357 class ClosureDeserializationCluster : public DeserializationCluster { 3291 class ClosureDeserializationCluster : public DeserializationCluster {
3358 public: 3292 public:
3359 ClosureDeserializationCluster() {} 3293 ClosureDeserializationCluster() {}
3360 virtual ~ClosureDeserializationCluster() {} 3294 virtual ~ClosureDeserializationCluster() {}
3361 3295
3362 void ReadAlloc(Deserializer* d) { 3296 void ReadAlloc(Deserializer* d) {
3363 start_index_ = d->next_index(); 3297 start_index_ = d->next_index();
3364 PageSpace* old_space = d->heap()->old_space(); 3298 PageSpace* old_space = d->heap()->old_space();
3365 intptr_t count = d->Read<int32_t>(); 3299 intptr_t count = d->Read<int32_t>();
3366 for (intptr_t i = 0; i < count; i++) { 3300 for (intptr_t i = 0; i < count; i++) {
(...skipping 13 matching lines...) Expand all
3380 is_canonical); 3314 is_canonical);
3381 RawObject** from = closure->from(); 3315 RawObject** from = closure->from();
3382 RawObject** to = closure->to(); 3316 RawObject** to = closure->to();
3383 for (RawObject** p = from; p <= to; p++) { 3317 for (RawObject** p = from; p <= to; p++) {
3384 *p = d->ReadRef(); 3318 *p = d->ReadRef();
3385 } 3319 }
3386 } 3320 }
3387 } 3321 }
3388 }; 3322 };
3389 3323
3390
3391 #if !defined(DART_PRECOMPILED_RUNTIME) 3324 #if !defined(DART_PRECOMPILED_RUNTIME)
3392 class MintSerializationCluster : public SerializationCluster { 3325 class MintSerializationCluster : public SerializationCluster {
3393 public: 3326 public:
3394 MintSerializationCluster() {} 3327 MintSerializationCluster() {}
3395 virtual ~MintSerializationCluster() {} 3328 virtual ~MintSerializationCluster() {}
3396 3329
3397 void Trace(Serializer* s, RawObject* object) { 3330 void Trace(Serializer* s, RawObject* object) {
3398 if (!object->IsHeapObject()) { 3331 if (!object->IsHeapObject()) {
3399 RawSmi* smi = Smi::RawCast(object); 3332 RawSmi* smi = Smi::RawCast(object);
3400 smis_.Add(smi); 3333 smis_.Add(smi);
(...skipping 22 matching lines...) Expand all
3423 } 3356 }
3424 3357
3425 void WriteFill(Serializer* s) {} 3358 void WriteFill(Serializer* s) {}
3426 3359
3427 private: 3360 private:
3428 GrowableArray<RawSmi*> smis_; 3361 GrowableArray<RawSmi*> smis_;
3429 GrowableArray<RawMint*> mints_; 3362 GrowableArray<RawMint*> mints_;
3430 }; 3363 };
3431 #endif // !DART_PRECOMPILED_RUNTIME 3364 #endif // !DART_PRECOMPILED_RUNTIME
3432 3365
3433
3434 class MintDeserializationCluster : public DeserializationCluster { 3366 class MintDeserializationCluster : public DeserializationCluster {
3435 public: 3367 public:
3436 MintDeserializationCluster() {} 3368 MintDeserializationCluster() {}
3437 virtual ~MintDeserializationCluster() {} 3369 virtual ~MintDeserializationCluster() {}
3438 3370
3439 void ReadAlloc(Deserializer* d) { 3371 void ReadAlloc(Deserializer* d) {
3440 PageSpace* old_space = d->heap()->old_space(); 3372 PageSpace* old_space = d->heap()->old_space();
3441 bool is_vm_object = d->isolate() == Dart::vm_isolate(); 3373 bool is_vm_object = d->isolate() == Dart::vm_isolate();
3442 3374
3443 start_index_ = d->next_index(); 3375 start_index_ = d->next_index();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3475 } 3407 }
3476 } 3408 }
3477 const Array& constants_array = 3409 const Array& constants_array =
3478 Array::Handle(zone, Array::MakeFixedLength(new_constants)); 3410 Array::Handle(zone, Array::MakeFixedLength(new_constants));
3479 const Class& mint_cls = 3411 const Class& mint_cls =
3480 Class::Handle(zone, Isolate::Current()->object_store()->mint_class()); 3412 Class::Handle(zone, Isolate::Current()->object_store()->mint_class());
3481 mint_cls.set_constants(constants_array); 3413 mint_cls.set_constants(constants_array);
3482 } 3414 }
3483 }; 3415 };
3484 3416
3485
3486 #if !defined(DART_PRECOMPILED_RUNTIME) 3417 #if !defined(DART_PRECOMPILED_RUNTIME)
3487 class BigintSerializationCluster : public SerializationCluster { 3418 class BigintSerializationCluster : public SerializationCluster {
3488 public: 3419 public:
3489 BigintSerializationCluster() {} 3420 BigintSerializationCluster() {}
3490 virtual ~BigintSerializationCluster() {} 3421 virtual ~BigintSerializationCluster() {}
3491 3422
3492 void Trace(Serializer* s, RawObject* object) { 3423 void Trace(Serializer* s, RawObject* object) {
3493 RawBigint* bigint = Bigint::RawCast(object); 3424 RawBigint* bigint = Bigint::RawCast(object);
3494 objects_.Add(bigint); 3425 objects_.Add(bigint);
3495 3426
(...skipping 25 matching lines...) Expand all
3521 s->WriteRef(*p); 3452 s->WriteRef(*p);
3522 } 3453 }
3523 } 3454 }
3524 } 3455 }
3525 3456
3526 private: 3457 private:
3527 GrowableArray<RawBigint*> objects_; 3458 GrowableArray<RawBigint*> objects_;
3528 }; 3459 };
3529 #endif // !DART_PRECOMPILED_RUNTIME 3460 #endif // !DART_PRECOMPILED_RUNTIME
3530 3461
3531
3532 class BigintDeserializationCluster : public DeserializationCluster { 3462 class BigintDeserializationCluster : public DeserializationCluster {
3533 public: 3463 public:
3534 BigintDeserializationCluster() {} 3464 BigintDeserializationCluster() {}
3535 virtual ~BigintDeserializationCluster() {} 3465 virtual ~BigintDeserializationCluster() {}
3536 3466
3537 void ReadAlloc(Deserializer* d) { 3467 void ReadAlloc(Deserializer* d) {
3538 start_index_ = d->next_index(); 3468 start_index_ = d->next_index();
3539 PageSpace* old_space = d->heap()->old_space(); 3469 PageSpace* old_space = d->heap()->old_space();
3540 intptr_t count = d->Read<int32_t>(); 3470 intptr_t count = d->Read<int32_t>();
3541 for (intptr_t i = 0; i < count; i++) { 3471 for (intptr_t i = 0; i < count; i++) {
(...skipping 12 matching lines...) Expand all
3554 is_vm_object, is_canonical); 3484 is_vm_object, is_canonical);
3555 RawObject** from = bigint->from(); 3485 RawObject** from = bigint->from();
3556 RawObject** to = bigint->to(); 3486 RawObject** to = bigint->to();
3557 for (RawObject** p = from; p <= to; p++) { 3487 for (RawObject** p = from; p <= to; p++) {
3558 *p = d->ReadRef(); 3488 *p = d->ReadRef();
3559 } 3489 }
3560 } 3490 }
3561 } 3491 }
3562 }; 3492 };
3563 3493
3564
3565 #if !defined(DART_PRECOMPILED_RUNTIME) 3494 #if !defined(DART_PRECOMPILED_RUNTIME)
3566 class DoubleSerializationCluster : public SerializationCluster { 3495 class DoubleSerializationCluster : public SerializationCluster {
3567 public: 3496 public:
3568 DoubleSerializationCluster() {} 3497 DoubleSerializationCluster() {}
3569 virtual ~DoubleSerializationCluster() {} 3498 virtual ~DoubleSerializationCluster() {}
3570 3499
3571 void Trace(Serializer* s, RawObject* object) { 3500 void Trace(Serializer* s, RawObject* object) {
3572 RawDouble* dbl = Double::RawCast(object); 3501 RawDouble* dbl = Double::RawCast(object);
3573 objects_.Add(dbl); 3502 objects_.Add(dbl);
3574 } 3503 }
(...skipping 15 matching lines...) Expand all
3590 s->Write<bool>(dbl->IsCanonical()); 3519 s->Write<bool>(dbl->IsCanonical());
3591 s->Write<double>(dbl->ptr()->value_); 3520 s->Write<double>(dbl->ptr()->value_);
3592 } 3521 }
3593 } 3522 }
3594 3523
3595 private: 3524 private:
3596 GrowableArray<RawDouble*> objects_; 3525 GrowableArray<RawDouble*> objects_;
3597 }; 3526 };
3598 #endif // !DART_PRECOMPILED_RUNTIME 3527 #endif // !DART_PRECOMPILED_RUNTIME
3599 3528
3600
3601 class DoubleDeserializationCluster : public DeserializationCluster { 3529 class DoubleDeserializationCluster : public DeserializationCluster {
3602 public: 3530 public:
3603 DoubleDeserializationCluster() {} 3531 DoubleDeserializationCluster() {}
3604 virtual ~DoubleDeserializationCluster() {} 3532 virtual ~DoubleDeserializationCluster() {}
3605 3533
3606 void ReadAlloc(Deserializer* d) { 3534 void ReadAlloc(Deserializer* d) {
3607 start_index_ = d->next_index(); 3535 start_index_ = d->next_index();
3608 PageSpace* old_space = d->heap()->old_space(); 3536 PageSpace* old_space = d->heap()->old_space();
3609 intptr_t count = d->Read<int32_t>(); 3537 intptr_t count = d->Read<int32_t>();
3610 for (intptr_t i = 0; i < count; i++) { 3538 for (intptr_t i = 0; i < count; i++) {
3611 d->AssignRef(AllocateUninitialized(old_space, Double::InstanceSize())); 3539 d->AssignRef(AllocateUninitialized(old_space, Double::InstanceSize()));
3612 } 3540 }
3613 stop_index_ = d->next_index(); 3541 stop_index_ = d->next_index();
3614 } 3542 }
3615 3543
3616 void ReadFill(Deserializer* d) { 3544 void ReadFill(Deserializer* d) {
3617 bool is_vm_object = d->isolate() == Dart::vm_isolate(); 3545 bool is_vm_object = d->isolate() == Dart::vm_isolate();
3618 3546
3619 for (intptr_t id = start_index_; id < stop_index_; id++) { 3547 for (intptr_t id = start_index_; id < stop_index_; id++) {
3620 RawDouble* dbl = reinterpret_cast<RawDouble*>(d->Ref(id)); 3548 RawDouble* dbl = reinterpret_cast<RawDouble*>(d->Ref(id));
3621 bool is_canonical = d->Read<bool>(); 3549 bool is_canonical = d->Read<bool>();
3622 Deserializer::InitializeHeader(dbl, kDoubleCid, Double::InstanceSize(), 3550 Deserializer::InitializeHeader(dbl, kDoubleCid, Double::InstanceSize(),
3623 is_vm_object, is_canonical); 3551 is_vm_object, is_canonical);
3624 dbl->ptr()->value_ = d->Read<double>(); 3552 dbl->ptr()->value_ = d->Read<double>();
3625 } 3553 }
3626 } 3554 }
3627 }; 3555 };
3628 3556
3629
3630 #if !defined(DART_PRECOMPILED_RUNTIME) 3557 #if !defined(DART_PRECOMPILED_RUNTIME)
3631 class GrowableObjectArraySerializationCluster : public SerializationCluster { 3558 class GrowableObjectArraySerializationCluster : public SerializationCluster {
3632 public: 3559 public:
3633 GrowableObjectArraySerializationCluster() {} 3560 GrowableObjectArraySerializationCluster() {}
3634 virtual ~GrowableObjectArraySerializationCluster() {} 3561 virtual ~GrowableObjectArraySerializationCluster() {}
3635 3562
3636 void Trace(Serializer* s, RawObject* object) { 3563 void Trace(Serializer* s, RawObject* object) {
3637 RawGrowableObjectArray* array = GrowableObjectArray::RawCast(object); 3564 RawGrowableObjectArray* array = GrowableObjectArray::RawCast(object);
3638 objects_.Add(array); 3565 objects_.Add(array);
3639 3566
(...skipping 25 matching lines...) Expand all
3665 s->WriteRef(*p); 3592 s->WriteRef(*p);
3666 } 3593 }
3667 } 3594 }
3668 } 3595 }
3669 3596
3670 private: 3597 private:
3671 GrowableArray<RawGrowableObjectArray*> objects_; 3598 GrowableArray<RawGrowableObjectArray*> objects_;
3672 }; 3599 };
3673 #endif // !DART_PRECOMPILED_RUNTIME 3600 #endif // !DART_PRECOMPILED_RUNTIME
3674 3601
3675
3676 class GrowableObjectArrayDeserializationCluster 3602 class GrowableObjectArrayDeserializationCluster
3677 : public DeserializationCluster { 3603 : public DeserializationCluster {
3678 public: 3604 public:
3679 GrowableObjectArrayDeserializationCluster() {} 3605 GrowableObjectArrayDeserializationCluster() {}
3680 virtual ~GrowableObjectArrayDeserializationCluster() {} 3606 virtual ~GrowableObjectArrayDeserializationCluster() {}
3681 3607
3682 void ReadAlloc(Deserializer* d) { 3608 void ReadAlloc(Deserializer* d) {
3683 start_index_ = d->next_index(); 3609 start_index_ = d->next_index();
3684 PageSpace* old_space = d->heap()->old_space(); 3610 PageSpace* old_space = d->heap()->old_space();
3685 intptr_t count = d->Read<int32_t>(); 3611 intptr_t count = d->Read<int32_t>();
(...skipping 16 matching lines...) Expand all
3702 is_vm_object, is_canonical); 3628 is_vm_object, is_canonical);
3703 RawObject** from = list->from(); 3629 RawObject** from = list->from();
3704 RawObject** to = list->to(); 3630 RawObject** to = list->to();
3705 for (RawObject** p = from; p <= to; p++) { 3631 for (RawObject** p = from; p <= to; p++) {
3706 *p = d->ReadRef(); 3632 *p = d->ReadRef();
3707 } 3633 }
3708 } 3634 }
3709 } 3635 }
3710 }; 3636 };
3711 3637
3712
3713 #if !defined(DART_PRECOMPILED_RUNTIME) 3638 #if !defined(DART_PRECOMPILED_RUNTIME)
3714 class TypedDataSerializationCluster : public SerializationCluster { 3639 class TypedDataSerializationCluster : public SerializationCluster {
3715 public: 3640 public:
3716 explicit TypedDataSerializationCluster(intptr_t cid) : cid_(cid) {} 3641 explicit TypedDataSerializationCluster(intptr_t cid) : cid_(cid) {}
3717 virtual ~TypedDataSerializationCluster() {} 3642 virtual ~TypedDataSerializationCluster() {}
3718 3643
3719 void Trace(Serializer* s, RawObject* object) { 3644 void Trace(Serializer* s, RawObject* object) {
3720 RawTypedData* data = TypedData::RawCast(object); 3645 RawTypedData* data = TypedData::RawCast(object);
3721 objects_.Add(data); 3646 objects_.Add(data);
3722 } 3647 }
(...skipping 22 matching lines...) Expand all
3745 s->WriteBytes(cdata, length * element_size); 3670 s->WriteBytes(cdata, length * element_size);
3746 } 3671 }
3747 } 3672 }
3748 3673
3749 private: 3674 private:
3750 const intptr_t cid_; 3675 const intptr_t cid_;
3751 GrowableArray<RawTypedData*> objects_; 3676 GrowableArray<RawTypedData*> objects_;
3752 }; 3677 };
3753 #endif // !DART_PRECOMPILED_RUNTIME 3678 #endif // !DART_PRECOMPILED_RUNTIME
3754 3679
3755
3756 class TypedDataDeserializationCluster : public DeserializationCluster { 3680 class TypedDataDeserializationCluster : public DeserializationCluster {
3757 public: 3681 public:
3758 explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {} 3682 explicit TypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {}
3759 virtual ~TypedDataDeserializationCluster() {} 3683 virtual ~TypedDataDeserializationCluster() {}
3760 3684
3761 void ReadAlloc(Deserializer* d) { 3685 void ReadAlloc(Deserializer* d) {
3762 start_index_ = d->next_index(); 3686 start_index_ = d->next_index();
3763 PageSpace* old_space = d->heap()->old_space(); 3687 PageSpace* old_space = d->heap()->old_space();
3764 intptr_t count = d->Read<int32_t>(); 3688 intptr_t count = d->Read<int32_t>();
3765 intptr_t element_size = TypedData::ElementSizeInBytes(cid_); 3689 intptr_t element_size = TypedData::ElementSizeInBytes(cid_);
(...skipping 20 matching lines...) Expand all
3786 data->ptr()->length_ = Smi::New(length); 3710 data->ptr()->length_ = Smi::New(length);
3787 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data()); 3711 uint8_t* cdata = reinterpret_cast<uint8_t*>(data->ptr()->data());
3788 d->ReadBytes(cdata, length_in_bytes); 3712 d->ReadBytes(cdata, length_in_bytes);
3789 } 3713 }
3790 } 3714 }
3791 3715
3792 private: 3716 private:
3793 const intptr_t cid_; 3717 const intptr_t cid_;
3794 }; 3718 };
3795 3719
3796
3797 #if !defined(DART_PRECOMPILED_RUNTIME) 3720 #if !defined(DART_PRECOMPILED_RUNTIME)
3798 class ExternalTypedDataSerializationCluster : public SerializationCluster { 3721 class ExternalTypedDataSerializationCluster : public SerializationCluster {
3799 public: 3722 public:
3800 explicit ExternalTypedDataSerializationCluster(intptr_t cid) : cid_(cid) {} 3723 explicit ExternalTypedDataSerializationCluster(intptr_t cid) : cid_(cid) {}
3801 virtual ~ExternalTypedDataSerializationCluster() {} 3724 virtual ~ExternalTypedDataSerializationCluster() {}
3802 3725
3803 void Trace(Serializer* s, RawObject* object) { 3726 void Trace(Serializer* s, RawObject* object) {
3804 RawExternalTypedData* data = ExternalTypedData::RawCast(object); 3727 RawExternalTypedData* data = ExternalTypedData::RawCast(object);
3805 objects_.Add(data); 3728 objects_.Add(data);
3806 ASSERT(!data->IsCanonical()); 3729 ASSERT(!data->IsCanonical());
(...skipping 20 matching lines...) Expand all
3827 s->WriteBytes(cdata, length * element_size); 3750 s->WriteBytes(cdata, length * element_size);
3828 } 3751 }
3829 } 3752 }
3830 3753
3831 private: 3754 private:
3832 const intptr_t cid_; 3755 const intptr_t cid_;
3833 GrowableArray<RawExternalTypedData*> objects_; 3756 GrowableArray<RawExternalTypedData*> objects_;
3834 }; 3757 };
3835 #endif // !DART_PRECOMPILED_RUNTIME 3758 #endif // !DART_PRECOMPILED_RUNTIME
3836 3759
3837
3838 class ExternalTypedDataDeserializationCluster : public DeserializationCluster { 3760 class ExternalTypedDataDeserializationCluster : public DeserializationCluster {
3839 public: 3761 public:
3840 explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {} 3762 explicit ExternalTypedDataDeserializationCluster(intptr_t cid) : cid_(cid) {}
3841 virtual ~ExternalTypedDataDeserializationCluster() {} 3763 virtual ~ExternalTypedDataDeserializationCluster() {}
3842 3764
3843 void ReadAlloc(Deserializer* d) { 3765 void ReadAlloc(Deserializer* d) {
3844 start_index_ = d->next_index(); 3766 start_index_ = d->next_index();
3845 PageSpace* old_space = d->heap()->old_space(); 3767 PageSpace* old_space = d->heap()->old_space();
3846 intptr_t count = d->Read<int32_t>(); 3768 intptr_t count = d->Read<int32_t>();
3847 for (intptr_t i = 0; i < count; i++) { 3769 for (intptr_t i = 0; i < count; i++) {
(...skipping 17 matching lines...) Expand all
3865 data->ptr()->data_ = const_cast<uint8_t*>(d->CurrentBufferAddress()); 3787 data->ptr()->data_ = const_cast<uint8_t*>(d->CurrentBufferAddress());
3866 d->Advance(length * element_size); 3788 d->Advance(length * element_size);
3867 // No finalizer / external size 0. 3789 // No finalizer / external size 0.
3868 } 3790 }
3869 } 3791 }
3870 3792
3871 private: 3793 private:
3872 const intptr_t cid_; 3794 const intptr_t cid_;
3873 }; 3795 };
3874 3796
3875
3876 #if !defined(DART_PRECOMPILED_RUNTIME) 3797 #if !defined(DART_PRECOMPILED_RUNTIME)
3877 class StackTraceSerializationCluster : public SerializationCluster { 3798 class StackTraceSerializationCluster : public SerializationCluster {
3878 public: 3799 public:
3879 StackTraceSerializationCluster() {} 3800 StackTraceSerializationCluster() {}
3880 virtual ~StackTraceSerializationCluster() {} 3801 virtual ~StackTraceSerializationCluster() {}
3881 3802
3882 void Trace(Serializer* s, RawObject* object) { 3803 void Trace(Serializer* s, RawObject* object) {
3883 RawStackTrace* trace = StackTrace::RawCast(object); 3804 RawStackTrace* trace = StackTrace::RawCast(object);
3884 objects_.Add(trace); 3805 objects_.Add(trace);
3885 3806
(...skipping 24 matching lines...) Expand all
3910 s->WriteRef(*p); 3831 s->WriteRef(*p);
3911 } 3832 }
3912 } 3833 }
3913 } 3834 }
3914 3835
3915 private: 3836 private:
3916 GrowableArray<RawStackTrace*> objects_; 3837 GrowableArray<RawStackTrace*> objects_;
3917 }; 3838 };
3918 #endif // !DART_PRECOMPILED_RUNTIME 3839 #endif // !DART_PRECOMPILED_RUNTIME
3919 3840
3920
3921 class StackTraceDeserializationCluster : public DeserializationCluster { 3841 class StackTraceDeserializationCluster : public DeserializationCluster {
3922 public: 3842 public:
3923 StackTraceDeserializationCluster() {} 3843 StackTraceDeserializationCluster() {}
3924 virtual ~StackTraceDeserializationCluster() {} 3844 virtual ~StackTraceDeserializationCluster() {}
3925 3845
3926 void ReadAlloc(Deserializer* d) { 3846 void ReadAlloc(Deserializer* d) {
3927 start_index_ = d->next_index(); 3847 start_index_ = d->next_index();
3928 PageSpace* old_space = d->heap()->old_space(); 3848 PageSpace* old_space = d->heap()->old_space();
3929 intptr_t count = d->Read<int32_t>(); 3849 intptr_t count = d->Read<int32_t>();
3930 for (intptr_t i = 0; i < count; i++) { 3850 for (intptr_t i = 0; i < count; i++) {
(...skipping 12 matching lines...) Expand all
3943 StackTrace::InstanceSize(), is_vm_object); 3863 StackTrace::InstanceSize(), is_vm_object);
3944 RawObject** from = trace->from(); 3864 RawObject** from = trace->from();
3945 RawObject** to = trace->to(); 3865 RawObject** to = trace->to();
3946 for (RawObject** p = from; p <= to; p++) { 3866 for (RawObject** p = from; p <= to; p++) {
3947 *p = d->ReadRef(); 3867 *p = d->ReadRef();
3948 } 3868 }
3949 } 3869 }
3950 } 3870 }
3951 }; 3871 };
3952 3872
3953
3954 #if !defined(DART_PRECOMPILED_RUNTIME) 3873 #if !defined(DART_PRECOMPILED_RUNTIME)
3955 class RegExpSerializationCluster : public SerializationCluster { 3874 class RegExpSerializationCluster : public SerializationCluster {
3956 public: 3875 public:
3957 RegExpSerializationCluster() {} 3876 RegExpSerializationCluster() {}
3958 virtual ~RegExpSerializationCluster() {} 3877 virtual ~RegExpSerializationCluster() {}
3959 3878
3960 void Trace(Serializer* s, RawObject* object) { 3879 void Trace(Serializer* s, RawObject* object) {
3961 RawRegExp* regexp = RegExp::RawCast(object); 3880 RawRegExp* regexp = RegExp::RawCast(object);
3962 objects_.Add(regexp); 3881 objects_.Add(regexp);
3963 3882
(...skipping 27 matching lines...) Expand all
3991 s->Write<int32_t>(regexp->ptr()->num_registers_); 3910 s->Write<int32_t>(regexp->ptr()->num_registers_);
3992 s->Write<int8_t>(regexp->ptr()->type_flags_); 3911 s->Write<int8_t>(regexp->ptr()->type_flags_);
3993 } 3912 }
3994 } 3913 }
3995 3914
3996 private: 3915 private:
3997 GrowableArray<RawRegExp*> objects_; 3916 GrowableArray<RawRegExp*> objects_;
3998 }; 3917 };
3999 #endif // !DART_PRECOMPILED_RUNTIME 3918 #endif // !DART_PRECOMPILED_RUNTIME
4000 3919
4001
4002 class RegExpDeserializationCluster : public DeserializationCluster { 3920 class RegExpDeserializationCluster : public DeserializationCluster {
4003 public: 3921 public:
4004 RegExpDeserializationCluster() {} 3922 RegExpDeserializationCluster() {}
4005 virtual ~RegExpDeserializationCluster() {} 3923 virtual ~RegExpDeserializationCluster() {}
4006 3924
4007 void ReadAlloc(Deserializer* d) { 3925 void ReadAlloc(Deserializer* d) {
4008 start_index_ = d->next_index(); 3926 start_index_ = d->next_index();
4009 PageSpace* old_space = d->heap()->old_space(); 3927 PageSpace* old_space = d->heap()->old_space();
4010 intptr_t count = d->Read<int32_t>(); 3928 intptr_t count = d->Read<int32_t>();
4011 for (intptr_t i = 0; i < count; i++) { 3929 for (intptr_t i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
4026 for (RawObject** p = from; p <= to; p++) { 3944 for (RawObject** p = from; p <= to; p++) {
4027 *p = d->ReadRef(); 3945 *p = d->ReadRef();
4028 } 3946 }
4029 3947
4030 regexp->ptr()->num_registers_ = d->Read<int32_t>(); 3948 regexp->ptr()->num_registers_ = d->Read<int32_t>();
4031 regexp->ptr()->type_flags_ = d->Read<int8_t>(); 3949 regexp->ptr()->type_flags_ = d->Read<int8_t>();
4032 } 3950 }
4033 } 3951 }
4034 }; 3952 };
4035 3953
4036
4037 #if !defined(DART_PRECOMPILED_RUNTIME) 3954 #if !defined(DART_PRECOMPILED_RUNTIME)
4038 class WeakPropertySerializationCluster : public SerializationCluster { 3955 class WeakPropertySerializationCluster : public SerializationCluster {
4039 public: 3956 public:
4040 WeakPropertySerializationCluster() {} 3957 WeakPropertySerializationCluster() {}
4041 virtual ~WeakPropertySerializationCluster() {} 3958 virtual ~WeakPropertySerializationCluster() {}
4042 3959
4043 void Trace(Serializer* s, RawObject* object) { 3960 void Trace(Serializer* s, RawObject* object) {
4044 RawWeakProperty* property = WeakProperty::RawCast(object); 3961 RawWeakProperty* property = WeakProperty::RawCast(object);
4045 objects_.Add(property); 3962 objects_.Add(property);
4046 3963
(...skipping 24 matching lines...) Expand all
4071 s->WriteRef(*p); 3988 s->WriteRef(*p);
4072 } 3989 }
4073 } 3990 }
4074 } 3991 }
4075 3992
4076 private: 3993 private:
4077 GrowableArray<RawWeakProperty*> objects_; 3994 GrowableArray<RawWeakProperty*> objects_;
4078 }; 3995 };
4079 #endif // !DART_PRECOMPILED_RUNTIME 3996 #endif // !DART_PRECOMPILED_RUNTIME
4080 3997
4081
4082 class WeakPropertyDeserializationCluster : public DeserializationCluster { 3998 class WeakPropertyDeserializationCluster : public DeserializationCluster {
4083 public: 3999 public:
4084 WeakPropertyDeserializationCluster() {} 4000 WeakPropertyDeserializationCluster() {}
4085 virtual ~WeakPropertyDeserializationCluster() {} 4001 virtual ~WeakPropertyDeserializationCluster() {}
4086 4002
4087 void ReadAlloc(Deserializer* d) { 4003 void ReadAlloc(Deserializer* d) {
4088 start_index_ = d->next_index(); 4004 start_index_ = d->next_index();
4089 PageSpace* old_space = d->heap()->old_space(); 4005 PageSpace* old_space = d->heap()->old_space();
4090 intptr_t count = d->Read<int32_t>(); 4006 intptr_t count = d->Read<int32_t>();
4091 for (intptr_t i = 0; i < count; i++) { 4007 for (intptr_t i = 0; i < count; i++) {
(...skipping 14 matching lines...) Expand all
4106 is_vm_object); 4022 is_vm_object);
4107 RawObject** from = property->from(); 4023 RawObject** from = property->from();
4108 RawObject** to = property->to(); 4024 RawObject** to = property->to();
4109 for (RawObject** p = from; p <= to; p++) { 4025 for (RawObject** p = from; p <= to; p++) {
4110 *p = d->ReadRef(); 4026 *p = d->ReadRef();
4111 } 4027 }
4112 } 4028 }
4113 } 4029 }
4114 }; 4030 };
4115 4031
4116
4117 #if !defined(DART_PRECOMPILED_RUNTIME) 4032 #if !defined(DART_PRECOMPILED_RUNTIME)
4118 class LinkedHashMapSerializationCluster : public SerializationCluster { 4033 class LinkedHashMapSerializationCluster : public SerializationCluster {
4119 public: 4034 public:
4120 LinkedHashMapSerializationCluster() {} 4035 LinkedHashMapSerializationCluster() {}
4121 virtual ~LinkedHashMapSerializationCluster() {} 4036 virtual ~LinkedHashMapSerializationCluster() {}
4122 4037
4123 void Trace(Serializer* s, RawObject* object) { 4038 void Trace(Serializer* s, RawObject* object) {
4124 RawLinkedHashMap* map = LinkedHashMap::RawCast(object); 4039 RawLinkedHashMap* map = LinkedHashMap::RawCast(object);
4125 objects_.Add(map); 4040 objects_.Add(map);
4126 4041
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
4175 } 4090 }
4176 } 4091 }
4177 } 4092 }
4178 } 4093 }
4179 4094
4180 private: 4095 private:
4181 GrowableArray<RawLinkedHashMap*> objects_; 4096 GrowableArray<RawLinkedHashMap*> objects_;
4182 }; 4097 };
4183 #endif // !DART_PRECOMPILED_RUNTIME 4098 #endif // !DART_PRECOMPILED_RUNTIME
4184 4099
4185
4186 class LinkedHashMapDeserializationCluster : public DeserializationCluster { 4100 class LinkedHashMapDeserializationCluster : public DeserializationCluster {
4187 public: 4101 public:
4188 LinkedHashMapDeserializationCluster() {} 4102 LinkedHashMapDeserializationCluster() {}
4189 virtual ~LinkedHashMapDeserializationCluster() {} 4103 virtual ~LinkedHashMapDeserializationCluster() {}
4190 4104
4191 void ReadAlloc(Deserializer* d) { 4105 void ReadAlloc(Deserializer* d) {
4192 start_index_ = d->next_index(); 4106 start_index_ = d->next_index();
4193 PageSpace* old_space = d->heap()->old_space(); 4107 PageSpace* old_space = d->heap()->old_space();
4194 intptr_t count = d->Read<int32_t>(); 4108 intptr_t count = d->Read<int32_t>();
4195 for (intptr_t i = 0; i < count; i++) { 4109 for (intptr_t i = 0; i < count; i++) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4234 4148
4235 map->ptr()->index_ = TypedData::null(); 4149 map->ptr()->index_ = TypedData::null();
4236 map->ptr()->hash_mask_ = Smi::New(0); 4150 map->ptr()->hash_mask_ = Smi::New(0);
4237 map->ptr()->data_ = data; 4151 map->ptr()->data_ = data;
4238 map->ptr()->used_data_ = Smi::New(used_data); 4152 map->ptr()->used_data_ = Smi::New(used_data);
4239 map->ptr()->deleted_keys_ = Smi::New(0); 4153 map->ptr()->deleted_keys_ = Smi::New(0);
4240 } 4154 }
4241 } 4155 }
4242 }; 4156 };
4243 4157
4244
4245 #if !defined(DART_PRECOMPILED_RUNTIME) 4158 #if !defined(DART_PRECOMPILED_RUNTIME)
4246 class ArraySerializationCluster : public SerializationCluster { 4159 class ArraySerializationCluster : public SerializationCluster {
4247 public: 4160 public:
4248 explicit ArraySerializationCluster(intptr_t cid) : cid_(cid) {} 4161 explicit ArraySerializationCluster(intptr_t cid) : cid_(cid) {}
4249 virtual ~ArraySerializationCluster() {} 4162 virtual ~ArraySerializationCluster() {}
4250 4163
4251 void Trace(Serializer* s, RawObject* object) { 4164 void Trace(Serializer* s, RawObject* object) {
4252 RawArray* array = Array::RawCast(object); 4165 RawArray* array = Array::RawCast(object);
4253 objects_.Add(array); 4166 objects_.Add(array);
4254 4167
(...skipping 29 matching lines...) Expand all
4284 } 4197 }
4285 } 4198 }
4286 } 4199 }
4287 4200
4288 private: 4201 private:
4289 intptr_t cid_; 4202 intptr_t cid_;
4290 GrowableArray<RawArray*> objects_; 4203 GrowableArray<RawArray*> objects_;
4291 }; 4204 };
4292 #endif // !DART_PRECOMPILED_RUNTIME 4205 #endif // !DART_PRECOMPILED_RUNTIME
4293 4206
4294
4295 class ArrayDeserializationCluster : public DeserializationCluster { 4207 class ArrayDeserializationCluster : public DeserializationCluster {
4296 public: 4208 public:
4297 explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) {} 4209 explicit ArrayDeserializationCluster(intptr_t cid) : cid_(cid) {}
4298 virtual ~ArrayDeserializationCluster() {} 4210 virtual ~ArrayDeserializationCluster() {}
4299 4211
4300 void ReadAlloc(Deserializer* d) { 4212 void ReadAlloc(Deserializer* d) {
4301 start_index_ = d->next_index(); 4213 start_index_ = d->next_index();
4302 PageSpace* old_space = d->heap()->old_space(); 4214 PageSpace* old_space = d->heap()->old_space();
4303 intptr_t count = d->Read<int32_t>(); 4215 intptr_t count = d->Read<int32_t>();
4304 for (intptr_t i = 0; i < count; i++) { 4216 for (intptr_t i = 0; i < count; i++) {
(...skipping 19 matching lines...) Expand all
4324 for (intptr_t j = 0; j < length; j++) { 4236 for (intptr_t j = 0; j < length; j++) {
4325 array->ptr()->data()[j] = d->ReadRef(); 4237 array->ptr()->data()[j] = d->ReadRef();
4326 } 4238 }
4327 } 4239 }
4328 } 4240 }
4329 4241
4330 private: 4242 private:
4331 const intptr_t cid_; 4243 const intptr_t cid_;
4332 }; 4244 };
4333 4245
4334
4335 #if !defined(DART_PRECOMPILED_RUNTIME) 4246 #if !defined(DART_PRECOMPILED_RUNTIME)
4336 class OneByteStringSerializationCluster : public SerializationCluster { 4247 class OneByteStringSerializationCluster : public SerializationCluster {
4337 public: 4248 public:
4338 OneByteStringSerializationCluster() {} 4249 OneByteStringSerializationCluster() {}
4339 virtual ~OneByteStringSerializationCluster() {} 4250 virtual ~OneByteStringSerializationCluster() {}
4340 4251
4341 void Trace(Serializer* s, RawObject* object) { 4252 void Trace(Serializer* s, RawObject* object) {
4342 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(object); 4253 RawOneByteString* str = reinterpret_cast<RawOneByteString*>(object);
4343 objects_.Add(str); 4254 objects_.Add(str);
4344 } 4255 }
(...skipping 21 matching lines...) Expand all
4366 s->Write<int32_t>(hash); 4277 s->Write<int32_t>(hash);
4367 s->WriteBytes(str->ptr()->data(), length); 4278 s->WriteBytes(str->ptr()->data(), length);
4368 } 4279 }
4369 } 4280 }
4370 4281
4371 private: 4282 private:
4372 GrowableArray<RawOneByteString*> objects_; 4283 GrowableArray<RawOneByteString*> objects_;
4373 }; 4284 };
4374 #endif // !DART_PRECOMPILED_RUNTIME 4285 #endif // !DART_PRECOMPILED_RUNTIME
4375 4286
4376
4377 class OneByteStringDeserializationCluster : public DeserializationCluster { 4287 class OneByteStringDeserializationCluster : public DeserializationCluster {
4378 public: 4288 public:
4379 OneByteStringDeserializationCluster() {} 4289 OneByteStringDeserializationCluster() {}
4380 virtual ~OneByteStringDeserializationCluster() {} 4290 virtual ~OneByteStringDeserializationCluster() {}
4381 4291
4382 void ReadAlloc(Deserializer* d) { 4292 void ReadAlloc(Deserializer* d) {
4383 start_index_ = d->next_index(); 4293 start_index_ = d->next_index();
4384 PageSpace* old_space = d->heap()->old_space(); 4294 PageSpace* old_space = d->heap()->old_space();
4385 intptr_t count = d->Read<int32_t>(); 4295 intptr_t count = d->Read<int32_t>();
4386 for (intptr_t i = 0; i < count; i++) { 4296 for (intptr_t i = 0; i < count; i++) {
(...skipping 16 matching lines...) Expand all
4403 is_vm_object, is_canonical); 4313 is_vm_object, is_canonical);
4404 str->ptr()->length_ = Smi::New(length); 4314 str->ptr()->length_ = Smi::New(length);
4405 String::SetCachedHash(str, d->Read<int32_t>()); 4315 String::SetCachedHash(str, d->Read<int32_t>());
4406 for (intptr_t j = 0; j < length; j++) { 4316 for (intptr_t j = 0; j < length; j++) {
4407 str->ptr()->data()[j] = d->Read<uint8_t>(); 4317 str->ptr()->data()[j] = d->Read<uint8_t>();
4408 } 4318 }
4409 } 4319 }
4410 } 4320 }
4411 }; 4321 };
4412 4322
4413
4414 #if !defined(DART_PRECOMPILED_RUNTIME) 4323 #if !defined(DART_PRECOMPILED_RUNTIME)
4415 class TwoByteStringSerializationCluster : public SerializationCluster { 4324 class TwoByteStringSerializationCluster : public SerializationCluster {
4416 public: 4325 public:
4417 TwoByteStringSerializationCluster() {} 4326 TwoByteStringSerializationCluster() {}
4418 virtual ~TwoByteStringSerializationCluster() {} 4327 virtual ~TwoByteStringSerializationCluster() {}
4419 4328
4420 void Trace(Serializer* s, RawObject* object) { 4329 void Trace(Serializer* s, RawObject* object) {
4421 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(object); 4330 RawTwoByteString* str = reinterpret_cast<RawTwoByteString*>(object);
4422 objects_.Add(str); 4331 objects_.Add(str);
4423 } 4332 }
(...skipping 21 matching lines...) Expand all
4445 s->Write<int32_t>(hash); 4354 s->Write<int32_t>(hash);
4446 s->WriteBytes(reinterpret_cast<uint8_t*>(str->ptr()->data()), length * 2); 4355 s->WriteBytes(reinterpret_cast<uint8_t*>(str->ptr()->data()), length * 2);
4447 } 4356 }
4448 } 4357 }
4449 4358
4450 private: 4359 private:
4451 GrowableArray<RawTwoByteString*> objects_; 4360 GrowableArray<RawTwoByteString*> objects_;
4452 }; 4361 };
4453 #endif // !DART_PRECOMPILED_RUNTIME 4362 #endif // !DART_PRECOMPILED_RUNTIME
4454 4363
4455
4456 class TwoByteStringDeserializationCluster : public DeserializationCluster { 4364 class TwoByteStringDeserializationCluster : public DeserializationCluster {
4457 public: 4365 public:
4458 TwoByteStringDeserializationCluster() {} 4366 TwoByteStringDeserializationCluster() {}
4459 virtual ~TwoByteStringDeserializationCluster() {} 4367 virtual ~TwoByteStringDeserializationCluster() {}
4460 4368
4461 void ReadAlloc(Deserializer* d) { 4369 void ReadAlloc(Deserializer* d) {
4462 start_index_ = d->next_index(); 4370 start_index_ = d->next_index();
4463 PageSpace* old_space = d->heap()->old_space(); 4371 PageSpace* old_space = d->heap()->old_space();
4464 intptr_t count = d->Read<int32_t>(); 4372 intptr_t count = d->Read<int32_t>();
4465 for (intptr_t i = 0; i < count; i++) { 4373 for (intptr_t i = 0; i < count; i++) {
(...skipping 15 matching lines...) Expand all
4481 TwoByteString::InstanceSize(length), 4389 TwoByteString::InstanceSize(length),
4482 is_vm_object, is_canonical); 4390 is_vm_object, is_canonical);
4483 str->ptr()->length_ = Smi::New(length); 4391 str->ptr()->length_ = Smi::New(length);
4484 String::SetCachedHash(str, d->Read<int32_t>()); 4392 String::SetCachedHash(str, d->Read<int32_t>());
4485 uint8_t* cdata = reinterpret_cast<uint8_t*>(str->ptr()->data()); 4393 uint8_t* cdata = reinterpret_cast<uint8_t*>(str->ptr()->data());
4486 d->ReadBytes(cdata, length * 2); 4394 d->ReadBytes(cdata, length * 2);
4487 } 4395 }
4488 } 4396 }
4489 }; 4397 };
4490 4398
4491
4492 Serializer::Serializer(Thread* thread, 4399 Serializer::Serializer(Thread* thread,
4493 Snapshot::Kind kind, 4400 Snapshot::Kind kind,
4494 uint8_t** buffer, 4401 uint8_t** buffer,
4495 ReAlloc alloc, 4402 ReAlloc alloc,
4496 intptr_t initial_size, 4403 intptr_t initial_size,
4497 ImageWriter* image_writer) 4404 ImageWriter* image_writer)
4498 : StackResource(thread), 4405 : StackResource(thread),
4499 heap_(thread->isolate()->heap()), 4406 heap_(thread->isolate()->heap()),
4500 zone_(thread->zone()), 4407 zone_(thread->zone()),
4501 kind_(kind), 4408 kind_(kind),
(...skipping 11 matching lines...) Expand all
4513 parent_pairs_() 4420 parent_pairs_()
4514 #endif 4421 #endif
4515 { 4422 {
4516 num_cids_ = thread->isolate()->class_table()->NumCids(); 4423 num_cids_ = thread->isolate()->class_table()->NumCids();
4517 clusters_by_cid_ = new SerializationCluster*[num_cids_]; 4424 clusters_by_cid_ = new SerializationCluster*[num_cids_];
4518 for (intptr_t i = 0; i < num_cids_; i++) { 4425 for (intptr_t i = 0; i < num_cids_; i++) {
4519 clusters_by_cid_[i] = NULL; 4426 clusters_by_cid_[i] = NULL;
4520 } 4427 }
4521 } 4428 }
4522 4429
4523
4524 Serializer::~Serializer() { 4430 Serializer::~Serializer() {
4525 delete[] clusters_by_cid_; 4431 delete[] clusters_by_cid_;
4526 } 4432 }
4527 4433
4528
4529 SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) { 4434 SerializationCluster* Serializer::NewClusterForClass(intptr_t cid) {
4530 #if defined(DART_PRECOMPILED_RUNTIME) 4435 #if defined(DART_PRECOMPILED_RUNTIME)
4531 UNREACHABLE(); 4436 UNREACHABLE();
4532 return NULL; 4437 return NULL;
4533 #else 4438 #else
4534 Zone* Z = zone_; 4439 Zone* Z = zone_;
4535 if ((cid >= kNumPredefinedCids) || (cid == kInstanceCid) || 4440 if ((cid >= kNumPredefinedCids) || (cid == kInstanceCid) ||
4536 RawObject::IsTypedDataViewClassId(cid)) { 4441 RawObject::IsTypedDataViewClassId(cid)) {
4537 Push(isolate()->class_table()->At(cid)); 4442 Push(isolate()->class_table()->At(cid));
4538 return new (Z) InstanceSerializationCluster(cid); 4443 return new (Z) InstanceSerializationCluster(cid);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
4650 default: 4555 default:
4651 break; 4556 break;
4652 } 4557 }
4653 4558
4654 FATAL2("No cluster defined for cid %" Pd ", kind %s", cid, 4559 FATAL2("No cluster defined for cid %" Pd ", kind %s", cid,
4655 Snapshot::KindToCString(kind_)); 4560 Snapshot::KindToCString(kind_));
4656 return NULL; 4561 return NULL;
4657 #endif // !DART_PRECOMPILED_RUNTIME 4562 #endif // !DART_PRECOMPILED_RUNTIME
4658 } 4563 }
4659 4564
4660
4661 void Serializer::Push(RawObject* object) { 4565 void Serializer::Push(RawObject* object) {
4662 if (!object->IsHeapObject()) { 4566 if (!object->IsHeapObject()) {
4663 RawSmi* smi = Smi::RawCast(object); 4567 RawSmi* smi = Smi::RawCast(object);
4664 if (smi_ids_.Lookup(smi) == NULL) { 4568 if (smi_ids_.Lookup(smi) == NULL) {
4665 SmiObjectIdPair pair; 4569 SmiObjectIdPair pair;
4666 pair.smi_ = smi; 4570 pair.smi_ = smi;
4667 pair.id_ = 1; 4571 pair.id_ = 1;
4668 smi_ids_.Insert(pair); 4572 smi_ids_.Insert(pair);
4669 stack_.Add(object); 4573 stack_.Add(object);
4670 num_written_objects_++; 4574 num_written_objects_++;
(...skipping 18 matching lines...) Expand all
4689 stack_.Add(object); 4593 stack_.Add(object);
4690 num_written_objects_++; 4594 num_written_objects_++;
4691 4595
4692 #if defined(SNAPSHOT_BACKTRACE) 4596 #if defined(SNAPSHOT_BACKTRACE)
4693 parent_pairs_.Add(&Object::Handle(object)); 4597 parent_pairs_.Add(&Object::Handle(object));
4694 parent_pairs_.Add(&Object::Handle(current_parent_)); 4598 parent_pairs_.Add(&Object::Handle(current_parent_));
4695 #endif 4599 #endif
4696 } 4600 }
4697 } 4601 }
4698 4602
4699
4700 void Serializer::Trace(RawObject* object) { 4603 void Serializer::Trace(RawObject* object) {
4701 intptr_t cid; 4604 intptr_t cid;
4702 if (!object->IsHeapObject()) { 4605 if (!object->IsHeapObject()) {
4703 // Smis are merged into the Mint cluster because Smis for the writer might 4606 // Smis are merged into the Mint cluster because Smis for the writer might
4704 // become Mints for the reader and vice versa. 4607 // become Mints for the reader and vice versa.
4705 cid = kMintCid; 4608 cid = kMintCid;
4706 } else { 4609 } else {
4707 cid = object->GetClassId(); 4610 cid = object->GetClassId();
4708 } 4611 }
4709 4612
4710 SerializationCluster* cluster = clusters_by_cid_[cid]; 4613 SerializationCluster* cluster = clusters_by_cid_[cid];
4711 if (cluster == NULL) { 4614 if (cluster == NULL) {
4712 cluster = NewClusterForClass(cid); 4615 cluster = NewClusterForClass(cid);
4713 clusters_by_cid_[cid] = cluster; 4616 clusters_by_cid_[cid] = cluster;
4714 } 4617 }
4715 ASSERT(cluster != NULL); 4618 ASSERT(cluster != NULL);
4716 4619
4717 #if defined(SNAPSHOT_BACKTRACE) 4620 #if defined(SNAPSHOT_BACKTRACE)
4718 current_parent_ = object; 4621 current_parent_ = object;
4719 #endif 4622 #endif
4720 4623
4721 cluster->Trace(this, object); 4624 cluster->Trace(this, object);
4722 4625
4723 #if defined(SNAPSHOT_BACKTRACE) 4626 #if defined(SNAPSHOT_BACKTRACE)
4724 current_parent_ = Object::null(); 4627 current_parent_ = Object::null();
4725 #endif 4628 #endif
4726 } 4629 }
4727 4630
4728
4729 void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) { 4631 void Serializer::UnexpectedObject(RawObject* raw_object, const char* message) {
4730 Object& object = Object::Handle(raw_object); 4632 Object& object = Object::Handle(raw_object);
4731 OS::PrintErr("Unexpected object (%s): %s\n", message, object.ToCString()); 4633 OS::PrintErr("Unexpected object (%s): %s\n", message, object.ToCString());
4732 #if defined(SNAPSHOT_BACKTRACE) 4634 #if defined(SNAPSHOT_BACKTRACE)
4733 while (!object.IsNull()) { 4635 while (!object.IsNull()) {
4734 object = ParentOf(object); 4636 object = ParentOf(object);
4735 OS::PrintErr("referenced by %s\n", object.ToCString()); 4637 OS::PrintErr("referenced by %s\n", object.ToCString());
4736 } 4638 }
4737 #endif 4639 #endif
4738 OS::Abort(); 4640 OS::Abort();
4739 } 4641 }
4740 4642
4741
4742 #if defined(SNAPSHOT_BACKTRACE) 4643 #if defined(SNAPSHOT_BACKTRACE)
4743 RawObject* Serializer::ParentOf(const Object& object) { 4644 RawObject* Serializer::ParentOf(const Object& object) {
4744 for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) { 4645 for (intptr_t i = 0; i < parent_pairs_.length(); i += 2) {
4745 if (parent_pairs_[i]->raw() == object.raw()) { 4646 if (parent_pairs_[i]->raw() == object.raw()) {
4746 return parent_pairs_[i + 1]->raw(); 4647 return parent_pairs_[i + 1]->raw();
4747 } 4648 }
4748 } 4649 }
4749 return Object::null(); 4650 return Object::null();
4750 } 4651 }
4751 #endif // SNAPSHOT_BACKTRACE 4652 #endif // SNAPSHOT_BACKTRACE
4752 4653
4753
4754 void Serializer::WriteVersionAndFeatures() { 4654 void Serializer::WriteVersionAndFeatures() {
4755 const char* expected_version = Version::SnapshotString(); 4655 const char* expected_version = Version::SnapshotString();
4756 ASSERT(expected_version != NULL); 4656 ASSERT(expected_version != NULL);
4757 const intptr_t version_len = strlen(expected_version); 4657 const intptr_t version_len = strlen(expected_version);
4758 WriteBytes(reinterpret_cast<const uint8_t*>(expected_version), version_len); 4658 WriteBytes(reinterpret_cast<const uint8_t*>(expected_version), version_len);
4759 4659
4760 const char* expected_features = 4660 const char* expected_features =
4761 Dart::FeaturesString(Isolate::Current(), kind_); 4661 Dart::FeaturesString(Isolate::Current(), kind_);
4762 ASSERT(expected_features != NULL); 4662 ASSERT(expected_features != NULL);
4763 const intptr_t features_len = strlen(expected_features); 4663 const intptr_t features_len = strlen(expected_features);
4764 WriteBytes(reinterpret_cast<const uint8_t*>(expected_features), 4664 WriteBytes(reinterpret_cast<const uint8_t*>(expected_features),
4765 features_len + 1); 4665 features_len + 1);
4766 free(const_cast<char*>(expected_features)); 4666 free(const_cast<char*>(expected_features));
4767 } 4667 }
4768 4668
4769
4770 #if defined(DEBUG) 4669 #if defined(DEBUG)
4771 static const int32_t kSectionMarker = 0xABAB; 4670 static const int32_t kSectionMarker = 0xABAB;
4772 #endif 4671 #endif
4773 4672
4774 void Serializer::Serialize() { 4673 void Serializer::Serialize() {
4775 while (stack_.length() > 0) { 4674 while (stack_.length() > 0) {
4776 Trace(stack_.RemoveLast()); 4675 Trace(stack_.RemoveLast());
4777 } 4676 }
4778 4677
4779 intptr_t num_clusters = 0; 4678 intptr_t num_clusters = 0;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4812 SerializationCluster* cluster = clusters_by_cid_[cid]; 4711 SerializationCluster* cluster = clusters_by_cid_[cid];
4813 if (cluster != NULL) { 4712 if (cluster != NULL) {
4814 cluster->WriteFill(this); 4713 cluster->WriteFill(this);
4815 #if defined(DEBUG) 4714 #if defined(DEBUG)
4816 Write<int32_t>(kSectionMarker); 4715 Write<int32_t>(kSectionMarker);
4817 #endif 4716 #endif
4818 } 4717 }
4819 } 4718 }
4820 } 4719 }
4821 4720
4822
4823 void Serializer::AddVMIsolateBaseObjects() { 4721 void Serializer::AddVMIsolateBaseObjects() {
4824 // These objects are always allocated by Object::InitOnce, so they are not 4722 // These objects are always allocated by Object::InitOnce, so they are not
4825 // written into the snapshot. 4723 // written into the snapshot.
4826 4724
4827 AddBaseObject(Object::null()); 4725 AddBaseObject(Object::null());
4828 AddBaseObject(Object::sentinel().raw()); 4726 AddBaseObject(Object::sentinel().raw());
4829 AddBaseObject(Object::transition_sentinel().raw()); 4727 AddBaseObject(Object::transition_sentinel().raw());
4830 AddBaseObject(Object::empty_type_arguments().raw()); 4728 AddBaseObject(Object::empty_type_arguments().raw());
4831 AddBaseObject(Object::empty_array().raw()); 4729 AddBaseObject(Object::empty_array().raw());
4832 AddBaseObject(Object::zero_array().raw()); 4730 AddBaseObject(Object::zero_array().raw());
(...skipping 27 matching lines...) Expand all
4860 AddBaseObject(table->At(kDynamicCid)); 4758 AddBaseObject(table->At(kDynamicCid));
4861 AddBaseObject(table->At(kVoidCid)); 4759 AddBaseObject(table->At(kVoidCid));
4862 4760
4863 if (!Snapshot::IncludesCode(kind_)) { 4761 if (!Snapshot::IncludesCode(kind_)) {
4864 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) { 4762 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
4865 AddBaseObject(StubCode::EntryAt(i)->code()); 4763 AddBaseObject(StubCode::EntryAt(i)->code());
4866 } 4764 }
4867 } 4765 }
4868 } 4766 }
4869 4767
4870
4871 intptr_t Serializer::WriteVMSnapshot(const Array& symbols, 4768 intptr_t Serializer::WriteVMSnapshot(const Array& symbols,
4872 const Array& scripts) { 4769 const Array& scripts) {
4873 NoSafepointScope no_safepoint; 4770 NoSafepointScope no_safepoint;
4874 4771
4875 AddVMIsolateBaseObjects(); 4772 AddVMIsolateBaseObjects();
4876 4773
4877 // Push roots. 4774 // Push roots.
4878 Push(symbols.raw()); 4775 Push(symbols.raw());
4879 Push(scripts.raw()); 4776 Push(scripts.raw());
4880 if (Snapshot::IncludesCode(kind_)) { 4777 if (Snapshot::IncludesCode(kind_)) {
(...skipping 18 matching lines...) Expand all
4899 #endif 4796 #endif
4900 4797
4901 // Note we are not clearing the object id table. The full ref table 4798 // Note we are not clearing the object id table. The full ref table
4902 // of the vm isolate snapshot serves as the base objects for the 4799 // of the vm isolate snapshot serves as the base objects for the
4903 // regular isolate snapshot. 4800 // regular isolate snapshot.
4904 4801
4905 // Return the number of objects, -1 accounts for unused ref 0. 4802 // Return the number of objects, -1 accounts for unused ref 0.
4906 return next_ref_index_ - 1; 4803 return next_ref_index_ - 1;
4907 } 4804 }
4908 4805
4909
4910 void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects, 4806 void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects,
4911 ObjectStore* object_store) { 4807 ObjectStore* object_store) {
4912 NoSafepointScope no_safepoint; 4808 NoSafepointScope no_safepoint;
4913 4809
4914 if (num_base_objects == 0) { 4810 if (num_base_objects == 0) {
4915 // Units tests not writing a new vm isolate. 4811 // Units tests not writing a new vm isolate.
4916 const Array& base_objects = Object::vm_isolate_snapshot_object_table(); 4812 const Array& base_objects = Object::vm_isolate_snapshot_object_table();
4917 for (intptr_t i = 1; i < base_objects.Length(); i++) { 4813 for (intptr_t i = 1; i < base_objects.Length(); i++) {
4918 AddBaseObject(base_objects.At(i)); 4814 AddBaseObject(base_objects.At(i));
4919 } 4815 }
(...skipping 17 matching lines...) Expand all
4937 WriteRef(*p); 4833 WriteRef(*p);
4938 } 4834 }
4939 4835
4940 #if defined(DEBUG) 4836 #if defined(DEBUG)
4941 Write<int32_t>(kSectionMarker); 4837 Write<int32_t>(kSectionMarker);
4942 #endif 4838 #endif
4943 4839
4944 heap_->ResetObjectIdTable(); 4840 heap_->ResetObjectIdTable();
4945 } 4841 }
4946 4842
4947
4948 Deserializer::Deserializer(Thread* thread, 4843 Deserializer::Deserializer(Thread* thread,
4949 Snapshot::Kind kind, 4844 Snapshot::Kind kind,
4950 const uint8_t* buffer, 4845 const uint8_t* buffer,
4951 intptr_t size, 4846 intptr_t size,
4952 const uint8_t* instructions_buffer, 4847 const uint8_t* instructions_buffer,
4953 const uint8_t* data_buffer) 4848 const uint8_t* data_buffer)
4954 : StackResource(thread), 4849 : StackResource(thread),
4955 heap_(thread->isolate()->heap()), 4850 heap_(thread->isolate()->heap()),
4956 zone_(thread->zone()), 4851 zone_(thread->zone()),
4957 kind_(kind), 4852 kind_(kind),
4958 stream_(buffer, size), 4853 stream_(buffer, size),
4959 image_reader_(NULL), 4854 image_reader_(NULL),
4960 refs_(NULL), 4855 refs_(NULL),
4961 next_ref_index_(1), 4856 next_ref_index_(1),
4962 clusters_(NULL) { 4857 clusters_(NULL) {
4963 if (Snapshot::IncludesCode(kind)) { 4858 if (Snapshot::IncludesCode(kind)) {
4964 ASSERT(instructions_buffer != NULL); 4859 ASSERT(instructions_buffer != NULL);
4965 ASSERT(data_buffer != NULL); 4860 ASSERT(data_buffer != NULL);
4966 image_reader_ = new (zone_) ImageReader(instructions_buffer, data_buffer); 4861 image_reader_ = new (zone_) ImageReader(instructions_buffer, data_buffer);
4967 } 4862 }
4968 } 4863 }
4969 4864
4970
4971 Deserializer::~Deserializer() { 4865 Deserializer::~Deserializer() {
4972 delete[] clusters_; 4866 delete[] clusters_;
4973 } 4867 }
4974 4868
4975
4976 DeserializationCluster* Deserializer::ReadCluster() { 4869 DeserializationCluster* Deserializer::ReadCluster() {
4977 intptr_t cid = ReadCid(); 4870 intptr_t cid = ReadCid();
4978 4871
4979 Zone* Z = zone_; 4872 Zone* Z = zone_;
4980 if ((cid >= kNumPredefinedCids) || (cid == kInstanceCid) || 4873 if ((cid >= kNumPredefinedCids) || (cid == kInstanceCid) ||
4981 RawObject::IsTypedDataViewClassId(cid)) { 4874 RawObject::IsTypedDataViewClassId(cid)) {
4982 return new (Z) InstanceDeserializationCluster(cid); 4875 return new (Z) InstanceDeserializationCluster(cid);
4983 } 4876 }
4984 if (RawObject::IsExternalTypedDataClassId(cid)) { 4877 if (RawObject::IsExternalTypedDataClassId(cid)) {
4985 return new (Z) ExternalTypedDataDeserializationCluster(cid); 4878 return new (Z) ExternalTypedDataDeserializationCluster(cid);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
5089 return new (Z) TwoByteStringDeserializationCluster(); 4982 return new (Z) TwoByteStringDeserializationCluster();
5090 } 4983 }
5091 } 4984 }
5092 default: 4985 default:
5093 break; 4986 break;
5094 } 4987 }
5095 FATAL1("No cluster defined for cid %" Pd, cid); 4988 FATAL1("No cluster defined for cid %" Pd, cid);
5096 return NULL; 4989 return NULL;
5097 } 4990 }
5098 4991
5099
5100 RawApiError* Deserializer::VerifyVersionAndFeatures(Isolate* isolate) { 4992 RawApiError* Deserializer::VerifyVersionAndFeatures(Isolate* isolate) {
5101 // If the version string doesn't match, return an error. 4993 // If the version string doesn't match, return an error.
5102 // Note: New things are allocated only if we're going to return an error. 4994 // Note: New things are allocated only if we're going to return an error.
5103 4995
5104 const char* expected_version = Version::SnapshotString(); 4996 const char* expected_version = Version::SnapshotString();
5105 ASSERT(expected_version != NULL); 4997 ASSERT(expected_version != NULL);
5106 const intptr_t version_len = strlen(expected_version); 4998 const intptr_t version_len = strlen(expected_version);
5107 if (PendingBytes() < version_len) { 4999 if (PendingBytes() < version_len) {
5108 const intptr_t kMessageBufferSize = 128; 5000 const intptr_t kMessageBufferSize = 128;
5109 char message_buffer[kMessageBufferSize]; 5001 char message_buffer[kMessageBufferSize];
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
5156 // This can also fail while bringing up the VM isolate, so make sure to 5048 // This can also fail while bringing up the VM isolate, so make sure to
5157 // allocate the error message in old space. 5049 // allocate the error message in old space.
5158 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); 5050 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld));
5159 return ApiError::New(msg, Heap::kOld); 5051 return ApiError::New(msg, Heap::kOld);
5160 } 5052 }
5161 free(const_cast<char*>(expected_features)); 5053 free(const_cast<char*>(expected_features));
5162 Advance(expected_len + 1); 5054 Advance(expected_len + 1);
5163 return ApiError::null(); 5055 return ApiError::null();
5164 } 5056 }
5165 5057
5166
5167 void Deserializer::Prepare() { 5058 void Deserializer::Prepare() {
5168 num_base_objects_ = Read<int32_t>(); 5059 num_base_objects_ = Read<int32_t>();
5169 num_objects_ = Read<int32_t>(); 5060 num_objects_ = Read<int32_t>();
5170 num_clusters_ = Read<int32_t>(); 5061 num_clusters_ = Read<int32_t>();
5171 5062
5172 clusters_ = new DeserializationCluster*[num_clusters_]; 5063 clusters_ = new DeserializationCluster*[num_clusters_];
5173 refs_ = Array::New(num_objects_ + 1, Heap::kOld); 5064 refs_ = Array::New(num_objects_ + 1, Heap::kOld);
5174 } 5065 }
5175 5066
5176
5177 void Deserializer::Deserialize() { 5067 void Deserializer::Deserialize() {
5178 if (num_base_objects_ != (next_ref_index_ - 1)) { 5068 if (num_base_objects_ != (next_ref_index_ - 1)) {
5179 FATAL2("Snapshot expects %" Pd 5069 FATAL2("Snapshot expects %" Pd
5180 " base objects, but deserializer provided %" Pd, 5070 " base objects, but deserializer provided %" Pd,
5181 num_base_objects_, next_ref_index_ - 1); 5071 num_base_objects_, next_ref_index_ - 1);
5182 } 5072 }
5183 5073
5184 { 5074 {
5185 NOT_IN_PRODUCT(TimelineDurationScope tds( 5075 NOT_IN_PRODUCT(TimelineDurationScope tds(
5186 thread(), Timeline::GetIsolateStream(), "ReadAlloc")); 5076 thread(), Timeline::GetIsolateStream(), "ReadAlloc"));
(...skipping 28 matching lines...) Expand all
5215 HeapLocker(Thread* thread, PageSpace* page_space) 5105 HeapLocker(Thread* thread, PageSpace* page_space)
5216 : StackResource(thread), page_space_(page_space) { 5106 : StackResource(thread), page_space_(page_space) {
5217 page_space_->AcquireDataLock(); 5107 page_space_->AcquireDataLock();
5218 } 5108 }
5219 ~HeapLocker() { page_space_->ReleaseDataLock(); } 5109 ~HeapLocker() { page_space_->ReleaseDataLock(); }
5220 5110
5221 private: 5111 private:
5222 PageSpace* page_space_; 5112 PageSpace* page_space_;
5223 }; 5113 };
5224 5114
5225
5226 void Deserializer::AddVMIsolateBaseObjects() { 5115 void Deserializer::AddVMIsolateBaseObjects() {
5227 // These objects are always allocated by Object::InitOnce, so they are not 5116 // These objects are always allocated by Object::InitOnce, so they are not
5228 // written into the snapshot. 5117 // written into the snapshot.
5229 5118
5230 AddBaseObject(Object::null()); 5119 AddBaseObject(Object::null());
5231 AddBaseObject(Object::sentinel().raw()); 5120 AddBaseObject(Object::sentinel().raw());
5232 AddBaseObject(Object::transition_sentinel().raw()); 5121 AddBaseObject(Object::transition_sentinel().raw());
5233 AddBaseObject(Object::empty_type_arguments().raw()); 5122 AddBaseObject(Object::empty_type_arguments().raw());
5234 AddBaseObject(Object::empty_array().raw()); 5123 AddBaseObject(Object::empty_array().raw());
5235 AddBaseObject(Object::zero_array().raw()); 5124 AddBaseObject(Object::zero_array().raw());
(...skipping 27 matching lines...) Expand all
5263 AddBaseObject(table->At(kDynamicCid)); 5152 AddBaseObject(table->At(kDynamicCid));
5264 AddBaseObject(table->At(kVoidCid)); 5153 AddBaseObject(table->At(kVoidCid));
5265 5154
5266 if (!Snapshot::IncludesCode(kind_)) { 5155 if (!Snapshot::IncludesCode(kind_)) {
5267 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) { 5156 for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
5268 AddBaseObject(StubCode::EntryAt(i)->code()); 5157 AddBaseObject(StubCode::EntryAt(i)->code());
5269 } 5158 }
5270 } 5159 }
5271 } 5160 }
5272 5161
5273
5274 void Deserializer::ReadVMSnapshot() { 5162 void Deserializer::ReadVMSnapshot() {
5275 Array& symbol_table = Array::Handle(zone_); 5163 Array& symbol_table = Array::Handle(zone_);
5276 Array& refs = Array::Handle(zone_); 5164 Array& refs = Array::Handle(zone_);
5277 Prepare(); 5165 Prepare();
5278 5166
5279 { 5167 {
5280 NoSafepointScope no_safepoint; 5168 NoSafepointScope no_safepoint;
5281 HeapLocker hl(thread(), heap_->old_space()); 5169 HeapLocker hl(thread(), heap_->old_space());
5282 5170
5283 AddVMIsolateBaseObjects(); 5171 AddVMIsolateBaseObjects();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
5361 thread(), Timeline::GetIsolateStream(), "PostLoad")); 5249 thread(), Timeline::GetIsolateStream(), "PostLoad"));
5362 for (intptr_t i = 0; i < num_clusters_; i++) { 5250 for (intptr_t i = 0; i < num_clusters_; i++) {
5363 clusters_[i]->PostLoad(refs, kind_, zone_); 5251 clusters_[i]->PostLoad(refs, kind_, zone_);
5364 } 5252 }
5365 } 5253 }
5366 5254
5367 // Setup native resolver for bootstrap impl. 5255 // Setup native resolver for bootstrap impl.
5368 Bootstrap::SetupNativeResolver(); 5256 Bootstrap::SetupNativeResolver();
5369 } 5257 }
5370 5258
5371
5372 // An object visitor which will iterate over all the token stream objects in the 5259 // An object visitor which will iterate over all the token stream objects in the
5373 // heap and either count them or collect them into an array. This is used during 5260 // heap and either count them or collect them into an array. This is used during
5374 // full snapshot generation of the VM isolate to write out all token streams so 5261 // full snapshot generation of the VM isolate to write out all token streams so
5375 // they will be shared across all isolates. 5262 // they will be shared across all isolates.
5376 class SnapshotTokenStreamVisitor : public ObjectVisitor { 5263 class SnapshotTokenStreamVisitor : public ObjectVisitor {
5377 public: 5264 public:
5378 explicit SnapshotTokenStreamVisitor(Thread* thread) 5265 explicit SnapshotTokenStreamVisitor(Thread* thread)
5379 : objHandle_(Object::Handle(thread->zone())), 5266 : objHandle_(Object::Handle(thread->zone())),
5380 count_(0), 5267 count_(0),
5381 token_streams_(NULL) {} 5268 token_streams_(NULL) {}
(...skipping 14 matching lines...) Expand all
5396 } 5283 }
5397 5284
5398 intptr_t count() const { return count_; } 5285 intptr_t count() const { return count_; }
5399 5286
5400 private: 5287 private:
5401 Object& objHandle_; 5288 Object& objHandle_;
5402 intptr_t count_; 5289 intptr_t count_;
5403 const Array* token_streams_; 5290 const Array* token_streams_;
5404 }; 5291 };
5405 5292
5406
5407 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind, 5293 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
5408 uint8_t** vm_snapshot_data_buffer, 5294 uint8_t** vm_snapshot_data_buffer,
5409 uint8_t** isolate_snapshot_data_buffer, 5295 uint8_t** isolate_snapshot_data_buffer,
5410 ReAlloc alloc, 5296 ReAlloc alloc,
5411 ImageWriter* vm_image_writer, 5297 ImageWriter* vm_image_writer,
5412 ImageWriter* isolate_image_writer) 5298 ImageWriter* isolate_image_writer)
5413 : thread_(Thread::Current()), 5299 : thread_(Thread::Current()),
5414 kind_(kind), 5300 kind_(kind),
5415 vm_snapshot_data_buffer_(vm_snapshot_data_buffer), 5301 vm_snapshot_data_buffer_(vm_snapshot_data_buffer),
5416 isolate_snapshot_data_buffer_(isolate_snapshot_data_buffer), 5302 isolate_snapshot_data_buffer_(isolate_snapshot_data_buffer),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
5485 FullSnapshotWriter::~FullSnapshotWriter() { 5371 FullSnapshotWriter::~FullSnapshotWriter() {
5486 // We may run Dart code afterwards, restore the symbol table if needed. 5372 // We may run Dart code afterwards, restore the symbol table if needed.
5487 if (!saved_symbol_table_.IsNull()) { 5373 if (!saved_symbol_table_.IsNull()) {
5488 isolate()->object_store()->set_symbol_table(saved_symbol_table_); 5374 isolate()->object_store()->set_symbol_table(saved_symbol_table_);
5489 saved_symbol_table_ = Array::null(); 5375 saved_symbol_table_ = Array::null();
5490 } 5376 }
5491 new_vm_symbol_table_ = Array::null(); 5377 new_vm_symbol_table_ = Array::null();
5492 token_streams_ = Array::null(); 5378 token_streams_ = Array::null();
5493 } 5379 }
5494 5380
5495
5496 intptr_t FullSnapshotWriter::WriteVMSnapshot() { 5381 intptr_t FullSnapshotWriter::WriteVMSnapshot() {
5497 NOT_IN_PRODUCT(TimelineDurationScope tds( 5382 NOT_IN_PRODUCT(TimelineDurationScope tds(
5498 thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot")); 5383 thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot"));
5499 5384
5500 ASSERT(vm_snapshot_data_buffer_ != NULL); 5385 ASSERT(vm_snapshot_data_buffer_ != NULL);
5501 Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_, 5386 Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_,
5502 kInitialSize, vm_image_writer_); 5387 kInitialSize, vm_image_writer_);
5503 5388
5504 serializer.ReserveHeader(); 5389 serializer.ReserveHeader();
5505 serializer.WriteVersionAndFeatures(); 5390 serializer.WriteVersionAndFeatures();
(...skipping 11 matching lines...) Expand all
5517 mapped_data_size_ += vm_image_writer_->data_size(); 5402 mapped_data_size_ += vm_image_writer_->data_size();
5518 mapped_instructions_size_ += vm_image_writer_->text_size(); 5403 mapped_instructions_size_ += vm_image_writer_->text_size();
5519 vm_image_writer_->ResetOffsets(); 5404 vm_image_writer_->ResetOffsets();
5520 } 5405 }
5521 5406
5522 // The clustered part + the direct mapped data part. 5407 // The clustered part + the direct mapped data part.
5523 vm_isolate_snapshot_size_ = serializer.bytes_written(); 5408 vm_isolate_snapshot_size_ = serializer.bytes_written();
5524 return num_objects; 5409 return num_objects;
5525 } 5410 }
5526 5411
5527
5528 void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) { 5412 void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) {
5529 NOT_IN_PRODUCT(TimelineDurationScope tds( 5413 NOT_IN_PRODUCT(TimelineDurationScope tds(
5530 thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot")); 5414 thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot"));
5531 5415
5532 Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_, 5416 Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_,
5533 kInitialSize, isolate_image_writer_); 5417 kInitialSize, isolate_image_writer_);
5534 ObjectStore* object_store = isolate()->object_store(); 5418 ObjectStore* object_store = isolate()->object_store();
5535 ASSERT(object_store != NULL); 5419 ASSERT(object_store != NULL);
5536 5420
5537 serializer.ReserveHeader(); 5421 serializer.ReserveHeader();
5538 serializer.WriteVersionAndFeatures(); 5422 serializer.WriteVersionAndFeatures();
5539 // Isolate snapshot roots are: 5423 // Isolate snapshot roots are:
5540 // - the object store 5424 // - the object store
5541 serializer.WriteIsolateSnapshot(num_base_objects, object_store); 5425 serializer.WriteIsolateSnapshot(num_base_objects, object_store);
5542 serializer.FillHeader(serializer.kind()); 5426 serializer.FillHeader(serializer.kind());
5543 clustered_isolate_size_ = serializer.bytes_written(); 5427 clustered_isolate_size_ = serializer.bytes_written();
5544 5428
5545 if (Snapshot::IncludesCode(kind_)) { 5429 if (Snapshot::IncludesCode(kind_)) {
5546 isolate_image_writer_->Write(serializer.stream(), false); 5430 isolate_image_writer_->Write(serializer.stream(), false);
5547 mapped_data_size_ += isolate_image_writer_->data_size(); 5431 mapped_data_size_ += isolate_image_writer_->data_size();
5548 mapped_instructions_size_ += isolate_image_writer_->text_size(); 5432 mapped_instructions_size_ += isolate_image_writer_->text_size();
5549 isolate_image_writer_->ResetOffsets(); 5433 isolate_image_writer_->ResetOffsets();
5550 } 5434 }
5551 5435
5552 // The clustered part + the direct mapped data part. 5436 // The clustered part + the direct mapped data part.
5553 isolate_snapshot_size_ = serializer.bytes_written(); 5437 isolate_snapshot_size_ = serializer.bytes_written();
5554 } 5438 }
5555 5439
5556
5557 void FullSnapshotWriter::WriteFullSnapshot() { 5440 void FullSnapshotWriter::WriteFullSnapshot() {
5558 intptr_t num_base_objects; 5441 intptr_t num_base_objects;
5559 if (vm_snapshot_data_buffer() != NULL) { 5442 if (vm_snapshot_data_buffer() != NULL) {
5560 num_base_objects = WriteVMSnapshot(); 5443 num_base_objects = WriteVMSnapshot();
5561 ASSERT(num_base_objects != 0); 5444 ASSERT(num_base_objects != 0);
5562 } else { 5445 } else {
5563 num_base_objects = 0; 5446 num_base_objects = 0;
5564 } 5447 }
5565 5448
5566 WriteIsolateSnapshot(num_base_objects); 5449 WriteIsolateSnapshot(num_base_objects);
5567 5450
5568 if (FLAG_print_snapshot_sizes) { 5451 if (FLAG_print_snapshot_sizes) {
5569 OS::Print("VMIsolate(CodeSize): %" Pd "\n", clustered_vm_size_); 5452 OS::Print("VMIsolate(CodeSize): %" Pd "\n", clustered_vm_size_);
5570 OS::Print("Isolate(CodeSize): %" Pd "\n", clustered_isolate_size_); 5453 OS::Print("Isolate(CodeSize): %" Pd "\n", clustered_isolate_size_);
5571 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", mapped_data_size_); 5454 OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", mapped_data_size_);
5572 OS::Print("Instructions(CodeSize): %" Pd "\n", mapped_instructions_size_); 5455 OS::Print("Instructions(CodeSize): %" Pd "\n", mapped_instructions_size_);
5573 OS::Print("Total(CodeSize): %" Pd "\n", 5456 OS::Print("Total(CodeSize): %" Pd "\n",
5574 clustered_vm_size_ + clustered_isolate_size_ + mapped_data_size_ + 5457 clustered_vm_size_ + clustered_isolate_size_ + mapped_data_size_ +
5575 mapped_instructions_size_); 5458 mapped_instructions_size_);
5576 } 5459 }
5577 } 5460 }
5578 5461
5579
5580 static const uint8_t* DataBuffer(const Snapshot* snapshot) { 5462 static const uint8_t* DataBuffer(const Snapshot* snapshot) {
5581 if (Snapshot::IncludesCode(snapshot->kind())) { 5463 if (Snapshot::IncludesCode(snapshot->kind())) {
5582 uword offset = 5464 uword offset =
5583 Utils::RoundUp(snapshot->length(), OS::kMaxPreferredCodeAlignment); 5465 Utils::RoundUp(snapshot->length(), OS::kMaxPreferredCodeAlignment);
5584 return snapshot->Addr() + offset; 5466 return snapshot->Addr() + offset;
5585 } 5467 }
5586 return NULL; 5468 return NULL;
5587 } 5469 }
5588 5470
5589
5590 FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot, 5471 FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot,
5591 const uint8_t* instructions_buffer, 5472 const uint8_t* instructions_buffer,
5592 Thread* thread) 5473 Thread* thread)
5593 : kind_(snapshot->kind()), 5474 : kind_(snapshot->kind()),
5594 thread_(thread), 5475 thread_(thread),
5595 buffer_(snapshot->content()), 5476 buffer_(snapshot->content()),
5596 size_(snapshot->length()), 5477 size_(snapshot->length()),
5597 instructions_buffer_(instructions_buffer), 5478 instructions_buffer_(instructions_buffer),
5598 data_buffer_(DataBuffer(snapshot)) { 5479 data_buffer_(DataBuffer(snapshot)) {
5599 thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kFullAOT); 5480 thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kFullAOT);
5600 } 5481 }
5601 5482
5602
5603 RawApiError* FullSnapshotReader::ReadVMSnapshot() { 5483 RawApiError* FullSnapshotReader::ReadVMSnapshot() {
5604 Deserializer deserializer(thread_, kind_, buffer_, size_, 5484 Deserializer deserializer(thread_, kind_, buffer_, size_,
5605 instructions_buffer_, data_buffer_); 5485 instructions_buffer_, data_buffer_);
5606 5486
5607 RawApiError* error = deserializer.VerifyVersionAndFeatures(/*isolate=*/NULL); 5487 RawApiError* error = deserializer.VerifyVersionAndFeatures(/*isolate=*/NULL);
5608 if (error != ApiError::null()) { 5488 if (error != ApiError::null()) {
5609 return error; 5489 return error;
5610 } 5490 }
5611 5491
5612 if (Snapshot::IncludesCode(kind_)) { 5492 if (Snapshot::IncludesCode(kind_)) {
5613 ASSERT(instructions_buffer_ != NULL); 5493 ASSERT(instructions_buffer_ != NULL);
5614 thread_->isolate()->SetupImagePage(instructions_buffer_, 5494 thread_->isolate()->SetupImagePage(instructions_buffer_,
5615 /* is_executable */ true); 5495 /* is_executable */ true);
5616 ASSERT(data_buffer_ != NULL); 5496 ASSERT(data_buffer_ != NULL);
5617 thread_->isolate()->SetupImagePage(data_buffer_, 5497 thread_->isolate()->SetupImagePage(data_buffer_,
5618 /* is_executable */ false); 5498 /* is_executable */ false);
5619 } 5499 }
5620 5500
5621 deserializer.ReadVMSnapshot(); 5501 deserializer.ReadVMSnapshot();
5622 5502
5623 return ApiError::null(); 5503 return ApiError::null();
5624 } 5504 }
5625 5505
5626
5627 RawApiError* FullSnapshotReader::ReadIsolateSnapshot() { 5506 RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
5628 Deserializer deserializer(thread_, kind_, buffer_, size_, 5507 Deserializer deserializer(thread_, kind_, buffer_, size_,
5629 instructions_buffer_, data_buffer_); 5508 instructions_buffer_, data_buffer_);
5630 5509
5631 RawApiError* error = 5510 RawApiError* error =
5632 deserializer.VerifyVersionAndFeatures(thread_->isolate()); 5511 deserializer.VerifyVersionAndFeatures(thread_->isolate());
5633 if (error != ApiError::null()) { 5512 if (error != ApiError::null()) {
5634 return error; 5513 return error;
5635 } 5514 }
5636 5515
5637 if (Snapshot::IncludesCode(kind_)) { 5516 if (Snapshot::IncludesCode(kind_)) {
5638 ASSERT(instructions_buffer_ != NULL); 5517 ASSERT(instructions_buffer_ != NULL);
5639 thread_->isolate()->SetupImagePage(instructions_buffer_, 5518 thread_->isolate()->SetupImagePage(instructions_buffer_,
5640 /* is_executable */ true); 5519 /* is_executable */ true);
5641 ASSERT(data_buffer_ != NULL); 5520 ASSERT(data_buffer_ != NULL);
5642 thread_->isolate()->SetupImagePage(data_buffer_, 5521 thread_->isolate()->SetupImagePage(data_buffer_,
5643 /* is_executable */ false); 5522 /* is_executable */ false);
5644 } 5523 }
5645 5524
5646 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); 5525 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store());
5647 5526
5648 return ApiError::null(); 5527 return ApiError::null();
5649 } 5528 }
5650 5529
5651 } // namespace dart 5530 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/clustered_snapshot.h ('k') | runtime/vm/code_descriptors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698