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

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 10832199: Add a weak property type to the virtual machine. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address final review comments Created 8 years, 4 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 | « runtime/vm/raw_object.cc ('k') | runtime/vm/scavenger.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/symbols.h" 9 #include "vm/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2044 // Write out all the other fields. 2044 // Write out all the other fields.
2045 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 2045 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
2046 writer->WriteObjectImpl(ptr()->pattern_); 2046 writer->WriteObjectImpl(ptr()->pattern_);
2047 writer->WriteIntptrValue(ptr()->type_); 2047 writer->WriteIntptrValue(ptr()->type_);
2048 writer->WriteIntptrValue(ptr()->flags_); 2048 writer->WriteIntptrValue(ptr()->flags_);
2049 2049
2050 // Do not write out the data part which is native. 2050 // Do not write out the data part which is native.
2051 } 2051 }
2052 2052
2053 2053
2054 RawWeakProperty* WeakProperty::ReadFrom(SnapshotReader* reader,
2055 intptr_t object_id,
2056 intptr_t tags,
2057 Snapshot::Kind kind) {
2058 ASSERT(reader != NULL);
2059
2060 // Allocate the weak property object.
2061 WeakProperty& weak_property = WeakProperty::ZoneHandle(
2062 reader->isolate(),
2063 WeakProperty::New((kind == Snapshot::kFull) ? Heap::kOld : Heap::kNew));
2064 reader->AddBackRef(object_id, &weak_property, kIsDeserialized);
2065
2066 // Set the object tags.
2067 weak_property.set_tags(tags);
2068
2069 // Set all the object fields.
2070 weak_property.raw_ptr()->key_ = reader->ReadObjectRef();
2071 weak_property.raw_ptr()->value_ = reader->ReadObjectRef();
2072
2073 return weak_property.raw();
2074 }
2075
2076
2077 void RawWeakProperty::WriteTo(SnapshotWriter* writer,
2078 intptr_t object_id,
2079 Snapshot::Kind kind) {
2080 ASSERT(writer != NULL);
2081
2082 // Write out the serialization header value for this object.
2083 writer->WriteInlinedObjectHeader(object_id);
2084
2085 // Write out the class and tags information.
2086 writer->WriteIndexedObject(kWeakPropertyCid);
2087 writer->WriteIntptrValue(writer->GetObjectTags(this));
2088
2089 // Write out all the other fields.
2090 writer->Write<RawObject*>(ptr()->key_);
2091 writer->Write<RawObject*>(ptr()->value_);
2092 }
2093
2054 } // namespace dart 2094 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | runtime/vm/scavenger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698