Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: runtime/vm/snapshot.h

Issue 2416973003: Reapply "Use a single file for app snapshots." (Closed)
Patch Set: sync Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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() = 0; 753 virtual void Write(uint8_t* vmisolate_buffer,
754 intptr_t vmisolate_length,
755 uint8_t* isolate_buffer,
756 intptr_t isolate_length) = 0;
754 virtual intptr_t text_size() = 0; 757 virtual intptr_t text_size() = 0;
755 virtual intptr_t data_size() = 0; 758 virtual intptr_t data_size() = 0;
756 759
757 protected: 760 protected:
758 struct InstructionsData { 761 struct InstructionsData {
759 explicit InstructionsData(RawInstructions* insns, 762 explicit InstructionsData(RawInstructions* insns,
760 RawCode* code, 763 RawCode* code,
761 intptr_t offset) 764 intptr_t offset)
762 : raw_insns_(insns), raw_code_(code), offset_(offset) { } 765 : raw_insns_(insns), raw_code_(code), offset_(offset) { }
763 766
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 public: 799 public:
797 AssemblyInstructionsWriter(uint8_t** assembly_buffer, 800 AssemblyInstructionsWriter(uint8_t** assembly_buffer,
798 ReAlloc alloc, 801 ReAlloc alloc,
799 intptr_t initial_size) 802 intptr_t initial_size)
800 : InstructionsWriter(), 803 : InstructionsWriter(),
801 assembly_stream_(assembly_buffer, alloc, initial_size), 804 assembly_stream_(assembly_buffer, alloc, initial_size),
802 text_size_(0), 805 text_size_(0),
803 data_size_(0) { 806 data_size_(0) {
804 } 807 }
805 808
806 virtual void Write(); 809 virtual void Write(uint8_t* vmisolate_buffer,
810 intptr_t vmisolate_length,
811 uint8_t* isolate_buffer,
812 intptr_t isolate_length);
807 virtual intptr_t text_size() { return text_size_; } 813 virtual intptr_t text_size() { return text_size_; }
808 virtual intptr_t data_size() { return data_size_; } 814 virtual intptr_t data_size() { return data_size_; }
809 815
810 intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); } 816 intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); }
811 817
812 private: 818 private:
813 void WriteWordLiteralText(uword value) { 819 void WriteWordLiteralText(uword value) {
814 // Padding is helpful for comparing the .S with --disassemble. 820 // Padding is helpful for comparing the .S with --disassemble.
815 #if defined(ARCH_IS_64_BIT) 821 #if defined(ARCH_IS_64_BIT)
816 assembly_stream_.Print(".quad 0x%0.16" Px "\n", value); 822 assembly_stream_.Print(".quad 0x%0.16" Px "\n", value);
(...skipping 25 matching lines...) Expand all
842 public: 848 public:
843 BlobInstructionsWriter(uint8_t** instructions_blob_buffer, 849 BlobInstructionsWriter(uint8_t** instructions_blob_buffer,
844 uint8_t** rodata_blob_buffer, 850 uint8_t** rodata_blob_buffer,
845 ReAlloc alloc, 851 ReAlloc alloc,
846 intptr_t initial_size) 852 intptr_t initial_size)
847 : InstructionsWriter(), 853 : InstructionsWriter(),
848 instructions_blob_stream_(instructions_blob_buffer, alloc, initial_size), 854 instructions_blob_stream_(instructions_blob_buffer, alloc, initial_size),
849 rodata_blob_stream_(rodata_blob_buffer, alloc, initial_size) { 855 rodata_blob_stream_(rodata_blob_buffer, alloc, initial_size) {
850 } 856 }
851 857
852 virtual void Write(); 858 virtual void Write(uint8_t* vmisolate_buffer,
859 intptr_t vmisolate_length,
860 uint8_t* isolate_buffer,
861 intptr_t isolate_length);
853 virtual intptr_t text_size() { return InstructionsBlobSize(); } 862 virtual intptr_t text_size() { return InstructionsBlobSize(); }
854 virtual intptr_t data_size() { return RodataBlobSize(); } 863 virtual intptr_t data_size() { return RodataBlobSize(); }
855 864
856 intptr_t InstructionsBlobSize() const { 865 intptr_t InstructionsBlobSize() const {
857 return instructions_blob_stream_.bytes_written(); 866 return instructions_blob_stream_.bytes_written();
858 } 867 }
859 intptr_t RodataBlobSize() const { 868 intptr_t RodataBlobSize() const {
860 return rodata_blob_stream_.bytes_written(); 869 return rodata_blob_stream_.bytes_written();
861 } 870 }
862 871
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 private: 1043 private:
1035 SnapshotWriter* writer_; 1044 SnapshotWriter* writer_;
1036 bool as_references_; 1045 bool as_references_;
1037 1046
1038 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 1047 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
1039 }; 1048 };
1040 1049
1041 } // namespace dart 1050 } // namespace dart
1042 1051
1043 #endif // VM_SNAPSHOT_H_ 1052 #endif // VM_SNAPSHOT_H_
OLDNEW
« runtime/bin/main.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698