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

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

Issue 2591823002: Introduce a SignatureData class so that signature functions can store both their (Closed)
Patch Set: address comments Created 4 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
« no previous file with comments | « runtime/vm/raw_object.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/native_entry.h" 5 #include "vm/native_entry.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/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 writer->WriteObjectImpl(ptr()->parent_function_, kAsInlinedObject); 625 writer->WriteObjectImpl(ptr()->parent_function_, kAsInlinedObject);
626 626
627 // Signature type. 627 // Signature type.
628 writer->WriteObjectImpl(ptr()->signature_type_, kAsInlinedObject); 628 writer->WriteObjectImpl(ptr()->signature_type_, kAsInlinedObject);
629 629
630 // Canonical static closure. 630 // Canonical static closure.
631 writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject); 631 writer->WriteObjectImpl(ptr()->closure_, kAsInlinedObject);
632 } 632 }
633 633
634 634
635 RawSignatureData* SignatureData::ReadFrom(SnapshotReader* reader,
636 intptr_t object_id,
637 intptr_t tags,
638 Snapshot::Kind kind,
639 bool as_reference) {
640 ASSERT(reader != NULL);
641 ASSERT(kind == Snapshot::kScript);
642
643 // Allocate signature data object.
644 SignatureData& data =
645 SignatureData::ZoneHandle(reader->zone(), SignatureData::New());
646 reader->AddBackRef(object_id, &data, kIsDeserialized);
647
648 // Set all the object fields.
649 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(),
650 kAsInlinedObject);
651
652 return data.raw();
653 }
654
655
656 void RawSignatureData::WriteTo(SnapshotWriter* writer,
657 intptr_t object_id,
658 Snapshot::Kind kind,
659 bool as_reference) {
660 ASSERT(writer != NULL);
661 ASSERT(kind == Snapshot::kScript);
662
663 // Write out the serialization header value for this object.
664 writer->WriteInlinedObjectHeader(object_id);
665
666 // Write out the class and tags information.
667 writer->WriteVMIsolateObject(kSignatureDataCid);
668 writer->WriteTags(writer->GetObjectTags(this));
669
670 // Write out all the object pointer fields.
671 SnapshotWriterVisitor visitor(writer, kAsInlinedObject);
672 visitor.VisitPointers(from(), to());
673 }
674
675
635 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader, 676 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader,
636 intptr_t object_id, 677 intptr_t object_id,
637 intptr_t tags, 678 intptr_t tags,
638 Snapshot::Kind kind, 679 Snapshot::Kind kind,
639 bool as_reference) { 680 bool as_reference) {
640 ASSERT(reader != NULL); 681 ASSERT(reader != NULL);
641 ASSERT(kind == Snapshot::kScript); 682 ASSERT(kind == Snapshot::kScript);
642 683
643 // Allocate redirection data object. 684 // Allocate redirection data object.
644 RedirectionData& data = 685 RedirectionData& data =
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3008 // We do not allow objects with native fields in an isolate message. 3049 // We do not allow objects with native fields in an isolate message.
3009 writer->SetWriteException(Exceptions::kArgument, 3050 writer->SetWriteException(Exceptions::kArgument,
3010 "Illegal argument in isolate message" 3051 "Illegal argument in isolate message"
3011 " : (object is a UserTag)"); 3052 " : (object is a UserTag)");
3012 } else { 3053 } else {
3013 UNREACHABLE(); 3054 UNREACHABLE();
3014 } 3055 }
3015 } 3056 }
3016 3057
3017 } // namespace dart 3058 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698