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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 12123002: Fix class patching involving type parameters: type parameters of patched classes (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
===================================================================
--- runtime/vm/raw_object_snapshot.cc (revision 17960)
+++ runtime/vm/raw_object_snapshot.cc (working copy)
@@ -116,50 +116,16 @@
intptr_t object_id,
intptr_t tags,
Snapshot::Kind kind) {
- ASSERT(reader != NULL);
-
- // Allocate parameterized type object.
- UnresolvedClass& unresolved_class = UnresolvedClass::ZoneHandle(
- reader->isolate(), NEW_OBJECT(UnresolvedClass));
- reader->AddBackRef(object_id, &unresolved_class, kIsDeserialized);
-
- // Set the object tags.
- unresolved_class.set_tags(tags);
-
- // Set all non object fields.
- unresolved_class.set_token_pos(reader->ReadIntptrValue());
-
- // Set all the object fields.
- // TODO(5411462): Need to assert No GC can happen here, even though
- // allocations may happen.
- intptr_t num_flds = (unresolved_class.raw()->to() -
- unresolved_class.raw()->from());
- for (intptr_t i = 0; i <= num_flds; i++) {
- unresolved_class.StorePointer((unresolved_class.raw()->from() + i),
- reader->ReadObjectRef());
- }
- return unresolved_class.raw();
+ UNREACHABLE(); // Only finalized types are written to a snapshot.
+ return NULL;
}
void RawUnresolvedClass::WriteTo(SnapshotWriter* writer,
intptr_t object_id,
Snapshot::Kind kind) {
- ASSERT(writer != NULL);
-
- // Write out the serialization header value for this object.
- writer->WriteInlinedObjectHeader(object_id);
-
- // Write out the class and tags information.
- writer->WriteVMIsolateObject(kUnresolvedClassCid);
- writer->WriteIntptrValue(writer->GetObjectTags(this));
-
- // Write out all the non object pointer fields.
- writer->WriteIntptrValue(ptr()->token_pos_);
-
- // Write out all the object pointer fields.
- SnapshotWriterVisitor visitor(writer);
- visitor.VisitPointers(from(), to());
+ UNREACHABLE(); // Only finalized types are written to a snapshot.
+ // Specify --error_on_malformed_type flag for details.
}
@@ -219,6 +185,11 @@
Snapshot::Kind kind) {
ASSERT(writer != NULL);
+ // Check that the type is finalized.
+ // Specify --error_on_malformed_type flag for details in case of error.
+ ASSERT((ptr()->type_state_ == RawType::kFinalizedInstantiated) ||
+ (ptr()->type_state_ == RawType::kFinalizedUninstantiated));
+
// Write out the serialization header value for this object.
writer->WriteInlinedObjectHeader(object_id);
@@ -244,7 +215,7 @@
// Allocate type parameter object.
TypeParameter& type_parameter = TypeParameter::ZoneHandle(
- reader->isolate(), NEW_OBJECT(TypeParameter));
+ reader->isolate(), NEW_OBJECT(TypeParameter));
reader->AddBackRef(object_id, &type_parameter, kIsDeserialized);
// Set the object tags.
@@ -274,6 +245,10 @@
Snapshot::Kind kind) {
ASSERT(writer != NULL);
+ // Check that the type parameter is finalized.
+ // Specify --error_on_malformed_type flag for details in case of error.
+ ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated);
+
// Write out the serialization header value for this object.
writer->WriteInlinedObjectHeader(object_id);
« no previous file with comments | « runtime/vm/parser.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698