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

Unified Diff: src/serialize.cc

Issue 724053004: Revert "Soft fail for invalid cache data." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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') | test/cctest/test-api.cc » ('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 090eeb401c0d6476b12de18f2a8749036743e1db..63479430670361fdd478772a9146544eb1979fd4 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -2185,7 +2185,7 @@ void CodeSerializer::SerializeSourceObject(HowToCode how_to_code,
MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
- Isolate* isolate, ScriptData* cached_data, Handle<String> source) {
+ Isolate* isolate, ScriptData* data, Handle<String> source) {
base::ElapsedTimer timer;
if (FLAG_profile_deserialization) timer.Start();
@@ -2194,24 +2194,18 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
{
HandleScope scope(isolate);
- SerializedCodeData* scd =
- SerializedCodeData::FromCachedData(cached_data, *source);
- if (scd == NULL) {
- if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
- DCHECK(cached_data->rejected());
- return MaybeHandle<SharedFunctionInfo>();
- }
- SnapshotByteSource payload(scd->Payload(), scd->PayloadLength());
+ SerializedCodeData scd(data, *source);
+ SnapshotByteSource payload(scd.Payload(), scd.PayloadLength());
Deserializer deserializer(&payload);
// Eagerly expand string table to avoid allocations during deserialization.
- StringTable::EnsureCapacityForDeserialization(
- isolate, scd->NumInternalizedStrings());
+ StringTable::EnsureCapacityForDeserialization(isolate,
+ scd.NumInternalizedStrings());
// Set reservations.
STATIC_ASSERT(NEW_SPACE == 0);
int current_space = NEW_SPACE;
- Vector<const SerializedCodeData::Reservation> res = scd->Reservations();
+ Vector<const SerializedCodeData::Reservation> res = scd.Reservations();
for (const auto& r : res) {
deserializer.AddReservation(current_space, r.chunk_size());
if (r.is_last_chunk()) current_space++;
@@ -2219,7 +2213,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
DCHECK_EQ(kNumberOfSpaces, current_space);
// Prepare and register list of attached objects.
- Vector<const uint32_t> code_stub_keys = scd->CodeStubKeys();
+ Vector<const uint32_t> code_stub_keys = scd.CodeStubKeys();
Vector<Handle<Object> > attached_objects = Vector<Handle<Object> >::New(
code_stub_keys.length() + kCodeStubsBaseIndex);
attached_objects[kSourceObjectIndex] = source;
@@ -2241,7 +2235,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
if (FLAG_profile_deserialization) {
double ms = timer.Elapsed().InMillisecondsF();
- int length = cached_data->length();
+ int length = data->length();
PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms);
}
Handle<SharedFunctionInfo> result(SharedFunctionInfo::cast(root), isolate);
@@ -2321,6 +2315,11 @@ bool SerializedCodeData::IsSane(String* source) {
int SerializedCodeData::CheckSum(String* string) {
- return Version::Hash() ^ string->length();
+ int checksum = Version::Hash();
+#ifdef DEBUG
+ uint32_t seed = static_cast<uint32_t>(checksum);
+ checksum = static_cast<int>(IteratingStringHasher::Hash(string, seed));
+#endif // DEBUG
+ return checksum;
}
} } // namespace v8::internal
« no previous file with comments | « src/serialize.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698