Commit 6b045152 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Ensure a separate task id for the main thread

If the main thread (or multiple main threads, or different isolates)
executes compilation units, it uses task id 0. This id will also be used
by the first worker thread. Avoid this by shifting the ids of worker
threads by one.

R=thibaudm@chromium.org
CC=etiennep@chromium.org

Bug: v8:11005
Change-Id: I3beb8a5716112d9466c5b0296ab4ed1f2cf20519
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2471378Reviewed-by: 's avatarThibaud Michaud <thibaudm@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70613}
parent d4843937
...@@ -1171,7 +1171,10 @@ CompilationExecutionResult ExecuteCompilationUnits( ...@@ -1171,7 +1171,10 @@ CompilationExecutionResult ExecuteCompilationUnits(
std::shared_ptr<WireBytesStorage> wire_bytes; std::shared_ptr<WireBytesStorage> wire_bytes;
std::shared_ptr<const WasmModule> module; std::shared_ptr<const WasmModule> module;
WasmEngine* wasm_engine; WasmEngine* wasm_engine;
int task_id = delegate ? delegate->GetTaskId() : 0; // Task 0 is any main thread (there might be multiple from multiple isolates),
// worker threads start at 1 (thus the "+ 1").
int task_id = delegate ? (int{delegate->GetTaskId()} + 1) : 0;
DCHECK_LE(0, task_id);
CompilationUnitQueues::Queue* queue; CompilationUnitQueues::Queue* queue;
int unpublished_units_limit; int unpublished_units_limit;
base::Optional<WasmCompilationUnit> unit; base::Optional<WasmCompilationUnit> unit;
......
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