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

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

Issue 2080223005: [wasm] Store the semaphore for parallel compilation in exactly one smart pointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | 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 29e342b0912f3bfea593535336b808cb2535fb07..b1d9cb0213ab271d8863db77bec8dadf61712b2b 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -530,8 +530,8 @@ uint32_t* StartCompilationTasks(
Isolate* isolate,
std::vector<compiler::WasmCompilationUnit*>& compilation_units,
std::queue<compiler::WasmCompilationUnit*>& executed_units,
- const base::SmartPointer<base::Semaphore>& pending_tasks,
- base::Mutex& result_mutex, base::AtomicNumber<size_t>& next_unit) {
+ base::Semaphore* pending_tasks, base::Mutex& result_mutex,
+ base::AtomicNumber<size_t>& next_unit) {
const size_t num_tasks =
Min(static_cast<size_t>(FLAG_wasm_num_compilation_tasks),
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads());
@@ -539,7 +539,7 @@ uint32_t* StartCompilationTasks(
for (size_t i = 0; i < num_tasks; i++) {
WasmCompilationTask* task =
new WasmCompilationTask(isolate, &compilation_units, &executed_units,
- pending_tasks.get(), &result_mutex, &next_unit);
+ pending_tasks, &result_mutex, &next_unit);
task_ids[i] = task->id();
V8::GetCurrentPlatform()->CallOnBackgroundThread(
task, v8::Platform::kShortRunningTask);
@@ -547,9 +547,8 @@ uint32_t* StartCompilationTasks(
return task_ids;
}
-void WaitForCompilationTasks(
- Isolate* isolate, uint32_t* task_ids,
- const base::SmartPointer<base::Semaphore>& pending_tasks) {
+void WaitForCompilationTasks(Isolate* isolate, uint32_t* task_ids,
+ base::Semaphore* pending_tasks) {
const size_t num_tasks =
Min(static_cast<size_t>(FLAG_wasm_num_compilation_tasks),
V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads());
@@ -624,7 +623,7 @@ void CompileInParallel(Isolate* isolate, const WasmModule* module,
// the background threads.
base::SmartArrayPointer<uint32_t> task_ids(
StartCompilationTasks(isolate, compilation_units, executed_units,
- pending_tasks, result_mutex, next_unit));
+ 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
@@ -641,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);
+ WaitForCompilationTasks(isolate, task_ids.get(), pending_tasks.get());
// Finish the compilation of the remaining compilation units.
FinishCompilationUnits(executed_units, functions, result_mutex);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698