tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

count-from-nans.js (1077B)


      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 Rick Waldron.  All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-atomics.notify
      7 description: >
      8  NaNs are converted to 0 for 'count' argument to Atomics.notify
      9 info: |
     10  Atomics.notify( typedArray, index, count )
     11 
     12  ...
     13  3. If count is undefined, let c be +∞.
     14  4. Else,
     15    a. Let intCount be ? ToInteger(count).
     16  ...
     17 
     18  ToInteger ( argument )
     19 
     20  ...
     21  2. If number is NaN, return +0.
     22  ...
     23 
     24 includes: [nans.js]
     25 features: [Atomics, SharedArrayBuffer, TypedArray]
     26 ---*/
     27 
     28 const i32a = new Int32Array(
     29  new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
     30 );
     31 
     32 NaNs.forEach(nan => {
     33  assert.sameValue(Atomics.notify(i32a, 0, nan), 0, 'Atomics.notify(i32a, 0, nan) returns 0');
     34 });
     35 
     36 reportCompare(0, 0);