| OLD | NEW | 
|     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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   441                                           Snapshot::Kind kind) { |   441                                           Snapshot::Kind kind) { | 
|   442   ASSERT(reader != NULL); |   442   ASSERT(reader != NULL); | 
|   443  |   443  | 
|   444   // Read the length so that we can determine instance size to allocate. |   444   // Read the length so that we can determine instance size to allocate. | 
|   445   intptr_t len = reader->ReadSmiValue(); |   445   intptr_t len = reader->ReadSmiValue(); | 
|   446  |   446  | 
|   447   TypeArguments& type_arguments = TypeArguments::ZoneHandle( |   447   TypeArguments& type_arguments = TypeArguments::ZoneHandle( | 
|   448       reader->isolate(), NEW_OBJECT_WITH_LEN_SPACE(TypeArguments, len, kind)); |   448       reader->isolate(), NEW_OBJECT_WITH_LEN_SPACE(TypeArguments, len, kind)); | 
|   449   reader->AddBackRef(object_id, &type_arguments, kIsDeserialized); |   449   reader->AddBackRef(object_id, &type_arguments, kIsDeserialized); | 
|   450  |   450  | 
|   451   // Now set all the object fields. |   451   // Set the instantiations field, which is only read from a full snapshot. | 
|   452   *reader->ArrayHandle() ^= reader->ReadObjectImpl(); |   452   if (kind == Snapshot::kFull) { | 
|   453   type_arguments.set_instantiations(*reader->ArrayHandle()); |   453     *reader->ArrayHandle() ^= reader->ReadObjectImpl(); | 
 |   454     type_arguments.set_instantiations(*reader->ArrayHandle()); | 
 |   455   } else { | 
 |   456     // TODO(regis): Change to Object::zero_array() once supported. | 
 |   457     type_arguments.set_instantiations(Object::empty_array()); | 
 |   458   } | 
 |   459  | 
 |   460   // Now set all the type fields. | 
|   454   for (intptr_t i = 0; i < len; i++) { |   461   for (intptr_t i = 0; i < len; i++) { | 
|   455     *reader->TypeHandle() ^= reader->ReadObjectImpl(); |   462     *reader->TypeHandle() ^= reader->ReadObjectImpl(); | 
|   456     type_arguments.set_type_at(i, *reader->TypeHandle()); |   463     type_arguments.set_type_at(i, *reader->TypeHandle()); | 
|   457   } |   464   } | 
|   458  |   465  | 
|   459   // If object needs to be a canonical object, Canonicalize it. |   466   // If object needs to be a canonical object, Canonicalize it. | 
|   460   // When reading a full snapshot we don't need to canonicalize the object |   467   // When reading a full snapshot we don't need to canonicalize the object | 
|   461   // as it would already be a canonical object. |   468   // as it would already be a canonical object. | 
|   462   // When reading a script snapshot we need to canonicalize only those object |   469   // When reading a script snapshot we need to canonicalize only those object | 
|   463   // references that are objects from the core library (loaded from a |   470   // references that are objects from the core library (loaded from a | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|   488   // Write out the serialization header value for this object. |   495   // Write out the serialization header value for this object. | 
|   489   writer->WriteInlinedObjectHeader(object_id); |   496   writer->WriteInlinedObjectHeader(object_id); | 
|   490  |   497  | 
|   491   // Write out the class and tags information. |   498   // Write out the class and tags information. | 
|   492   writer->WriteVMIsolateObject(kTypeArgumentsCid); |   499   writer->WriteVMIsolateObject(kTypeArgumentsCid); | 
|   493   writer->WriteIntptrValue(writer->GetObjectTags(this)); |   500   writer->WriteIntptrValue(writer->GetObjectTags(this)); | 
|   494  |   501  | 
|   495   // Write out the length field. |   502   // Write out the length field. | 
|   496   writer->Write<RawObject*>(ptr()->length_); |   503   writer->Write<RawObject*>(ptr()->length_); | 
|   497  |   504  | 
|   498   // Write out the instantiations field. |   505   // Write out the instantiations field, but only in a full snapshot. | 
|   499   writer->WriteObjectImpl(ptr()->instantiations_); |   506   if (kind == Snapshot::kFull) { | 
 |   507     writer->WriteObjectImpl(ptr()->instantiations_); | 
 |   508   } | 
|   500  |   509  | 
|   501   // Write out the individual types. |   510   // Write out the individual types. | 
|   502   intptr_t len = Smi::Value(ptr()->length_); |   511   intptr_t len = Smi::Value(ptr()->length_); | 
|   503   for (intptr_t i = 0; i < len; i++) { |   512   for (intptr_t i = 0; i < len; i++) { | 
|   504     writer->WriteObjectImpl(ptr()->types_[i]); |   513     writer->WriteObjectImpl(ptr()->types_[i]); | 
|   505   } |   514   } | 
|   506 } |   515 } | 
|   507  |   516  | 
|   508  |   517  | 
|   509 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, |   518 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, | 
| (...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2667     // We do not allow objects with native fields in an isolate message. |  2676     // We do not allow objects with native fields in an isolate message. | 
|  2668     writer->SetWriteException(Exceptions::kArgument, |  2677     writer->SetWriteException(Exceptions::kArgument, | 
|  2669                               "Illegal argument in isolate message" |  2678                               "Illegal argument in isolate message" | 
|  2670                               " : (object is a MirrorReference)"); |  2679                               " : (object is a MirrorReference)"); | 
|  2671   } else { |  2680   } else { | 
|  2672     UNREACHABLE(); |  2681     UNREACHABLE(); | 
|  2673   } |  2682   } | 
|  2674 } |  2683 } | 
|  2675  |  2684  | 
|  2676 }  // namespace dart |  2685 }  // namespace dart | 
| OLD | NEW |