Skip to content

Commit 07ed874

Browse files
refacktargos
authored andcommitted
deps: V8: use ATOMIC_VAR_INIT instead of std::atomic_init
`std::atomic_init<size_t>` is not implemented on all platforms. Backport-PR-URL: #29241 PR-URL: #27375 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 1ed3909 commit 07ed874

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

common.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.6',
41+
'v8_embedder_string': '-node.7',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/src/wasm/module-compiler.cc

+11-10
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ class CompilationUnitQueues {
152152
for (int task_id = 0; task_id < max_tasks; ++task_id) {
153153
queues_[task_id].next_steal_task_id = next_task_id(task_id);
154154
}
155-
for (auto& atomic_counter : num_units_) {
156-
std::atomic_init(&atomic_counter, size_t{0});
157-
}
158155
}
159156

160157
base::Optional<WasmCompilationUnit> GetNextUnit(
@@ -257,14 +254,15 @@ class CompilationUnitQueues {
257254
};
258255

259256
struct BigUnitsQueue {
260-
BigUnitsQueue() {
261-
for (auto& atomic : has_units) std::atomic_init(&atomic, false);
262-
}
257+
BigUnitsQueue() = default;
263258

264259
base::Mutex mutex;
265260

266261
// Can be read concurrently to check whether any elements are in the queue.
267-
std::atomic<bool> has_units[kNumTiers];
262+
std::atomic_bool has_units[kNumTiers] = {
263+
ATOMIC_VAR_INIT(false),
264+
ATOMIC_VAR_INIT(false)
265+
};
268266

269267
// Protected by {mutex}:
270268
std::priority_queue<BigUnit> units[kNumTiers];
@@ -273,8 +271,11 @@ class CompilationUnitQueues {
273271
std::vector<Queue> queues_;
274272
BigUnitsQueue big_units_queue_;
275273

276-
std::atomic<size_t> num_units_[kNumTiers];
277-
std::atomic<int> next_queue_to_add{0};
274+
std::atomic_size_t num_units_[kNumTiers] = {
275+
ATOMIC_VAR_INIT(0),
276+
ATOMIC_VAR_INIT(0)
277+
};
278+
std::atomic_int next_queue_to_add{0};
278279

279280
int next_task_id(int task_id) const {
280281
int next = task_id + 1;
@@ -470,7 +471,7 @@ class CompilationStateImpl {
470471

471472
// Compilation error, atomically updated. This flag can be updated and read
472473
// using relaxed semantics.
473-
std::atomic<bool> compile_failed_{false};
474+
std::atomic_bool compile_failed_{false};
474475

475476
const int max_background_tasks_ = 0;
476477

0 commit comments

Comments
 (0)