Commit 366c5308 authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[offthread] Remove Isolate param from SanityCheck

The Isolate* parameter in the deserializer SanityCheck is unused, and is
blocking the use of the deserializer off-thread.

Bug: chromium:1075999
Change-Id: I0f2acae3c1aff62aafeb2680a2eecb44b1608803
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2184290
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67594}
parent 467c2062
...@@ -270,8 +270,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize( ...@@ -270,8 +270,7 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
SerializedCodeData::SanityCheckResult sanity_check_result = SerializedCodeData::SanityCheckResult sanity_check_result =
SerializedCodeData::CHECK_SUCCESS; SerializedCodeData::CHECK_SUCCESS;
const SerializedCodeData scd = SerializedCodeData::FromCachedData( const SerializedCodeData scd = SerializedCodeData::FromCachedData(
isolate, cached_data, cached_data, SerializedCodeData::SourceHash(source, origin_options),
SerializedCodeData::SourceHash(source, origin_options),
&sanity_check_result); &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"); if (FLAG_profile_deserialization) PrintF("[Cached code failed check]\n");
...@@ -405,7 +404,7 @@ SerializedCodeData::SerializedCodeData(const std::vector<byte>* payload, ...@@ -405,7 +404,7 @@ SerializedCodeData::SerializedCodeData(const std::vector<byte>* payload,
} }
SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck( SerializedCodeData::SanityCheckResult SerializedCodeData::SanityCheck(
Isolate* isolate, uint32_t expected_source_hash) const { uint32_t expected_source_hash) const {
if (this->size_ < kHeaderSize) return INVALID_HEADER; if (this->size_ < kHeaderSize) return INVALID_HEADER;
uint32_t magic_number = GetMagicNumber(); uint32_t magic_number = GetMagicNumber();
if (magic_number != kMagicNumber) return MAGIC_NUMBER_MISMATCH; if (magic_number != kMagicNumber) return MAGIC_NUMBER_MISMATCH;
...@@ -471,11 +470,11 @@ SerializedCodeData::SerializedCodeData(ScriptData* data) ...@@ -471,11 +470,11 @@ SerializedCodeData::SerializedCodeData(ScriptData* data)
: SerializedData(const_cast<byte*>(data->data()), data->length()) {} : SerializedData(const_cast<byte*>(data->data()), data->length()) {}
SerializedCodeData SerializedCodeData::FromCachedData( SerializedCodeData SerializedCodeData::FromCachedData(
Isolate* isolate, ScriptData* cached_data, uint32_t expected_source_hash, ScriptData* cached_data, uint32_t expected_source_hash,
SanityCheckResult* rejection_result) { SanityCheckResult* rejection_result) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
SerializedCodeData scd(cached_data); SerializedCodeData scd(cached_data);
*rejection_result = scd.SanityCheck(isolate, expected_source_hash); *rejection_result = scd.SanityCheck(expected_source_hash);
if (*rejection_result != CHECK_SUCCESS) { if (*rejection_result != CHECK_SUCCESS) {
cached_data->Reject(); cached_data->Reject();
return SerializedCodeData(nullptr, 0); return SerializedCodeData(nullptr, 0);
......
...@@ -109,8 +109,7 @@ class SerializedCodeData : public SerializedData { ...@@ -109,8 +109,7 @@ class SerializedCodeData : public SerializedData {
static const uint32_t kHeaderSize = POINTER_SIZE_ALIGN(kUnalignedHeaderSize); static const uint32_t kHeaderSize = POINTER_SIZE_ALIGN(kUnalignedHeaderSize);
// Used when consuming. // Used when consuming.
static SerializedCodeData FromCachedData(Isolate* isolate, static SerializedCodeData FromCachedData(ScriptData* cached_data,
ScriptData* cached_data,
uint32_t expected_source_hash, uint32_t expected_source_hash,
SanityCheckResult* rejection_result); SanityCheckResult* rejection_result);
...@@ -136,8 +135,7 @@ class SerializedCodeData : public SerializedData { ...@@ -136,8 +135,7 @@ class SerializedCodeData : public SerializedData {
return Vector<const byte>(data_ + kHeaderSize, size_ - kHeaderSize); return Vector<const byte>(data_ + kHeaderSize, size_ - kHeaderSize);
} }
SanityCheckResult SanityCheck(Isolate* isolate, SanityCheckResult SanityCheck(uint32_t expected_source_hash) const;
uint32_t expected_source_hash) const;
}; };
} // namespace internal } // namespace internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment