Chromium Code Reviews| 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/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/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1703 object_id, | 1703 object_id, |
| 1704 kind, | 1704 kind, |
| 1705 ObjectStore::kImmutableArrayClass, | 1705 ObjectStore::kImmutableArrayClass, |
| 1706 ptr()->tags_, | 1706 ptr()->tags_, |
| 1707 ptr()->length_, | 1707 ptr()->length_, |
| 1708 ptr()->type_arguments_, | 1708 ptr()->type_arguments_, |
| 1709 ptr()->data()); | 1709 ptr()->data()); |
| 1710 } | 1710 } |
| 1711 | 1711 |
| 1712 | 1712 |
| 1713 RawGrowableObjectArray* GrowableObjectArray::ReadFrom(SnapshotReader* reader, | |
| 1714 intptr_t object_id, | |
| 1715 intptr_t tags, | |
| 1716 Snapshot::Kind kind) { | |
| 1717 ASSERT(reader != NULL); | |
| 1718 | |
| 1719 // Read the length so that we can determine instance size to allocate. | |
|
cshapiro
2012/03/06 00:56:31
Maybe use the common array reader. See my comment
siva
2012/03/06 23:32:33
See my comment below.
On 2012/03/06 00:56:31, csh
| |
| 1720 intptr_t capacity = reader->ReadIntptrValue(); | |
| 1721 intptr_t length = reader->ReadIntptrValue(); | |
| 1722 GrowableObjectArray& array = GrowableObjectArray::ZoneHandle( | |
| 1723 reader->isolate(), reader->NewGrowableObjectArray()); | |
| 1724 reader->AddBackwardReference(object_id, &array); | |
| 1725 array.set_capacity(capacity); | |
| 1726 array.set_length(length); | |
| 1727 Array& contents = Array::Handle(); | |
| 1728 contents ^= reader->ReadObject(); | |
| 1729 array.set_data(contents); | |
| 1730 return array.raw(); | |
| 1731 } | |
| 1732 | |
| 1733 | |
| 1734 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer, | |
| 1735 intptr_t object_id, | |
| 1736 Snapshot::Kind kind) { | |
| 1737 ASSERT(writer != NULL); | |
| 1738 | |
| 1739 // Write out the serialization header value for this object. | |
| 1740 writer->WriteSerializationMarker(kInlined, object_id); | |
| 1741 | |
| 1742 // Write out the class and tags information. | |
| 1743 writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass, | |
| 1744 ptr()->tags_); | |
| 1745 | |
| 1746 // Write out the capacity and length fields. | |
| 1747 writer->WriteIntptrValue(ptr()->capacity_); | |
|
cshapiro
2012/03/06 00:56:31
Hmm... if you get rid of the capacity member you c
siva
2012/03/06 23:32:33
I got rid of the capacity_ field.
I prefer to wri
| |
| 1748 writer->WriteIntptrValue(ptr()->length_); | |
| 1749 | |
| 1750 // Write out the Array object. | |
| 1751 writer->WriteObject(ptr()->data_); | |
| 1752 } | |
| 1753 | |
| 1754 | |
| 1713 RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader, | 1755 RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader, |
| 1714 intptr_t object_id, | 1756 intptr_t object_id, |
| 1715 intptr_t tags, | 1757 intptr_t tags, |
| 1716 Snapshot::Kind kind) { | 1758 Snapshot::Kind kind) { |
| 1717 UNREACHABLE(); // ByteArray is an abstract class. | 1759 UNREACHABLE(); // ByteArray is an abstract class. |
| 1718 return ByteArray::null(); | 1760 return ByteArray::null(); |
| 1719 } | 1761 } |
| 1720 | 1762 |
| 1721 | 1763 |
| 1722 RawInternalByteArray* InternalByteArray::ReadFrom(SnapshotReader* reader, | 1764 RawInternalByteArray* InternalByteArray::ReadFrom(SnapshotReader* reader, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1912 | 1954 |
| 1913 | 1955 |
| 1914 void RawICData::WriteTo(SnapshotWriter* writer, | 1956 void RawICData::WriteTo(SnapshotWriter* writer, |
| 1915 intptr_t object_id, | 1957 intptr_t object_id, |
| 1916 Snapshot::Kind kind) { | 1958 Snapshot::Kind kind) { |
| 1917 UNREACHABLE(); | 1959 UNREACHABLE(); |
| 1918 } | 1960 } |
| 1919 | 1961 |
| 1920 | 1962 |
| 1921 } // namespace dart | 1963 } // namespace dart |
| OLD | NEW |