From 9c4e0fd9026b7536298ace8335ececdac9594450 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 11 Jan 2024 02:35:28 -0800 Subject: [PATCH] introduce nonClampedIntArrayConstructors (#3984) --- harness/testTypedArray.js | 8 +++++--- test/built-ins/Atomics/add/bad-range.js | 2 +- test/built-ins/Atomics/add/good-views.js | 2 +- test/built-ins/Atomics/and/bad-range.js | 2 +- test/built-ins/Atomics/and/good-views.js | 2 +- test/built-ins/Atomics/compareExchange/bad-range.js | 2 +- test/built-ins/Atomics/compareExchange/good-views.js | 2 +- test/built-ins/Atomics/exchange/bad-range.js | 2 +- test/built-ins/Atomics/exchange/good-views.js | 2 +- test/built-ins/Atomics/load/bad-range.js | 2 +- test/built-ins/Atomics/load/good-views.js | 2 +- test/built-ins/Atomics/or/bad-range.js | 2 +- test/built-ins/Atomics/or/good-views.js | 2 +- test/built-ins/Atomics/store/bad-range.js | 2 +- test/built-ins/Atomics/store/good-views.js | 2 +- test/built-ins/Atomics/sub/bad-range.js | 2 +- test/built-ins/Atomics/sub/good-views.js | 2 +- test/built-ins/Atomics/xor/bad-range.js | 2 +- test/built-ins/Atomics/xor/good-views.js | 2 +- 19 files changed, 23 insertions(+), 21 deletions(-) diff --git a/harness/testTypedArray.js b/harness/testTypedArray.js index f8345924f81..d831072ec85 100644 --- a/harness/testTypedArray.js +++ b/harness/testTypedArray.js @@ -5,6 +5,7 @@ description: | Collection of functions used to assert the correctness of TypedArray objects. defines: - floatArrayConstructors + - nonClampedIntArrayConstructors - intArrayConstructors - typedArrayConstructors - TypedArray @@ -20,16 +21,17 @@ var floatArrayConstructors = [ Float32Array ]; -var intArrayConstructors = [ +var nonClampedIntArrayConstructors = [ Int32Array, Int16Array, Int8Array, Uint32Array, Uint16Array, - Uint8Array, - Uint8ClampedArray + Uint8Array ]; +var intArrayConstructors = nonClampedIntArrayConstructors.concat([Uint8ClampedArray]); + // Float16Array is a newer feature // adding it to this list unconditionally would cause implementations lacking it to fail every test which uses it if (typeof Float16Array !== 'undefined') { diff --git a/test/built-ins/Atomics/add/bad-range.js b/test/built-ins/Atomics/add/bad-range.js index 8c582b88ca6..d5ad1d732c3 100644 --- a/test/built-ins/Atomics/add/bad-range.js +++ b/test/built-ins/Atomics/add/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ const buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { let view = new TA(buffer); diff --git a/test/built-ins/Atomics/add/good-views.js b/test/built-ins/Atomics/add/good-views.js index ddef527b5ac..95f60854d90 100644 --- a/test/built-ins/Atomics/add/good-views.js +++ b/test/built-ins/Atomics/add/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray const sab = new SharedArrayBuffer(1024); const ab = new ArrayBuffer(16); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/and/bad-range.js b/test/built-ins/Atomics/and/bad-range.js index 730fd6b560c..bf41aa26d88 100644 --- a/test/built-ins/Atomics/and/bad-range.js +++ b/test/built-ins/Atomics/and/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ const buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { const view = new TA(buffer); diff --git a/test/built-ins/Atomics/and/good-views.js b/test/built-ins/Atomics/and/good-views.js index 6bf15d2f18a..59fbd736c4b 100644 --- a/test/built-ins/Atomics/and/good-views.js +++ b/test/built-ins/Atomics/and/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray const sab = new SharedArrayBuffer(1024); const ab = new ArrayBuffer(16); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/compareExchange/bad-range.js b/test/built-ins/Atomics/compareExchange/bad-range.js index 1cb3e527854..04fc7bda26a 100644 --- a/test/built-ins/Atomics/compareExchange/bad-range.js +++ b/test/built-ins/Atomics/compareExchange/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ const buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { const view = new TA(buffer); diff --git a/test/built-ins/Atomics/compareExchange/good-views.js b/test/built-ins/Atomics/compareExchange/good-views.js index 1468eaabf29..99a55768041 100644 --- a/test/built-ins/Atomics/compareExchange/good-views.js +++ b/test/built-ins/Atomics/compareExchange/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray const sab = new SharedArrayBuffer(1024); const ab = new ArrayBuffer(16); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/exchange/bad-range.js b/test/built-ins/Atomics/exchange/bad-range.js index 6f5c8f1749e..0c5294e99a5 100644 --- a/test/built-ins/Atomics/exchange/bad-range.js +++ b/test/built-ins/Atomics/exchange/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ const buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { const view = new TA(buffer); diff --git a/test/built-ins/Atomics/exchange/good-views.js b/test/built-ins/Atomics/exchange/good-views.js index 2eeb53bd70e..90b635d893b 100644 --- a/test/built-ins/Atomics/exchange/good-views.js +++ b/test/built-ins/Atomics/exchange/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray const sab = new SharedArrayBuffer(1024); const ab = new ArrayBuffer(16); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/load/bad-range.js b/test/built-ins/Atomics/load/bad-range.js index dd0546b10ff..77e47f95ca8 100644 --- a/test/built-ins/Atomics/load/bad-range.js +++ b/test/built-ins/Atomics/load/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { let view = new TA(buffer); diff --git a/test/built-ins/Atomics/load/good-views.js b/test/built-ins/Atomics/load/good-views.js index f7f3e7ed47b..69b3d281300 100644 --- a/test/built-ins/Atomics/load/good-views.js +++ b/test/built-ins/Atomics/load/good-views.js @@ -11,7 +11,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray const sab = new SharedArrayBuffer(1024); const ab = new ArrayBuffer(16); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/or/bad-range.js b/test/built-ins/Atomics/or/bad-range.js index ac859a9a843..5ac2f377870 100644 --- a/test/built-ins/Atomics/or/bad-range.js +++ b/test/built-ins/Atomics/or/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { let view = new TA(buffer); diff --git a/test/built-ins/Atomics/or/good-views.js b/test/built-ins/Atomics/or/good-views.js index 89803533974..bea292a310f 100644 --- a/test/built-ins/Atomics/or/good-views.js +++ b/test/built-ins/Atomics/or/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray var sab = new SharedArrayBuffer(1024); var ab = new ArrayBuffer(16); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/store/bad-range.js b/test/built-ins/Atomics/store/bad-range.js index 9d67dabdded..7037736a983 100644 --- a/test/built-ins/Atomics/store/bad-range.js +++ b/test/built-ins/Atomics/store/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ const buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { const view = new TA(buffer); diff --git a/test/built-ins/Atomics/store/good-views.js b/test/built-ins/Atomics/store/good-views.js index 086559cf1fa..f84c83ce7ed 100644 --- a/test/built-ins/Atomics/store/good-views.js +++ b/test/built-ins/Atomics/store/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray const sab = new SharedArrayBuffer(1024); const ab = new ArrayBuffer(16); -const views = intArrayConstructors.slice(); +const views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/sub/bad-range.js b/test/built-ins/Atomics/sub/bad-range.js index c7444d7772a..245fcb66a7b 100644 --- a/test/built-ins/Atomics/sub/bad-range.js +++ b/test/built-ins/Atomics/sub/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ var buffer = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { let view = new TA(buffer); diff --git a/test/built-ins/Atomics/sub/good-views.js b/test/built-ins/Atomics/sub/good-views.js index c53596f4577..a13b7d15e8e 100644 --- a/test/built-ins/Atomics/sub/good-views.js +++ b/test/built-ins/Atomics/sub/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray var sab = new SharedArrayBuffer(1024); var ab = new ArrayBuffer(16); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes. diff --git a/test/built-ins/Atomics/xor/bad-range.js b/test/built-ins/Atomics/xor/bad-range.js index 09395761edf..644f7523503 100644 --- a/test/built-ins/Atomics/xor/bad-range.js +++ b/test/built-ins/Atomics/xor/bad-range.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray ---*/ var sab = new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { let view = new TA(sab); diff --git a/test/built-ins/Atomics/xor/good-views.js b/test/built-ins/Atomics/xor/good-views.js index cdf1714178a..74198415fe5 100644 --- a/test/built-ins/Atomics/xor/good-views.js +++ b/test/built-ins/Atomics/xor/good-views.js @@ -10,7 +10,7 @@ features: [ArrayBuffer, Atomics, DataView, SharedArrayBuffer, Symbol, TypedArray var sab = new SharedArrayBuffer(1024); var ab = new ArrayBuffer(16); -var views = intArrayConstructors.slice(); +var views = nonClampedIntArrayConstructors.slice(); testWithTypedArrayConstructors(function(TA) { // Make it interesting - use non-zero byteOffsets and non-zero indexes.