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

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

Issue 8247014: Changes to handle unresolved qualified identifiers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 writer->Write<bool>(ptr()->is_interface_); 90 writer->Write<bool>(ptr()->is_interface_);
91 91
92 // Write out all the object pointer fields. 92 // Write out all the object pointer fields.
93 visitor.VisitPointers(from(), to()); 93 visitor.VisitPointers(from(), to());
94 } else { 94 } else {
95 writer->WriteClassId(this); 95 writer->WriteClassId(this);
96 } 96 }
97 } 97 }
98 98
99 99
100 RawUnresolvedClass* UnresolvedClass::ReadFrom(SnapshotReader* reader,
101 intptr_t object_id,
102 bool classes_serialized) {
103 ASSERT(reader != NULL);
104
105 // Allocate parameterized type object.
106 UnresolvedClass& unresolved_class =
107 UnresolvedClass::ZoneHandle(UnresolvedClass::New());
108 reader->AddBackwardReference(object_id, &unresolved_class);
109
110 // Set all non object fields.
111 unresolved_class.set_token_index(reader->Read<intptr_t>());
112
113 // Set all the object fields.
114 // TODO(5411462): Need to assert No GC can happen here, even though
115 // allocations may happen.
116 intptr_t num_flds = (unresolved_class.raw()->to() -
117 unresolved_class.raw()->from());
118 for (intptr_t i = 0; i <= num_flds; i++) {
119 *(unresolved_class.raw()->from() + i) = reader->ReadObject();
120 }
121 return unresolved_class.raw();
122 }
123
124
125 void RawUnresolvedClass::WriteTo(SnapshotWriter* writer,
126 intptr_t object_id,
127 bool serialize_classes) {
128 ASSERT(writer != NULL);
129 SnapshotWriterVisitor visitor(writer);
130
131 // Write out the serialization header value for this object.
132 writer->WriteObjectHeader(kInlined, object_id);
133
134 // Write out the class information.
135 writer->WriteObjectHeader(kObjectId, Object::kUnresolvedClassClass);
136
137 // Write out all the non object pointer fields.
138 writer->Write<intptr_t>(ptr()->token_index_);
139
140 // Write out all the object pointer fields.
141 visitor.VisitPointers(from(), to());
142 }
143
144
100 RawType* Type::ReadFrom(SnapshotReader* reader, 145 RawType* Type::ReadFrom(SnapshotReader* reader,
101 intptr_t object_id, 146 intptr_t object_id,
102 bool classes_serialized) { 147 bool classes_serialized) {
103 UNREACHABLE(); // Type is an abstract class. 148 UNREACHABLE(); // Type is an abstract class.
104 return Type::null(); 149 return Type::null();
105 } 150 }
106 151
107 152
108 void RawType::WriteTo(SnapshotWriter* writer, 153 void RawType::WriteTo(SnapshotWriter* writer,
109 intptr_t object_id, 154 intptr_t object_id,
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 // Write out all the other fields. 1320 // Write out all the other fields.
1276 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 1321 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
1277 writer->WriteObject(ptr()->pattern_); 1322 writer->WriteObject(ptr()->pattern_);
1278 writer->Write<intptr_t>(ptr()->type_); 1323 writer->Write<intptr_t>(ptr()->type_);
1279 writer->Write<intptr_t>(ptr()->flags_); 1324 writer->Write<intptr_t>(ptr()->flags_);
1280 1325
1281 // Do not write out the data part which is native. 1326 // Do not write out the data part which is native.
1282 } 1327 }
1283 1328
1284 } // namespace dart 1329 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698