Index: src/serialize.cc |
diff --git a/src/serialize.cc b/src/serialize.cc |
index 0b9e9387c382b1c1c47f2c77092973e30695c22e..1423b2349d326d2f356f69649ea38944e72c91b5 100644 |
--- a/src/serialize.cc |
+++ b/src/serialize.cc |
@@ -2500,7 +2500,11 @@ SerializedCodeData::SerializedCodeData(const List<byte>& payload, |
AllocateData(size); |
// Set header values. |
- SetHeaderValue(kCheckSumOffset, CheckSum(cs.source())); |
+ SetHeaderValue(kVersionHashOffset, Version::Hash()); |
+ SetHeaderValue(kSourceHashOffset, SourceHash(cs.source())); |
+ SetHeaderValue(kCpuFeaturesOffset, |
+ static_cast<uint32_t>(CpuFeatures::SupportedFeatures())); |
+ SetHeaderValue(kFlagHashOffset, FlagList::Hash()); |
SetHeaderValue(kNumInternalizedStringsOffset, cs.num_internalized_strings()); |
SetHeaderValue(kReservationsOffset, reservations.length()); |
SetHeaderValue(kNumCodeStubKeysOffset, num_stub_keys); |
@@ -2521,16 +2525,15 @@ SerializedCodeData::SerializedCodeData(const List<byte>& payload, |
bool SerializedCodeData::IsSane(String* source) { |
- return GetHeaderValue(kCheckSumOffset) == CheckSum(source) && |
+ return GetHeaderValue(kVersionHashOffset) == Version::Hash() && |
+ GetHeaderValue(kSourceHashOffset) == SourceHash(source) && |
+ GetHeaderValue(kCpuFeaturesOffset) == |
+ static_cast<uint32_t>(CpuFeatures::SupportedFeatures()) && |
+ GetHeaderValue(kFlagHashOffset) == FlagList::Hash() && |
Payload().length() >= SharedFunctionInfo::kSize; |
} |
-int SerializedCodeData::CheckSum(String* string) { |
- return Version::Hash() ^ string->length(); |
-} |
- |
- |
// Return ScriptData object and relinquish ownership over it to the caller. |
ScriptData* SerializedCodeData::GetScriptData() { |
DCHECK(owns_data_); |