diff options
Diffstat (limited to '')
31 files changed, 97 insertions, 12 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/absent-indices-computed-from-initial-length.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/absent-indices-computed-from-initial-length.js new file mode 100644 index 0000000000..e2ae779081 --- /dev/null +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/absent-indices-computed-from-initial-length.js @@ -0,0 +1,54 @@ +// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options +// Copyright (C) 2024 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%typedarray%.prototype.fill +description: > + Absent start and end parameters are computed from initial length. +info: | + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) + + ... + 2. Let taRecord be ? ValidateTypedArray(O, seq-cst). + 3. Let len be TypedArrayLength(taRecord). + ... + 5. Otherwise, set value to ? ToNumber(value). + 6. Let relativeStart be ? ToIntegerOrInfinity(start). + ... + 9. Else, let startIndex be min(relativeStart, len). + 10. If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + ... + 13. Else, let endIndex be min(relativeEnd, len). + ... + +features: [TypedArray, resizable-arraybuffer] +---*/ + +let rab = new ArrayBuffer(1, {maxByteLength: 4}); +let ta = new Int8Array(rab); + +let value = { + valueOf() { + // Set buffer to maximum byte length. + rab.resize(4); + + // Return the fill value. + return 123; + } +}; + +// Ensure typed array is correctly initialised. +assert.sameValue(ta.length, 1); +assert.sameValue(ta[0], 0); + +ta.fill(value); + +// Ensure typed array has correct length and only the first element was filled. +assert.sameValue(ta.length, 4); +assert.sameValue(ta[0], 123); +assert.sameValue(ta[1], 0); +assert.sameValue(ta[2], 0); +assert.sameValue(ta[3], 0); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-end-detach.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-end-detach.js index ccaa1ae6bd..44881f8a7e 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-end-detach.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-end-detach.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2020 Google. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-indexes.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-indexes.js index f2f78c3d39..43225f1632 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-indexes.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-indexes.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-start-detach.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-start-detach.js index 63656210b1..891c1e1c05 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-start-detach.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-start-detach.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2020 Google. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-value-detach.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-value-detach.js index cdfa9efd88..b7bc5c54e2 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-value-detach.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/coerced-value-detach.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2020 Google. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/detached-buffer.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/detached-buffer.js index e81231bc64..c43330e575 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/detached-buffer.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/detached-buffer.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js index 0abceac140..1a9c45bfa3 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2017 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js index 0990868026..2263805084 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations-consistent-nan.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js index c23bfe9b2b..78325d980f 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-conversion-operations.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js index 7f8d6dd51f..802022c54b 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-custom-start-and-end.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index 371f9bde5f..70b83203ce 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js index 086bf5d1b9..f324c228a7 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-end.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js index d418285a8e..af824a5dcb 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-relative-start.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js index 48bbe9c94e..08b9ee6ae8 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values.js index a3a4bad901..c9315ee3e5 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/fill-values.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js index bdd67a6212..085264a17f 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-func.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-func.js index 10b81cbf80..7845158253 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-func.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-func.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-method.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-method.js index 2293f0644a..1ab0241f6d 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-method.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/invoked-as-method.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/length.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/length.js index 2106e754bc..7427e6459a 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/length.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/length.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2015 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. @@ -23,10 +24,11 @@ includes: [propertyHelper.js, testTypedArray.js] features: [TypedArray] ---*/ -assert.sameValue(TypedArray.prototype.fill.length, 1); - -verifyNotEnumerable(TypedArray.prototype.fill, "length"); -verifyNotWritable(TypedArray.prototype.fill, "length"); -verifyConfigurable(TypedArray.prototype.fill, "length"); +verifyProperty(TypedArray.prototype.fill, "length", { + value: 1, + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/name.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/name.js index c1e6729cee..5fe1511722 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/name.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/name.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2015 André Bargull. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. @@ -20,10 +21,11 @@ includes: [propertyHelper.js, testTypedArray.js] features: [TypedArray] ---*/ -assert.sameValue(TypedArray.prototype.fill.name, "fill"); - -verifyNotEnumerable(TypedArray.prototype.fill, "name"); -verifyNotWritable(TypedArray.prototype.fill, "name"); -verifyConfigurable(TypedArray.prototype.fill, "name"); +verifyProperty(TypedArray.prototype.fill, "name", { + value: "fill", + writable: false, + enumerable: false, + configurable: true +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/not-a-constructor.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/not-a-constructor.js index 984f6435ce..ebc79348f6 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/not-a-constructor.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/not-a-constructor.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2020 Rick Waldron. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. @@ -29,7 +30,7 @@ assert.sameValue( assert.throws(TypeError, () => { let u8 = new Uint8Array(1); new u8.fill(); -}, '`let u8 = new Uint8Array(1); new u8.fill()` throws TypeError'); +}); reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/prop-desc.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/prop-desc.js index b9de7e83b7..91e78b8b2a 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/prop-desc.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/prop-desc.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js index 0c77c38dcd..54a911522f 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end-as-symbol.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js index aa95620a25..506a1fdf71 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-end.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js index 90d3c469ac..dd3266124a 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js index 2a94acc7e4..6b2ab793e0 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start-as-symbol.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js index e7016c9159..afe1580f6b 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-start.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js index 2f1fec95a1..709a6a6fc4 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-abrupt-from-this-out-of-bounds.js @@ -1,4 +1,4 @@ -// |reftest| shell-option(--enable-arraybuffer-resizable) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options +// |reftest| shell-option(--enable-arraybuffer-resizable) shell-option(--enable-float16array) skip-if(!ArrayBuffer.prototype.resize||!xulRuntime.shell) -- resizable-arraybuffer is not enabled unconditionally, requires shell-options // Copyright (C) 2021 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-this.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-this.js index afba1718ac..aa940228fc 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-this.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/return-this.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-object.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-object.js index 17d8f004c5..5b5fe09212 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-object.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-object.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- diff --git a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-typedarray-instance.js b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-typedarray-instance.js index 4568ee60c1..cbaeac38ea 100644 --- a/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-typedarray-instance.js +++ b/js/src/tests/test262/built-ins/TypedArray/prototype/fill/this-is-not-typedarray-instance.js @@ -1,3 +1,4 @@ +// |reftest| shell-option(--enable-float16array) // Copyright (C) 2016 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- |