1 // |reftest| skip-if(!this.hasOwnProperty('Atomics')||!this.hasOwnProperty('SharedArrayBuffer')||(this.hasOwnProperty('getBuildConfiguration')&&getBuildConfiguration('arm64-simulator'))) -- Atomics,SharedArrayBuffer is not enabled unconditionally, ARM64 Simulator cannot emulate atomics
2 // Copyright (C) 2018 Amal Hussein. All rights reserved.
3 // This code is governed by the BSD license found in the LICENSE file.
8 Throws a TypeError if index arg can not be converted to an Integer
10 Atomics.wait( typedArray, index, value, timeout )
12 4. Let q be ? ToNumber(timeout).
14 Object -> Apply the following steps:
16 Let primValue be ? ToPrimitive(argument, hint Number).
17 Return ? ToNumber(primValue).
19 features: [Atomics, SharedArrayBuffer, Symbol, Symbol.toPrimitive, TypedArray]
22 const i32a = new Int32Array(
23 new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
26 const poisonedValueOf = {
28 throw new Test262Error('should not evaluate this code');
32 const poisonedToPrimitive = {
33 [Symbol.toPrimitive]: function() {
34 throw new Test262Error("passing a poisoned object using @@ToPrimitive");
38 assert.throws(Test262Error, function() {
39 Atomics.wait(i32a, 0, 0, poisonedValueOf);
40 }, '`Atomics.wait(i32a, 0, 0, poisonedValueOf)` throws Test262Error');
42 assert.throws(Test262Error, function() {
43 Atomics.wait(i32a, 0, 0, poisonedToPrimitive);
44 }, '`Atomics.wait(i32a, 0, 0, poisonedToPrimitive)` throws Test262Error');