Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(984)

Unified Diff: src/serialize.cc

Issue 909473002: Add hash fields to code cache header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix test case Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/serialize.h ('k') | src/version.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_);
« no previous file with comments | « src/serialize.h ('k') | src/version.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698