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