| 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 @@
|
|
|
|
|
| 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 @@
|
| {
|
| 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 @@
|
| 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 @@
|
|
|
| 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 @@
|
|
|
|
|
| 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
|
|
|