| 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 next_object_offset_(DataSnapshot::kHeaderSize), | 743 next_object_offset_(DataSnapshot::kHeaderSize), |
| 744 instructions_(), | 744 instructions_(), |
| 745 objects_() { | 745 objects_() { |
| 746 } | 746 } |
| 747 virtual ~InstructionsWriter() { } | 747 virtual ~InstructionsWriter() { } |
| 748 | 748 |
| 749 int32_t GetOffsetFor(RawInstructions* instructions, RawCode* code); | 749 int32_t GetOffsetFor(RawInstructions* instructions, RawCode* code); |
| 750 | 750 |
| 751 int32_t GetObjectOffsetFor(RawObject* raw_object); | 751 int32_t GetObjectOffsetFor(RawObject* raw_object); |
| 752 | 752 |
| 753 virtual void Write(uint8_t* vmisolate_buffer, | 753 virtual void Write() = 0; |
| 754 intptr_t vmisolate_length, | |
| 755 uint8_t* isolate_buffer, | |
| 756 intptr_t isolate_length) = 0; | |
| 757 virtual intptr_t text_size() = 0; | 754 virtual intptr_t text_size() = 0; |
| 758 virtual intptr_t data_size() = 0; | 755 virtual intptr_t data_size() = 0; |
| 759 | 756 |
| 760 protected: | 757 protected: |
| 761 struct InstructionsData { | 758 struct InstructionsData { |
| 762 explicit InstructionsData(RawInstructions* insns, | 759 explicit InstructionsData(RawInstructions* insns, |
| 763 RawCode* code, | 760 RawCode* code, |
| 764 intptr_t offset) | 761 intptr_t offset) |
| 765 : raw_insns_(insns), raw_code_(code), offset_(offset) { } | 762 : raw_insns_(insns), raw_code_(code), offset_(offset) { } |
| 766 | 763 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 public: | 796 public: |
| 800 AssemblyInstructionsWriter(uint8_t** assembly_buffer, | 797 AssemblyInstructionsWriter(uint8_t** assembly_buffer, |
| 801 ReAlloc alloc, | 798 ReAlloc alloc, |
| 802 intptr_t initial_size) | 799 intptr_t initial_size) |
| 803 : InstructionsWriter(), | 800 : InstructionsWriter(), |
| 804 assembly_stream_(assembly_buffer, alloc, initial_size), | 801 assembly_stream_(assembly_buffer, alloc, initial_size), |
| 805 text_size_(0), | 802 text_size_(0), |
| 806 data_size_(0) { | 803 data_size_(0) { |
| 807 } | 804 } |
| 808 | 805 |
| 809 virtual void Write(uint8_t* vmisolate_buffer, | 806 virtual void Write(); |
| 810 intptr_t vmisolate_length, | |
| 811 uint8_t* isolate_buffer, | |
| 812 intptr_t isolate_length); | |
| 813 virtual intptr_t text_size() { return text_size_; } | 807 virtual intptr_t text_size() { return text_size_; } |
| 814 virtual intptr_t data_size() { return data_size_; } | 808 virtual intptr_t data_size() { return data_size_; } |
| 815 | 809 |
| 816 intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); } | 810 intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); } |
| 817 | 811 |
| 818 private: | 812 private: |
| 819 void WriteWordLiteralText(uword value) { | 813 void WriteWordLiteralText(uword value) { |
| 820 // Padding is helpful for comparing the .S with --disassemble. | 814 // Padding is helpful for comparing the .S with --disassemble. |
| 821 #if defined(ARCH_IS_64_BIT) | 815 #if defined(ARCH_IS_64_BIT) |
| 822 assembly_stream_.Print(".quad 0x%0.16" Px "\n", value); | 816 assembly_stream_.Print(".quad 0x%0.16" Px "\n", value); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 848 public: | 842 public: |
| 849 BlobInstructionsWriter(uint8_t** instructions_blob_buffer, | 843 BlobInstructionsWriter(uint8_t** instructions_blob_buffer, |
| 850 uint8_t** rodata_blob_buffer, | 844 uint8_t** rodata_blob_buffer, |
| 851 ReAlloc alloc, | 845 ReAlloc alloc, |
| 852 intptr_t initial_size) | 846 intptr_t initial_size) |
| 853 : InstructionsWriter(), | 847 : InstructionsWriter(), |
| 854 instructions_blob_stream_(instructions_blob_buffer, alloc, initial_size), | 848 instructions_blob_stream_(instructions_blob_buffer, alloc, initial_size), |
| 855 rodata_blob_stream_(rodata_blob_buffer, alloc, initial_size) { | 849 rodata_blob_stream_(rodata_blob_buffer, alloc, initial_size) { |
| 856 } | 850 } |
| 857 | 851 |
| 858 virtual void Write(uint8_t* vmisolate_buffer, | 852 virtual void Write(); |
| 859 intptr_t vmisolate_length, | |
| 860 uint8_t* isolate_buffer, | |
| 861 intptr_t isolate_length); | |
| 862 virtual intptr_t text_size() { return InstructionsBlobSize(); } | 853 virtual intptr_t text_size() { return InstructionsBlobSize(); } |
| 863 virtual intptr_t data_size() { return RodataBlobSize(); } | 854 virtual intptr_t data_size() { return RodataBlobSize(); } |
| 864 | 855 |
| 865 intptr_t InstructionsBlobSize() const { | 856 intptr_t InstructionsBlobSize() const { |
| 866 return instructions_blob_stream_.bytes_written(); | 857 return instructions_blob_stream_.bytes_written(); |
| 867 } | 858 } |
| 868 intptr_t RodataBlobSize() const { | 859 intptr_t RodataBlobSize() const { |
| 869 return rodata_blob_stream_.bytes_written(); | 860 return rodata_blob_stream_.bytes_written(); |
| 870 } | 861 } |
| 871 | 862 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 private: | 1034 private: |
| 1044 SnapshotWriter* writer_; | 1035 SnapshotWriter* writer_; |
| 1045 bool as_references_; | 1036 bool as_references_; |
| 1046 | 1037 |
| 1047 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 1038 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 1048 }; | 1039 }; |
| 1049 | 1040 |
| 1050 } // namespace dart | 1041 } // namespace dart |
| 1051 | 1042 |
| 1052 #endif // VM_SNAPSHOT_H_ | 1043 #endif // VM_SNAPSHOT_H_ |
| OLD | NEW |