Sanity? pepega

This commit is contained in:
Reece Wilson 2021-04-24 15:17:34 +01:00
parent ea51bd7601
commit 95d8a9fdcc

View File

@ -301,7 +301,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
const SerializedCodeData scd = SerializedCodeData::FromCachedData(
cached_data, SerializedCodeData::SourceHash(source, origin_options),
&sanity_check_result);
if (sanity_check_result != SerializedCodeData::CHECK_SUCCESS) {
if ((sanity_check_result != SerializedCodeData::CHECK_SUCCESS)) {
if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
DCHECK(cached_data->rejected());
isolate->counters()->code_cache_reject_reason()->AddSample(
@ -311,23 +312,8 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
// Deserialize.
MaybeHandle<SharedFunctionInfo> maybe_result;
// TODO(leszeks): Add LocalHeap support to deserializer
if (false && FLAG_stress_background_compile) {
StressOffThreadDeserializeThread thread(isolate, &scd);
CHECK(thread.Start());
thread.Join();
maybe_result = thread.maybe_result();
// Fix-up result script source.
Handle<SharedFunctionInfo> result;
if (maybe_result.ToHandle(&result)) {
Script::cast(result->script()).set_source(*source);
}
} else {
maybe_result = ObjectDeserializer::DeserializeSharedFunctionInfo(
isolate, &scd, source);
}
maybe_result = ObjectDeserializer::DeserializeSharedFunctionInfo(isolate, &scd, source);
Handle<SharedFunctionInfo> result;
if (!maybe_result.ToHandle(&result)) {
@ -438,12 +424,12 @@ SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck(
uint32_t magic_number = GetMagicNumber();
if (magic_number != kMagicNumber) return MAGIC_NUMBER_MISMATCH;
uint32_t version_hash = GetHeaderValue(kVersionHashOffset);
uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
//uint32_t source_hash = GetHeaderValue(kSourceHashOffset);
uint32_t flags_hash = GetHeaderValue(kFlagHashOffset);
uint32_t payload_length = GetHeaderValue(kPayloadLengthOffset);
uint32_t c = GetHeaderValue(kChecksumOffset);
if (version_hash != Version::Hash()) return VERSION_MISMATCH;
if (source_hash != expected_source_hash) return SOURCE_MISMATCH;
//if (source_hash != expected_source_hash) return SOURCE_MISMATCH;
if (flags_hash != FlagList::Hash()) return FLAGS_MISMATCH;
uint32_t max_payload_length = this->size_ - kHeaderSize;
if (payload_length > max_payload_length) return LENGTH_MISMATCH;