| 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/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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); | 251 (ptr()->type_state_ == RawType::kFinalizedUninstantiated)); |
| 252 ASSERT(ptr()->type_class_id_ != Object::null()); | 252 ASSERT(ptr()->type_class_id_ != Object::null()); |
| 253 | 253 |
| 254 // Write out the serialization header value for this object. | 254 // Write out the serialization header value for this object. |
| 255 writer->WriteInlinedObjectHeader(object_id); | 255 writer->WriteInlinedObjectHeader(object_id); |
| 256 | 256 |
| 257 // Write out the class and tags information. | 257 // Write out the class and tags information. |
| 258 writer->WriteIndexedObject(kTypeCid); | 258 writer->WriteIndexedObject(kTypeCid); |
| 259 writer->WriteTags(writer->GetObjectTags(this)); | 259 writer->WriteTags(writer->GetObjectTags(this)); |
| 260 | 260 |
| 261 if (ptr()->type_class_id_->IsHeapObject()) { |
| 262 // Type class is still an unresolved class. |
| 263 UNREACHABLE(); |
| 264 } |
| 265 |
| 261 // Lookup the type class. | 266 // Lookup the type class. |
| 262 RawSmi* raw_type_class_id = Smi::RawCast(ptr()->type_class_id_); | 267 RawSmi* raw_type_class_id = Smi::RawCast(ptr()->type_class_id_); |
| 263 RawClass* type_class = | 268 RawClass* type_class = |
| 264 writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id)); | 269 writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id)); |
| 265 | 270 |
| 266 // Write out typeclass_is_in_fullsnapshot first as this will | 271 // Write out typeclass_is_in_fullsnapshot first as this will |
| 267 // help the reader decide on how to canonicalize the type object. | 272 // help the reader decide on how to canonicalize the type object. |
| 268 intptr_t tags = writer->GetObjectTags(type_class); | 273 intptr_t tags = writer->GetObjectTags(type_class); |
| 269 bool typeclass_is_in_fullsnapshot = | 274 bool typeclass_is_in_fullsnapshot = |
| 270 (ClassIdTag::decode(tags) == kClassCid) && | 275 (ClassIdTag::decode(tags) == kClassCid) && |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 339 |
| 335 // Allocate type parameter object. | 340 // Allocate type parameter object. |
| 336 TypeParameter& type_parameter = TypeParameter::ZoneHandle( | 341 TypeParameter& type_parameter = TypeParameter::ZoneHandle( |
| 337 reader->zone(), TypeParameter::New()); | 342 reader->zone(), TypeParameter::New()); |
| 338 reader->AddBackRef(object_id, &type_parameter, kIsDeserialized); | 343 reader->AddBackRef(object_id, &type_parameter, kIsDeserialized); |
| 339 | 344 |
| 340 // Set all non object fields. | 345 // Set all non object fields. |
| 341 type_parameter.set_token_pos( | 346 type_parameter.set_token_pos( |
| 342 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); | 347 TokenPosition::SnapshotDecode(reader->Read<int32_t>())); |
| 343 type_parameter.set_index(reader->Read<int16_t>()); | 348 type_parameter.set_index(reader->Read<int16_t>()); |
| 349 type_parameter.set_parent_level(reader->Read<uint8_t>()); |
| 344 type_parameter.set_type_state(reader->Read<int8_t>()); | 350 type_parameter.set_type_state(reader->Read<int8_t>()); |
| 345 | 351 |
| 346 // Set all the object fields. | 352 // Set all the object fields. |
| 347 READ_OBJECT_FIELDS(type_parameter, | 353 READ_OBJECT_FIELDS(type_parameter, |
| 348 type_parameter.raw()->from(), type_parameter.raw()->to(), | 354 type_parameter.raw()->from(), type_parameter.raw()->to(), |
| 349 kAsReference); | 355 kAsReference); |
| 350 | 356 |
| 351 // Read in the parameterized class. | 357 // Read in the parameterized class. |
| 352 (*reader->ClassHandle()) = | 358 (*reader->ClassHandle()) = |
| 353 Class::RawCast(reader->ReadObjectImpl(kAsReference)); | 359 Class::RawCast(reader->ReadObjectImpl(kAsReference)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 369 // Write out the serialization header value for this object. | 375 // Write out the serialization header value for this object. |
| 370 writer->WriteInlinedObjectHeader(object_id); | 376 writer->WriteInlinedObjectHeader(object_id); |
| 371 | 377 |
| 372 // Write out the class and tags information. | 378 // Write out the class and tags information. |
| 373 writer->WriteIndexedObject(kTypeParameterCid); | 379 writer->WriteIndexedObject(kTypeParameterCid); |
| 374 writer->WriteTags(writer->GetObjectTags(this)); | 380 writer->WriteTags(writer->GetObjectTags(this)); |
| 375 | 381 |
| 376 // Write out all the non object pointer fields. | 382 // Write out all the non object pointer fields. |
| 377 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); | 383 writer->Write<int32_t>(ptr()->token_pos_.SnapshotEncode()); |
| 378 writer->Write<int16_t>(ptr()->index_); | 384 writer->Write<int16_t>(ptr()->index_); |
| 385 writer->Write<uint8_t>(ptr()->parent_level_); |
| 379 writer->Write<int8_t>(ptr()->type_state_); | 386 writer->Write<int8_t>(ptr()->type_state_); |
| 380 | 387 |
| 381 // Write out all the object pointer fields. | 388 // Write out all the object pointer fields. |
| 382 SnapshotWriterVisitor visitor(writer, kAsReference); | 389 SnapshotWriterVisitor visitor(writer, kAsReference); |
| 383 visitor.VisitPointers(from(), to()); | 390 visitor.VisitPointers(from(), to()); |
| 384 | 391 |
| 385 // Write out the parameterized class. | 392 // Write out the parameterized class. |
| 386 RawClass* param_class = | 393 RawClass* param_class = |
| 387 writer->isolate()->class_table()->At(ptr()->parameterized_class_id_); | 394 writer->isolate()->class_table()->At(ptr()->parameterized_class_id_); |
| 388 writer->WriteObjectImpl(param_class, kAsReference); | 395 writer->WriteObjectImpl(param_class, kAsReference); |
| (...skipping 2657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 // We do not allow objects with native fields in an isolate message. | 3053 // We do not allow objects with native fields in an isolate message. |
| 3047 writer->SetWriteException(Exceptions::kArgument, | 3054 writer->SetWriteException(Exceptions::kArgument, |
| 3048 "Illegal argument in isolate message" | 3055 "Illegal argument in isolate message" |
| 3049 " : (object is a UserTag)"); | 3056 " : (object is a UserTag)"); |
| 3050 } else { | 3057 } else { |
| 3051 UNREACHABLE(); | 3058 UNREACHABLE(); |
| 3052 } | 3059 } |
| 3053 } | 3060 } |
| 3054 | 3061 |
| 3055 } // namespace dart | 3062 } // namespace dart |
| OLD | NEW |