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

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

Issue 14820028: Delay Class parsing until the class is actually used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Set the object tags. 59 // Set the object tags.
60 cls.set_tags(tags); 60 cls.set_tags(tags);
61 61
62 // Set all non object fields. 62 // Set all non object fields.
63 cls.set_instance_size_in_words(reader->ReadIntptrValue()); 63 cls.set_instance_size_in_words(reader->ReadIntptrValue());
64 cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue()); 64 cls.set_type_arguments_field_offset_in_words(reader->ReadIntptrValue());
65 cls.set_next_field_offset_in_words(reader->ReadIntptrValue()); 65 cls.set_next_field_offset_in_words(reader->ReadIntptrValue());
66 cls.set_num_native_fields(reader->ReadIntptrValue()); 66 cls.set_num_native_fields(reader->ReadIntptrValue());
67 cls.set_token_pos(reader->ReadIntptrValue()); 67 cls.set_token_pos(reader->ReadIntptrValue());
68 cls.set_state_bits(reader->Read<uint8_t>()); 68 cls.set_state_bits(reader->Read<uint16_t>());
69 69
70 // Set all the object fields. 70 // Set all the object fields.
71 // TODO(5411462): Need to assert No GC can happen here, even though 71 // TODO(5411462): Need to assert No GC can happen here, even though
72 // allocations may happen. 72 // allocations may happen.
73 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); 73 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from());
74 for (intptr_t i = 0; i <= num_flds; i++) { 74 for (intptr_t i = 0; i <= num_flds; i++) {
75 *(cls.raw()->from() + i) = reader->ReadObjectRef(); 75 *(cls.raw()->from() + i) = reader->ReadObjectRef();
76 } 76 }
77 } else { 77 } else {
78 cls ^= reader->ReadClassId(object_id); 78 cls ^= reader->ReadClassId(object_id);
(...skipping 18 matching lines...) Expand all
97 writer->WriteIntptrValue(writer->GetObjectTags(this)); 97 writer->WriteIntptrValue(writer->GetObjectTags(this));
98 98
99 // Write out all the non object pointer fields. 99 // Write out all the non object pointer fields.
100 // NOTE: cpp_vtable_ is not written. 100 // NOTE: cpp_vtable_ is not written.
101 writer->WriteIntptrValue(ptr()->id_); 101 writer->WriteIntptrValue(ptr()->id_);
102 writer->WriteIntptrValue(ptr()->instance_size_in_words_); 102 writer->WriteIntptrValue(ptr()->instance_size_in_words_);
103 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_); 103 writer->WriteIntptrValue(ptr()->type_arguments_field_offset_in_words_);
104 writer->WriteIntptrValue(ptr()->next_field_offset_in_words_); 104 writer->WriteIntptrValue(ptr()->next_field_offset_in_words_);
105 writer->WriteIntptrValue(ptr()->num_native_fields_); 105 writer->WriteIntptrValue(ptr()->num_native_fields_);
106 writer->WriteIntptrValue(ptr()->token_pos_); 106 writer->WriteIntptrValue(ptr()->token_pos_);
107 writer->Write<uint8_t>(ptr()->state_bits_); 107 writer->Write<uint16_t>(ptr()->state_bits_);
108 108
109 // Write out all the object pointer fields. 109 // Write out all the object pointer fields.
110 SnapshotWriterVisitor visitor(writer); 110 SnapshotWriterVisitor visitor(writer);
111 visitor.VisitPointers(from(), to()); 111 visitor.VisitPointers(from(), to());
112 } else { 112 } else {
113 writer->WriteClassId(this); 113 writer->WriteClassId(this);
114 } 114 }
115 } 115 }
116 116
117 117
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 // Write out the class and tags information. 2640 // Write out the class and tags information.
2641 writer->WriteIndexedObject(kWeakPropertyCid); 2641 writer->WriteIndexedObject(kWeakPropertyCid);
2642 writer->WriteIntptrValue(writer->GetObjectTags(this)); 2642 writer->WriteIntptrValue(writer->GetObjectTags(this));
2643 2643
2644 // Write out all the other fields. 2644 // Write out all the other fields.
2645 writer->Write<RawObject*>(ptr()->key_); 2645 writer->Write<RawObject*>(ptr()->key_);
2646 writer->Write<RawObject*>(ptr()->value_); 2646 writer->Write<RawObject*>(ptr()->value_);
2647 } 2647 }
2648 2648
2649 } // namespace dart 2649 } // namespace dart
OLDNEW
« runtime/vm/parser.h ('K') | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698