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/stub_code.h" | 9 #include "vm/stub_code.h" |
10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2165 writer->WriteTags(writer->GetObjectTags(this)); | 2165 writer->WriteTags(writer->GetObjectTags(this)); |
2166 | 2166 |
2167 // Write out the used length field. | 2167 // Write out the used length field. |
2168 writer->Write<RawObject*>(ptr()->length_); | 2168 writer->Write<RawObject*>(ptr()->length_); |
2169 | 2169 |
2170 // Write out the Array object. | 2170 // Write out the Array object. |
2171 writer->WriteObjectImpl(ptr()->data_); | 2171 writer->WriteObjectImpl(ptr()->data_); |
2172 } | 2172 } |
2173 | 2173 |
2174 | 2174 |
2175 RawLinkedHashMap* LinkedHashMap::ReadFrom(SnapshotReader* reader, | |
2176 intptr_t object_id, | |
2177 intptr_t tags, | |
2178 Snapshot::Kind kind) { | |
2179 ASSERT(reader != NULL); | |
2180 | |
2181 LinkedHashMap& map = LinkedHashMap::ZoneHandle( | |
2182 reader->isolate(), LinkedHashMap::null()); | |
2183 if (kind == Snapshot::kFull) { | |
siva
2014/07/23 22:43:07
Do we expect to see hash maps in script snapshots?
koda
2014/07/24 19:31:44
In the future, yes. But not currently, the immutab
| |
2184 UNREACHABLE(); | |
2185 } else { | |
2186 map = LinkedHashMap::New(HEAP_SPACE(kind)); | |
2187 } | |
2188 reader->AddBackRef(object_id, &map, kIsDeserialized); | |
2189 Array& contents = Array::Handle(); | |
siva
2014/07/23 22:43:07
Array::Handle(reader->isolate());
koda
2014/07/24 19:31:44
Done, also in GrowableObjectArray above.
| |
2190 contents ^= reader->ReadObjectImpl(); | |
2191 map.SetData(contents); | |
2192 const TypeArguments& type_arguments = | |
2193 TypeArguments::Handle(contents.GetTypeArguments()); | |
siva
2014/07/23 22:43:07
TypeArguments::Handle(reader->isolate(), ...);
koda
2014/07/24 19:31:44
Done, also in GrowableObjectArray above.
| |
2194 map.SetTypeArguments(type_arguments); | |
2195 return map.raw(); | |
2196 } | |
2197 | |
2198 | |
2199 void RawLinkedHashMap::WriteTo(SnapshotWriter* writer, | |
2200 intptr_t object_id, | |
2201 Snapshot::Kind kind) { | |
siva
2014/07/23 22:43:07
if (kind == Snapshot::kFull) UNREACHABLE() ?
Also
koda
2014/07/24 19:31:44
See previous comment.
| |
2202 ASSERT(writer != NULL); | |
2203 | |
2204 // Write out the serialization header value for this object. | |
2205 writer->WriteInlinedObjectHeader(object_id); | |
2206 | |
2207 // Write out the class and tags information. | |
2208 writer->WriteIndexedObject(kLinkedHashMapCid); | |
2209 writer->WriteTags(writer->GetObjectTags(this)); | |
2210 | |
2211 // Write out the backing array. | |
2212 // TODO(koda): Serialize as pairs (like ToArray) instead, to reduce space and | |
2213 // support per-isolate salted hash codes. | |
2214 writer->WriteObjectImpl(ptr()->data_); | |
2215 } | |
2216 | |
2217 | |
2175 RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, | 2218 RawFloat32x4* Float32x4::ReadFrom(SnapshotReader* reader, |
2176 intptr_t object_id, | 2219 intptr_t object_id, |
2177 intptr_t tags, | 2220 intptr_t tags, |
2178 Snapshot::Kind kind) { | 2221 Snapshot::Kind kind) { |
2179 ASSERT(reader != NULL); | 2222 ASSERT(reader != NULL); |
2180 // Read the values. | 2223 // Read the values. |
2181 float value0 = reader->Read<float>(); | 2224 float value0 = reader->Read<float>(); |
2182 float value1 = reader->Read<float>(); | 2225 float value1 = reader->Read<float>(); |
2183 float value2 = reader->Read<float>(); | 2226 float value2 = reader->Read<float>(); |
2184 float value3 = reader->Read<float>(); | 2227 float value3 = reader->Read<float>(); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2799 // We do not allow objects with native fields in an isolate message. | 2842 // We do not allow objects with native fields in an isolate message. |
2800 writer->SetWriteException(Exceptions::kArgument, | 2843 writer->SetWriteException(Exceptions::kArgument, |
2801 "Illegal argument in isolate message" | 2844 "Illegal argument in isolate message" |
2802 " : (object is a UserTag)"); | 2845 " : (object is a UserTag)"); |
2803 } else { | 2846 } else { |
2804 UNREACHABLE(); | 2847 UNREACHABLE(); |
2805 } | 2848 } |
2806 } | 2849 } |
2807 | 2850 |
2808 } // namespace dart | 2851 } // namespace dart |
OLD | NEW |