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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Write out the class and tags information. | 404 // Write out the class and tags information. |
405 writer->WriteVMIsolateObject(kInstantiatedTypeArgumentsCid); | 405 writer->WriteVMIsolateObject(kInstantiatedTypeArgumentsCid); |
406 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 406 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
407 | 407 |
408 // Write out all the object pointer fields. | 408 // Write out all the object pointer fields. |
409 SnapshotWriterVisitor visitor(writer, false); | 409 SnapshotWriterVisitor visitor(writer, false); |
410 visitor.VisitPointers(from(), to()); | 410 visitor.VisitPointers(from(), to()); |
411 } | 411 } |
412 | 412 |
413 | 413 |
| 414 RawPatchClass* PatchClass::ReadFrom(SnapshotReader* reader, |
| 415 intptr_t object_id, |
| 416 intptr_t tags, |
| 417 Snapshot::Kind kind) { |
| 418 ASSERT(reader != NULL); |
| 419 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags)); |
| 420 |
| 421 // Allocate function object. |
| 422 PatchClass& cls = PatchClass::ZoneHandle(reader->isolate(), |
| 423 NEW_OBJECT(PatchClass)); |
| 424 reader->AddBackRef(object_id, &cls, kIsDeserialized); |
| 425 |
| 426 // Set the object tags. |
| 427 cls.set_tags(tags); |
| 428 |
| 429 // Set all the object fields. |
| 430 // TODO(5411462): Need to assert No GC can happen here, even though |
| 431 // allocations may happen. |
| 432 intptr_t num_flds = (cls.raw()->to() - cls.raw()->from()); |
| 433 for (intptr_t i = 0; i <= num_flds; i++) { |
| 434 *(cls.raw()->from() + i) = reader->ReadObjectRef(); |
| 435 } |
| 436 |
| 437 return cls.raw(); |
| 438 } |
| 439 |
| 440 |
| 441 void RawPatchClass::WriteTo(SnapshotWriter* writer, |
| 442 intptr_t object_id, |
| 443 Snapshot::Kind kind) { |
| 444 ASSERT(writer != NULL); |
| 445 ASSERT(kind != Snapshot::kMessage && |
| 446 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); |
| 447 |
| 448 // Write out the serialization header value for this object. |
| 449 writer->WriteInlinedObjectHeader(object_id); |
| 450 |
| 451 // Write out the class and tags information. |
| 452 writer->WriteVMIsolateObject(kPatchClassCid); |
| 453 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
| 454 // Write out all the object pointer fields. |
| 455 SnapshotWriterVisitor visitor(writer); |
| 456 visitor.VisitPointers(from(), to()); |
| 457 } |
| 458 |
| 459 |
414 RawFunction* Function::ReadFrom(SnapshotReader* reader, | 460 RawFunction* Function::ReadFrom(SnapshotReader* reader, |
415 intptr_t object_id, | 461 intptr_t object_id, |
416 intptr_t tags, | 462 intptr_t tags, |
417 Snapshot::Kind kind) { | 463 Snapshot::Kind kind) { |
418 ASSERT(reader != NULL); | 464 ASSERT(reader != NULL); |
419 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags)); | 465 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags)); |
420 | 466 |
421 // Allocate function object. | 467 // Allocate function object. |
422 Function& func = Function::ZoneHandle( | 468 Function& func = Function::ZoneHandle( |
423 reader->isolate(), NEW_OBJECT(Function)); | 469 reader->isolate(), NEW_OBJECT(Function)); |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2013 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 2059 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
2014 writer->WriteObjectImpl(ptr()->pattern_); | 2060 writer->WriteObjectImpl(ptr()->pattern_); |
2015 writer->WriteIntptrValue(ptr()->type_); | 2061 writer->WriteIntptrValue(ptr()->type_); |
2016 writer->WriteIntptrValue(ptr()->flags_); | 2062 writer->WriteIntptrValue(ptr()->flags_); |
2017 | 2063 |
2018 // Do not write out the data part which is native. | 2064 // Do not write out the data part which is native. |
2019 } | 2065 } |
2020 | 2066 |
2021 | 2067 |
2022 } // namespace dart | 2068 } // namespace dart |
OLD | NEW |