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

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

Issue 1151573022: Fix for issue 192 in domokit/mojo (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add comment Created 5 years, 6 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot.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/object.h" 5 #include "vm/object.h"
6 #include "vm/object_store.h" 6 #include "vm/object_store.h"
7 #include "vm/snapshot.h" 7 #include "vm/snapshot.h"
8 #include "vm/stub_code.h" 8 #include "vm/stub_code.h"
9 #include "vm/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 1674
1675 // Write out the serialization header value for this object. 1675 // Write out the serialization header value for this object.
1676 writer->WriteInlinedObjectHeader(object_id); 1676 writer->WriteInlinedObjectHeader(object_id);
1677 1677
1678 // Write out the class and tags information. 1678 // Write out the class and tags information.
1679 writer->WriteIndexedObject(kInstanceCid); 1679 writer->WriteIndexedObject(kInstanceCid);
1680 writer->WriteTags(writer->GetObjectTags(this)); 1680 writer->WriteTags(writer->GetObjectTags(this));
1681 } 1681 }
1682 1682
1683 1683
1684 RawMint* Mint::ReadFrom(SnapshotReader* reader, 1684 RawInteger* Mint::ReadFrom(SnapshotReader* reader,
1685 intptr_t object_id, 1685 intptr_t object_id,
1686 intptr_t tags, 1686 intptr_t tags,
1687 Snapshot::Kind kind) { 1687 Snapshot::Kind kind) {
1688 ASSERT(reader != NULL); 1688 ASSERT(reader != NULL);
1689 1689
1690 // Read the 64 bit value for the object. 1690 // Read the 64 bit value for the object.
1691 int64_t value = reader->Read<int64_t>(); 1691 int64_t value = reader->Read<int64_t>();
1692 1692
1693 // Check if the value could potentially fit in a Smi in our current
1694 // architecture, if so return the object as a Smi.
1695 if (Smi::IsValid(value)) {
1696 return Smi::New(static_cast<intptr_t>(value));
1697 }
1698
1693 // Create a Mint object or get canonical one if it is a canonical constant. 1699 // Create a Mint object or get canonical one if it is a canonical constant.
1694 Mint& mint = Mint::ZoneHandle(reader->zone(), Mint::null()); 1700 Mint& mint = Mint::ZoneHandle(reader->zone(), Mint::null());
1695 if (kind == Snapshot::kFull) { 1701 if (kind == Snapshot::kFull) {
1696 mint = reader->NewMint(value); 1702 mint = reader->NewMint(value);
1697 } else { 1703 } else {
1698 // When reading a script snapshot we need to canonicalize only those object 1704 // When reading a script snapshot we need to canonicalize only those object
1699 // references that are objects from the core library (loaded from a 1705 // references that are objects from the core library (loaded from a
1700 // full snapshot). Objects that are only in the script need not be 1706 // full snapshot). Objects that are only in the script need not be
1701 // canonicalized as they are already canonical. 1707 // canonicalized as they are already canonical.
1702 // When reading a message snapshot we always have to canonicalize. 1708 // When reading a message snapshot we always have to canonicalize.
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2941 // We do not allow objects with native fields in an isolate message. 2947 // We do not allow objects with native fields in an isolate message.
2942 writer->SetWriteException(Exceptions::kArgument, 2948 writer->SetWriteException(Exceptions::kArgument,
2943 "Illegal argument in isolate message" 2949 "Illegal argument in isolate message"
2944 " : (object is a UserTag)"); 2950 " : (object is a UserTag)");
2945 } else { 2951 } else {
2946 UNREACHABLE(); 2952 UNREACHABLE();
2947 } 2953 }
2948 } 2954 }
2949 2955
2950 } // namespace dart 2956 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698