| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 PassiveObject* PassiveObjectHandle() { return &pobj_; } | 277 PassiveObject* PassiveObjectHandle() { return &pobj_; } |
| 278 Array* ArrayHandle() { return &array_; } | 278 Array* ArrayHandle() { return &array_; } |
| 279 String* StringHandle() { return &str_; } | 279 String* StringHandle() { return &str_; } |
| 280 AbstractType* TypeHandle() { return &type_; } | 280 AbstractType* TypeHandle() { return &type_; } |
| 281 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } | 281 TypeArguments* TypeArgumentsHandle() { return &type_arguments_; } |
| 282 Array* TokensHandle() { return &tokens_; } | 282 Array* TokensHandle() { return &tokens_; } |
| 283 TokenStream* StreamHandle() { return &stream_; } | 283 TokenStream* StreamHandle() { return &stream_; } |
| 284 ExternalTypedData* DataHandle() { return &data_; } | 284 ExternalTypedData* DataHandle() { return &data_; } |
| 285 TypedData* TypedDataHandle() { return &typed_data_; } | 285 TypedData* TypedDataHandle() { return &typed_data_; } |
| 286 Snapshot::Kind kind() const { return kind_; } | 286 Snapshot::Kind kind() const { return kind_; } |
| 287 bool allow_code() const { return false; } |
| 287 | 288 |
| 288 // Reads an object. | 289 // Reads an object. |
| 289 RawObject* ReadObject(); | 290 RawObject* ReadObject(); |
| 290 | 291 |
| 291 // Add object to backward references. | 292 // Add object to backward references. |
| 292 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); | 293 void AddBackRef(intptr_t id, Object* obj, DeserializeState state); |
| 293 | 294 |
| 294 // Get an object from the backward references list. | 295 // Get an object from the backward references list. |
| 295 Object* GetBackRef(intptr_t id); | 296 Object* GetBackRef(intptr_t id); |
| 296 | 297 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 friend class Stacktrace; | 440 friend class Stacktrace; |
| 440 friend class TokenStream; | 441 friend class TokenStream; |
| 441 friend class Type; | 442 friend class Type; |
| 442 friend class TypeArguments; | 443 friend class TypeArguments; |
| 443 friend class TypeParameter; | 444 friend class TypeParameter; |
| 444 friend class TypeRef; | 445 friend class TypeRef; |
| 445 friend class UnresolvedClass; | 446 friend class UnresolvedClass; |
| 446 friend class UnhandledException; | 447 friend class UnhandledException; |
| 447 friend class WeakProperty; | 448 friend class WeakProperty; |
| 448 friend class MirrorReference; | 449 friend class MirrorReference; |
| 450 friend class ExceptionHandlers; |
| 451 friend class LocalVarDescriptors; |
| 449 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); | 452 DISALLOW_COPY_AND_ASSIGN(SnapshotReader); |
| 450 }; | 453 }; |
| 451 | 454 |
| 452 | 455 |
| 453 class VmIsolateSnapshotReader : public SnapshotReader { | 456 class VmIsolateSnapshotReader : public SnapshotReader { |
| 454 public: | 457 public: |
| 455 VmIsolateSnapshotReader(const uint8_t* buffer, intptr_t size, Zone* zone); | 458 VmIsolateSnapshotReader(const uint8_t* buffer, intptr_t size, Zone* zone); |
| 456 ~VmIsolateSnapshotReader(); | 459 ~VmIsolateSnapshotReader(); |
| 457 | 460 |
| 458 RawApiError* ReadVmIsolateSnapshot(); | 461 RawApiError* ReadVmIsolateSnapshot(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 SnapshotWriter(Snapshot::Kind kind, | 654 SnapshotWriter(Snapshot::Kind kind, |
| 652 uint8_t** buffer, | 655 uint8_t** buffer, |
| 653 ReAlloc alloc, | 656 ReAlloc alloc, |
| 654 intptr_t initial_size, | 657 intptr_t initial_size, |
| 655 ForwardList* forward_list, | 658 ForwardList* forward_list, |
| 656 bool can_send_any_object); | 659 bool can_send_any_object); |
| 657 | 660 |
| 658 public: | 661 public: |
| 659 // Snapshot kind. | 662 // Snapshot kind. |
| 660 Snapshot::Kind kind() const { return kind_; } | 663 Snapshot::Kind kind() const { return kind_; } |
| 664 bool allow_code() const { return false; } |
| 661 | 665 |
| 662 // Serialize an object into the buffer. | 666 // Serialize an object into the buffer. |
| 663 void WriteObject(RawObject* raw); | 667 void WriteObject(RawObject* raw); |
| 664 | 668 |
| 665 uword GetObjectTags(RawObject* raw); | 669 uword GetObjectTags(RawObject* raw); |
| 666 | 670 |
| 667 Exceptions::ExceptionType exception_type() const { | 671 Exceptions::ExceptionType exception_type() const { |
| 668 return exception_type_; | 672 return exception_type_; |
| 669 } | 673 } |
| 670 void set_exception_type(Exceptions::ExceptionType type) { | 674 void set_exception_type(Exceptions::ExceptionType type) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 friend class RawJSRegExp; | 756 friend class RawJSRegExp; |
| 753 friend class RawLibrary; | 757 friend class RawLibrary; |
| 754 friend class RawLiteralToken; | 758 friend class RawLiteralToken; |
| 755 friend class RawMirrorReference; | 759 friend class RawMirrorReference; |
| 756 friend class RawReceivePort; | 760 friend class RawReceivePort; |
| 757 friend class RawScript; | 761 friend class RawScript; |
| 758 friend class RawStacktrace; | 762 friend class RawStacktrace; |
| 759 friend class RawTokenStream; | 763 friend class RawTokenStream; |
| 760 friend class RawTypeArguments; | 764 friend class RawTypeArguments; |
| 761 friend class RawUserTag; | 765 friend class RawUserTag; |
| 766 friend class RawExceptionHandlers; |
| 767 friend class RawLocalVarDescriptors; |
| 762 friend class SnapshotWriterVisitor; | 768 friend class SnapshotWriterVisitor; |
| 763 friend class WriteInlinedObjectVisitor; | 769 friend class WriteInlinedObjectVisitor; |
| 764 DISALLOW_COPY_AND_ASSIGN(SnapshotWriter); | 770 DISALLOW_COPY_AND_ASSIGN(SnapshotWriter); |
| 765 }; | 771 }; |
| 766 | 772 |
| 767 | 773 |
| 768 class FullSnapshotWriter { | 774 class FullSnapshotWriter { |
| 769 public: | 775 public: |
| 770 static const intptr_t kInitialSize = 64 * KB; | 776 static const intptr_t kInitialSize = 64 * KB; |
| 771 FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, | 777 FullSnapshotWriter(uint8_t** vm_isolate_snapshot_buffer, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 private: | 868 private: |
| 863 SnapshotWriter* writer_; | 869 SnapshotWriter* writer_; |
| 864 bool as_references_; | 870 bool as_references_; |
| 865 | 871 |
| 866 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 872 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 867 }; | 873 }; |
| 868 | 874 |
| 869 } // namespace dart | 875 } // namespace dart |
| 870 | 876 |
| 871 #endif // VM_SNAPSHOT_H_ | 877 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |