diff --git a/harness/resizableArrayBufferUtils.js b/harness/resizableArrayBufferUtils.js index db58f521f8..9dad8ccb83 100644 --- a/harness/resizableArrayBufferUtils.js +++ b/harness/resizableArrayBufferUtils.js @@ -9,7 +9,7 @@ defines: - ctors - MyBigInt64Array - CreateResizableArrayBuffer - - WriteToTypedArray + - MayNeedBigInt - Convert - ToNumbers - CreateRabForTest @@ -74,14 +74,6 @@ function CreateResizableArrayBuffer(byteLength, maxByteLength) { return new ArrayBuffer(byteLength, { maxByteLength: maxByteLength }); } -function WriteToTypedArray(array, index, value) { - if (array instanceof BigInt64Array || array instanceof BigUint64Array) { - array[index] = BigInt(value); - } else { - array[index] = value; - } -} - function Convert(item) { if (typeof item == 'bigint') { return Number(item); @@ -98,12 +90,21 @@ function ToNumbers(array) { return result; } +function MayNeedBigInt(ta, n) { + assert.sameValue(typeof n, 'number'); + if ((BigInt64Array !== 'undefined' && ta instanceof BigInt64Array) + || (BigUint64Array !== 'undefined' && ta instanceof BigUint64Array)) { + return BigInt(n); + } + return n; +} + function CreateRabForTest(ctor) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } return rab; } diff --git a/test/built-ins/Array/prototype/at/typed-array-resizable-buffer.js b/test/built-ins/Array/prototype/at/typed-array-resizable-buffer.js index 238ebab160..a4f8afbdcc 100644 --- a/test/built-ins/Array/prototype/at/typed-array-resizable-buffer.js +++ b/test/built-ins/Array/prototype/at/typed-array-resizable-buffer.js @@ -24,7 +24,7 @@ for (let ctor of ctors) { // Write some data into the array. let ta_write = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(ta_write, i, i); + ta_write[i] = MayNeedBigInt(ta_write, i); } assert.sameValue(ArrayAtHelper(fixedLength, -1), 3); assert.sameValue(ArrayAtHelper(lengthTracking, -1), 3); diff --git a/test/built-ins/Array/prototype/copyWithin/resizable-buffer.js b/test/built-ins/Array/prototype/copyWithin/resizable-buffer.js index 02918d2980..7c0cda3a29 100644 --- a/test/built-ins/Array/prototype/copyWithin/resizable-buffer.js +++ b/test/built-ins/Array/prototype/copyWithin/resizable-buffer.js @@ -24,7 +24,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3] @@ -41,7 +41,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } ArrayCopyWithinHelper(fixedLengthWithOffset, 0, 1); assert.compareArray(ToNumbers(fixedLengthWithOffset), [ @@ -49,7 +49,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } ArrayCopyWithinHelper(lengthTracking, 0, 2); assert.compareArray(ToNumbers(lengthTracking), [ @@ -67,7 +67,7 @@ for (let ctor of ctors) { // Shrink so that fixed length TAs go out of bounds. rab.resize(3 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 3; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2] @@ -99,7 +99,7 @@ for (let ctor of ctors) { // Shrink so that the TAs with offset go out of bounds. rab.resize(1 * ctor.BYTES_PER_ELEMENT); - WriteToTypedArray(taWrite, 0, 0); + taWrite[0] = MayNeedBigInt(taWrite, 0); ArrayCopyWithinHelper(fixedLength, 0, 1, 1); ArrayCopyWithinHelper(fixedLengthWithOffset, 0, 1, 1); ArrayCopyWithinHelper(lengthTrackingWithOffset, 0, 1, 1); @@ -121,7 +121,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3, 4, 5] @@ -138,7 +138,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } ArrayCopyWithinHelper(fixedLengthWithOffset, 0, 1); assert.compareArray(ToNumbers(fixedLengthWithOffset), [ @@ -146,7 +146,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // [0, 1, 2, 3, 4, 5, ...] << lengthTracking @@ -161,7 +161,7 @@ for (let ctor of ctors) { 5 ]); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // [2, 3, 4, 5, ...] << lengthTrackingWithOffset diff --git a/test/built-ins/Array/prototype/entries/resizable-buffer.js b/test/built-ins/Array/prototype/entries/resizable-buffer.js index 7f20fa608c..9563fb0fdf 100644 --- a/test/built-ins/Array/prototype/entries/resizable-buffer.js +++ b/test/built-ins/Array/prototype/entries/resizable-buffer.js @@ -35,7 +35,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -128,7 +128,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/every/resizable-buffer.js b/test/built-ins/Array/prototype/every/resizable-buffer.js index b6f68e0f69..c2f0fe680b 100644 --- a/test/built-ins/Array/prototype/every/resizable-buffer.js +++ b/test/built-ins/Array/prototype/every/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -86,7 +86,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/filter/resizable-buffer.js b/test/built-ins/Array/prototype/filter/resizable-buffer.js index df38c65791..6e5a291971 100644 --- a/test/built-ins/Array/prototype/filter/resizable-buffer.js +++ b/test/built-ins/Array/prototype/filter/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3] @@ -77,7 +77,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3, 4, 5] diff --git a/test/built-ins/Array/prototype/find/resizable-buffer.js b/test/built-ins/Array/prototype/find/resizable-buffer.js index bcf793ebe5..45217f3db0 100644 --- a/test/built-ins/Array/prototype/find/resizable-buffer.js +++ b/test/built-ins/Array/prototype/find/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -69,10 +69,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/Array/prototype/findIndex/resizable-buffer.js b/test/built-ins/Array/prototype/findIndex/resizable-buffer.js index 09e4191583..4826e06c96 100644 --- a/test/built-ins/Array/prototype/findIndex/resizable-buffer.js +++ b/test/built-ins/Array/prototype/findIndex/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -69,10 +69,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/Array/prototype/findLast/resizable-buffer.js b/test/built-ins/Array/prototype/findLast/resizable-buffer.js index 2c716576e7..8eeb665a27 100644 --- a/test/built-ins/Array/prototype/findLast/resizable-buffer.js +++ b/test/built-ins/Array/prototype/findLast/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -69,10 +69,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/Array/prototype/findLastIndex/resizable-buffer.js b/test/built-ins/Array/prototype/findLastIndex/resizable-buffer.js index f55f0f3f80..9b94240fb6 100644 --- a/test/built-ins/Array/prototype/findLastIndex/resizable-buffer.js +++ b/test/built-ins/Array/prototype/findLastIndex/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -69,10 +69,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/Array/prototype/forEach/resizable-buffer.js b/test/built-ins/Array/prototype/forEach/resizable-buffer.js index 3b3936f90e..57523ddc27 100644 --- a/test/built-ins/Array/prototype/forEach/resizable-buffer.js +++ b/test/built-ins/Array/prototype/forEach/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -91,7 +91,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/includes/coerced-searchelement-fromindex-resize.js b/test/built-ins/Array/prototype/includes/coerced-searchelement-fromindex-resize.js index 96c5ca2ff4..965a23ddf6 100644 --- a/test/built-ins/Array/prototype/includes/coerced-searchelement-fromindex-resize.js +++ b/test/built-ins/Array/prototype/includes/coerced-searchelement-fromindex-resize.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer, Array.prototype.includes] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -61,7 +54,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, 1); } let evil = { valueOf: () => { @@ -77,7 +70,7 @@ for (let ctor of ctors) { for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); - WriteToTypedArray(lengthTracking, 0, 1); + lengthTracking[0] = MayNeedBigInt(lengthTracking, 1); let evil = { valueOf: () => { rab.resize(6 * ctor.BYTES_PER_ELEMENT); diff --git a/test/built-ins/Array/prototype/includes/resizable-buffer.js b/test/built-ins/Array/prototype/includes/resizable-buffer.js index b9a78cef9a..c31d5827d2 100644 --- a/test/built-ins/Array/prototype/includes/resizable-buffer.js +++ b/test/built-ins/Array/prototype/includes/resizable-buffer.js @@ -9,13 +9,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer, Array.prototype.includes] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -26,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -100,7 +93,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-grow.js b/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-grow.js index fc1c3e0f7d..cc0b2b7dcc 100644 --- a/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-grow.js +++ b/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-grow.js @@ -10,19 +10,12 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Growing + length-tracking TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, 1); } let evil = { valueOf: () => { @@ -40,7 +33,7 @@ for (let ctor of ctors) { for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); - WriteToTypedArray(lengthTracking, 0, 1); + lengthTracking[0] = MayNeedBigInt(lengthTracking, 1); let evil = { valueOf: () => { rab.resize(6 * ctor.BYTES_PER_ELEMENT); diff --git a/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-shrink.js b/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-shrink.js index 9e803e491a..ab4c4ae4d5 100644 --- a/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-shrink.js +++ b/test/built-ins/Array/prototype/indexOf/coerced-searchelement-fromindex-shrink.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Shrinking + fixed-length TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); @@ -52,7 +45,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } let evil = { valueOf: () => { diff --git a/test/built-ins/Array/prototype/indexOf/resizable-buffer.js b/test/built-ins/Array/prototype/indexOf/resizable-buffer.js index 74f232dd2c..cb66e19be6 100644 --- a/test/built-ins/Array/prototype/indexOf/resizable-buffer.js +++ b/test/built-ins/Array/prototype/indexOf/resizable-buffer.js @@ -9,13 +9,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -26,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1] @@ -98,7 +91,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1, 2, 2] diff --git a/test/built-ins/Array/prototype/join/resizable-buffer.js b/test/built-ins/Array/prototype/join/resizable-buffer.js index e28414ab00..9eb672bb84 100644 --- a/test/built-ins/Array/prototype/join/resizable-buffer.js +++ b/test/built-ins/Array/prototype/join/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -66,7 +66,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/keys/resizable-buffer.js b/test/built-ins/Array/prototype/keys/resizable-buffer.js index 295ce3612b..de1d7436e2 100644 --- a/test/built-ins/Array/prototype/keys/resizable-buffer.js +++ b/test/built-ins/Array/prototype/keys/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } assert.compareArray(Array.from(Array.prototype.keys.call(fixedLength)), [ @@ -106,7 +106,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/lastIndexOf/coerced-position-grow.js b/test/built-ins/Array/prototype/lastIndexOf/coerced-position-grow.js index 76f95eed3f..f6dffe0110 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/coerced-position-grow.js +++ b/test/built-ins/Array/prototype/lastIndexOf/coerced-position-grow.js @@ -10,19 +10,12 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Growing + length-tracking TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, 1); } let evil = { valueOf: () => { diff --git a/test/built-ins/Array/prototype/lastIndexOf/coerced-position-shrink.js b/test/built-ins/Array/prototype/lastIndexOf/coerced-position-shrink.js index 13e07043b4..517530e0a8 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/coerced-position-shrink.js +++ b/test/built-ins/Array/prototype/lastIndexOf/coerced-position-shrink.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Shrinking + fixed-length TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); @@ -51,7 +44,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } let evil = { valueOf: () => { diff --git a/test/built-ins/Array/prototype/lastIndexOf/resizable-buffer.js b/test/built-ins/Array/prototype/lastIndexOf/resizable-buffer.js index 5e93b68598..686b09903b 100644 --- a/test/built-ins/Array/prototype/lastIndexOf/resizable-buffer.js +++ b/test/built-ins/Array/prototype/lastIndexOf/resizable-buffer.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -27,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1] @@ -104,7 +97,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1, 2, 2] diff --git a/test/built-ins/Array/prototype/map/resizable-buffer.js b/test/built-ins/Array/prototype/map/resizable-buffer.js index e108395fcb..2fbef3500e 100644 --- a/test/built-ins/Array/prototype/map/resizable-buffer.js +++ b/test/built-ins/Array/prototype/map/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < taWrite.length; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -105,7 +105,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/reduce/resizable-buffer.js b/test/built-ins/Array/prototype/reduce/resizable-buffer.js index c03585e3cd..9637a12e4f 100644 --- a/test/built-ins/Array/prototype/reduce/resizable-buffer.js +++ b/test/built-ins/Array/prototype/reduce/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -90,7 +90,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/reduceRight/resizable-buffer.js b/test/built-ins/Array/prototype/reduceRight/resizable-buffer.js index a1fa69c6b0..7603636822 100644 --- a/test/built-ins/Array/prototype/reduceRight/resizable-buffer.js +++ b/test/built-ins/Array/prototype/reduceRight/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -93,7 +93,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/reverse/resizable-buffer.js b/test/built-ins/Array/prototype/reverse/resizable-buffer.js index f3b06228e7..e6a285d10f 100644 --- a/test/built-ins/Array/prototype/reverse/resizable-buffer.js +++ b/test/built-ins/Array/prototype/reverse/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { function WriteData() { // Write some data into the array. for (let i = 0; i < wholeArrayView.length; ++i) { - WriteToTypedArray(wholeArrayView, i, 2 * i); + wholeArrayView[i] = MayNeedBigInt(wholeArrayView, 2 * i); } } WriteData(); diff --git a/test/built-ins/Array/prototype/slice/coerced-start-end-grow.js b/test/built-ins/Array/prototype/slice/coerced-start-end-grow.js index 2d718b803d..aff475886f 100644 --- a/test/built-ins/Array/prototype/slice/coerced-start-end-grow.js +++ b/test/built-ins/Array/prototype/slice/coerced-start-end-grow.js @@ -15,7 +15,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { @@ -37,7 +37,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { diff --git a/test/built-ins/Array/prototype/slice/coerced-start-end-shrink.js b/test/built-ins/Array/prototype/slice/coerced-start-end-shrink.js index b6656b3be3..4786edaffc 100644 --- a/test/built-ins/Array/prototype/slice/coerced-start-end-shrink.js +++ b/test/built-ins/Array/prototype/slice/coerced-start-end-shrink.js @@ -34,7 +34,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { @@ -76,7 +76,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { diff --git a/test/built-ins/Array/prototype/slice/resizable-buffer.js b/test/built-ins/Array/prototype/slice/resizable-buffer.js index 606a520101..059d5293a6 100644 --- a/test/built-ins/Array/prototype/slice/resizable-buffer.js +++ b/test/built-ins/Array/prototype/slice/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } const fixedLengthSlice = Array.prototype.slice.call(fixedLength); assert.compareArray(ToNumbers(fixedLengthSlice), [ diff --git a/test/built-ins/Array/prototype/some/resizable-buffer.js b/test/built-ins/Array/prototype/some/resizable-buffer.js index 0bd06bc97e..3f38be8073 100644 --- a/test/built-ins/Array/prototype/some/resizable-buffer.js +++ b/test/built-ins/Array/prototype/some/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -79,7 +79,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/sort/comparefn-grow.js b/test/built-ins/Array/prototype/sort/comparefn-grow.js index 640cdda2ae..7b2046490c 100644 --- a/test/built-ins/Array/prototype/sort/comparefn-grow.js +++ b/test/built-ins/Array/prototype/sort/comparefn-grow.js @@ -25,7 +25,7 @@ function ResizeAndCompare(rab, resizeTo) { function WriteUnsortedData(taFull) { for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - i); + taFull[i] = MayNeedBigInt(taFull, 10 - i); } } diff --git a/test/built-ins/Array/prototype/sort/comparefn-resizable-buffer.js b/test/built-ins/Array/prototype/sort/comparefn-resizable-buffer.js index b575811e80..91d0f5b6ff 100644 --- a/test/built-ins/Array/prototype/sort/comparefn-resizable-buffer.js +++ b/test/built-ins/Array/prototype/sort/comparefn-resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { function WriteUnsortedData() { // Write some data into the array. for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - i); + taFull[i] = MayNeedBigInt(taFull, 10 - i); } } function OddBeforeEvenComparison(a, b) { diff --git a/test/built-ins/Array/prototype/sort/comparefn-shrink.js b/test/built-ins/Array/prototype/sort/comparefn-shrink.js index c9c26f01c6..2dd82e2c22 100644 --- a/test/built-ins/Array/prototype/sort/comparefn-shrink.js +++ b/test/built-ins/Array/prototype/sort/comparefn-shrink.js @@ -25,7 +25,7 @@ function ResizeAndCompare(rab, resizeTo) { function WriteUnsortedData(taFull) { for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - i); + taFull[i] = MayNeedBigInt(taFull, 10 - i); } } diff --git a/test/built-ins/Array/prototype/sort/resizable-buffer-default-comparator.js b/test/built-ins/Array/prototype/sort/resizable-buffer-default-comparator.js index 38b1c065da..db3f71ca60 100644 --- a/test/built-ins/Array/prototype/sort/resizable-buffer-default-comparator.js +++ b/test/built-ins/Array/prototype/sort/resizable-buffer-default-comparator.js @@ -22,7 +22,7 @@ for (let ctor of ctors) { function WriteUnsortedData() { // Write some data into the array. for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - 2 * i); + taFull[i] = MayNeedBigInt(taFull, 10 - 2 * i); } } // Orig. array: [10, 8, 6, 4] diff --git a/test/built-ins/Array/prototype/toLocaleString/resizable-buffer.js b/test/built-ins/Array/prototype/toLocaleString/resizable-buffer.js index c8768f47fe..e9b4b6add2 100644 --- a/test/built-ins/Array/prototype/toLocaleString/resizable-buffer.js +++ b/test/built-ins/Array/prototype/toLocaleString/resizable-buffer.js @@ -26,7 +26,7 @@ for (let ctor of ctors) { // Write some data into the array. for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -72,7 +72,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Array/prototype/values/resizable-buffer.js b/test/built-ins/Array/prototype/values/resizable-buffer.js index c4b7f77868..c2d06cc9d1 100644 --- a/test/built-ins/Array/prototype/values/resizable-buffer.js +++ b/test/built-ins/Array/prototype/values/resizable-buffer.js @@ -27,7 +27,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -120,7 +120,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/Function/prototype/apply/resizable-buffer.js b/test/built-ins/Function/prototype/apply/resizable-buffer.js index 2e93f387cb..2487870667 100644 --- a/test/built-ins/Function/prototype/apply/resizable-buffer.js +++ b/test/built-ins/Function/prototype/apply/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { const lengthTrackingWithOffset = new ctor(rab, 2 * ctor.BYTES_PER_ELEMENT); const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } function func(...args) { return [...args]; diff --git a/test/built-ins/Object/defineProperties/typedarray-backed-by-resizable-buffer.js b/test/built-ins/Object/defineProperties/typedarray-backed-by-resizable-buffer.js index 46901a0874..fa3c597701 100644 --- a/test/built-ins/Object/defineProperties/typedarray-backed-by-resizable-buffer.js +++ b/test/built-ins/Object/defineProperties/typedarray-backed-by-resizable-buffer.js @@ -10,14 +10,6 @@ includes: [compareArray.js, resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, value) { - if (ta instanceof BigInt64Array || ta instanceof BigUint64Array) { - return BigInt(value); - } else { - return value; - } -} - function DefinePropertiesMayNeedBigInt(ta, index, value) { const values = {}; values[index] = { value: MayNeedBigInt(ta, value) }; diff --git a/test/built-ins/Object/defineProperty/coerced-P-grow.js b/test/built-ins/Object/defineProperty/coerced-P-grow.js index 106de77d25..9a84f8770c 100644 --- a/test/built-ins/Object/defineProperty/coerced-P-grow.js +++ b/test/built-ins/Object/defineProperty/coerced-P-grow.js @@ -11,14 +11,6 @@ includes: [compareArray.js, resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, value) { - if (ta instanceof BigInt64Array || ta instanceof BigUint64Array) { - return BigInt(value); - } else { - return value; - } -} - // Fixed length. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); diff --git a/test/built-ins/Object/defineProperty/coerced-P-shrink.js b/test/built-ins/Object/defineProperty/coerced-P-shrink.js index bcc3019d5a..55ac63ae47 100644 --- a/test/built-ins/Object/defineProperty/coerced-P-shrink.js +++ b/test/built-ins/Object/defineProperty/coerced-P-shrink.js @@ -11,14 +11,6 @@ includes: [compareArray.js, resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, value) { - if (ta instanceof BigInt64Array || ta instanceof BigUint64Array) { - return BigInt(value); - } else { - return value; - } -} - // Fixed length. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); diff --git a/test/built-ins/Object/defineProperty/typedarray-backed-by-resizable-buffer.js b/test/built-ins/Object/defineProperty/typedarray-backed-by-resizable-buffer.js index 155fd50445..9c031dc4ac 100644 --- a/test/built-ins/Object/defineProperty/typedarray-backed-by-resizable-buffer.js +++ b/test/built-ins/Object/defineProperty/typedarray-backed-by-resizable-buffer.js @@ -10,14 +10,6 @@ includes: [compareArray.js, resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, value) { - if (ta instanceof BigInt64Array || ta instanceof BigUint64Array) { - return BigInt(value); - } else { - return value; - } -} - function DefinePropertyMayNeedBigInt(ta, index, value) { Object.defineProperty(ta, index, { value: MayNeedBigInt(ta, value) }); } diff --git a/test/built-ins/TypedArray/out-of-bounds-get-and-set.js b/test/built-ins/TypedArray/out-of-bounds-get-and-set.js index 5e3b59c49a..4d7019ae3a 100644 --- a/test/built-ins/TypedArray/out-of-bounds-get-and-set.js +++ b/test/built-ins/TypedArray/out-of-bounds-get-and-set.js @@ -10,14 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, num) { - if (ta instanceof BigInt64Array || ta instanceof BigUint64Array) { - return BigInt(num); - } else { - return num; - } -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 40 * ctor.BYTES_PER_ELEMENT); const array = new ctor(rab, 0, 4); diff --git a/test/built-ins/TypedArray/prototype/at/resizable-buffer.js b/test/built-ins/TypedArray/prototype/at/resizable-buffer.js index 6379e40332..9fea7397d0 100644 --- a/test/built-ins/TypedArray/prototype/at/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/at/resizable-buffer.js @@ -24,7 +24,7 @@ for (let ctor of ctors) { // Write some data into the array. let ta_write = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(ta_write, i, i); + ta_write[i] = MayNeedBigInt(ta_write, i); } assert.sameValue(TypedArrayAtHelper(fixedLength, -1), 3); assert.sameValue(TypedArrayAtHelper(lengthTracking, -1), 3); diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-end-shrink.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-end-shrink.js index 34e5ea74d0..65270444ad 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-end-shrink.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-end-shrink.js @@ -34,7 +34,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } // [0, 1, 2, 3] // ^ @@ -58,7 +58,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } // [0, 1, 2, 3] // ^ diff --git a/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-grow.js b/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-grow.js index 6d1b3fc9d0..94495d35bd 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-grow.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/coerced-target-start-grow.js @@ -13,13 +13,13 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } const evil = { valueOf: () => { rab.resize(6 * ctor.BYTES_PER_ELEMENT); - WriteToTypedArray(lengthTracking, 4, 4); - WriteToTypedArray(lengthTracking, 5, 5); + lengthTracking[4] = MayNeedBigInt(lengthTracking, 4); + lengthTracking[5] = MayNeedBigInt(lengthTracking, 5); return 0; } }; @@ -37,7 +37,7 @@ for (let ctor of ctors) { ]); rab.resize(4 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } // Orig. array: [0, 1, 2, 3] [4, 5] diff --git a/test/built-ins/TypedArray/prototype/copyWithin/resizable-buffer.js b/test/built-ins/TypedArray/prototype/copyWithin/resizable-buffer.js index 7bd24ffc0b..d86049c04e 100644 --- a/test/built-ins/TypedArray/prototype/copyWithin/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/copyWithin/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3] @@ -37,7 +37,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } fixedLengthWithOffset.copyWithin(0, 1); assert.compareArray(ToNumbers(fixedLengthWithOffset), [ @@ -45,7 +45,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } lengthTracking.copyWithin(0, 2); assert.compareArray(ToNumbers(lengthTracking), [ @@ -63,7 +63,7 @@ for (let ctor of ctors) { // Shrink so that fixed length TAs go out of bounds. rab.resize(3 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 3; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2] @@ -92,7 +92,7 @@ for (let ctor of ctors) { // Shrink so that the TAs with offset go out of bounds. rab.resize(1 * ctor.BYTES_PER_ELEMENT); - WriteToTypedArray(taWrite, 0, 0); + taWrite[0] = MayNeedBigInt(taWrite, 0); assert.throws(TypeError, () => { fixedLength.copyWithin(0, 1, 1); }); @@ -124,7 +124,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3, 4, 5] @@ -141,7 +141,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } fixedLengthWithOffset.copyWithin(0, 1); assert.compareArray(ToNumbers(fixedLengthWithOffset), [ @@ -149,7 +149,7 @@ for (let ctor of ctors) { 3 ]); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // [0, 1, 2, 3, 4, 5, ...] << lengthTracking @@ -164,7 +164,7 @@ for (let ctor of ctors) { 5 ]); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // [2, 3, 4, 5, ...] << lengthTrackingWithOffset diff --git a/test/built-ins/TypedArray/prototype/entries/resizable-buffer.js b/test/built-ins/TypedArray/prototype/entries/resizable-buffer.js index a5fae1ba7b..1124bb2a6e 100644 --- a/test/built-ins/TypedArray/prototype/entries/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/entries/resizable-buffer.js @@ -31,7 +31,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -140,7 +140,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/every/resizable-buffer.js b/test/built-ins/TypedArray/prototype/every/resizable-buffer.js index 22369d6271..37140219f3 100644 --- a/test/built-ins/TypedArray/prototype/every/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/every/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -102,7 +102,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/filter/resizable-buffer.js b/test/built-ins/TypedArray/prototype/filter/resizable-buffer.js index de536e2912..b0700f2ed3 100644 --- a/test/built-ins/TypedArray/prototype/filter/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/filter/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3] @@ -94,7 +94,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } // Orig. array: [0, 1, 2, 3, 4, 5] diff --git a/test/built-ins/TypedArray/prototype/find/resizable-buffer.js b/test/built-ins/TypedArray/prototype/find/resizable-buffer.js index 128f4c1140..98ac15257f 100644 --- a/test/built-ins/TypedArray/prototype/find/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/find/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -85,10 +85,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/TypedArray/prototype/findIndex/resizable-buffer.js b/test/built-ins/TypedArray/prototype/findIndex/resizable-buffer.js index 645ff3369a..ef2b768a2d 100644 --- a/test/built-ins/TypedArray/prototype/findIndex/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/findIndex/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -84,10 +84,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/TypedArray/prototype/findLast/resizable-buffer.js b/test/built-ins/TypedArray/prototype/findLast/resizable-buffer.js index 0b8bcc2044..7d842f18b2 100644 --- a/test/built-ins/TypedArray/prototype/findLast/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/findLast/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -85,10 +85,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/TypedArray/prototype/findLastIndex/resizable-buffer.js b/test/built-ins/TypedArray/prototype/findLastIndex/resizable-buffer.js index 3adf4d0ebb..0dad13566c 100644 --- a/test/built-ins/TypedArray/prototype/findLastIndex/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/findLastIndex/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -84,10 +84,10 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 0); + taWrite[i] = MayNeedBigInt(taWrite, 0); } - WriteToTypedArray(taWrite, 4, 2); - WriteToTypedArray(taWrite, 5, 4); + taWrite[4] = MayNeedBigInt(taWrite, 2); + taWrite[5] = MayNeedBigInt(taWrite, 4); // Orig. array: [0, 0, 0, 0, 2, 4] // [0, 0, 0, 0] << fixedLength diff --git a/test/built-ins/TypedArray/prototype/forEach/resizable-buffer.js b/test/built-ins/TypedArray/prototype/forEach/resizable-buffer.js index 74ab29bb23..411ae267f4 100644 --- a/test/built-ins/TypedArray/prototype/forEach/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/forEach/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -109,7 +109,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/includes/coerced-searchelement-fromindex-resize.js b/test/built-ins/TypedArray/prototype/includes/coerced-searchelement-fromindex-resize.js index 8fed6fec14..8eeced9cb9 100644 --- a/test/built-ins/TypedArray/prototype/includes/coerced-searchelement-fromindex-resize.js +++ b/test/built-ins/TypedArray/prototype/includes/coerced-searchelement-fromindex-resize.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer, Array.prototype.includes] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -61,7 +54,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, 1); } let evil = { valueOf: () => { @@ -77,7 +70,7 @@ for (let ctor of ctors) { for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); - WriteToTypedArray(lengthTracking, 0, 1); + lengthTracking[0] = MayNeedBigInt(lengthTracking, 1); let evil = { valueOf: () => { rab.resize(6 * ctor.BYTES_PER_ELEMENT); diff --git a/test/built-ins/TypedArray/prototype/includes/resizable-buffer.js b/test/built-ins/TypedArray/prototype/includes/resizable-buffer.js index 8e99ce5db6..523422df22 100644 --- a/test/built-ins/TypedArray/prototype/includes/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/includes/resizable-buffer.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer, Array.prototype.includes] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -27,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -116,7 +109,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-grow.js b/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-grow.js index 7b63c5009c..f18ccf1a8c 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-grow.js +++ b/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-grow.js @@ -10,19 +10,12 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Growing + length-tracking TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, 1); } let evil = { valueOf: () => { @@ -40,7 +33,7 @@ for (let ctor of ctors) { for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); - WriteToTypedArray(lengthTracking, 0, 1); + lengthTracking[0] = MayNeedBigInt(lengthTracking, 1); let evil = { valueOf: () => { rab.resize(6 * ctor.BYTES_PER_ELEMENT); diff --git a/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-shrink.js b/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-shrink.js index befab22a27..6a2ffce3f2 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-shrink.js +++ b/test/built-ins/TypedArray/prototype/indexOf/coerced-searchelement-fromindex-shrink.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Shrinking + fixed-length TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); @@ -52,7 +45,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } let evil = { valueOf: () => { diff --git a/test/built-ins/TypedArray/prototype/indexOf/resizable-buffer.js b/test/built-ins/TypedArray/prototype/indexOf/resizable-buffer.js index 43519225f0..16398b4e76 100644 --- a/test/built-ins/TypedArray/prototype/indexOf/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/indexOf/resizable-buffer.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -27,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1] @@ -116,7 +109,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1, 2, 2] diff --git a/test/built-ins/TypedArray/prototype/join/resizable-buffer.js b/test/built-ins/TypedArray/prototype/join/resizable-buffer.js index 02d96a4f0c..cbe3ca744b 100644 --- a/test/built-ins/TypedArray/prototype/join/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/join/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -82,7 +82,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/keys/resizable-buffer.js b/test/built-ins/TypedArray/prototype/keys/resizable-buffer.js index 694087c7e8..21a2d34ec9 100644 --- a/test/built-ins/TypedArray/prototype/keys/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/keys/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -105,7 +105,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-grow.js b/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-grow.js index 8ac8387581..504642dbc0 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-grow.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-grow.js @@ -10,19 +10,12 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Growing + length-tracking TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, 1); } let evil = { valueOf: () => { diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-shrink.js b/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-shrink.js index 2879e776ed..ee5a88faa9 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-shrink.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/coerced-position-shrink.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - // Shrinking + fixed-length TA. for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); @@ -52,7 +45,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i); } let evil = { valueOf: () => { diff --git a/test/built-ins/TypedArray/prototype/lastIndexOf/resizable-buffer.js b/test/built-ins/TypedArray/prototype/lastIndexOf/resizable-buffer.js index bba8d75a97..4b2ac4536d 100644 --- a/test/built-ins/TypedArray/prototype/lastIndexOf/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/lastIndexOf/resizable-buffer.js @@ -10,13 +10,6 @@ includes: [resizableArrayBufferUtils.js] features: [resizable-arraybuffer] ---*/ -function MayNeedBigInt(ta, n) { - if (typeof n == 'number' && (ta instanceof BigInt64Array || ta instanceof BigUint64Array)) { - return BigInt(n); - } - return n; -} - for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const fixedLength = new ctor(rab, 0, 4); @@ -27,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1] @@ -120,7 +113,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, Math.floor(i / 2)); + taWrite[i] = MayNeedBigInt(taWrite, Math.floor(i / 2)); } // Orig. array: [0, 0, 1, 1, 2, 2] diff --git a/test/built-ins/TypedArray/prototype/map/resizable-buffer.js b/test/built-ins/TypedArray/prototype/map/resizable-buffer.js index 24c7cf1bb4..1f01829b16 100644 --- a/test/built-ins/TypedArray/prototype/map/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/map/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < taWrite.length; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -122,7 +122,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-grow.js b/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-grow.js index d9999cb8a2..bc17496648 100644 --- a/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-grow.js +++ b/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-grow.js @@ -32,7 +32,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } let resizeWhenConstructorCalled = false; class MyArray extends ctor { @@ -59,7 +59,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } let resizeWhenConstructorCalled = false; class MyArray extends ctor { diff --git a/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-shrink.js b/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-shrink.js index 7b4e47d99a..50e43622f5 100644 --- a/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-shrink.js +++ b/test/built-ins/TypedArray/prototype/map/speciesctor-resizable-buffer-shrink.js @@ -56,7 +56,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } let resizeWhenConstructorCalled = false; class MyArray extends ctor { diff --git a/test/built-ins/TypedArray/prototype/reduce/resizable-buffer.js b/test/built-ins/TypedArray/prototype/reduce/resizable-buffer.js index 4956887d17..6891e9423b 100644 --- a/test/built-ins/TypedArray/prototype/reduce/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/reduce/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -109,7 +109,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/reduceRight/resizable-buffer.js b/test/built-ins/TypedArray/prototype/reduceRight/resizable-buffer.js index a3c2770c06..305b072ba7 100644 --- a/test/built-ins/TypedArray/prototype/reduceRight/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/reduceRight/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -110,7 +110,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/reverse/resizable-buffer.js b/test/built-ins/TypedArray/prototype/reverse/resizable-buffer.js index 7c30bb0c1b..ec0162b3a4 100644 --- a/test/built-ins/TypedArray/prototype/reverse/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/reverse/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { function WriteData() { // Write some data into the array. for (let i = 0; i < wholeArrayView.length; ++i) { - WriteToTypedArray(wholeArrayView, i, 2 * i); + wholeArrayView[i] = MayNeedBigInt(wholeArrayView, 2 * i); } } WriteData(); diff --git a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-backed-by-resizable-buffer.js b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-backed-by-resizable-buffer.js index 79aba4fb70..b11b759e6c 100644 --- a/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-backed-by-resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-backed-by-resizable-buffer.js @@ -42,7 +42,7 @@ for (let targetIsResizable of [ // Write some data into the array. const taFull = new sourceCtor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taFull, i, i + 1); + taFull[i] = MayNeedBigInt(taFull, i + 1); } // Orig. array: [1, 2, 3, 4] @@ -179,7 +179,7 @@ for (let targetIsResizable of [ // Grow so that all TAs are back in-bounds. rab.resize(6 * sourceCtor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taFull, i, i + 1); + taFull[i] = MayNeedBigInt(taFull, i + 1); } // Orig. array: [1, 2, 3, 4, 5, 6] diff --git a/test/built-ins/TypedArray/prototype/slice/coerced-start-end-grow.js b/test/built-ins/TypedArray/prototype/slice/coerced-start-end-grow.js index 4a927dd8aa..48cb09eb19 100644 --- a/test/built-ins/TypedArray/prototype/slice/coerced-start-end-grow.js +++ b/test/built-ins/TypedArray/prototype/slice/coerced-start-end-grow.js @@ -15,7 +15,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { @@ -37,7 +37,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { diff --git a/test/built-ins/TypedArray/prototype/slice/coerced-start-end-shrink.js b/test/built-ins/TypedArray/prototype/slice/coerced-start-end-shrink.js index 1359f8ba34..750a78ca97 100644 --- a/test/built-ins/TypedArray/prototype/slice/coerced-start-end-shrink.js +++ b/test/built-ins/TypedArray/prototype/slice/coerced-start-end-shrink.js @@ -29,7 +29,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { @@ -69,7 +69,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const lengthTracking = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(lengthTracking, i, i + 1); + lengthTracking[i] = MayNeedBigInt(lengthTracking, i + 1); } const evil = { valueOf: () => { diff --git a/test/built-ins/TypedArray/prototype/slice/resizable-buffer.js b/test/built-ins/TypedArray/prototype/slice/resizable-buffer.js index db072bf3d5..cc92b2f616 100644 --- a/test/built-ins/TypedArray/prototype/slice/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/slice/resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, i); + taWrite[i] = MayNeedBigInt(taWrite, i); } const fixedLengthSlice = fixedLength.slice(); assert.compareArray(ToNumbers(fixedLengthSlice), [ diff --git a/test/built-ins/TypedArray/prototype/slice/speciesctor-resize.js b/test/built-ins/TypedArray/prototype/slice/speciesctor-resize.js index 280d8a3c13..2da4d2a531 100644 --- a/test/built-ins/TypedArray/prototype/slice/speciesctor-resize.js +++ b/test/built-ins/TypedArray/prototype/slice/speciesctor-resize.js @@ -36,7 +36,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 1); + taWrite[i] = MayNeedBigInt(taWrite, 1); } let resizeWhenConstructorCalled = false; class MyArray extends ctor { @@ -69,7 +69,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 1); + taWrite[i] = MayNeedBigInt(taWrite, 1); } let resizeWhenConstructorCalled = false; class MyArray extends ctor { @@ -99,7 +99,7 @@ for (let ctor of ctors) { const rab = CreateResizableArrayBuffer(8, 16); const taWrite = new Uint8Array(rab); for (let i = 0; i < 8; ++i) { - WriteToTypedArray(taWrite, i, 255); + taWrite[i] = MayNeedBigInt(taWrite, 255); } let resizeWhenConstructorCalled = false; class MyArray extends Uint16Array { diff --git a/test/built-ins/TypedArray/prototype/some/resizable-buffer.js b/test/built-ins/TypedArray/prototype/some/resizable-buffer.js index 6a4c08b55d..dcb57bac93 100644 --- a/test/built-ins/TypedArray/prototype/some/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/some/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -95,7 +95,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-grow.js b/test/built-ins/TypedArray/prototype/sort/comparefn-grow.js index 11f09bf467..8a54fbd01b 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-grow.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-grow.js @@ -27,7 +27,7 @@ function ResizeAndCompare(rab, resizeTo) { function WriteUnsortedData(taFull) { for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - i); + taFull[i] = MayNeedBigInt(taFull, 10 - i); } } diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-resizable-buffer.js b/test/built-ins/TypedArray/prototype/sort/comparefn-resizable-buffer.js index c3c8c93371..ded426ff1d 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-resizable-buffer.js @@ -20,7 +20,7 @@ for (let ctor of ctors) { function WriteUnsortedData() { // Write some data into the array. for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - i); + taFull[i] = MayNeedBigInt(taFull, 10 - i); } } function OddBeforeEvenComparison(a, b) { diff --git a/test/built-ins/TypedArray/prototype/sort/comparefn-shrink.js b/test/built-ins/TypedArray/prototype/sort/comparefn-shrink.js index b057179066..1daf665b9b 100644 --- a/test/built-ins/TypedArray/prototype/sort/comparefn-shrink.js +++ b/test/built-ins/TypedArray/prototype/sort/comparefn-shrink.js @@ -27,7 +27,7 @@ function ResizeAndCompare(rab, resizeTo) { function WriteUnsortedData(taFull) { for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - i); + taFull[i] = MayNeedBigInt(taFull, 10 - i); } } diff --git a/test/built-ins/TypedArray/prototype/sort/resizable-buffer-default-comparator.js b/test/built-ins/TypedArray/prototype/sort/resizable-buffer-default-comparator.js index f3386199bd..a72343d783 100644 --- a/test/built-ins/TypedArray/prototype/sort/resizable-buffer-default-comparator.js +++ b/test/built-ins/TypedArray/prototype/sort/resizable-buffer-default-comparator.js @@ -22,7 +22,7 @@ for (let ctor of ctors) { function WriteUnsortedData() { // Write some data into the array. for (let i = 0; i < taFull.length; ++i) { - WriteToTypedArray(taFull, i, 10 - 2 * i); + taFull[i] = MayNeedBigInt(taFull, 10 - 2 * i); } } // Orig. array: [10, 8, 6, 4] diff --git a/test/built-ins/TypedArray/prototype/subarray/resizable-buffer.js b/test/built-ins/TypedArray/prototype/subarray/resizable-buffer.js index d740f26b52..6b0e4fc5cd 100644 --- a/test/built-ins/TypedArray/prototype/subarray/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/subarray/resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -129,7 +129,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/toLocaleString/resizable-buffer.js b/test/built-ins/TypedArray/prototype/toLocaleString/resizable-buffer.js index d31c5f5a5b..0cb4161acc 100644 --- a/test/built-ins/TypedArray/prototype/toLocaleString/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/toLocaleString/resizable-buffer.js @@ -36,7 +36,7 @@ for (let ctor of ctors) { // Write some data into the array. for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -98,7 +98,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArray/prototype/values/resizable-buffer.js b/test/built-ins/TypedArray/prototype/values/resizable-buffer.js index e7eb2347ac..55dfc162ab 100644 --- a/test/built-ins/TypedArray/prototype/values/resizable-buffer.js +++ b/test/built-ins/TypedArray/prototype/values/resizable-buffer.js @@ -28,7 +28,7 @@ for (let ctor of ctors) { // Write some data into the array. const taWrite = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6] @@ -113,7 +113,7 @@ for (let ctor of ctors) { // Grow so that all TAs are back in-bounds. rab.resize(6 * ctor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taWrite, i, 2 * i); + taWrite[i] = MayNeedBigInt(taWrite, 2 * i); } // Orig. array: [0, 2, 4, 6, 8, 10] diff --git a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/src-typedarray-resizable-buffer.js b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/src-typedarray-resizable-buffer.js index 924d3e8943..c5bbd3ee6a 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/src-typedarray-resizable-buffer.js +++ b/test/built-ins/TypedArrayConstructors/ctors/typedarray-arg/src-typedarray-resizable-buffer.js @@ -35,7 +35,7 @@ AllBigIntMatchedCtorCombinations((targetCtor, sourceCtor) => { // Write some data into the array. const taFull = new sourceCtor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(taFull, i, i + 1); + taFull[i] = MayNeedBigInt(taFull, i + 1); } // Orig. array: [1, 2, 3, 4] @@ -114,7 +114,7 @@ AllBigIntMatchedCtorCombinations((targetCtor, sourceCtor) => { // Grow so that all TAs are back in-bounds. rab.resize(6 * sourceCtor.BYTES_PER_ELEMENT); for (let i = 0; i < 6; ++i) { - WriteToTypedArray(taFull, i, i + 1); + taFull[i] = MayNeedBigInt(taFull, i + 1); } // Orig. array: [1, 2, 3, 4, 5, 6] diff --git a/test/language/destructuring/binding/typedarray-backed-by-resizable-buffer.js b/test/language/destructuring/binding/typedarray-backed-by-resizable-buffer.js index 13e4df0221..7eb24f2b0e 100644 --- a/test/language/destructuring/binding/typedarray-backed-by-resizable-buffer.js +++ b/test/language/destructuring/binding/typedarray-backed-by-resizable-buffer.js @@ -19,7 +19,7 @@ for (let ctor of ctors) { // Write some data into the array. let ta_write = new ctor(rab); for (let i = 0; i < 4; ++i) { - WriteToTypedArray(ta_write, i, i); + ta_write[i] = MayNeedBigInt(ta_write, i); } { let [a, b, c, d, e] = fixedLength; diff --git a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-before-end.js b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-before-end.js index e8b56e2510..c9b5108e46 100644 --- a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-before-end.js +++ b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-before-end.js @@ -14,7 +14,7 @@ function CreateRab(buffer_byte_length, ctor) { const rab = CreateResizableArrayBuffer(buffer_byte_length, 2 * buffer_byte_length); let ta_write = new ctor(rab); for (let i = 0; i < buffer_byte_length / ctor.BYTES_PER_ELEMENT; ++i) { - WriteToTypedArray(ta_write, i, i % 128); + ta_write[i] = MayNeedBigInt(ta_write, i % 128); } return rab; } diff --git a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-mid-iteration.js b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-mid-iteration.js index 243c67dd9e..11e0017924 100644 --- a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-mid-iteration.js +++ b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-grow-mid-iteration.js @@ -14,7 +14,7 @@ function CreateRab(buffer_byte_length, ctor) { const rab = CreateResizableArrayBuffer(buffer_byte_length, 2 * buffer_byte_length); let ta_write = new ctor(rab); for (let i = 0; i < buffer_byte_length / ctor.BYTES_PER_ELEMENT; ++i) { - WriteToTypedArray(ta_write, i, i % 128); + ta_write[i] = MayNeedBigInt(ta_write, i % 128); } return rab; } diff --git a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-mid-iteration.js b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-mid-iteration.js index 53cf49f967..a4862fd5c6 100644 --- a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-mid-iteration.js +++ b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-mid-iteration.js @@ -14,7 +14,7 @@ function CreateRab(buffer_byte_length, ctor) { const rab = CreateResizableArrayBuffer(buffer_byte_length, 2 * buffer_byte_length); let ta_write = new ctor(rab); for (let i = 0; i < buffer_byte_length / ctor.BYTES_PER_ELEMENT; ++i) { - WriteToTypedArray(ta_write, i, i % 128); + ta_write[i] = MayNeedBigInt(ta_write, i % 128); } return rab; } diff --git a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-to-zero-mid-iteration.js b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-to-zero-mid-iteration.js index 05393f707d..061b2e0ef8 100644 --- a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-to-zero-mid-iteration.js +++ b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer-shrink-to-zero-mid-iteration.js @@ -14,7 +14,7 @@ function CreateRab(buffer_byte_length, ctor) { const rab = CreateResizableArrayBuffer(buffer_byte_length, 2 * buffer_byte_length); let ta_write = new ctor(rab); for (let i = 0; i < buffer_byte_length / ctor.BYTES_PER_ELEMENT; ++i) { - WriteToTypedArray(ta_write, i, i % 128); + ta_write[i] = MayNeedBigInt(ta_write, i % 128); } return rab; } diff --git a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer.js b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer.js index fcdfab5cee..4d94f3badb 100644 --- a/test/language/statements/for-of/typedarray-backed-by-resizable-buffer.js +++ b/test/language/statements/for-of/typedarray-backed-by-resizable-buffer.js @@ -28,7 +28,7 @@ for (let ctor of ctors) { // Write some data into the array. let ta_write = new ctor(rab); for (let i = 0; i < no_elements; ++i) { - WriteToTypedArray(ta_write, i, i % 128); + ta_write[i] = MayNeedBigInt(ta_write, i % 128); } // Create various different styles of TypedArrays with the RAB as the