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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index fcb7b0a47669edeeab5055c027d7529d6bab092d..541e8a7500eec08fb7c4b76b7e6c2f4b53b8520d 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1681,15 +1681,21 @@ void RawInstance::WriteTo(SnapshotWriter* writer,
}
-RawMint* Mint::ReadFrom(SnapshotReader* reader,
- intptr_t object_id,
- intptr_t tags,
- Snapshot::Kind kind) {
+RawInteger* Mint::ReadFrom(SnapshotReader* reader,
+ intptr_t object_id,
+ intptr_t tags,
+ Snapshot::Kind kind) {
ASSERT(reader != NULL);
// Read the 64 bit value for the object.
int64_t value = reader->Read<int64_t>();
+ // Check if the value could potentially fit in a Smi in our current
+ // architecture, if so return the object as a Smi.
+ if (Smi::IsValid(value)) {
+ return Smi::New(static_cast<intptr_t>(value));
+ }
+
// Create a Mint object or get canonical one if it is a canonical constant.
Mint& mint = Mint::ZoneHandle(reader->zone(), Mint::null());
if (kind == Snapshot::kFull) {
« 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