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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 9594028: Add a first class GrowableObjectArray type in the VM and use it internally in the VM at all spots w… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « vm/raw_object.cc ('k') | 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/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
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.
1720 GrowableObjectArray& array = GrowableObjectArray::ZoneHandle(
1721 reader->isolate(), reader->NewGrowableObjectArray());
1722 reader->AddBackwardReference(object_id, &array);
1723 intptr_t length = reader->ReadSmiValue();
1724 array.SetLength(length);
1725 Array& contents = Array::Handle();
1726 contents ^= reader->ReadObject();
1727 array.SetData(contents);
1728 return array.raw();
1729 }
1730
1731
1732 void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer,
1733 intptr_t object_id,
1734 Snapshot::Kind kind) {
1735 ASSERT(writer != NULL);
1736
1737 // Write out the serialization header value for this object.
1738 writer->WriteSerializationMarker(kInlined, object_id);
1739
1740 // Write out the class and tags information.
1741 writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass,
1742 ptr()->tags_);
1743
1744 // Write out the used length field.
1745 writer->Write<RawObject*>(ptr()->length_);
1746
1747 // Write out the Array object.
1748 writer->WriteObject(ptr()->data_);
1749 }
1750
1751
1713 RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader, 1752 RawByteArray* ByteArray::ReadFrom(SnapshotReader* reader,
1714 intptr_t object_id, 1753 intptr_t object_id,
1715 intptr_t tags, 1754 intptr_t tags,
1716 Snapshot::Kind kind) { 1755 Snapshot::Kind kind) {
1717 UNREACHABLE(); // ByteArray is an abstract class. 1756 UNREACHABLE(); // ByteArray is an abstract class.
1718 return ByteArray::null(); 1757 return ByteArray::null();
1719 } 1758 }
1720 1759
1721 1760
1722 RawInternalByteArray* InternalByteArray::ReadFrom(SnapshotReader* reader, 1761 RawInternalByteArray* InternalByteArray::ReadFrom(SnapshotReader* reader,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 1951
1913 1952
1914 void RawICData::WriteTo(SnapshotWriter* writer, 1953 void RawICData::WriteTo(SnapshotWriter* writer,
1915 intptr_t object_id, 1954 intptr_t object_id,
1916 Snapshot::Kind kind) { 1955 Snapshot::Kind kind) {
1917 UNREACHABLE(); 1956 UNREACHABLE();
1918 } 1957 }
1919 1958
1920 1959
1921 } // namespace dart 1960 } // namespace dart
OLDNEW
« no previous file with comments | « vm/raw_object.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698