Debian Codegraph @

js/src/tests/test262/built-ins/Atomics/notify/bigint/non-shared-bufferdata-count-evaluation-throws.js

raw
1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')) -- Atomics is not enabled unconditionally
2 // Copyright (C) 2020 Rick Waldron. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-atomics.notify
6 description: >
7 Evaluates index before returning 0, when TA.buffer is not a SharedArrayBuffer
8 info: |
9 Atomics.notify( typedArray, index, count )
10
11 Let buffer be ? ValidateIntegerTypedArray(typedArray, true).
12 ...
13 Else,
14 Let intCount be ? ToInteger(count).
15 Let c be max(intCount, 0).
16 ...
17 If IsSharedArrayBuffer(buffer) is false, return 0.
18
19 features: [ArrayBuffer, Atomics, BigInt, TypedArray]
20 ---*/
21
22 const i64a = new BigInt64Array(
23 new ArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 8)
24 );
25
26 const poisoned = {
27 valueOf() {
28 throw new Test262Error();
29 }
30 };
31
32 assert.throws(Test262Error, function() {
33 Atomics.notify(i64a, poisoned, 0);
34 });
35
36 reportCompare(0, 0);