diff options
author | Refael Ackermann <refack@gmail.com> | 2019-05-23 12:02:15 -0400 |
---|---|---|
committer | Myles Borins <myles.borins@gmail.com> | 2019-10-07 03:19:54 -0400 |
commit | 3995e52dc60fbd6f06a5c1b6a97b8c3f8c27c48e (patch) | |
tree | ae8dd58788177272551b991b163178e7cb586474 /deps | |
parent | 4c2ff0ad592da2033df4dc3302aac6b858402cae (diff) | |
download | node-new-3995e52dc60fbd6f06a5c1b6a97b8c3f8c27c48e.tar.gz |
deps: V8: use ATOMIC_VAR_INIT instead of std::atomic_init
`std::atomic_init<size_t>` is not implemented on all platforms.
PR-URL: https://github.com/nodejs/node/pull/27375
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps')
-rw-r--r-- | deps/v8/src/wasm/module-compiler.cc | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/deps/v8/src/wasm/module-compiler.cc b/deps/v8/src/wasm/module-compiler.cc index c264bac96e..2847b02c64 100644 --- a/deps/v8/src/wasm/module-compiler.cc +++ b/deps/v8/src/wasm/module-compiler.cc @@ -152,9 +152,6 @@ class CompilationUnitQueues { for (int task_id = 0; task_id < max_tasks; ++task_id) { queues_[task_id].next_steal_task_id = next_task_id(task_id); } - for (auto& atomic_counter : num_units_) { - std::atomic_init(&atomic_counter, size_t{0}); - } } base::Optional<WasmCompilationUnit> GetNextUnit( @@ -257,14 +254,15 @@ class CompilationUnitQueues { }; struct BigUnitsQueue { - BigUnitsQueue() { - for (auto& atomic : has_units) std::atomic_init(&atomic, false); - } + BigUnitsQueue() = default; base::Mutex mutex; // Can be read concurrently to check whether any elements are in the queue. - std::atomic<bool> has_units[kNumTiers]; + std::atomic_bool has_units[kNumTiers] = { + ATOMIC_VAR_INIT(false), + ATOMIC_VAR_INIT(false) + }; // Protected by {mutex}: std::priority_queue<BigUnit> units[kNumTiers]; @@ -273,8 +271,11 @@ class CompilationUnitQueues { std::vector<Queue> queues_; BigUnitsQueue big_units_queue_; - std::atomic<size_t> num_units_[kNumTiers]; - std::atomic<int> next_queue_to_add{0}; + std::atomic_size_t num_units_[kNumTiers] = { + ATOMIC_VAR_INIT(0), + ATOMIC_VAR_INIT(0) + }; + std::atomic_int next_queue_to_add{0}; int next_task_id(int task_id) const { int next = task_id + 1; @@ -481,7 +482,7 @@ class CompilationStateImpl { // Compilation error, atomically updated. This flag can be updated and read // using relaxed semantics. - std::atomic<bool> compile_failed_{false}; + std::atomic_bool compile_failed_{false}; const int max_background_tasks_ = 0; |