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 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2015 // Write out all the other fields. | 2015 // Write out all the other fields. |
2016 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 2016 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
2017 writer->WriteObjectImpl(ptr()->pattern_); | 2017 writer->WriteObjectImpl(ptr()->pattern_); |
2018 writer->WriteIntptrValue(ptr()->type_); | 2018 writer->WriteIntptrValue(ptr()->type_); |
2019 writer->WriteIntptrValue(ptr()->flags_); | 2019 writer->WriteIntptrValue(ptr()->flags_); |
2020 | 2020 |
2021 // Do not write out the data part which is native. | 2021 // Do not write out the data part which is native. |
2022 } | 2022 } |
2023 | 2023 |
2024 | 2024 |
| 2025 RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader, |
| 2026 intptr_t object_id, |
| 2027 intptr_t tags, |
| 2028 Snapshot::Kind kind) { |
| 2029 ASSERT(reader != NULL); |
| 2030 |
| 2031 // Allocate the weak property object. |
| 2032 WeakProperty& weak_property = WeakProperty::ZoneHandle( |
| 2033 reader->isolate(), |
| 2034 WeakProperty::New((kind == Snapshot::kFull) ? Heap::kOld : Heap::kNew)); |
| 2035 reader->AddBackRef(object_id, &weak_property, kIsDeserialized); |
| 2036 |
| 2037 // Set the object tags. |
| 2038 weak_property.set_tags(tags); |
| 2039 |
| 2040 // Set all the object fields. |
| 2041 weak_property.raw_ptr()->key_ = reader->ReadObjectRef(); |
| 2042 weak_property.raw_ptr()->value_ = reader->ReadObjectRef(); |
| 2043 |
| 2044 return weak_property.raw(); |
| 2045 } |
| 2046 |
| 2047 |
| 2048 void RawWeakProperty::WriteTo(SnapshotWriter* writer, |
| 2049 intptr_t object_id, |
| 2050 Snapshot::Kind kind) { |
| 2051 ASSERT(writer != NULL); |
| 2052 |
| 2053 // Write out the serialization header value for this object. |
| 2054 writer->WriteInlinedObjectHeader(object_id); |
| 2055 |
| 2056 // Write out the class and tags information. |
| 2057 writer->WriteIndexedObject(ObjectStore::kWeakPropertyClass); |
| 2058 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 2059 |
| 2060 // Write out all the other fields. |
| 2061 writer->Write<RawObject*>(ptr()->key_); |
| 2062 writer->Write<RawObject*>(ptr()->value_); |
| 2063 } |
| 2064 |
2025 } // namespace dart | 2065 } // namespace dart |
OLD | NEW |