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

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

Issue 22915008: Tests for GuardField length check along with bug fixes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bigint_operations.h" 5 #include "vm/bigint_operations.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/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());
825 field.set_kind_bits(reader->Read<uint8_t>()); 824 field.set_kind_bits(reader->Read<uint8_t>());
826 825
827 // Set all the object fields. 826 // Set all the object fields.
828 // TODO(5411462): Need to assert No GC can happen here, even though 827 // TODO(5411462): Need to assert No GC can happen here, even though
829 // allocations may happen. 828 // allocations may happen.
830 intptr_t num_flds = (field.raw()->to() - field.raw()->from()); 829 intptr_t num_flds = (field.raw()->to() - field.raw()->from());
831 for (intptr_t i = 0; i <= num_flds; i++) { 830 for (intptr_t i = 0; i <= num_flds; i++) {
832 *(field.raw()->from() + i) = reader->ReadObjectRef(); 831 *(field.raw()->from() + i) = reader->ReadObjectRef();
833 } 832 }
834 833
(...skipping 13 matching lines...) Expand all
848 writer->WriteInlinedObjectHeader(object_id); 847 writer->WriteInlinedObjectHeader(object_id);
849 848
850 // Write out the class and tags information. 849 // Write out the class and tags information.
851 writer->WriteVMIsolateObject(kFieldCid); 850 writer->WriteVMIsolateObject(kFieldCid);
852 writer->WriteIntptrValue(writer->GetObjectTags(this)); 851 writer->WriteIntptrValue(writer->GetObjectTags(this));
853 852
854 // Write out all the non object fields. 853 // Write out all the non object fields.
855 writer->WriteIntptrValue(ptr()->token_pos_); 854 writer->WriteIntptrValue(ptr()->token_pos_);
856 writer->WriteIntptrValue(ptr()->guarded_cid_); 855 writer->WriteIntptrValue(ptr()->guarded_cid_);
857 writer->WriteIntptrValue(ptr()->is_nullable_); 856 writer->WriteIntptrValue(ptr()->is_nullable_);
858 writer->WriteIntptrValue(ptr()->guarded_list_length_);
859 writer->Write<uint8_t>(ptr()->kind_bits_); 857 writer->Write<uint8_t>(ptr()->kind_bits_);
860 858
861 // Write out all the object pointer fields. 859 // Write out all the object pointer fields.
862 SnapshotWriterVisitor visitor(writer); 860 SnapshotWriterVisitor visitor(writer);
863 visitor.VisitPointers(from(), to()); 861 visitor.VisitPointers(from(), to());
864 } 862 }
865 863
866 864
867 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader, 865 RawLiteralToken* LiteralToken::ReadFrom(SnapshotReader* reader,
868 intptr_t object_id, 866 intptr_t object_id,
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 } 2638 }
2641 2639
2642 2640
2643 void RawMirrorReference::WriteTo(SnapshotWriter* writer, 2641 void RawMirrorReference::WriteTo(SnapshotWriter* writer,
2644 intptr_t object_id, 2642 intptr_t object_id,
2645 Snapshot::Kind kind) { 2643 Snapshot::Kind kind) {
2646 UNREACHABLE(); 2644 UNREACHABLE();
2647 } 2645 }
2648 2646
2649 } // namespace dart 2647 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698