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

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

Issue 132623007: Fix snapshotting of TypeArguments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 ASSERT(reader != NULL); 442 ASSERT(reader != NULL);
443 443
444 // Read the length so that we can determine instance size to allocate. 444 // Read the length so that we can determine instance size to allocate.
445 intptr_t len = reader->ReadSmiValue(); 445 intptr_t len = reader->ReadSmiValue();
446 446
447 TypeArguments& type_arguments = TypeArguments::ZoneHandle( 447 TypeArguments& type_arguments = TypeArguments::ZoneHandle(
448 reader->isolate(), NEW_OBJECT_WITH_LEN_SPACE(TypeArguments, len, kind)); 448 reader->isolate(), NEW_OBJECT_WITH_LEN_SPACE(TypeArguments, len, kind));
449 reader->AddBackRef(object_id, &type_arguments, kIsDeserialized); 449 reader->AddBackRef(object_id, &type_arguments, kIsDeserialized);
450 450
451 // Now set all the object fields. 451 // Now set all the object fields.
452 *reader->ArrayHandle() ^= reader->ReadObjectImpl();
453 type_arguments.set_instantiations(*reader->ArrayHandle());
452 for (intptr_t i = 0; i < len; i++) { 454 for (intptr_t i = 0; i < len; i++) {
453 *reader->TypeHandle() ^= reader->ReadObjectImpl(); 455 *reader->TypeHandle() ^= reader->ReadObjectImpl();
454 type_arguments.SetTypeAt(i, *reader->TypeHandle()); 456 type_arguments.SetTypeAt(i, *reader->TypeHandle());
455 } 457 }
456 458
457 // If object needs to be a canonical object, Canonicalize it. 459 // If object needs to be a canonical object, Canonicalize it.
458 // When reading a full snapshot we don't need to canonicalize the object 460 // When reading a full snapshot we don't need to canonicalize the object
459 // as it would already be a canonical object. 461 // as it would already be a canonical object.
460 // When reading a script snapshot we need to canonicalize only those object 462 // When reading a script snapshot we need to canonicalize only those object
461 // references that are objects from the core library (loaded from a 463 // references that are objects from the core library (loaded from a
(...skipping 24 matching lines...) Expand all
486 // Write out the serialization header value for this object. 488 // Write out the serialization header value for this object.
487 writer->WriteInlinedObjectHeader(object_id); 489 writer->WriteInlinedObjectHeader(object_id);
488 490
489 // Write out the class and tags information. 491 // Write out the class and tags information.
490 writer->WriteVMIsolateObject(kTypeArgumentsCid); 492 writer->WriteVMIsolateObject(kTypeArgumentsCid);
491 writer->WriteIntptrValue(writer->GetObjectTags(this)); 493 writer->WriteIntptrValue(writer->GetObjectTags(this));
492 494
493 // Write out the length field. 495 // Write out the length field.
494 writer->Write<RawObject*>(ptr()->length_); 496 writer->Write<RawObject*>(ptr()->length_);
495 497
498 // Write out the instantiations field.
499 writer->WriteObjectImpl(ptr()->instantiations_);
500
496 // Write out the individual types. 501 // Write out the individual types.
497 intptr_t len = Smi::Value(ptr()->length_); 502 intptr_t len = Smi::Value(ptr()->length_);
498 for (intptr_t i = 0; i < len; i++) { 503 for (intptr_t i = 0; i < len; i++) {
499 writer->WriteObjectImpl(ptr()->types_[i]); 504 writer->WriteObjectImpl(ptr()->types_[i]);
500 } 505 }
501 } 506 }
502 507
503 508
504 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, 509 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader,
505 intptr_t object_id, 510 intptr_t object_id,
(...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 // We do not allow objects with native fields in an isolate message. 2667 // We do not allow objects with native fields in an isolate message.
2663 writer->SetWriteException(Exceptions::kArgument, 2668 writer->SetWriteException(Exceptions::kArgument,
2664 "Illegal argument in isolate message" 2669 "Illegal argument in isolate message"
2665 " : (object is a MirrorReference)"); 2670 " : (object is a MirrorReference)");
2666 } else { 2671 } else {
2667 UNREACHABLE(); 2672 UNREACHABLE();
2668 } 2673 }
2669 } 2674 }
2670 2675
2671 } // namespace dart 2676 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_message.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698