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/symbols.h" | 9 #include "vm/symbols.h" |
10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
(...skipping 2064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 | 2075 |
2076 | 2076 |
2077 RawImmutableArray* ImmutableArray::ReadFrom(SnapshotReader* reader, | 2077 RawImmutableArray* ImmutableArray::ReadFrom(SnapshotReader* reader, |
2078 intptr_t object_id, | 2078 intptr_t object_id, |
2079 intptr_t tags, | 2079 intptr_t tags, |
2080 Snapshot::Kind kind) { | 2080 Snapshot::Kind kind) { |
2081 ASSERT(reader != NULL); | 2081 ASSERT(reader != NULL); |
2082 | 2082 |
2083 // Read the length so that we can determine instance size to allocate. | 2083 // Read the length so that we can determine instance size to allocate. |
2084 intptr_t len = reader->ReadSmiValue(); | 2084 intptr_t len = reader->ReadSmiValue(); |
2085 ImmutableArray* array = reinterpret_cast<ImmutableArray*>( | 2085 Array* array = reinterpret_cast<Array*>(reader->GetBackRef(object_id)); |
2086 reader->GetBackRef(object_id)); | |
2087 if (array == NULL) { | 2086 if (array == NULL) { |
2088 array = &(ImmutableArray::ZoneHandle( | 2087 array = &(Array::ZoneHandle( |
2089 reader->isolate(), | 2088 reader->isolate(), |
2090 NEW_OBJECT_WITH_LEN_SPACE(ImmutableArray, len, kind))); | 2089 NEW_OBJECT_WITH_LEN_SPACE(ImmutableArray, len, kind))); |
2091 reader->AddBackRef(object_id, array, kIsDeserialized); | 2090 reader->AddBackRef(object_id, array, kIsDeserialized); |
2092 } | 2091 } |
2093 reader->ArrayReadFrom(*array, len, tags); | 2092 reader->ArrayReadFrom(*array, len, tags); |
2094 return array->raw(); | 2093 return raw(*array); |
2095 } | 2094 } |
2096 | 2095 |
2097 | 2096 |
2098 void RawArray::WriteTo(SnapshotWriter* writer, | 2097 void RawArray::WriteTo(SnapshotWriter* writer, |
2099 intptr_t object_id, | 2098 intptr_t object_id, |
2100 Snapshot::Kind kind) { | 2099 Snapshot::Kind kind) { |
2101 writer->ArrayWriteTo(object_id, | 2100 writer->ArrayWriteTo(object_id, |
2102 kArrayCid, | 2101 kArrayCid, |
2103 writer->GetObjectTags(this), | 2102 writer->GetObjectTags(this), |
2104 ptr()->length_, | 2103 ptr()->length_, |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2640 // Write out the class and tags information. | 2639 // Write out the class and tags information. |
2641 writer->WriteIndexedObject(kWeakPropertyCid); | 2640 writer->WriteIndexedObject(kWeakPropertyCid); |
2642 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2641 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2643 | 2642 |
2644 // Write out all the other fields. | 2643 // Write out all the other fields. |
2645 writer->Write<RawObject*>(ptr()->key_); | 2644 writer->Write<RawObject*>(ptr()->key_); |
2646 writer->Write<RawObject*>(ptr()->value_); | 2645 writer->Write<RawObject*>(ptr()->value_); |
2647 } | 2646 } |
2648 | 2647 |
2649 } // namespace dart | 2648 } // namespace dart |
OLD | NEW |