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

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

Issue 10380019: Stop postponing instantiation of Type and remove InstantiatedType VM class. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/snapshot_test.cc » ('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/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 writer->WriteIntptrValue(ptr()->index_); 276 writer->WriteIntptrValue(ptr()->index_);
277 writer->WriteIntptrValue(ptr()->token_index_); 277 writer->WriteIntptrValue(ptr()->token_index_);
278 writer->Write<int8_t>(ptr()->type_state_); 278 writer->Write<int8_t>(ptr()->type_state_);
279 279
280 // Write out all the object pointer fields. 280 // Write out all the object pointer fields.
281 SnapshotWriterVisitor visitor(writer); 281 SnapshotWriterVisitor visitor(writer);
282 visitor.VisitPointers(from(), to()); 282 visitor.VisitPointers(from(), to());
283 } 283 }
284 284
285 285
286 RawInstantiatedType* InstantiatedType::ReadFrom(SnapshotReader* reader,
287 intptr_t object_id,
288 intptr_t tags,
289 Snapshot::Kind kind) {
290 ASSERT(reader != NULL);
291 ASSERT(kind == Snapshot::kMessage);
292
293 // Allocate instantiated type object.
294 InstantiatedType& instantiated_type =
295 InstantiatedType::ZoneHandle(reader->isolate(), InstantiatedType::New());
296 reader->AddBackwardReference(object_id, &instantiated_type);
297
298 // Set the object tags.
299 instantiated_type.set_tags(tags);
300
301 // Now set all the object fields.
302 // TODO(5411462): Need to assert No GC can happen here, even though
303 // allocations may happen.
304 intptr_t num_flds = (instantiated_type.raw()->to() -
305 instantiated_type.raw()->from());
306 for (intptr_t i = 0; i <= num_flds; i++) {
307 *(instantiated_type.raw()->from() + i) = reader->ReadObject();
308 }
309 return instantiated_type.raw();
310 }
311
312
313 void RawInstantiatedType::WriteTo(SnapshotWriter* writer,
314 intptr_t object_id,
315 Snapshot::Kind kind) {
316 ASSERT(writer != NULL);
317 ASSERT(kind == Snapshot::kMessage);
318
319 // Write out the serialization header value for this object.
320 writer->WriteSerializationMarker(kInlined, object_id);
321
322 // Write out the class and tags information.
323 writer->WriteObjectHeader(Object::kInstantiatedTypeClass, ptr()->tags_);
324
325 // Write out all the object pointer fields.
326 SnapshotWriterVisitor visitor(writer);
327 visitor.VisitPointers(from(), to());
328 }
329
330
331 RawAbstractTypeArguments* AbstractTypeArguments::ReadFrom( 286 RawAbstractTypeArguments* AbstractTypeArguments::ReadFrom(
332 SnapshotReader* reader, 287 SnapshotReader* reader,
333 intptr_t object_id, 288 intptr_t object_id,
334 intptr_t tags, 289 intptr_t tags,
335 Snapshot::Kind kind) { 290 Snapshot::Kind kind) {
336 UNREACHABLE(); // AbstractTypeArguments is an abstract class. 291 UNREACHABLE(); // AbstractTypeArguments is an abstract class.
337 return TypeArguments::null(); 292 return TypeArguments::null();
338 } 293 }
339 294
340 295
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 2380 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
2426 writer->WriteObject(ptr()->pattern_); 2381 writer->WriteObject(ptr()->pattern_);
2427 writer->WriteIntptrValue(ptr()->type_); 2382 writer->WriteIntptrValue(ptr()->type_);
2428 writer->WriteIntptrValue(ptr()->flags_); 2383 writer->WriteIntptrValue(ptr()->flags_);
2429 2384
2430 // Do not write out the data part which is native. 2385 // Do not write out the data part which is native.
2431 } 2386 }
2432 2387
2433 2388
2434 } // namespace dart 2389 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698