Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: src/wasm/wasm-module.cc

Issue 2080223006: [wasm] Move the semaphore for parallel compilation to the wasm module. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Adjusted a comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index b1d9cb0213ab271d8863db77bec8dadf61712b2b..6d9b06b2b51fa835d2d4cc74934369f4dd1045be 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -348,7 +348,8 @@ WasmModule::WasmModule()
start_function_index(-1),
origin(kWasmOrigin),
globals_size(0),
- indirect_table_size(0) {}
+ indirect_table_size(0),
+ pending_tasks(new base::Semaphore(0)) {}
static MaybeHandle<JSFunction> ReportFFIError(ErrorThrower& thrower,
const char* error, uint32_t index,
@@ -614,16 +615,15 @@ void CompileInParallel(Isolate* isolate, const WasmModule* module,
*module_env, *thrower);
// Objects for the synchronization with the background threads.
- base::SmartPointer<base::Semaphore> pending_tasks(new base::Semaphore(0));
base::Mutex result_mutex;
base::AtomicNumber<size_t> next_unit(
static_cast<size_t>(FLAG_skip_compiling_wasm_funcs));
// 2) The main thread spawns {WasmCompilationTask} instances which run on
// the background threads.
- base::SmartArrayPointer<uint32_t> task_ids(
- StartCompilationTasks(isolate, compilation_units, executed_units,
- pending_tasks.get(), result_mutex, next_unit));
+ base::SmartArrayPointer<uint32_t> task_ids(StartCompilationTasks(
+ isolate, compilation_units, executed_units, module->pending_tasks.get(),
+ result_mutex, next_unit));
// 3.a) The background threads and the main thread pick one compilation
// unit at a time and execute the parallel phase of the compilation
@@ -640,7 +640,7 @@ void CompileInParallel(Isolate* isolate, const WasmModule* module,
}
// 4) After the parallel phase of all compilation units has started, the
// main thread waits for all {WasmCompilationTask} instances to finish.
- WaitForCompilationTasks(isolate, task_ids.get(), pending_tasks.get());
+ WaitForCompilationTasks(isolate, task_ids.get(), module->pending_tasks.get());
// Finish the compilation of the remaining compilation units.
FinishCompilationUnits(executed_units, functions, result_mutex);
}
« no previous file with comments | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698