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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/snapshot.cc » ('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/native_entry.h" 5 #include "vm/native_entry.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/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Write out the class and tags information. 497 // Write out the class and tags information.
498 writer->WriteVMIsolateObject(kTypeArgumentsCid); 498 writer->WriteVMIsolateObject(kTypeArgumentsCid);
499 writer->WriteTags(writer->GetObjectTags(this)); 499 writer->WriteTags(writer->GetObjectTags(this));
500 500
501 // Write out the length field. 501 // Write out the length field.
502 writer->Write<RawObject*>(ptr()->length_); 502 writer->Write<RawObject*>(ptr()->length_);
503 503
504 // Write out the individual types. 504 // Write out the individual types.
505 intptr_t len = Smi::Value(ptr()->length_); 505 intptr_t len = Smi::Value(ptr()->length_);
506 for (intptr_t i = 0; i < len; i++) { 506 for (intptr_t i = 0; i < len; i++) {
507 writer->WriteObjectImpl(ptr()->types()[i], kAsReference); 507 // The Dart VM reuses type argument lists across instances in order
508 // to reduce memory footprint, this can sometimes lead to a type from
509 // such a shared type argument list being sent over to another isolate.
510 // In such scenarios where it is not appropriate to send the types
511 // across (isolates spawned using spawnURI) we send them as dynamic.
512 if (!writer->can_send_any_object()) {
513 // Lookup the type class.
514 RawType* raw_type = Type::RawCast(ptr()->types()[i]);
515 RawSmi* raw_type_class_id = Smi::RawCast(raw_type->ptr()->type_class_id_);
516 RawClass* type_class =
517 writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id));
518 if (!writer->AllowObjectsInDartLibrary(type_class->ptr()->library_)) {
519 writer->WriteVMIsolateObject(kDynamicType);
520 } else {
521 writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
522 }
523 } else {
524 writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
525 }
508 } 526 }
509 } 527 }
510 528
511 529
512 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, 530 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader,
513 intptr_t object_id, 531 intptr_t object_id,
514 intptr_t tags, 532 intptr_t tags,
515 Snapshot::Kind kind, 533 Snapshot::Kind kind,
516 bool as_reference) { 534 bool as_reference) {
517 ASSERT(reader != NULL); 535 ASSERT(reader != NULL);
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3050 // We do not allow objects with native fields in an isolate message. 3068 // We do not allow objects with native fields in an isolate message.
3051 writer->SetWriteException(Exceptions::kArgument, 3069 writer->SetWriteException(Exceptions::kArgument,
3052 "Illegal argument in isolate message" 3070 "Illegal argument in isolate message"
3053 " : (object is a UserTag)"); 3071 " : (object is a UserTag)");
3054 } else { 3072 } else {
3055 UNREACHABLE(); 3073 UNREACHABLE();
3056 } 3074 }
3057 } 3075 }
3058 3076
3059 } // namespace dart 3077 } // namespace dart
OLDNEW
« 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