| 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_SERIALIZE_H_ | 5 #ifndef V8_SERIALIZE_H_ |
| 6 #define V8_SERIALIZE_H_ | 6 #define V8_SERIALIZE_H_ |
| 7 | 7 |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/hashmap.h" | 9 #include "src/hashmap.h" |
| 10 #include "src/heap-profiler.h" | 10 #include "src/heap-profiler.h" |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 Vector<const Reservation> Reservations() const; | 915 Vector<const Reservation> Reservations() const; |
| 916 Vector<const byte> Payload() const; | 916 Vector<const byte> Payload() const; |
| 917 | 917 |
| 918 int NumInternalizedStrings() const; | 918 int NumInternalizedStrings() const; |
| 919 Vector<const uint32_t> CodeStubKeys() const; | 919 Vector<const uint32_t> CodeStubKeys() const; |
| 920 | 920 |
| 921 private: | 921 private: |
| 922 explicit SerializedCodeData(ScriptData* data) | 922 explicit SerializedCodeData(ScriptData* data) |
| 923 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} | 923 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} |
| 924 | 924 |
| 925 bool IsSane(String* source); | 925 bool IsSane(String* source) const; |
| 926 | 926 |
| 927 uint32_t SourceHash(String* source) { return source->length(); } | 927 static uint32_t SourceHash(String* source) { return source->length(); } |
| 928 | 928 |
| 929 // The data header consists of int-sized entries: | 929 // The data header consists of int-sized entries: |
| 930 // [0] version hash | 930 // [0] version hash |
| 931 // [1] source hash | 931 // [1] source hash |
| 932 // [2] cpu features | 932 // [2] cpu features |
| 933 // [3] flag hash | 933 // [3] flag hash |
| 934 // [4] number of internalized strings | 934 // [4] number of internalized strings |
| 935 // [5] number of code stub keys | 935 // [5] number of code stub keys |
| 936 // [6] number of reservation size entries | 936 // [6] number of reservation size entries |
| 937 // [7] payload length | 937 // [7] payload length |
| 938 // [8] checksum 1 |
| 939 // [9] checksum 2 |
| 938 static const int kVersionHashOffset = 0; | 940 static const int kVersionHashOffset = 0; |
| 939 static const int kSourceHashOffset = 1; | 941 static const int kSourceHashOffset = 1; |
| 940 static const int kCpuFeaturesOffset = 2; | 942 static const int kCpuFeaturesOffset = 2; |
| 941 static const int kFlagHashOffset = 3; | 943 static const int kFlagHashOffset = 3; |
| 942 static const int kNumInternalizedStringsOffset = 4; | 944 static const int kNumInternalizedStringsOffset = 4; |
| 943 static const int kReservationsOffset = 5; | 945 static const int kReservationsOffset = 5; |
| 944 static const int kNumCodeStubKeysOffset = 6; | 946 static const int kNumCodeStubKeysOffset = 6; |
| 945 static const int kPayloadLengthOffset = 7; | 947 static const int kPayloadLengthOffset = 7; |
| 946 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; | 948 static const int kChecksum1Offset = 8; |
| 949 static const int kChecksum2Offset = 9; |
| 950 static const int kHeaderSize = (kChecksum2Offset + 1) * kIntSize; |
| 947 }; | 951 }; |
| 948 } } // namespace v8::internal | 952 } } // namespace v8::internal |
| 949 | 953 |
| 950 #endif // V8_SERIALIZE_H_ | 954 #endif // V8_SERIALIZE_H_ |
| OLD | NEW |