52cf5069e1
The test takes several minutes on slower bots, so speed it up a bit without removing the ability to hit the data race. R=ulan@chromium.org Bug: chromium:1205290, v8:11741 Change-Id: I57e411bfa2ff2a22bef1a916b74f7684b2f0be17 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2876855 Reviewed-by: Ulan Degenbaev <ulan@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Cr-Commit-Position: refs/heads/master@{#74408}
25 lines
744 B
JavaScript
25 lines
744 B
JavaScript
// Copyright 2021 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
const sync_arr = new Int32Array(new SharedArrayBuffer(4));
|
|
function waitForWorker() {
|
|
while (Atomics.load(sync_arr) == 0) {}
|
|
}
|
|
function onmessage([sab, lock]) {
|
|
const i32a = new Int32Array(sab);
|
|
Atomics.store(lock, 0, 1);
|
|
for (let j = 1; j < 1000; ++j) {
|
|
for (let i = 0; i < i32a.length; ++i) {
|
|
i32a[i] = j;
|
|
}
|
|
}
|
|
}
|
|
const worker = new Worker(`onmessage = ${onmessage}`, {type: 'string'});
|
|
const arr =
|
|
new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 100));
|
|
worker.postMessage([arr.buffer, sync_arr]);
|
|
|
|
waitForWorker();
|
|
arr.sort();
|