Commit c967d81f authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Switch {outstanding_finishers} to {std::atomic}.

R=clemensh@chromium.org
BUG=v8:7754

Change-Id: Ic6157ab1219bcdbdb6ac751d05602ab411d58ce2
Reviewed-on: https://chromium-review.googlesource.com/1117072
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54065}
parent f10412d4
......@@ -2547,7 +2547,7 @@ class AsyncCompileJob::PrepareAndStartCompile : public CompileStep {
// foreground task is currently pending, and no finisher is
// outstanding (streaming compilation).
if (job->num_pending_foreground_tasks_ == 0 &&
job->outstanding_finishers_.Value() == 0) {
job->outstanding_finishers_.load() == 0) {
job->isolate_->wasm_engine()->RemoveCompileJob(job);
} else {
// If a foreground task was pending or a finsher was pending,
......@@ -2766,7 +2766,7 @@ bool AsyncStreamingProcessor::ProcessCodeSectionHeader(size_t functions_count,
// Set outstanding_finishers_ to 2, because both the AsyncCompileJob and the
// AsyncStreamingProcessor have to finish.
job_->outstanding_finishers_.SetValue(2);
job_->outstanding_finishers_.store(2);
compilation_unit_builder_.reset(
new CompilationUnitBuilder(job_->native_module_));
return true;
......
......@@ -5,10 +5,10 @@
#ifndef V8_WASM_MODULE_COMPILER_H_
#define V8_WASM_MODULE_COMPILER_H_
#include <atomic>
#include <functional>
#include <memory>
#include "src/base/atomic-utils.h"
#include "src/cancelable-task.h"
#include "src/globals.h"
#include "src/wasm/wasm-module.h"
......@@ -162,13 +162,13 @@ class AsyncCompileJob {
// For async compilation the AsyncCompileJob is the only finisher. For
// streaming compilation also the AsyncStreamingProcessor has to finish before
// compilation can be finished.
base::AtomicNumber<int32_t> outstanding_finishers_{1};
std::atomic<int32_t> outstanding_finishers_{1};
// Decrements the number of outstanding finishers. The last caller of this
// function should finish the asynchronous compilation, see the comment on
// {outstanding_finishers_}.
V8_WARN_UNUSED_RESULT bool DecrementAndCheckFinisherCount() {
return outstanding_finishers_.Decrement(1) == 0;
return outstanding_finishers_.fetch_sub(1) == 1;
}
// Counts the number of pending foreground tasks.
......
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