[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/+/2562251 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Thibaud Michaud <thibaudm@chromium.org> Cr-Commit-Position: refs/heads/master@{#71431}
This commit is contained in:
parent
4ad08c82f7
commit
bbaa91f37d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user