OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_SNAPSHOT_SERIALIZE_H_ | 5 #ifndef V8_SNAPSHOT_SERIALIZE_H_ |
6 #define V8_SNAPSHOT_SERIALIZE_H_ | 6 #define V8_SNAPSHOT_SERIALIZE_H_ |
7 | 7 |
8 #include "src/hashmap.h" | 8 #include "src/hashmap.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 static const int kCodeStubsBaseIndex = 1; | 848 static const int kCodeStubsBaseIndex = 1; |
849 | 849 |
850 String* source() const { | 850 String* source() const { |
851 DCHECK(!AllowHeapAllocation::IsAllowed()); | 851 DCHECK(!AllowHeapAllocation::IsAllowed()); |
852 return source_; | 852 return source_; |
853 } | 853 } |
854 | 854 |
855 const List<uint32_t>* stub_keys() const { return &stub_keys_; } | 855 const List<uint32_t>* stub_keys() const { return &stub_keys_; } |
856 | 856 |
857 private: | 857 private: |
858 CodeSerializer(Isolate* isolate, SnapshotByteSink* sink, String* source, | 858 CodeSerializer(Isolate* isolate, SnapshotByteSink* sink, String* source) |
859 Code* main_code) | 859 : Serializer(isolate, sink), source_(source) { |
860 : Serializer(isolate, sink), source_(source), main_code_(main_code) { | |
861 back_reference_map_.AddSourceString(source); | 860 back_reference_map_.AddSourceString(source); |
862 } | 861 } |
863 | 862 |
864 ~CodeSerializer() { OutputStatistics("CodeSerializer"); } | 863 ~CodeSerializer() { OutputStatistics("CodeSerializer"); } |
865 | 864 |
866 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code, | 865 virtual void SerializeObject(HeapObject* o, HowToCode how_to_code, |
867 WhereToPoint where_to_point, int skip) override; | 866 WhereToPoint where_to_point, int skip) override; |
868 | 867 |
869 void SerializeBuiltin(int builtin_index, HowToCode how_to_code, | 868 void SerializeBuiltin(int builtin_index, HowToCode how_to_code, |
870 WhereToPoint where_to_point); | 869 WhereToPoint where_to_point); |
871 void SerializeIC(Code* ic, HowToCode how_to_code, | 870 void SerializeIC(Code* ic, HowToCode how_to_code, |
872 WhereToPoint where_to_point); | 871 WhereToPoint where_to_point); |
873 void SerializeCodeStub(uint32_t stub_key, HowToCode how_to_code, | 872 void SerializeCodeStub(uint32_t stub_key, HowToCode how_to_code, |
874 WhereToPoint where_to_point); | 873 WhereToPoint where_to_point); |
875 void SerializeGeneric(HeapObject* heap_object, HowToCode how_to_code, | 874 void SerializeGeneric(HeapObject* heap_object, HowToCode how_to_code, |
876 WhereToPoint where_to_point); | 875 WhereToPoint where_to_point); |
877 int AddCodeStubKey(uint32_t stub_key); | 876 int AddCodeStubKey(uint32_t stub_key); |
878 | 877 |
879 DisallowHeapAllocation no_gc_; | 878 DisallowHeapAllocation no_gc_; |
880 String* source_; | 879 String* source_; |
881 Code* main_code_; | |
882 List<uint32_t> stub_keys_; | 880 List<uint32_t> stub_keys_; |
883 DISALLOW_COPY_AND_ASSIGN(CodeSerializer); | 881 DISALLOW_COPY_AND_ASSIGN(CodeSerializer); |
884 }; | 882 }; |
885 | 883 |
886 | 884 |
887 // Wrapper around reservation sizes and the serialization payload. | 885 // Wrapper around reservation sizes and the serialization payload. |
888 class SnapshotData : public SerializedData { | 886 class SnapshotData : public SerializedData { |
889 public: | 887 public: |
890 // Used when producing. | 888 // Used when producing. |
891 explicit SnapshotData(const Serializer& ser); | 889 explicit SnapshotData(const Serializer& ser); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; | 976 static const int kNumCodeStubKeysOffset = kNumReservationsOffset + kInt32Size; |
979 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; | 977 static const int kPayloadLengthOffset = kNumCodeStubKeysOffset + kInt32Size; |
980 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; | 978 static const int kChecksum1Offset = kPayloadLengthOffset + kInt32Size; |
981 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; | 979 static const int kChecksum2Offset = kChecksum1Offset + kInt32Size; |
982 static const int kHeaderSize = kChecksum2Offset + kInt32Size; | 980 static const int kHeaderSize = kChecksum2Offset + kInt32Size; |
983 }; | 981 }; |
984 } // namespace internal | 982 } // namespace internal |
985 } // namespace v8 | 983 } // namespace v8 |
986 | 984 |
987 #endif // V8_SNAPSHOT_SERIALIZE_H_ | 985 #endif // V8_SNAPSHOT_SERIALIZE_H_ |
OLD | NEW |