OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/snapshot.h" | 5 #include "vm/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" |
11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
12 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
13 #include "vm/heap.h" | 13 #include "vm/heap.h" |
14 #include "vm/lockers.h" | 14 #include "vm/lockers.h" |
15 #include "vm/longjump.h" | 15 #include "vm/longjump.h" |
16 #include "vm/object.h" | 16 #include "vm/object.h" |
17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
18 #include "vm/snapshot_ids.h" | 18 #include "vm/snapshot_ids.h" |
19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
20 #include "vm/verified_memory.h" | 20 #include "vm/verified_memory.h" |
21 #include "vm/version.h" | 21 #include "vm/version.h" |
22 | 22 |
| 23 // We currently only expect the Dart mutator to read snapshots. |
| 24 #define ASSERT_NO_SAFEPOINT_SCOPE() \ |
| 25 isolate()->AssertCurrentThreadIsMutator(); \ |
| 26 ASSERT(Thread::Current()->no_safepoint_scope_depth() != 0) |
| 27 |
23 namespace dart { | 28 namespace dart { |
24 | 29 |
25 static const int kNumVmIsolateSnapshotReferences = 32 * KB; | 30 static const int kNumVmIsolateSnapshotReferences = 32 * KB; |
26 static const int kNumInitialReferencesInFullSnapshot = 160 * KB; | 31 static const int kNumInitialReferencesInFullSnapshot = 160 * KB; |
27 static const int kNumInitialReferences = 64; | 32 static const int kNumInitialReferences = 64; |
28 | 33 |
29 | 34 |
30 static bool IsSingletonClassId(intptr_t class_id) { | 35 static bool IsSingletonClassId(intptr_t class_id) { |
31 // Check if this is a singleton object class which is shared by all isolates. | 36 // Check if this is a singleton object class which is shared by all isolates. |
32 return ((class_id >= kClassCid && class_id <= kUnwindErrorCid) || | 37 return ((class_id >= kClassCid && class_id <= kUnwindErrorCid) || |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); | 607 const String& msg = String::Handle(String::New(message_buffer, Heap::kOld)); |
603 return ApiError::New(msg, Heap::kOld); | 608 return ApiError::New(msg, Heap::kOld); |
604 } | 609 } |
605 Advance(version_len); | 610 Advance(version_len); |
606 return ApiError::null(); | 611 return ApiError::null(); |
607 } | 612 } |
608 | 613 |
609 | 614 |
610 #define ALLOC_NEW_OBJECT_WITH_LEN(type, length) \ | 615 #define ALLOC_NEW_OBJECT_WITH_LEN(type, length) \ |
611 ASSERT(kind_ == Snapshot::kFull); \ | 616 ASSERT(kind_ == Snapshot::kFull); \ |
612 ASSERT(isolate()->no_safepoint_scope_depth() != 0); \ | 617 ASSERT_NO_SAFEPOINT_SCOPE(); \ |
613 Raw##type* obj = reinterpret_cast<Raw##type*>( \ | 618 Raw##type* obj = reinterpret_cast<Raw##type*>( \ |
614 AllocateUninitialized(k##type##Cid, type::InstanceSize(length))); \ | 619 AllocateUninitialized(k##type##Cid, type::InstanceSize(length))); \ |
615 obj->StoreSmi(&(obj->ptr()->length_), Smi::New(length)); \ | 620 obj->StoreSmi(&(obj->ptr()->length_), Smi::New(length)); \ |
616 return obj; \ | 621 return obj; \ |
617 | 622 |
618 | 623 |
619 RawArray* SnapshotReader::NewArray(intptr_t len) { | 624 RawArray* SnapshotReader::NewArray(intptr_t len) { |
620 ALLOC_NEW_OBJECT_WITH_LEN(Array, len); | 625 ALLOC_NEW_OBJECT_WITH_LEN(Array, len); |
621 } | 626 } |
622 | 627 |
(...skipping 13 matching lines...) Expand all Loading... |
636 } | 641 } |
637 | 642 |
638 | 643 |
639 RawTypeArguments* SnapshotReader::NewTypeArguments(intptr_t len) { | 644 RawTypeArguments* SnapshotReader::NewTypeArguments(intptr_t len) { |
640 ALLOC_NEW_OBJECT_WITH_LEN(TypeArguments, len); | 645 ALLOC_NEW_OBJECT_WITH_LEN(TypeArguments, len); |
641 } | 646 } |
642 | 647 |
643 | 648 |
644 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { | 649 RawTokenStream* SnapshotReader::NewTokenStream(intptr_t len) { |
645 ASSERT(kind_ == Snapshot::kFull); | 650 ASSERT(kind_ == Snapshot::kFull); |
646 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 651 ASSERT_NO_SAFEPOINT_SCOPE(); |
647 stream_ = reinterpret_cast<RawTokenStream*>( | 652 stream_ = reinterpret_cast<RawTokenStream*>( |
648 AllocateUninitialized(kTokenStreamCid, TokenStream::InstanceSize())); | 653 AllocateUninitialized(kTokenStreamCid, TokenStream::InstanceSize())); |
649 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); | 654 uint8_t* array = const_cast<uint8_t*>(CurrentBufferAddress()); |
650 ASSERT(array != NULL); | 655 ASSERT(array != NULL); |
651 Advance(len); | 656 Advance(len); |
652 data_ = reinterpret_cast<RawExternalTypedData*>( | 657 data_ = reinterpret_cast<RawExternalTypedData*>( |
653 AllocateUninitialized(kExternalTypedDataUint8ArrayCid, | 658 AllocateUninitialized(kExternalTypedDataUint8ArrayCid, |
654 ExternalTypedData::InstanceSize())); | 659 ExternalTypedData::InstanceSize())); |
655 data_.SetData(array); | 660 data_.SetData(array); |
656 data_.SetLength(len); | 661 data_.SetLength(len); |
657 stream_.SetStream(data_); | 662 stream_.SetStream(data_); |
658 return stream_.raw(); | 663 return stream_.raw(); |
659 } | 664 } |
660 | 665 |
661 | 666 |
662 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { | 667 RawContext* SnapshotReader::NewContext(intptr_t num_variables) { |
663 ASSERT(kind_ == Snapshot::kFull); | 668 ASSERT(kind_ == Snapshot::kFull); |
664 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 669 ASSERT_NO_SAFEPOINT_SCOPE(); |
665 RawContext* obj = reinterpret_cast<RawContext*>( | 670 RawContext* obj = reinterpret_cast<RawContext*>( |
666 AllocateUninitialized(kContextCid, Context::InstanceSize(num_variables))); | 671 AllocateUninitialized(kContextCid, Context::InstanceSize(num_variables))); |
667 obj->ptr()->num_variables_ = num_variables; | 672 obj->ptr()->num_variables_ = num_variables; |
668 return obj; | 673 return obj; |
669 } | 674 } |
670 | 675 |
671 | 676 |
672 RawClass* SnapshotReader::NewClass(intptr_t class_id) { | 677 RawClass* SnapshotReader::NewClass(intptr_t class_id) { |
673 ASSERT(kind_ == Snapshot::kFull); | 678 ASSERT(kind_ == Snapshot::kFull); |
674 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 679 ASSERT_NO_SAFEPOINT_SCOPE(); |
675 if (class_id < kNumPredefinedCids) { | 680 if (class_id < kNumPredefinedCids) { |
676 ASSERT((class_id >= kInstanceCid) && | 681 ASSERT((class_id >= kInstanceCid) && |
677 (class_id <= kNullCid)); | 682 (class_id <= kNullCid)); |
678 return isolate()->class_table()->At(class_id); | 683 return isolate()->class_table()->At(class_id); |
679 } | 684 } |
680 RawClass* obj = reinterpret_cast<RawClass*>( | 685 RawClass* obj = reinterpret_cast<RawClass*>( |
681 AllocateUninitialized(kClassCid, Class::InstanceSize())); | 686 AllocateUninitialized(kClassCid, Class::InstanceSize())); |
682 Instance fake; | 687 Instance fake; |
683 obj->ptr()->handle_vtable_ = fake.vtable(); | 688 obj->ptr()->handle_vtable_ = fake.vtable(); |
684 cls_ = obj; | 689 cls_ = obj; |
685 cls_.set_id(class_id); | 690 cls_.set_id(class_id); |
686 isolate()->RegisterClassAt(class_id, cls_); | 691 isolate()->RegisterClassAt(class_id, cls_); |
687 return cls_.raw(); | 692 return cls_.raw(); |
688 } | 693 } |
689 | 694 |
690 | 695 |
691 RawInstance* SnapshotReader::NewInstance() { | 696 RawInstance* SnapshotReader::NewInstance() { |
692 ASSERT(kind_ == Snapshot::kFull); | 697 ASSERT(kind_ == Snapshot::kFull); |
693 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 698 ASSERT_NO_SAFEPOINT_SCOPE(); |
694 RawInstance* obj = reinterpret_cast<RawInstance*>( | 699 RawInstance* obj = reinterpret_cast<RawInstance*>( |
695 AllocateUninitialized(kObjectCid, Instance::InstanceSize())); | 700 AllocateUninitialized(kObjectCid, Instance::InstanceSize())); |
696 return obj; | 701 return obj; |
697 } | 702 } |
698 | 703 |
699 | 704 |
700 RawMint* SnapshotReader::NewMint(int64_t value) { | 705 RawMint* SnapshotReader::NewMint(int64_t value) { |
701 ASSERT(kind_ == Snapshot::kFull); | 706 ASSERT(kind_ == Snapshot::kFull); |
702 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 707 ASSERT_NO_SAFEPOINT_SCOPE(); |
703 RawMint* obj = reinterpret_cast<RawMint*>( | 708 RawMint* obj = reinterpret_cast<RawMint*>( |
704 AllocateUninitialized(kMintCid, Mint::InstanceSize())); | 709 AllocateUninitialized(kMintCid, Mint::InstanceSize())); |
705 obj->ptr()->value_ = value; | 710 obj->ptr()->value_ = value; |
706 return obj; | 711 return obj; |
707 } | 712 } |
708 | 713 |
709 | 714 |
710 RawDouble* SnapshotReader::NewDouble(double value) { | 715 RawDouble* SnapshotReader::NewDouble(double value) { |
711 ASSERT(kind_ == Snapshot::kFull); | 716 ASSERT(kind_ == Snapshot::kFull); |
712 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 717 ASSERT_NO_SAFEPOINT_SCOPE(); |
713 RawDouble* obj = reinterpret_cast<RawDouble*>( | 718 RawDouble* obj = reinterpret_cast<RawDouble*>( |
714 AllocateUninitialized(kDoubleCid, Double::InstanceSize())); | 719 AllocateUninitialized(kDoubleCid, Double::InstanceSize())); |
715 obj->ptr()->value_ = value; | 720 obj->ptr()->value_ = value; |
716 return obj; | 721 return obj; |
717 } | 722 } |
718 | 723 |
719 | 724 |
720 RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) { | 725 RawTypedData* SnapshotReader::NewTypedData(intptr_t class_id, intptr_t len) { |
721 ASSERT(kind_ == Snapshot::kFull); | 726 ASSERT(kind_ == Snapshot::kFull); |
722 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 727 ASSERT_NO_SAFEPOINT_SCOPE(); |
723 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id); | 728 const intptr_t lengthInBytes = len * TypedData::ElementSizeInBytes(class_id); |
724 RawTypedData* obj = reinterpret_cast<RawTypedData*>( | 729 RawTypedData* obj = reinterpret_cast<RawTypedData*>( |
725 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes))); | 730 AllocateUninitialized(class_id, TypedData::InstanceSize(lengthInBytes))); |
726 obj->StoreSmi(&(obj->ptr()->length_), Smi::New(len)); | 731 obj->StoreSmi(&(obj->ptr()->length_), Smi::New(len)); |
727 return obj; | 732 return obj; |
728 } | 733 } |
729 | 734 |
730 | 735 |
731 #define ALLOC_NEW_OBJECT(type) \ | 736 #define ALLOC_NEW_OBJECT(type) \ |
732 ASSERT(kind_ == Snapshot::kFull); \ | 737 ASSERT(kind_ == Snapshot::kFull); \ |
733 ASSERT(isolate()->no_safepoint_scope_depth() != 0); \ | 738 ASSERT_NO_SAFEPOINT_SCOPE(); \ |
734 return reinterpret_cast<Raw##type*>( \ | 739 return reinterpret_cast<Raw##type*>( \ |
735 AllocateUninitialized(k##type##Cid, type::InstanceSize())); \ | 740 AllocateUninitialized(k##type##Cid, type::InstanceSize())); \ |
736 | 741 |
737 | 742 |
738 RawBigint* SnapshotReader::NewBigint() { | 743 RawBigint* SnapshotReader::NewBigint() { |
739 ALLOC_NEW_OBJECT(Bigint); | 744 ALLOC_NEW_OBJECT(Bigint); |
740 } | 745 } |
741 | 746 |
742 | 747 |
743 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() { | 748 RawUnresolvedClass* SnapshotReader::NewUnresolvedClass() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 | 826 |
822 | 827 |
823 RawGrowableObjectArray* SnapshotReader::NewGrowableObjectArray() { | 828 RawGrowableObjectArray* SnapshotReader::NewGrowableObjectArray() { |
824 ALLOC_NEW_OBJECT(GrowableObjectArray); | 829 ALLOC_NEW_OBJECT(GrowableObjectArray); |
825 } | 830 } |
826 | 831 |
827 | 832 |
828 RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2, | 833 RawFloat32x4* SnapshotReader::NewFloat32x4(float v0, float v1, float v2, |
829 float v3) { | 834 float v3) { |
830 ASSERT(kind_ == Snapshot::kFull); | 835 ASSERT(kind_ == Snapshot::kFull); |
831 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 836 ASSERT_NO_SAFEPOINT_SCOPE(); |
832 RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>( | 837 RawFloat32x4* obj = reinterpret_cast<RawFloat32x4*>( |
833 AllocateUninitialized(kFloat32x4Cid, Float32x4::InstanceSize())); | 838 AllocateUninitialized(kFloat32x4Cid, Float32x4::InstanceSize())); |
834 obj->ptr()->value_[0] = v0; | 839 obj->ptr()->value_[0] = v0; |
835 obj->ptr()->value_[1] = v1; | 840 obj->ptr()->value_[1] = v1; |
836 obj->ptr()->value_[2] = v2; | 841 obj->ptr()->value_[2] = v2; |
837 obj->ptr()->value_[3] = v3; | 842 obj->ptr()->value_[3] = v3; |
838 return obj; | 843 return obj; |
839 } | 844 } |
840 | 845 |
841 | 846 |
842 RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, | 847 RawInt32x4* SnapshotReader::NewInt32x4(uint32_t v0, uint32_t v1, uint32_t v2, |
843 uint32_t v3) { | 848 uint32_t v3) { |
844 ASSERT(kind_ == Snapshot::kFull); | 849 ASSERT(kind_ == Snapshot::kFull); |
845 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 850 ASSERT_NO_SAFEPOINT_SCOPE(); |
846 RawInt32x4* obj = reinterpret_cast<RawInt32x4*>( | 851 RawInt32x4* obj = reinterpret_cast<RawInt32x4*>( |
847 AllocateUninitialized(kInt32x4Cid, Int32x4::InstanceSize())); | 852 AllocateUninitialized(kInt32x4Cid, Int32x4::InstanceSize())); |
848 obj->ptr()->value_[0] = v0; | 853 obj->ptr()->value_[0] = v0; |
849 obj->ptr()->value_[1] = v1; | 854 obj->ptr()->value_[1] = v1; |
850 obj->ptr()->value_[2] = v2; | 855 obj->ptr()->value_[2] = v2; |
851 obj->ptr()->value_[3] = v3; | 856 obj->ptr()->value_[3] = v3; |
852 return obj; | 857 return obj; |
853 } | 858 } |
854 | 859 |
855 | 860 |
856 RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) { | 861 RawFloat64x2* SnapshotReader::NewFloat64x2(double v0, double v1) { |
857 ASSERT(kind_ == Snapshot::kFull); | 862 ASSERT(kind_ == Snapshot::kFull); |
858 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 863 ASSERT_NO_SAFEPOINT_SCOPE(); |
859 RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>( | 864 RawFloat64x2* obj = reinterpret_cast<RawFloat64x2*>( |
860 AllocateUninitialized(kFloat64x2Cid, Float64x2::InstanceSize())); | 865 AllocateUninitialized(kFloat64x2Cid, Float64x2::InstanceSize())); |
861 obj->ptr()->value_[0] = v0; | 866 obj->ptr()->value_[0] = v0; |
862 obj->ptr()->value_[1] = v1; | 867 obj->ptr()->value_[1] = v1; |
863 return obj; | 868 return obj; |
864 } | 869 } |
865 | 870 |
866 | 871 |
867 RawApiError* SnapshotReader::NewApiError() { | 872 RawApiError* SnapshotReader::NewApiError() { |
868 ALLOC_NEW_OBJECT(ApiError); | 873 ALLOC_NEW_OBJECT(ApiError); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 } | 912 } |
908 ASSERT(SerializedHeaderTag::decode(class_header) == kObjectId); | 913 ASSERT(SerializedHeaderTag::decode(class_header) == kObjectId); |
909 intptr_t class_id = SerializedHeaderData::decode(class_header); | 914 intptr_t class_id = SerializedHeaderData::decode(class_header); |
910 ASSERT(IsObjectStoreClassId(class_id)); | 915 ASSERT(IsObjectStoreClassId(class_id)); |
911 return class_id; | 916 return class_id; |
912 } | 917 } |
913 | 918 |
914 | 919 |
915 RawObject* SnapshotReader::AllocateUninitialized(intptr_t class_id, | 920 RawObject* SnapshotReader::AllocateUninitialized(intptr_t class_id, |
916 intptr_t size) { | 921 intptr_t size) { |
917 ASSERT(isolate()->no_safepoint_scope_depth() != 0); | 922 ASSERT_NO_SAFEPOINT_SCOPE(); |
918 ASSERT(Utils::IsAligned(size, kObjectAlignment)); | 923 ASSERT(Utils::IsAligned(size, kObjectAlignment)); |
919 | 924 |
920 // Allocate memory where all words look like smis. This is currently | 925 // Allocate memory where all words look like smis. This is currently |
921 // only needed for DEBUG-mode validation in StorePointer/StoreSmi, but will | 926 // only needed for DEBUG-mode validation in StorePointer/StoreSmi, but will |
922 // be essential with the upcoming deletion barrier. | 927 // be essential with the upcoming deletion barrier. |
923 uword address = | 928 uword address = |
924 old_space()->TryAllocateSmiInitializedLocked(size, | 929 old_space()->TryAllocateSmiInitializedLocked(size, |
925 PageSpace::kForceGrowth); | 930 PageSpace::kForceGrowth); |
926 if (address == 0) { | 931 if (address == 0) { |
927 // Use the preallocated out of memory exception to avoid calling | 932 // Use the preallocated out of memory exception to avoid calling |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1696 } | 1701 } |
1697 } | 1702 } |
1698 | 1703 |
1699 | 1704 |
1700 ForwardList::ForwardList(intptr_t first_object_id) | 1705 ForwardList::ForwardList(intptr_t first_object_id) |
1701 : first_object_id_(first_object_id), | 1706 : first_object_id_(first_object_id), |
1702 nodes_(), | 1707 nodes_(), |
1703 first_unprocessed_object_id_(first_object_id) { | 1708 first_unprocessed_object_id_(first_object_id) { |
1704 // The ForwardList encodes information in the header tag word. There cannot | 1709 // The ForwardList encodes information in the header tag word. There cannot |
1705 // be any concurrent GC tasks while it is in use. | 1710 // be any concurrent GC tasks while it is in use. |
1706 Isolate* isolate = Isolate::Current(); | 1711 Thread* thread = Thread::Current(); |
| 1712 Isolate* isolate = thread->isolate(); |
1707 PageSpace* page_space = isolate->heap()->old_space(); | 1713 PageSpace* page_space = isolate->heap()->old_space(); |
1708 MonitorLocker ml(page_space->tasks_lock()); | 1714 MonitorLocker ml(page_space->tasks_lock()); |
1709 while (page_space->tasks() > 0) { | 1715 while (page_space->tasks() > 0) { |
1710 ml.Wait(); | 1716 ml.Wait(); |
1711 } | 1717 } |
1712 // Ensure that no GC happens while we are writing out the full snapshot. | 1718 // Ensure that no GC happens while we are writing out the full snapshot. |
1713 isolate->IncrementNoSafepointScopeDepth(); | 1719 thread->IncrementNoSafepointScopeDepth(); |
1714 } | 1720 } |
1715 | 1721 |
1716 | 1722 |
1717 ForwardList::~ForwardList() { | 1723 ForwardList::~ForwardList() { |
1718 } | 1724 } |
1719 | 1725 |
1720 | 1726 |
1721 intptr_t ForwardList::MarkAndAddObject(RawObject* raw, SerializeState state) { | 1727 intptr_t ForwardList::MarkAndAddObject(RawObject* raw, SerializeState state) { |
1722 NoSafepointScope no_safepoint; | 1728 NoSafepointScope no_safepoint; |
1723 intptr_t object_id = next_object_id(); | 1729 intptr_t object_id = next_object_id(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 | 1768 |
1763 | 1769 |
1764 void ForwardList::UnmarkAll() const { | 1770 void ForwardList::UnmarkAll() const { |
1765 for (intptr_t id = first_object_id(); id < next_object_id(); ++id) { | 1771 for (intptr_t id = first_object_id(); id < next_object_id(); ++id) { |
1766 const Node* node = NodeForObjectId(id); | 1772 const Node* node = NodeForObjectId(id); |
1767 RawObject* raw = node->raw(); | 1773 RawObject* raw = node->raw(); |
1768 if (SerializedHeaderTag::decode(raw->ptr()->tags_) == kObjectId) { | 1774 if (SerializedHeaderTag::decode(raw->ptr()->tags_) == kObjectId) { |
1769 raw->ptr()->tags_ = node->tags(); // Restore original tags. | 1775 raw->ptr()->tags_ = node->tags(); // Restore original tags. |
1770 } | 1776 } |
1771 } | 1777 } |
1772 Isolate::Current()->DecrementNoSafepointScopeDepth(); | 1778 Thread::Current()->DecrementNoSafepointScopeDepth(); |
1773 } | 1779 } |
1774 | 1780 |
1775 | 1781 |
1776 bool SnapshotWriter::CheckAndWritePredefinedObject(RawObject* rawobj) { | 1782 bool SnapshotWriter::CheckAndWritePredefinedObject(RawObject* rawobj) { |
1777 // Check if object can be written in one of the following ways: | 1783 // Check if object can be written in one of the following ways: |
1778 // - Smi: the Smi value is written as is (last bit is not tagged). | 1784 // - Smi: the Smi value is written as is (last bit is not tagged). |
1779 // - VM internal class (from VM isolate): (index of class in vm isolate | 0x3) | 1785 // - VM internal class (from VM isolate): (index of class in vm isolate | 0x3) |
1780 // - Object that has already been written: (negative id in stream | 0x3) | 1786 // - Object that has already been written: (negative id in stream | 0x3) |
1781 | 1787 |
1782 NoSafepointScope no_safepoint; | 1788 NoSafepointScope no_safepoint; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 NoSafepointScope no_safepoint; | 2348 NoSafepointScope no_safepoint; |
2343 WriteObject(obj.raw()); | 2349 WriteObject(obj.raw()); |
2344 UnmarkAll(); | 2350 UnmarkAll(); |
2345 } else { | 2351 } else { |
2346 ThrowException(exception_type(), exception_msg()); | 2352 ThrowException(exception_type(), exception_msg()); |
2347 } | 2353 } |
2348 } | 2354 } |
2349 | 2355 |
2350 | 2356 |
2351 } // namespace dart | 2357 } // namespace dart |
OLD | NEW |