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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 2622273004: Fix for issue #28287 (Illegal argument in isolate message : (object is a regular Dart Instance)) (Closed)
Patch Set: Address self review comments. Created 3 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/raw_object.h ('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
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 77f057609b6ca60c31d4df18801ede1f57a33e4b..95a71c1f28e8720698a148113a6ed5b030309ba3 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -504,7 +504,25 @@ void RawTypeArguments::WriteTo(SnapshotWriter* writer,
// Write out the individual types.
intptr_t len = Smi::Value(ptr()->length_);
for (intptr_t i = 0; i < len; i++) {
- writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
+ // The Dart VM reuses type argument lists across instances in order
+ // to reduce memory footprint, this can sometimes lead to a type from
+ // such a shared type argument list being sent over to another isolate.
+ // In such scenarios where it is not appropriate to send the types
+ // across (isolates spawned using spawnURI) we send them as dynamic.
+ if (!writer->can_send_any_object()) {
+ // Lookup the type class.
+ RawType* raw_type = Type::RawCast(ptr()->types()[i]);
+ RawSmi* raw_type_class_id = Smi::RawCast(raw_type->ptr()->type_class_id_);
+ RawClass* type_class =
+ writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id));
+ if (!writer->AllowObjectsInDartLibrary(type_class->ptr()->library_)) {
+ writer->WriteVMIsolateObject(kDynamicType);
+ } else {
+ writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
+ }
+ } else {
+ writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
+ }
}
}
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698