mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 22:15:24 +02:00
Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer
This commit is contained in:
parent
11a1eabcc6
commit
8182e4efc4
15
test/built-ins/Atomics/store/bigint/non-shared-bufferdata.js
Normal file
15
test/built-ins/Atomics/store/bigint/non-shared-bufferdata.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.store
|
||||||
|
description: >
|
||||||
|
Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||||
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i64a = new BigInt64Array(
|
||||||
|
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.sameValue(Atomics.store(i64a, 0, 1), 1);
|
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.store
|
||||||
|
description: >
|
||||||
|
Atomics.store throws when operating on non-sharable integer TypedArrays
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4);
|
||||||
|
|
||||||
|
testWithNonShareableBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
const view = new TA(buffer);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
Atomics.store(view, 0, 1);
|
||||||
|
}, `Atomics.store(new ${TA.name}(view), 0, 1) throws TypeError`);
|
||||||
|
});
|
@ -1,16 +0,0 @@
|
|||||||
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-atomics.store
|
|
||||||
description: >
|
|
||||||
Test Atomics.store on non-shared integer TypedArrays
|
|
||||||
includes: [testBigIntTypedArray.js]
|
|
||||||
features: [ArrayBuffer, arrow-function, Atomics, BigInt, TypedArray]
|
|
||||||
---*/
|
|
||||||
const buffer = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 2);
|
|
||||||
|
|
||||||
testWithBigIntTypedArrayConstructors(function(TA) {
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Atomics.store(new TA(buffer), 0, 0n);
|
|
||||||
}, '`Atomics.store(new TA(buffer), 0, 0n)` throws TypeError');
|
|
||||||
});
|
|
15
test/built-ins/Atomics/store/non-shared-bufferdata.js
Normal file
15
test/built-ins/Atomics/store/non-shared-bufferdata.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.store
|
||||||
|
description: >
|
||||||
|
Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer
|
||||||
|
features: [ArrayBuffer, Atomics, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i32a = new Int32Array(
|
||||||
|
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.sameValue(Atomics.store(i32a, 0, 1), 1);
|
@ -4,16 +4,16 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.store
|
esid: sec-atomics.store
|
||||||
description: >
|
description: >
|
||||||
Test Atomics.store on non-shared integer TypedArrays
|
Atomics.store throws when operating on non-sharable integer TypedArrays
|
||||||
includes: [testTypedArray.js]
|
includes: [testTypedArray.js]
|
||||||
features: [ArrayBuffer, Atomics, TypedArray]
|
features: [ArrayBuffer, Atomics, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const buffer = new ArrayBuffer(16);
|
const buffer = new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4);
|
||||||
const views = intArrayConstructors.slice();
|
const views = intArrayConstructors.slice();
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithNonSharableTypedArrayConstructors(function(TA) {
|
||||||
assert.throws(TypeError, function() {
|
assert.throws(TypeError, function() {
|
||||||
Atomics.store(new TA(buffer), 0, 0);
|
Atomics.store(new TA(buffer), 0, 0);
|
||||||
}, '`Atomics.store(new TA(buffer), 0, 0)` throws TypeError');
|
}, `Atomics.store(new ${TA.name}(view), 0, 1) throws TypeError`);
|
||||||
}, views);
|
}, views);
|
Loading…
x
Reference in New Issue
Block a user