mirror of https://github.com/tc39/test262.git
Atomics.store will operate on TA when TA.buffer is not a SharedArrayBuffer
This commit is contained in:
parent
131165be7e
commit
5e43594d44
|
@ -12,4 +12,5 @@ const i64a = new BigInt64Array(
|
|||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
assert.sameValue(Atomics.store(i64a, 0, 1), 1);
|
||||
assert.sameValue(Atomics.store(i64a, 0, 1n), 1n);
|
||||
assert.sameValue(Atomics.load(i64a, 0), 1n);
|
||||
|
|
|
@ -14,6 +14,6 @@ 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}(buffer), 0, 1) throws TypeError`);
|
||||
Atomics.store(view, 0, 1n);
|
||||
}, `Atomics.store(new ${TA.name}(buffer), 0, 1n) throws TypeError`);
|
||||
});
|
||||
|
|
|
@ -13,3 +13,5 @@ const i32a = new Int32Array(
|
|||
);
|
||||
|
||||
assert.sameValue(Atomics.store(i32a, 0, 1), 1);
|
||||
assert.sameValue(Atomics.load(i32a, 0), 1);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
|
@ -10,10 +10,11 @@ features: [ArrayBuffer, Atomics, TypedArray]
|
|||
---*/
|
||||
|
||||
const buffer = new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4);
|
||||
const views = intArrayConstructors.slice();
|
||||
|
||||
testWithNonSharableTypedArrayConstructors(function(TA) {
|
||||
const view = new TA(buffer);
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
Atomics.store(new TA(buffer), 0, 0);
|
||||
Atomics.store(view, 0, 1);
|
||||
}, `Atomics.store(new ${TA.name}(buffer), 0, 1) throws TypeError`);
|
||||
}, views);
|
||||
});
|
Loading…
Reference in New Issue