5 #ifndef V8_SNAPSHOT_CODE_SERIALIZER_H_ 6 #define V8_SNAPSHOT_CODE_SERIALIZER_H_ 8 #include "src/snapshot/serializer.h" 17 if (owns_data_) DeleteArray(data_);
20 const byte* data()
const {
return data_; }
21 int length()
const {
return length_; }
22 bool rejected()
const {
return rejected_; }
24 void Reject() { rejected_ =
true; }
26 void AcquireDataOwnership() {
31 void ReleaseDataOwnership() {
55 const std::vector<uint32_t>* stub_keys()
const {
return &stub_keys_; }
57 uint32_t source_hash()
const {
return source_hash_; }
63 virtual void SerializeCodeObject(
Code code_object, HowToCode how_to_code,
64 WhereToPoint where_to_point) {
68 virtual bool ElideObject(
Object* obj) {
return false; }
69 void SerializeGeneric(
HeapObject* heap_object, HowToCode how_to_code,
70 WhereToPoint where_to_point);
73 void SerializeObject(
HeapObject* o, HowToCode how_to_code,
74 WhereToPoint where_to_point,
int skip)
override;
76 void SerializeCodeStub(
Code code_stub, HowToCode how_to_code,
77 WhereToPoint where_to_point);
79 bool SerializeReadOnlyObject(
HeapObject* obj, HowToCode how_to_code,
80 WhereToPoint where_to_point,
int skip);
82 DISALLOW_HEAP_ALLOCATION(no_gc_);
84 std::vector<uint32_t> stub_keys_;
91 enum SanityCheckResult {
93 MAGIC_NUMBER_MISMATCH = 1,
96 CPU_FEATURES_MISMATCH = 4,
98 CHECKSUM_MISMATCH = 6,
117 static const uint32_t kVersionHashOffset = kMagicNumberOffset + kUInt32Size;
118 static const uint32_t kSourceHashOffset = kVersionHashOffset + kUInt32Size;
119 static const uint32_t kCpuFeaturesOffset = kSourceHashOffset + kUInt32Size;
120 static const uint32_t kFlagHashOffset = kCpuFeaturesOffset + kUInt32Size;
121 static const uint32_t kNumReservationsOffset = kFlagHashOffset + kUInt32Size;
122 static const uint32_t kNumCodeStubKeysOffset =
123 kNumReservationsOffset + kUInt32Size;
124 static const uint32_t kPayloadLengthOffset =
125 kNumCodeStubKeysOffset + kUInt32Size;
126 static const uint32_t kChecksumPartAOffset =
127 kPayloadLengthOffset + kUInt32Size;
128 static const uint32_t kChecksumPartBOffset =
129 kChecksumPartAOffset + kUInt32Size;
130 static const uint32_t kUnalignedHeaderSize =
131 kChecksumPartBOffset + kUInt32Size;
132 static const uint32_t kHeaderSize = POINTER_SIZE_ALIGN(kUnalignedHeaderSize);
138 SanityCheckResult* rejection_result);
147 std::vector<Reservation> Reservations()
const;
164 SanityCheckResult SanityCheck(
Isolate* isolate,
165 uint32_t expected_source_hash)
const;
171 #endif // V8_SNAPSHOT_CODE_SERIALIZER_H_