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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 Vector<const Reservation> Reservations() const; | 939 Vector<const Reservation> Reservations() const; |
940 Vector<const byte> Payload() const; | 940 Vector<const byte> Payload() const; |
941 | 941 |
942 int NumInternalizedStrings() const; | 942 int NumInternalizedStrings() const; |
943 Vector<const uint32_t> CodeStubKeys() const; | 943 Vector<const uint32_t> CodeStubKeys() const; |
944 | 944 |
945 private: | 945 private: |
946 explicit SerializedCodeData(ScriptData* data) | 946 explicit SerializedCodeData(ScriptData* data) |
947 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} | 947 : SerializedData(const_cast<byte*>(data->data()), data->length()) {} |
948 | 948 |
949 bool IsSane(String* source); | 949 bool IsSane(String* source) const; |
950 | 950 |
951 uint32_t SourceHash(String* source) { return source->length(); } | 951 uint32_t SourceHash(String* source) const { return source->length(); } |
952 | 952 |
953 // The data header consists of int-sized entries: | 953 // The data header consists of int-sized entries: |
954 // [0] version hash | 954 // [0] version hash |
955 // [1] source hash | 955 // [1] source hash |
956 // [2] cpu features | 956 // [2] cpu features |
957 // [3] flag hash | 957 // [3] flag hash |
958 // [4] number of internalized strings | 958 // [4] number of internalized strings |
959 // [5] number of code stub keys | 959 // [5] number of code stub keys |
960 // [6] number of reservation size entries | 960 // [6] number of reservation size entries |
961 // [7] payload length | 961 // [7] payload length |
962 static const int kVersionHashOffset = 0; | 962 static const int kVersionHashOffset = 0; |
963 static const int kSourceHashOffset = 1; | 963 static const int kSourceHashOffset = 1; |
964 static const int kCpuFeaturesOffset = 2; | 964 static const int kCpuFeaturesOffset = 2; |
965 static const int kFlagHashOffset = 3; | 965 static const int kFlagHashOffset = 3; |
966 static const int kNumInternalizedStringsOffset = 4; | 966 static const int kNumInternalizedStringsOffset = 4; |
967 static const int kReservationsOffset = 5; | 967 static const int kReservationsOffset = 5; |
968 static const int kNumCodeStubKeysOffset = 6; | 968 static const int kNumCodeStubKeysOffset = 6; |
969 static const int kPayloadLengthOffset = 7; | 969 static const int kPayloadLengthOffset = 7; |
970 static const int kHeaderSize = (kPayloadLengthOffset + 1) * kIntSize; | 970 static const int kChecksum1Offset = 8; |
| 971 static const int kChecksum2Offset = 9; |
| 972 static const int kHeaderSize = |
| 973 POINTER_SIZE_ALIGN((kChecksum2Offset + 1) * kIntSize); |
971 }; | 974 }; |
972 } } // namespace v8::internal | 975 } } // namespace v8::internal |
973 | 976 |
974 #endif // V8_SERIALIZE_H_ | 977 #endif // V8_SERIALIZE_H_ |
OLD | NEW |