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

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

Issue 8761011: Renaming type classes as discussed: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 writer->WriteObjectHeader(kObjectId, Object::kUnresolvedClassClass); 133 writer->WriteObjectHeader(kObjectId, Object::kUnresolvedClassClass);
134 134
135 // Write out all the non object pointer fields. 135 // Write out all the non object pointer fields.
136 writer->Write<intptr_t>(ptr()->token_index_); 136 writer->Write<intptr_t>(ptr()->token_index_);
137 137
138 // Write out all the object pointer fields. 138 // Write out all the object pointer fields.
139 visitor.VisitPointers(from(), to()); 139 visitor.VisitPointers(from(), to());
140 } 140 }
141 141
142 142
143 RawAbstractType* AbstractType::ReadFrom(SnapshotReader* reader,
144 intptr_t object_id,
145 bool classes_serialized) {
146 UNREACHABLE(); // AbstractType is an abstract class.
147 return NULL;
148 }
149
150
151 void RawAbstractType::WriteTo(SnapshotWriter* writer,
152 intptr_t object_id,
153 bool serialize_classes) {
154 UNREACHABLE(); // AbstractType is an abstract class.
155 }
156
157
143 RawType* Type::ReadFrom(SnapshotReader* reader, 158 RawType* Type::ReadFrom(SnapshotReader* reader,
144 intptr_t object_id,
145 bool classes_serialized) {
146 UNREACHABLE(); // Type is an abstract class.
147 return NULL;
148 }
149
150
151 void RawType::WriteTo(SnapshotWriter* writer,
152 intptr_t object_id,
153 bool serialize_classes) {
154 UNREACHABLE(); // Type is an abstract class.
155 }
156
157
158 RawParameterizedType* ParameterizedType::ReadFrom(SnapshotReader* reader,
159 intptr_t object_id, 159 intptr_t object_id,
160 bool classes_serialized) { 160 bool classes_serialized) {
161 ASSERT(reader != NULL); 161 ASSERT(reader != NULL);
162 162
163 // Allocate parameterized type object. 163 // Allocate parameterized type object.
164 ParameterizedType& parameterized_type = 164 Type& parameterized_type = Type::ZoneHandle(Type::New());
165 ParameterizedType::ZoneHandle(ParameterizedType::New());
166 reader->AddBackwardReference(object_id, &parameterized_type); 165 reader->AddBackwardReference(object_id, &parameterized_type);
167 166
168 // Set all non object fields. 167 // Set all non object fields.
169 parameterized_type.set_type_state(reader->Read<int8_t>()); 168 parameterized_type.set_type_state(reader->Read<int8_t>());
170 169
171 // Set all the object fields. 170 // Set all the object fields.
172 // TODO(5411462): Need to assert No GC can happen here, even though 171 // TODO(5411462): Need to assert No GC can happen here, even though
173 // allocations may happen. 172 // allocations may happen.
174 intptr_t num_flds = (parameterized_type.raw()->to() - 173 intptr_t num_flds = (parameterized_type.raw()->to() -
175 parameterized_type.raw()->from()); 174 parameterized_type.raw()->from());
176 for (intptr_t i = 0; i <= num_flds; i++) { 175 for (intptr_t i = 0; i <= num_flds; i++) {
177 *(parameterized_type.raw()->from() + i) = reader->ReadObject(); 176 *(parameterized_type.raw()->from() + i) = reader->ReadObject();
178 } 177 }
179 return parameterized_type.raw(); 178 return parameterized_type.raw();
180 } 179 }
181 180
182 181
183 void RawParameterizedType::WriteTo(SnapshotWriter* writer, 182 void RawType::WriteTo(SnapshotWriter* writer,
184 intptr_t object_id, 183 intptr_t object_id,
185 bool serialize_classes) { 184 bool serialize_classes) {
186 ASSERT(writer != NULL); 185 ASSERT(writer != NULL);
187 SnapshotWriterVisitor visitor(writer); 186 SnapshotWriterVisitor visitor(writer);
188 187
189 // Write out the serialization header value for this object. 188 // Write out the serialization header value for this object.
190 writer->WriteObjectHeader(kInlined, object_id); 189 writer->WriteObjectHeader(kInlined, object_id);
191 190
192 // Write out the class information. 191 // Write out the class information.
193 writer->WriteObjectHeader(kObjectId, Object::kParameterizedTypeClass); 192 writer->WriteObjectHeader(kObjectId, Object::kTypeClass);
194 193
195 // Write out all the non object pointer fields. 194 // Write out all the non object pointer fields.
196 writer->Write<int8_t>(ptr()->type_state_); 195 writer->Write<int8_t>(ptr()->type_state_);
197 196
198 // Write out all the object pointer fields. 197 // Write out all the object pointer fields.
199 visitor.VisitPointers(from(), to()); 198 visitor.VisitPointers(from(), to());
200 } 199 }
201 200
202 201
203 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader, 202 RawTypeParameter* TypeParameter::ReadFrom(SnapshotReader* reader,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 intptr_t object_id, 302 intptr_t object_id,
304 bool classes_serialized) { 303 bool classes_serialized) {
305 ASSERT(reader != NULL); 304 ASSERT(reader != NULL);
306 305
307 // Read the length so that we can determine instance size to allocate. 306 // Read the length so that we can determine instance size to allocate.
308 RawSmi* smi_len = GetSmi(reader->Read<intptr_t>()); 307 RawSmi* smi_len = GetSmi(reader->Read<intptr_t>());
309 intptr_t len = Smi::Value(smi_len); 308 intptr_t len = Smi::Value(smi_len);
310 309
311 TypeArray& type_array = TypeArray::Handle(TypeArray::New(len)); 310 TypeArray& type_array = TypeArray::Handle(TypeArray::New(len));
312 reader->AddBackwardReference(object_id, &type_array); 311 reader->AddBackwardReference(object_id, &type_array);
313 Type& type = Type::Handle(); 312 AbstractType& type = AbstractType::Handle();
314 for (intptr_t i = 0; i < len; i++) { 313 for (intptr_t i = 0; i < len; i++) {
315 type ^= reader->ReadObject(); 314 type ^= reader->ReadObject();
316 type_array.SetTypeAt(i, type); 315 type_array.SetTypeAt(i, type);
317 } 316 }
318 return type_array.raw(); 317 return type_array.raw();
319 } 318 }
320 319
321 320
322 void RawTypeArray::WriteTo(SnapshotWriter* writer, 321 void RawTypeArray::WriteTo(SnapshotWriter* writer,
323 intptr_t object_id, 322 intptr_t object_id,
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 // Write out all the other fields. 1384 // Write out all the other fields.
1386 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 1385 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
1387 writer->WriteObject(ptr()->pattern_); 1386 writer->WriteObject(ptr()->pattern_);
1388 writer->Write<intptr_t>(ptr()->type_); 1387 writer->Write<intptr_t>(ptr()->type_);
1389 writer->Write<intptr_t>(ptr()->flags_); 1388 writer->Write<intptr_t>(ptr()->flags_);
1390 1389
1391 // Do not write out the data part which is native. 1390 // Do not write out the data part which is native.
1392 } 1391 }
1393 1392
1394 } // namespace dart 1393 } // namespace dart
OLDNEW
« runtime/vm/raw_object.h ('K') | « runtime/vm/raw_object.cc ('k') | runtime/vm/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698