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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 10450014: Request for comments on overall approach. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix scavenger and freelist handling Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 2e4c18266e9779e067de29d0feb6c0d0468d1bbd..009e2a4b7d89c4e5c9a7e7838b4a0a12eb983b2f 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -83,9 +83,10 @@ void RawClass::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
if ((kind == Snapshot::kFull) ||
- (kind == Snapshot::kScript && !IsCreatedFromSnapshot())) {
+ (kind == Snapshot::kScript &&
+ !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)))) {
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kClassClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kClassClass, writer->GetObjectTags(this));
// Write out all the non object pointer fields.
// NOTE: cpp_vtable_ is not written.
@@ -146,7 +147,8 @@ void RawUnresolvedClass::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kUnresolvedClassClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kUnresolvedClassClass,
+ writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->WriteIntptrValue(ptr()->token_index_);
@@ -217,7 +219,7 @@ void RawType::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kTypeClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kTypeClass, writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->WriteIntptrValue(ptr()->token_index_);
@@ -270,7 +272,8 @@ void RawTypeParameter::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kTypeParameterClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kTypeParameterClass,
+ writer->GetObjectTags(this));
// Write out all the non object pointer fields.
writer->WriteIntptrValue(ptr()->index_);
@@ -341,7 +344,8 @@ void RawTypeArguments::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kTypeArgumentsClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kTypeArgumentsClass,
+ writer->GetObjectTags(this));
// Write out the length field.
writer->Write<RawObject*>(ptr()->length_);
@@ -394,7 +398,7 @@ void RawInstantiatedTypeArguments::WriteTo(SnapshotWriter* writer,
// Write out the class and tags information.
writer->WriteObjectHeader(Object::kInstantiatedTypeArgumentsClass,
- ptr()->tags_);
+ writer->GetObjectTags(this));
// Write out all the object pointer fields.
SnapshotWriterVisitor visitor(writer);
@@ -445,13 +449,15 @@ void RawFunction::WriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind) {
ASSERT(writer != NULL);
- ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
+ ASSERT(kind != Snapshot::kMessage &&
+ !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
// Write out the serialization header value for this object.
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kFunctionClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kFunctionClass,
+ writer->GetObjectTags(this));
// Write out all the non object fields.
writer->WriteIntptrValue(ptr()->token_index_);
@@ -507,13 +513,14 @@ void RawField::WriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind) {
ASSERT(writer != NULL);
- ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
+ ASSERT(kind != Snapshot::kMessage &&
+ !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
// Write out the serialization header value for this object.
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kFieldClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kFieldClass, writer->GetObjectTags(this));
// Write out all the non object fields.
writer->WriteIntptrValue(ptr()->token_index_);
@@ -564,7 +571,8 @@ void RawLiteralToken::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kLiteralTokenClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kLiteralTokenClass,
+ writer->GetObjectTags(this));
// Write out the kind field.
writer->Write<intptr_t>(ptr()->kind_);
@@ -606,13 +614,15 @@ void RawTokenStream::WriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind) {
ASSERT(writer != NULL);
- ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
+ ASSERT(kind != Snapshot::kMessage &&
+ !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
// Write out the serialization header value for this object.
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kTokenStreamClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kTokenStreamClass,
+ writer->GetObjectTags(this));
// Write out the length field.
writer->Write<RawObject*>(ptr()->length_);
@@ -659,13 +669,14 @@ void RawScript::WriteTo(SnapshotWriter* writer,
Snapshot::Kind kind) {
ASSERT(writer != NULL);
ASSERT(tokens_ != TokenStream::null());
- ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
+ ASSERT(kind != Snapshot::kMessage &&
+ !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
// Write out the serialization header value for this object.
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kScriptClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kScriptClass, writer->GetObjectTags(this));
// Write out all the object pointer fields.
writer->WriteObject(ptr()->url_);
@@ -734,9 +745,9 @@ void RawLibrary::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kLibraryClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kLibraryClass, writer->GetObjectTags(this));
- if (IsCreatedFromSnapshot()) {
+ if (CreatedFromSnapshotTag::decode(writer->GetObjectTags(this))) {
ASSERT(kind != Snapshot::kFull);
// Write out library URL so that it can be looked up when reading.
writer->WriteObject(ptr()->url_);
@@ -795,13 +806,15 @@ void RawLibraryPrefix::WriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind) {
ASSERT(writer != NULL);
- ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
+ ASSERT(kind != Snapshot::kMessage &&
+ !CreatedFromSnapshotTag::decode(writer->GetObjectTags(this)));
// Write out the serialization header value for this object.
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kLibraryPrefixClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kLibraryPrefixClass,
+ writer->GetObjectTags(this));
// Write out all non object fields.
writer->WriteIntptrValue(ptr()->num_libs_);
@@ -953,7 +966,7 @@ void RawContext::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kContextClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kContextClass, writer->GetObjectTags(this));
// Write out num of variables in the context.
writer->WriteIntptrValue(ptr()->num_variables_);
@@ -1004,7 +1017,8 @@ void RawContextScope::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(Object::kContextScopeClass, ptr()->tags_);
+ writer->WriteObjectHeader(Object::kContextScopeClass,
+ writer->GetObjectTags(this));
// Serialize number of variables.
writer->WriteIntptrValue(ptr()->num_variables_);
@@ -1181,7 +1195,8 @@ void RawMint::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(ObjectStore::kMintClass, ptr()->tags_);
+ writer->WriteObjectHeader(ObjectStore::kMintClass,
+ writer->GetObjectTags(this));
// Write out the 64 bit value.
writer->Write<int64_t>(ptr()->value_);
@@ -1230,7 +1245,8 @@ void RawBigint::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(ObjectStore::kBigintClass, ptr()->tags_);
+ writer->WriteObjectHeader(ObjectStore::kBigintClass,
+ writer->GetObjectTags(this));
// Write out the bigint value as a HEXCstring.
intptr_t length = ptr()->signed_length_;
@@ -1301,7 +1317,8 @@ void RawDouble::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(ObjectStore::kDoubleClass, ptr()->tags_);
+ writer->WriteObjectHeader(ObjectStore::kDoubleClass,
+ writer->GetObjectTags(this));
// Write out the double value.
writer->Write<double>(ptr()->value_);
@@ -1482,7 +1499,7 @@ void RawOneByteString::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kOneByteStringClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->hash_,
ptr()->data_);
@@ -1496,7 +1513,7 @@ void RawTwoByteString::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kTwoByteStringClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->hash_,
ptr()->data_);
@@ -1510,7 +1527,7 @@ void RawFourByteString::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kFourByteStringClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->hash_,
ptr()->data_);
@@ -1555,7 +1572,7 @@ void RawExternalOneByteString::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kOneByteStringClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->hash_,
ptr()->external_data_->data());
@@ -1570,7 +1587,7 @@ void RawExternalTwoByteString::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kTwoByteStringClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->hash_,
ptr()->external_data_->data());
@@ -1585,7 +1602,7 @@ void RawExternalFourByteString::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kFourByteStringClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->hash_,
ptr()->external_data_->data());
@@ -1697,7 +1714,7 @@ void RawArray::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->type_arguments_,
ptr()->data());
@@ -1711,7 +1728,7 @@ void RawImmutableArray::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kImmutableArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
ptr()->type_arguments_,
ptr()->data());
@@ -1755,7 +1772,7 @@ void RawGrowableObjectArray::WriteTo(SnapshotWriter* writer,
// Write out the class and tags information.
writer->WriteObjectHeader(ObjectStore::kGrowableObjectArrayClass,
- ptr()->tags_);
+ writer->GetObjectTags(this));
// Write out the used length field.
writer->Write<RawObject*>(ptr()->length_);
@@ -2038,7 +2055,7 @@ void RawInt8Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt8ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2051,7 +2068,7 @@ void RawUint8Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint8ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2064,7 +2081,7 @@ void RawInt16Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt16ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2077,7 +2094,7 @@ void RawUint16Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint16ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2090,7 +2107,7 @@ void RawInt32Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt32ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2103,7 +2120,7 @@ void RawUint32Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint32ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2116,7 +2133,7 @@ void RawInt64Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt64ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2129,7 +2146,7 @@ void RawUint64Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint64ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2142,7 +2159,7 @@ void RawFloat32Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kFloat32ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2155,7 +2172,7 @@ void RawFloat64Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kFloat64ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->data_));
}
@@ -2168,7 +2185,7 @@ void RawExternalInt8Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt8ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2182,7 +2199,7 @@ void RawExternalUint8Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint8ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2196,7 +2213,7 @@ void RawExternalInt16Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt16ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2210,7 +2227,7 @@ void RawExternalUint16Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint16ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2224,7 +2241,7 @@ void RawExternalInt32Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt32ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2238,7 +2255,7 @@ void RawExternalUint32Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint32ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2252,7 +2269,7 @@ void RawExternalInt64Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kInt64ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2266,7 +2283,7 @@ void RawExternalUint64Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kUint64ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2280,7 +2297,7 @@ void RawExternalFloat32Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kFloat32ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2294,7 +2311,7 @@ void RawExternalFloat64Array::WriteTo(SnapshotWriter* writer,
object_id,
kind,
ObjectStore::kFloat64ArrayClass,
- ptr()->tags_,
+ writer->GetObjectTags(this),
ptr()->length_,
reinterpret_cast<uint8_t*>(ptr()->external_data_->data()));
}
@@ -2374,7 +2391,8 @@ void RawJSRegExp::WriteTo(SnapshotWriter* writer,
writer->WriteSerializationMarker(kInlined, object_id);
// Write out the class and tags information.
- writer->WriteObjectHeader(ObjectStore::kJSRegExpClass, ptr()->tags_);
+ writer->WriteObjectHeader(ObjectStore::kJSRegExpClass,
+ writer->GetObjectTags(this));
// Write out the data length field.
writer->Write<RawObject*>(ptr()->data_length_);

Powered by Google App Engine
This is Rietveld 408576698