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