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 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 } | 2461 } |
2462 return result.raw(); | 2462 return result.raw(); |
2463 } | 2463 } |
2464 #undef TYPED_DATA_READ | 2464 #undef TYPED_DATA_READ |
2465 | 2465 |
2466 | 2466 |
2467 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, | 2467 RawExternalTypedData* ExternalTypedData::ReadFrom(SnapshotReader* reader, |
2468 intptr_t object_id, | 2468 intptr_t object_id, |
2469 intptr_t tags, | 2469 intptr_t tags, |
2470 Snapshot::Kind kind) { | 2470 Snapshot::Kind kind) { |
2471 UNIMPLEMENTED(); | 2471 ASSERT(kind != Snapshot::kFull); |
2472 return ExternalTypedData::null(); | 2472 intptr_t cid = RawObject::ClassIdTag::decode(tags); |
| 2473 intptr_t length = reader->ReadSmiValue(); |
| 2474 uint8_t* data = reinterpret_cast<uint8_t*>(reader->ReadIntptrValue()); |
| 2475 const ExternalTypedData& obj = ExternalTypedData::Handle( |
| 2476 ExternalTypedData::New(cid, data, length)); |
| 2477 void* peer = reinterpret_cast<void*>(reader->ReadIntptrValue()); |
| 2478 Dart_WeakPersistentHandleFinalizer callback = |
| 2479 reinterpret_cast<Dart_WeakPersistentHandleFinalizer>( |
| 2480 reader->ReadIntptrValue()); |
| 2481 obj.AddFinalizer(peer, callback); |
| 2482 return obj.raw(); |
2473 } | 2483 } |
2474 | 2484 |
2475 | 2485 |
2476 #define TYPED_DATA_WRITE(type) \ | 2486 #define TYPED_DATA_WRITE(type) \ |
2477 { \ | 2487 { \ |
2478 type* data = reinterpret_cast<type*>(ptr()->data_); \ | 2488 type* data = reinterpret_cast<type*>(ptr()->data_); \ |
2479 for (intptr_t i = 0; i < len; i++) { \ | 2489 for (intptr_t i = 0; i < len; i++) { \ |
2480 writer->Write(data[i]); \ | 2490 writer->Write(data[i]); \ |
2481 } \ | 2491 } \ |
2482 } \ | 2492 } \ |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2766 // Write out the class and tags information. | 2776 // Write out the class and tags information. |
2767 writer->WriteIndexedObject(kWeakPropertyCid); | 2777 writer->WriteIndexedObject(kWeakPropertyCid); |
2768 writer->WriteIntptrValue(writer->GetObjectTags(this)); | 2778 writer->WriteIntptrValue(writer->GetObjectTags(this)); |
2769 | 2779 |
2770 // Write out all the other fields. | 2780 // Write out all the other fields. |
2771 writer->Write<RawObject*>(ptr()->key_); | 2781 writer->Write<RawObject*>(ptr()->key_); |
2772 writer->Write<RawObject*>(ptr()->value_); | 2782 writer->Write<RawObject*>(ptr()->value_); |
2773 } | 2783 } |
2774 | 2784 |
2775 } // namespace dart | 2785 } // namespace dart |
OLD | NEW |