| 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 RUNTIME_VM_SNAPSHOT_H_ | 5 #ifndef RUNTIME_VM_SNAPSHOT_H_ |
| 6 #define RUNTIME_VM_SNAPSHOT_H_ | 6 #define RUNTIME_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" |
| 11 #include "vm/datastream.h" | 11 #include "vm/datastream.h" |
| 12 #include "vm/exceptions.h" | 12 #include "vm/exceptions.h" |
| 13 #include "vm/globals.h" | 13 #include "vm/globals.h" |
| 14 #include "vm/growable_array.h" | 14 #include "vm/growable_array.h" |
| 15 #include "vm/isolate.h" | 15 #include "vm/isolate.h" |
| 16 #include "vm/visitor.h" | 16 #include "vm/visitor.h" |
| 17 | 17 |
| 18 namespace dart { | 18 namespace dart { |
| 19 | 19 |
| 20 // Forward declarations. | 20 // Forward declarations. |
| 21 class AbstractType; | 21 class AbstractType; |
| 22 class Array; | 22 class Array; |
| 23 class Class; | 23 class Class; |
| 24 class ClassTable; | 24 class ClassTable; |
| 25 class Closure; | 25 class Closure; |
| 26 class Code; | 26 class Code; |
| 27 class Dwarf; |
| 27 class ExternalTypedData; | 28 class ExternalTypedData; |
| 28 class GrowableObjectArray; | 29 class GrowableObjectArray; |
| 29 class Heap; | 30 class Heap; |
| 30 class Instructions; | 31 class Instructions; |
| 31 class LanguageError; | 32 class LanguageError; |
| 32 class Library; | 33 class Library; |
| 33 class Object; | 34 class Object; |
| 34 class PassiveObject; | 35 class PassiveObject; |
| 35 class ObjectStore; | 36 class ObjectStore; |
| 36 class MegamorphicCache; | 37 class MegamorphicCache; |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 | 759 |
| 759 private: | 760 private: |
| 760 DISALLOW_COPY_AND_ASSIGN(ImageWriter); | 761 DISALLOW_COPY_AND_ASSIGN(ImageWriter); |
| 761 }; | 762 }; |
| 762 | 763 |
| 763 | 764 |
| 764 class AssemblyImageWriter : public ImageWriter { | 765 class AssemblyImageWriter : public ImageWriter { |
| 765 public: | 766 public: |
| 766 AssemblyImageWriter(uint8_t** assembly_buffer, | 767 AssemblyImageWriter(uint8_t** assembly_buffer, |
| 767 ReAlloc alloc, | 768 ReAlloc alloc, |
| 768 intptr_t initial_size) | 769 intptr_t initial_size); |
| 769 : ImageWriter(), | 770 void Finalize(); |
| 770 assembly_stream_(assembly_buffer, alloc, initial_size), | |
| 771 text_size_(0) {} | |
| 772 | 771 |
| 773 virtual void WriteText(WriteStream* clustered_stream, bool vm); | 772 virtual void WriteText(WriteStream* clustered_stream, bool vm); |
| 774 virtual intptr_t text_size() { return text_size_; } | 773 virtual intptr_t text_size() { return text_size_; } |
| 775 | 774 |
| 776 intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); } | 775 intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); } |
| 777 | 776 |
| 778 private: | 777 private: |
| 778 void FrameUnwindPrologue(); |
| 779 void FrameUnwindEpilogue(); |
| 780 void WriteByteSequence(uword start, uword end); |
| 779 void WriteWordLiteralText(uword value) { | 781 void WriteWordLiteralText(uword value) { |
| 780 // Padding is helpful for comparing the .S with --disassemble. | 782 // Padding is helpful for comparing the .S with --disassemble. |
| 781 #if defined(ARCH_IS_64_BIT) | 783 #if defined(ARCH_IS_64_BIT) |
| 782 assembly_stream_.Print(".quad 0x%0.16" Px "\n", value); | 784 assembly_stream_.Print(".quad 0x%0.16" Px "\n", value); |
| 783 #else | 785 #else |
| 784 assembly_stream_.Print(".long 0x%0.8" Px "\n", value); | 786 assembly_stream_.Print(".long 0x%0.8" Px "\n", value); |
| 785 #endif | 787 #endif |
| 786 text_size_ += sizeof(value); | 788 text_size_ += sizeof(value); |
| 787 } | 789 } |
| 788 | 790 |
| 789 WriteStream assembly_stream_; | 791 WriteStream assembly_stream_; |
| 790 intptr_t text_size_; | 792 intptr_t text_size_; |
| 793 Dwarf* dwarf_; |
| 791 | 794 |
| 792 DISALLOW_COPY_AND_ASSIGN(AssemblyImageWriter); | 795 DISALLOW_COPY_AND_ASSIGN(AssemblyImageWriter); |
| 793 }; | 796 }; |
| 794 | 797 |
| 795 | 798 |
| 796 class BlobImageWriter : public ImageWriter { | 799 class BlobImageWriter : public ImageWriter { |
| 797 public: | 800 public: |
| 798 BlobImageWriter(uint8_t** instructions_blob_buffer, | 801 BlobImageWriter(uint8_t** instructions_blob_buffer, |
| 799 ReAlloc alloc, | 802 ReAlloc alloc, |
| 800 intptr_t initial_size) | 803 intptr_t initial_size) |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 private: | 1014 private: |
| 1012 SnapshotWriter* writer_; | 1015 SnapshotWriter* writer_; |
| 1013 bool as_references_; | 1016 bool as_references_; |
| 1014 | 1017 |
| 1015 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); | 1018 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); |
| 1016 }; | 1019 }; |
| 1017 | 1020 |
| 1018 } // namespace dart | 1021 } // namespace dart |
| 1019 | 1022 |
| 1020 #endif // RUNTIME_VM_SNAPSHOT_H_ | 1023 #endif // RUNTIME_VM_SNAPSHOT_H_ |
| OLD | NEW |