| OLD | NEW |
| 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/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 } | 1742 } |
| 1743 | 1743 |
| 1744 // Now check if it is an object from the VM isolate (NOTE: premarked objects | 1744 // Now check if it is an object from the VM isolate (NOTE: premarked objects |
| 1745 // are considered to be objects in the VM isolate). These objects are shared | 1745 // are considered to be objects in the VM isolate). These objects are shared |
| 1746 // by all isolates. | 1746 // by all isolates. |
| 1747 if (rawobj->IsVMHeapObject()) { | 1747 if (rawobj->IsVMHeapObject()) { |
| 1748 HandleVMIsolateObject(rawobj); | 1748 HandleVMIsolateObject(rawobj); |
| 1749 return true; | 1749 return true; |
| 1750 } | 1750 } |
| 1751 | 1751 |
| 1752 // Check if the object is a Mint and could potentially be a Smi | |
| 1753 // on other architectures (64 bit), if so write it out as int64_t value. | |
| 1754 if (cid == kMintCid) { | |
| 1755 int64_t value = reinterpret_cast<RawMint*>(rawobj)->ptr()->value_; | |
| 1756 const intptr_t kSmi64Bits = 62; | |
| 1757 const int64_t kSmi64Max = (static_cast<int64_t>(1) << kSmi64Bits) - 1; | |
| 1758 const int64_t kSmi64Min = -(static_cast<int64_t>(1) << kSmi64Bits); | |
| 1759 if (value <= kSmi64Max && value >= kSmi64Min) { | |
| 1760 Write<int64_t>((value << kSmiTagShift) | kSmiTag); | |
| 1761 return true; | |
| 1762 } | |
| 1763 } | |
| 1764 | |
| 1765 // Check if it is a code object in that case just write a Null object | 1752 // Check if it is a code object in that case just write a Null object |
| 1766 // as we do not want code objects in the snapshot. | 1753 // as we do not want code objects in the snapshot. |
| 1767 if (cid == kCodeCid) { | 1754 if (cid == kCodeCid) { |
| 1768 WriteVMIsolateObject(kNullObject); | 1755 WriteVMIsolateObject(kNullObject); |
| 1769 return true; | 1756 return true; |
| 1770 } | 1757 } |
| 1771 | 1758 |
| 1772 // Check if classes are not being serialized and it is preinitialized type | 1759 // Check if classes are not being serialized and it is preinitialized type |
| 1773 // or a predefined internal VM class in the object store. | 1760 // or a predefined internal VM class in the object store. |
| 1774 if (kind_ != Snapshot::kFull) { | 1761 if (kind_ != Snapshot::kFull) { |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2291 NoSafepointScope no_safepoint; | 2278 NoSafepointScope no_safepoint; |
| 2292 WriteObject(obj.raw()); | 2279 WriteObject(obj.raw()); |
| 2293 UnmarkAll(); | 2280 UnmarkAll(); |
| 2294 } else { | 2281 } else { |
| 2295 ThrowException(exception_type(), exception_msg()); | 2282 ThrowException(exception_type(), exception_msg()); |
| 2296 } | 2283 } |
| 2297 } | 2284 } |
| 2298 | 2285 |
| 2299 | 2286 |
| 2300 } // namespace dart | 2287 } // namespace dart |
| OLD | NEW |