OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <memory> | 5 #include <memory> |
6 | 6 |
7 #include "src/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 } | 312 } |
313 | 313 |
314 void WaitForCompilationTasks(Isolate* isolate, uint32_t* task_ids, | 314 void WaitForCompilationTasks(Isolate* isolate, uint32_t* task_ids, |
315 base::Semaphore* pending_tasks) { | 315 base::Semaphore* pending_tasks) { |
316 const size_t num_tasks = | 316 const size_t num_tasks = |
317 Min(static_cast<size_t>(FLAG_wasm_num_compilation_tasks), | 317 Min(static_cast<size_t>(FLAG_wasm_num_compilation_tasks), |
318 V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()); | 318 V8::GetCurrentPlatform()->NumberOfAvailableBackgroundThreads()); |
319 for (size_t i = 0; i < num_tasks; ++i) { | 319 for (size_t i = 0; i < num_tasks; ++i) { |
320 // If the task has not started yet, then we abort it. Otherwise we wait for | 320 // If the task has not started yet, then we abort it. Otherwise we wait for |
321 // it to finish. | 321 // it to finish. |
322 if (!isolate->cancelable_task_manager()->TryAbort(task_ids[i])) { | 322 if (isolate->cancelable_task_manager()->TryAbort(task_ids[i]) != |
| 323 CancelableTaskManager::kTaskAborted) { |
323 pending_tasks->Wait(); | 324 pending_tasks->Wait(); |
324 } | 325 } |
325 } | 326 } |
326 } | 327 } |
327 | 328 |
328 void FinishCompilationUnits( | 329 void FinishCompilationUnits( |
329 std::queue<compiler::WasmCompilationUnit*>& executed_units, | 330 std::queue<compiler::WasmCompilationUnit*>& executed_units, |
330 std::vector<Handle<Code>>& results, base::Mutex& result_mutex) { | 331 std::vector<Handle<Code>>& results, base::Mutex& result_mutex) { |
331 while (true) { | 332 while (true) { |
332 compiler::WasmCompilationUnit* unit = nullptr; | 333 compiler::WasmCompilationUnit* unit = nullptr; |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2090 CHECK_NOT_NULL(result.val); | 2091 CHECK_NOT_NULL(result.val); |
2091 module = const_cast<WasmModule*>(result.val); | 2092 module = const_cast<WasmModule*>(result.val); |
2092 } | 2093 } |
2093 | 2094 |
2094 Handle<WasmModuleWrapper> module_wrapper = | 2095 Handle<WasmModuleWrapper> module_wrapper = |
2095 WasmModuleWrapper::New(isolate, module); | 2096 WasmModuleWrapper::New(isolate, module); |
2096 | 2097 |
2097 compiled_module->set_module_wrapper(module_wrapper); | 2098 compiled_module->set_module_wrapper(module_wrapper); |
2098 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); | 2099 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); |
2099 } | 2100 } |
OLD | NEW |