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 #ifndef VM_SNAPSHOT_H_ | 5 #ifndef VM_SNAPSHOT_H_ |
6 #define VM_SNAPSHOT_H_ | 6 #define VM_SNAPSHOT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/bitfield.h" | 10 #include "vm/bitfield.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 // Allocates a Dart_CObject object for string data on the C heap. | 442 // Allocates a Dart_CObject object for string data on the C heap. |
443 Dart_CObject* AllocateDartCObjectString(intptr_t length); | 443 Dart_CObject* AllocateDartCObjectString(intptr_t length); |
444 // Allocates a C array of Dart_CObject objects on the C heap. | 444 // Allocates a C array of Dart_CObject objects on the C heap. |
445 Dart_CObject* AllocateDartCObjectArray(intptr_t length); | 445 Dart_CObject* AllocateDartCObjectArray(intptr_t length); |
446 | 446 |
447 intptr_t LookupInternalClass(intptr_t class_header); | 447 intptr_t LookupInternalClass(intptr_t class_header); |
448 Dart_CObject* ReadInlinedObject(intptr_t object_id); | 448 Dart_CObject* ReadInlinedObject(intptr_t object_id); |
449 Dart_CObject* ReadObjectImpl(intptr_t header); | 449 Dart_CObject* ReadObjectImpl(intptr_t header); |
450 Dart_CObject* ReadIndexedObject(intptr_t object_id); | 450 Dart_CObject* ReadIndexedObject(intptr_t object_id); |
451 | 451 |
| 452 // Add object to backward references. |
| 453 void AddBackwardReference(intptr_t id, Dart_CObject* obj); |
| 454 |
452 Dart_CObject_Internal* AsInternal(Dart_CObject* object) { | 455 Dart_CObject_Internal* AsInternal(Dart_CObject* object) { |
453 ASSERT(object->type >= Dart_CObject::kNumberOfTypes); | 456 ASSERT(object->type >= Dart_CObject::kNumberOfTypes); |
454 return reinterpret_cast<Dart_CObject_Internal*>(object); | 457 return reinterpret_cast<Dart_CObject_Internal*>(object); |
455 } | 458 } |
456 | 459 |
457 ReAlloc alloc_; | 460 ReAlloc alloc_; |
| 461 GrowableArray<Dart_CObject*> backward_references_; |
458 | 462 |
459 Dart_CObject type_arguments_marker; | 463 Dart_CObject type_arguments_marker; |
460 Dart_CObject dynamic_type_marker; | 464 Dart_CObject dynamic_type_marker; |
461 }; | 465 }; |
462 | 466 |
463 | 467 |
464 class BaseWriter { | 468 class BaseWriter { |
465 public: | 469 public: |
466 // Size of the snapshot. | 470 // Size of the snapshot. |
467 intptr_t BytesWritten() const { return stream_.bytes_written(); } | 471 intptr_t BytesWritten() const { return stream_.bytes_written(); } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 633 |
630 private: | 634 private: |
631 SnapshotWriter* writer_; | 635 SnapshotWriter* writer_; |
632 | 636 |
633 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 637 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
634 }; | 638 }; |
635 | 639 |
636 } // namespace dart | 640 } // namespace dart |
637 | 641 |
638 #endif // VM_SNAPSHOT_H_ | 642 #endif // VM_SNAPSHOT_H_ |
OLD | NEW |