mirror of https://github.com/tc39/test262.git
Atomics.notify changed to always return 0 on non-shared
This commit is contained in:
parent
f7322cca7a
commit
302f37eeff
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Evaluates index before returning 0, when TA.buffer is not a SharedArrayBuffer
|
||||||
|
info: |
|
||||||
|
Atomics.notify( typedArray, index, count )
|
||||||
|
|
||||||
|
Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
|
||||||
|
...
|
||||||
|
Else,
|
||||||
|
Let intCount be ? ToInteger(count).
|
||||||
|
Let c be max(intCount, 0).
|
||||||
|
...
|
||||||
|
If IsSharedArrayBuffer(buffer) is false, return 0.
|
||||||
|
|
||||||
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i64a = new BigInt64Array(
|
||||||
|
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
|
||||||
|
);
|
||||||
|
|
||||||
|
const poisoned = {
|
||||||
|
valueOf() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
Atomics.notify(i64a, poisoned, 0);
|
||||||
|
}, '`Atomics.notify(i64a, poisoned, 0)` throws Test262Error');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Evaluates index before returning 0, when TA.buffer is not a SharedArrayBuffer
|
||||||
|
info: |
|
||||||
|
Atomics.notify( typedArray, index, count )
|
||||||
|
|
||||||
|
Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
|
||||||
|
Let i be ? ValidateAtomicAccess(typedArray, index).
|
||||||
|
...
|
||||||
|
If IsSharedArrayBuffer(buffer) is false, return 0.
|
||||||
|
|
||||||
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i64a = new BigInt64Array(
|
||||||
|
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
|
||||||
|
);
|
||||||
|
|
||||||
|
const poisoned = {
|
||||||
|
valueOf() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
Atomics.notify(i64a, 0, poisoned);
|
||||||
|
}, '`Atomics.notify(i64a, 0, poisoned)` throws Test262Error');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Atomics.notify throws on non-shared integer TypedArrays
|
||||||
|
features: [ArrayBuffer, Atomics, BigInt TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const nonsab = new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8);
|
||||||
|
|
||||||
|
const poisoned = {
|
||||||
|
valueOf() {
|
||||||
|
throw new Test262Error('should not evaluate this code');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
Atomics.notify(new BigUint64Array(nonsab), poisoned, poisoned);
|
||||||
|
}, '`Atomics.notify(new BigUint64Array(nonsab), poisoned, poisoned)` throws TypeError');
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Returns 0, when TA.buffer is not a SharedArrayBuffer
|
||||||
|
info: |
|
||||||
|
Atomics.notify( typedArray, index, count )
|
||||||
|
|
||||||
|
Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
|
||||||
|
...
|
||||||
|
If IsSharedArrayBuffer(buffer) is false, return 0.
|
||||||
|
|
||||||
|
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
const i64a = new BigInt64Array(
|
||||||
|
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.sameValue(Atomics.notify(i64a, 0, 0), 0);
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Copyright (C) 2018 Amal Hussein. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-atomics.notify
|
|
||||||
description: >
|
|
||||||
Throws a TypeError if typedArray.buffer is not a SharedArrayBuffer
|
|
||||||
info: |
|
|
||||||
Atomics.notify( typedArray, index, count )
|
|
||||||
|
|
||||||
1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
|
|
||||||
...
|
|
||||||
9.If IsSharedArrayBuffer(buffer) is false, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
4.If bufferData is a Data Block, return false.
|
|
||||||
features: [ArrayBuffer, Atomics, BigInt, TypedArray]
|
|
||||||
---*/
|
|
||||||
const i64a = new BigInt64Array(
|
|
||||||
new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
|
|
||||||
);
|
|
||||||
|
|
||||||
const poisoned = {
|
|
||||||
valueOf: function() {
|
|
||||||
throw new Test262Error('should not evaluate this code');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Atomics.notify(i64a, 0, 0);
|
|
||||||
}, '`Atomics.notify(i64a, 0, 0)` throws TypeError');
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Atomics.notify(i64a, poisoned, poisoned);
|
|
||||||
}, '`Atomics.notify(i64a, poisoned, poisoned)` throws TypeError');
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Evaluates count before returning 0, when TA.buffer is not a SharedArrayBuffer
|
||||||
|
info: |
|
||||||
|
Atomics.notify( typedArray, index, count )
|
||||||
|
|
||||||
|
Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
|
||||||
|
...
|
||||||
|
Else,
|
||||||
|
Let intCount be ? ToInteger(count).
|
||||||
|
Let c be max(intCount, 0).
|
||||||
|
...
|
||||||
|
If IsSharedArrayBuffer(buffer) is false, return 0.
|
||||||
|
|
||||||
|
|
||||||
|
features: [ArrayBuffer, Atomics, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i32a = new Int32Array(
|
||||||
|
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||||
|
);
|
||||||
|
|
||||||
|
const poisoned = {
|
||||||
|
valueOf() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
Atomics.notify(i32a, 0, poisoned);
|
||||||
|
}, '`Atomics.notify(i32a, 0, poisoned)` throws Test262Error');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Evaluates index before returning 0, when TA.buffer is not a SharedArrayBuffer
|
||||||
|
info: |
|
||||||
|
Atomics.notify( typedArray, index, count )
|
||||||
|
|
||||||
|
Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
|
||||||
|
Let i be ? ValidateAtomicAccess(typedArray, index).
|
||||||
|
...
|
||||||
|
If IsSharedArrayBuffer(buffer) is false, return 0.
|
||||||
|
|
||||||
|
features: [ArrayBuffer, Atomics, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i32a = new Int32Array(
|
||||||
|
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||||
|
);
|
||||||
|
|
||||||
|
const poisoned = {
|
||||||
|
valueOf() {
|
||||||
|
throw new Test262Error();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.throws(Test262Error, function() {
|
||||||
|
Atomics.notify(i32a, poisoned, 0);
|
||||||
|
}, '`Atomics.notify(i32a, poisoned, 0)` throws Test262Error');
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test Atomics.notify on non-shared integer TypedArrays
|
Atomics.notify throws on non-shared integer TypedArrays
|
||||||
features: [ArrayBuffer, Atomics, TypedArray]
|
features: [ArrayBuffer, Atomics, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright (C) 2020 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-atomics.notify
|
||||||
|
description: >
|
||||||
|
Returns 0, when TA.buffer is not a SharedArrayBuffer
|
||||||
|
info: |
|
||||||
|
Atomics.notify( typedArray, index, count )
|
||||||
|
|
||||||
|
Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
|
||||||
|
...
|
||||||
|
If IsSharedArrayBuffer(buffer) is false, return 0.
|
||||||
|
|
||||||
|
features: [ArrayBuffer, Atomics, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
const i32a = new Int32Array(
|
||||||
|
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.sameValue(Atomics.notify(i32a, 0, 0), 0);
|
||||||
|
assert.sameValue(Atomics.notify(i32a, 0, 1), 0);
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
// Copyright (C) 2018 Amal Hussein. All rights reserved.
|
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
|
||||||
/*---
|
|
||||||
esid: sec-atomics.notify
|
|
||||||
description: >
|
|
||||||
Throws a TypeError if typedArray.buffer is not a SharedArrayBuffer
|
|
||||||
info: |
|
|
||||||
Atomics.notify( typedArray, index, count )
|
|
||||||
|
|
||||||
1.Let buffer be ? ValidateSharedIntegerTypedArray(typedArray, true).
|
|
||||||
...
|
|
||||||
9.If IsSharedArrayBuffer(buffer) is false, throw a TypeError exception.
|
|
||||||
...
|
|
||||||
4.If bufferData is a Data Block, return false.
|
|
||||||
features: [ArrayBuffer, Atomics, TypedArray]
|
|
||||||
---*/
|
|
||||||
|
|
||||||
const i32a = new Int32Array(
|
|
||||||
new ArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
|
||||||
);
|
|
||||||
|
|
||||||
const poisoned = {
|
|
||||||
valueOf: function() {
|
|
||||||
throw new Test262Error('should not evaluate this code');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Atomics.notify(i32a, 0, 0);
|
|
||||||
}, '`Atomics.notify(i32a, 0, 0)` throws TypeError');
|
|
||||||
|
|
||||||
assert.throws(TypeError, function() {
|
|
||||||
Atomics.notify(i32a, poisoned, poisoned);
|
|
||||||
}, '`Atomics.notify(i32a, poisoned, poisoned)` throws TypeError');
|
|
Loading…
Reference in New Issue