diff options
Diffstat (limited to 'js/src/tests/non262/TypedArray')
26 files changed, 34 insertions, 11 deletions
diff --git a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js index d454804f94..93c63e2922 100644 --- a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js +++ b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species-wrap.js @@ -1,4 +1,4 @@ -// |reftest| skip-if(!xulRuntime.shell) +// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell) let g = newGlobal(); diff --git a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js index aa7830df67..9e27b2cd3d 100644 --- a/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js +++ b/js/src/tests/non262/TypedArray/constructor-ArrayBuffer-species.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) for (let ctor of typedArrayConstructors) { let arr = new ctor([1, 2, 3, 4, 5, 6, 7, 8]); diff --git a/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js b/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js index ce213038d4..da26828da4 100644 --- a/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js +++ b/js/src/tests/non262/TypedArray/constructor-byteoffsets-bounds.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // 22.2.4.5 TypedArray ( buffer [ , byteOffset [ , length ] ] ) // Test bound checks around for |byteOffset| and |length| arguments. diff --git a/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js b/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js index 5a14d7d5a7..313aa5a750 100644 --- a/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js +++ b/js/src/tests/non262/TypedArray/constructor-iterator-primitive.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) var BUGNUMBER = 1021835; var summary = "Returning non-object from @@iterator should throw"; diff --git a/js/src/tests/non262/TypedArray/constructor-length-too-large.js b/js/src/tests/non262/TypedArray/constructor-length-too-large.js index 7a7a785041..456b6db284 100644 --- a/js/src/tests/non262/TypedArray/constructor-length-too-large.js +++ b/js/src/tests/non262/TypedArray/constructor-length-too-large.js @@ -1,4 +1,4 @@ -// |reftest| skip-if(!xulRuntime.shell) +// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell) // Test that all TypedArray constructor variants throw a RangeError when // attempting to create a too large array. diff --git a/js/src/tests/non262/TypedArray/constructor-non-detached.js b/js/src/tests/non262/TypedArray/constructor-non-detached.js index 9ec9329be8..b40c6cdcbe 100644 --- a/js/src/tests/non262/TypedArray/constructor-non-detached.js +++ b/js/src/tests/non262/TypedArray/constructor-non-detached.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) for (var constructor of typedArrayConstructors) { var buf = new constructor(); detachArrayBuffer(buf.buffer); diff --git a/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js b/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js index 872f46408a..281a764acb 100644 --- a/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js +++ b/js/src/tests/non262/TypedArray/constructor-typedarray-species-other-global.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // 22.2.4.3 TypedArray ( typedArray ) // Test [[Prototype]] of newly created typed array and its array buffer, and diff --git a/js/src/tests/non262/TypedArray/filter-validation.js b/js/src/tests/non262/TypedArray/filter-validation.js index 450b4fa2cf..513f1de7f4 100644 --- a/js/src/tests/non262/TypedArray/filter-validation.js +++ b/js/src/tests/non262/TypedArray/filter-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/from-iterable-validation.js b/js/src/tests/non262/TypedArray/from-iterable-validation.js index 50d46bb81f..ad0015492c 100644 --- a/js/src/tests/non262/TypedArray/from-iterable-validation.js +++ b/js/src/tests/non262/TypedArray/from-iterable-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/from-non-iterable-validation.js b/js/src/tests/non262/TypedArray/from-non-iterable-validation.js index 3276426b28..69d09ced9c 100644 --- a/js/src/tests/non262/TypedArray/from-non-iterable-validation.js +++ b/js/src/tests/non262/TypedArray/from-non-iterable-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/large-arrays.js b/js/src/tests/non262/TypedArray/large-arrays.js index 56ce117494..5d65c21464 100644 --- a/js/src/tests/non262/TypedArray/large-arrays.js +++ b/js/src/tests/non262/TypedArray/large-arrays.js @@ -1,4 +1,4 @@ -// |reftest| slow skip-if(!xulRuntime.shell) +// |reftest| shell-option(--enable-float16array) slow skip-if(!xulRuntime.shell) // Test that we can access TypedArrays beyond the 4GB mark, if large buffers are // supported. diff --git a/js/src/tests/non262/TypedArray/map-validation.js b/js/src/tests/non262/TypedArray/map-validation.js index 1694ef50cb..8b5b2ab3e8 100644 --- a/js/src/tests/non262/TypedArray/map-validation.js +++ b/js/src/tests/non262/TypedArray/map-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/of-validation.js b/js/src/tests/non262/TypedArray/of-validation.js index e7ab905195..e02eedf67e 100644 --- a/js/src/tests/non262/TypedArray/of-validation.js +++ b/js/src/tests/non262/TypedArray/of-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/set-wrapped.js b/js/src/tests/non262/TypedArray/set-wrapped.js index 30a242bf0b..2b2ee813c8 100644 --- a/js/src/tests/non262/TypedArray/set-wrapped.js +++ b/js/src/tests/non262/TypedArray/set-wrapped.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Test %TypedArray%.prototype.set(typedArray, offset) when called with wrapped // typed array. diff --git a/js/src/tests/non262/TypedArray/shell.js b/js/src/tests/non262/TypedArray/shell.js index 2fb0ab8f1d..b31fa70f59 100644 --- a/js/src/tests/non262/TypedArray/shell.js +++ b/js/src/tests/non262/TypedArray/shell.js @@ -2,7 +2,7 @@ "use strict"; const { - Float32Array, Float64Array, Object, Reflect, SharedArrayBuffer, WeakMap, + Float16Array, Float32Array, Float64Array, Object, Reflect, SharedArrayBuffer, WeakMap, assertEq } = global; const { @@ -69,7 +69,7 @@ Uint32Array, Float32Array, Float64Array, - ]); + ].concat(Float16Array ?? [])); /** * All TypedArray constructors for shared memory. @@ -97,13 +97,13 @@ /** * Returns `true` if `constructor` is a TypedArray constructor for shared - * or unshared memory, with an underlying element type of either Float32 or - * Float64. + * or unshared memory, with an underlying element type of one of Float16, Float32 + * or Float64. */ function isFloatConstructor(constructor) { if (isSharedConstructor(constructor)) constructor = Reflect_apply(WeakMap_prototype_get, sharedConstructors, [constructor]); - return constructor == Float32Array || constructor == Float64Array; + return constructor == Float32Array || constructor == Float64Array || (Float16Array && constructor == Float16Array); } global.typedArrayConstructors = typedArrayConstructors; diff --git a/js/src/tests/non262/TypedArray/slice-memcpy.js b/js/src/tests/non262/TypedArray/slice-memcpy.js index a20010ed16..e40ff0e4cc 100644 --- a/js/src/tests/non262/TypedArray/slice-memcpy.js +++ b/js/src/tests/non262/TypedArray/slice-memcpy.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) const otherGlobal = newGlobal(); // Create with new ArrayBuffer and offset. diff --git a/js/src/tests/non262/TypedArray/slice-species.js b/js/src/tests/non262/TypedArray/slice-species.js index 8a03f2f6ee..df73c65cad 100644 --- a/js/src/tests/non262/TypedArray/slice-species.js +++ b/js/src/tests/non262/TypedArray/slice-species.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) for (var constructor of typedArrayConstructors) { // Basic tests for our SpeciesConstructor implementation. var undefConstructor = new constructor(2); diff --git a/js/src/tests/non262/TypedArray/slice-validation.js b/js/src/tests/non262/TypedArray/slice-validation.js index 28d50e36f4..cb8deb813b 100644 --- a/js/src/tests/non262/TypedArray/slice-validation.js +++ b/js/src/tests/non262/TypedArray/slice-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/sort_basics.js b/js/src/tests/non262/TypedArray/sort_basics.js index 3338861507..685215eed6 100644 --- a/js/src/tests/non262/TypedArray/sort_basics.js +++ b/js/src/tests/non262/TypedArray/sort_basics.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Note: failed runs should include their "SEED" value in error messages, // setting "const SEED" to that value will recreate the data from any such run. const SEED = (Math.random() * 10) + 1; diff --git a/js/src/tests/non262/TypedArray/sort_byteoffset.js b/js/src/tests/non262/TypedArray/sort_byteoffset.js index b4e262c450..b8af8bda83 100644 --- a/js/src/tests/non262/TypedArray/sort_byteoffset.js +++ b/js/src/tests/non262/TypedArray/sort_byteoffset.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Ensure that when sorting TypedArrays we don't // ignore byte offsets (bug 1290579). diff --git a/js/src/tests/non262/TypedArray/sort_comparators.js b/js/src/tests/non262/TypedArray/sort_comparators.js index ca190948fc..6578bb066c 100644 --- a/js/src/tests/non262/TypedArray/sort_comparators.js +++ b/js/src/tests/non262/TypedArray/sort_comparators.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Ensure that sorts finish even if a comparator adds items // Note: the array is not expected to be properly sorted. let outsideArray = new Int32Array([1, 99, 2]); diff --git a/js/src/tests/non262/TypedArray/sort_modifications.js b/js/src/tests/non262/TypedArray/sort_modifications.js index 2a6ed49eb7..7098dedc95 100644 --- a/js/src/tests/non262/TypedArray/sort_modifications.js +++ b/js/src/tests/non262/TypedArray/sort_modifications.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) const TAConstructors = [ Int8Array, Uint8Array, @@ -10,7 +11,7 @@ const TAConstructors = [ Float64Array, BigInt64Array, BigUint64Array, -]; +].concat(this.Float16Array ?? []); // Use different size classes to catch any implementation-specific // optimisations. diff --git a/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js b/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js index 99493df800..60f58b0e0e 100644 --- a/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js +++ b/js/src/tests/non262/TypedArray/sort_modifications_concurrent.js @@ -1,4 +1,4 @@ -// |reftest| skip-if(!xulRuntime.shell) +// |reftest| shell-option(--enable-float16array) skip-if(!xulRuntime.shell) if (helperThreadCount() === 0) { if (typeof reportCompare === "function") @@ -18,7 +18,7 @@ const TAConstructors = [ Float64Array, BigInt64Array, BigUint64Array, -]; +].concat(this.Float16Array ?? []); // Use different size classes to catch any implementation-specific // optimisations. @@ -46,6 +46,8 @@ function ToAtomicTA(TA) { return TA; case Uint8ClampedArray: return Uint8Array; + case globalThis.Float16Array: + return Uint16Array; case Float32Array: return Uint32Array; case Float64Array: diff --git a/js/src/tests/non262/TypedArray/subarray-validation.js b/js/src/tests/non262/TypedArray/subarray-validation.js index 4ad8c86095..76ae10fb6f 100644 --- a/js/src/tests/non262/TypedArray/subarray-validation.js +++ b/js/src/tests/non262/TypedArray/subarray-validation.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/js/src/tests/non262/TypedArray/subarray.js b/js/src/tests/non262/TypedArray/subarray.js index a7bfab0efd..7ae41a0c93 100644 --- a/js/src/tests/non262/TypedArray/subarray.js +++ b/js/src/tests/non262/TypedArray/subarray.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Bug 1291003 if (typeof detachArrayBuffer === "function") { for (let constructor of typedArrayConstructors) { diff --git a/js/src/tests/non262/TypedArray/toLocaleString-detached.js b/js/src/tests/non262/TypedArray/toLocaleString-detached.js index 0ba22cc68e..ce0fe3e640 100644 --- a/js/src/tests/non262/TypedArray/toLocaleString-detached.js +++ b/js/src/tests/non262/TypedArray/toLocaleString-detached.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) if (typeof detachArrayBuffer === "function") { const originalNumberToLocaleString = Number.prototype.toLocaleString; |