Commit bbaa91f3 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm] Deserialization: avoid repeated locking

Use the overload of NativeModule::PublishCode that accepts a vector of
codes to only lock/unlock once per batch.

R=ahaas@chromium.org

Bug: v8:11164
Change-Id: I6428d3d9cec8526bdfef223d7ba03b35bad9e1eb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2562251Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71431}
parent 4ad08c82
......@@ -762,11 +762,14 @@ void NativeModuleDeserializer::CopyAndRelocate(
void NativeModuleDeserializer::Publish(
std::unique_ptr<std::vector<DeserializationUnit>> batch) {
DCHECK_NOT_NULL(batch);
std::vector<std::unique_ptr<WasmCode>> codes;
for (auto& unit : *batch) {
WasmCode* published_code =
native_module_->PublishCode(std::move(unit).code);
published_code->MaybePrint();
published_code->Validate();
codes.push_back(std::move(unit).code);
}
auto published_codes = native_module_->PublishCode(VectorOf(codes));
for (auto* wasm_code : published_codes) {
wasm_code->MaybePrint();
wasm_code->Validate();
}
#ifdef DEBUG
total_published_.fetch_add(1);
......
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