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

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

Issue 22851003: Initial support for length guards on final fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 Field& field = Field::ZoneHandle(reader->isolate(), NEW_OBJECT(Field)); 814 Field& field = Field::ZoneHandle(reader->isolate(), NEW_OBJECT(Field));
815 reader->AddBackRef(object_id, &field, kIsDeserialized); 815 reader->AddBackRef(object_id, &field, kIsDeserialized);
816 816
817 // Set the object tags. 817 // Set the object tags.
818 field.set_tags(tags); 818 field.set_tags(tags);
819 819
820 // Set all non object fields. 820 // Set all non object fields.
821 field.set_token_pos(reader->ReadIntptrValue()); 821 field.set_token_pos(reader->ReadIntptrValue());
822 field.set_guarded_cid(reader->ReadIntptrValue()); 822 field.set_guarded_cid(reader->ReadIntptrValue());
823 field.set_is_nullable(reader->ReadIntptrValue()); 823 field.set_is_nullable(reader->ReadIntptrValue());
824 field.set_guarded_list_length(reader->ReadIntptrValue());
824 field.set_kind_bits(reader->Read<uint8_t>()); 825 field.set_kind_bits(reader->Read<uint8_t>());
825 826
826 // Set all the object fields. 827 // Set all the object fields.
827 // TODO(5411462): Need to assert No GC can happen here, even though 828 // TODO(5411462): Need to assert No GC can happen here, even though
828 // allocations may happen. 829 // allocations may happen.
829 intptr_t num_flds = (field.raw()->to() - field.raw()->from()); 830 intptr_t num_flds = (field.raw()->to() - field.raw()->from());
830 for (intptr_t i = 0; i <= num_flds; i++) { 831 for (intptr_t i = 0; i <= num_flds; i++) {
831 *(field.raw()->from() + i) = reader->ReadObjectRef(); 832 *(field.raw()->from() + i) = reader->ReadObjectRef();
832 } 833 }
833 834
(...skipping 13 matching lines...) Expand all
847 writer->WriteInlinedObjectHeader(object_id); 848 writer->WriteInlinedObjectHeader(object_id);
848 849
849 // Write out the class and tags information. 850 // Write out the class and tags information.
850 writer->WriteVMIsolateObject(kFieldCid); 851 writer->WriteVMIsolateObject(kFieldCid);
851 writer->WriteIntptrValue(writer->GetObjectTags(this)); 852 writer->WriteIntptrValue(writer->GetObjectTags(this));
852 853
853 // Write out all the non object fields. 854 // Write out all the non object fields.
854 writer->WriteIntptrValue(ptr()->token_pos_); 855 writer->WriteIntptrValue(ptr()->token_pos_);
855 writer->WriteIntptrValue(ptr()->guarded_cid_); 856 writer->WriteIntptrValue(ptr()->guarded_cid_);
856 writer->WriteIntptrValue(ptr()->is_nullable_); 857 writer->WriteIntptrValue(ptr()->is_nullable_);
858 writer->WriteIntptrValue(ptr()->guarded_list_length_);
857 writer->Write<uint8_t>(ptr()->kind_bits_); 859 writer->Write<uint8_t>(ptr()->kind_bits_);
858 860
859 // Write out all the object pointer fields. 861 // Write out all the object pointer fields.
860 SnapshotWriterVisitor visitor(writer); 862 SnapshotWriterVisitor visitor(writer);
861 visitor.VisitPointers(from(), to()); 863 visitor.VisitPointers(from(), to());
862 } 864 }
863 865
864 866
865 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, 867 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader,
866 intptr_t object_id, 868 intptr_t object_id,
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 } 2644 }
2643 2645
2644 2646
2645 void RawMirrorReference::WriteTo(SnapshotWriter* writer, 2647 void RawMirrorReference::WriteTo(SnapshotWriter* writer,
2646 intptr_t object_id, 2648 intptr_t object_id,
2647 Snapshot::Kind kind) { 2649 Snapshot::Kind kind) {
2648 UNREACHABLE(); 2650 UNREACHABLE();
2649 } 2651 }
2650 2652
2651 } // namespace dart 2653 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698