From 96aff62fb25cf9ef27929a8ab822ee853d99b06e Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Wed, 25 Nov 2020 10:55:30 -0500 Subject: [PATCH] IntegerIndexedElementSet should always indicate success. Ref: tc39/ecma262/pull/2210 --- .../BigInt/fill-values-non-numeric-throw.js | 56 ++++++++++-------- .../fill/BigInt/fill-values-non-numeric.js | 57 +++++++++++-------- .../fill/BigInt/fill-values-symbol-throws.js | 55 +++++++++++------- .../BigInt/return-abrupt-from-set-value.js | 55 +++++++++++------- .../prototype/fill/fill-values-non-numeric.js | 55 +++++++++++------- .../fill/fill-values-symbol-throws.js | 55 +++++++++++------- .../fill/return-abrupt-from-set-value.js | 55 +++++++++++------- .../includes/detached-buffer-tointeger.js | 32 ++++++----- ...ray-conversion-operation-consistent-nan.js | 17 ++++-- ...urn-new-typedarray-conversion-operation.js | 17 ++++-- .../object-arg/bigint-tobigint64.js | 23 +++++--- .../object-arg/bigint-tobiguint64.js | 23 +++++--- .../object-arg/boolean-tobigint.js | 20 +++++-- .../ctors-bigint/object-arg/null-tobigint.js | 20 +++++-- .../object-arg/number-tobigint.js | 21 +++++-- .../object-arg/string-nan-tobigint.js | 21 +++++-- .../object-arg/string-tobigint.js | 21 +++++-- .../object-arg/symbol-tobigint.js | 21 +++++-- ...rows-setting-obj-to-primitive-typeerror.js | 21 +++++-- .../throws-setting-obj-to-primitive.js | 21 +++++-- .../object-arg/throws-setting-obj-tostring.js | 21 +++++-- .../throws-setting-obj-valueof-typeerror.js | 21 +++++-- .../object-arg/throws-setting-obj-valueof.js | 21 +++++-- .../object-arg/undefined-tobigint.js | 20 +++++-- .../conversion-operation-consistent-nan.js | 17 ++++-- .../ctors/object-arg/conversion-operation.js | 17 ++++-- ...rows-setting-obj-to-primitive-typeerror.js | 22 +++++-- .../throws-setting-obj-to-primitive.js | 22 +++++-- .../object-arg/throws-setting-obj-tostring.js | 22 +++++-- .../throws-setting-obj-valueof-typeerror.js | 22 +++++-- .../object-arg/throws-setting-obj-valueof.js | 22 +++++-- .../BigInt/source-value-is-symbol-throws.js | 20 +++++-- .../from/nan-conversion.js | 18 ++++-- .../from/source-value-is-symbol-throws.js | 18 ++++-- .../BigInt/desc-value-throws.js | 20 +++++-- .../BigInt/detached-buffer-realm.js | 15 ++++- .../BigInt/detached-buffer.js | 17 ++++-- .../DefineOwnProperty/BigInt/set-value.js | 18 ++++-- .../BigInt/tonumber-value-detached-buffer.js | 18 ++++-- .../DefineOwnProperty/conversion-operation.js | 17 ++++-- .../DefineOwnProperty/desc-value-throws.js | 18 ++++-- .../detached-buffer-realm.js | 17 ++++-- .../DefineOwnProperty/detached-buffer.js | 17 ++++-- .../internals/DefineOwnProperty/set-value.js | 18 ++++-- .../tonumber-value-detached-buffer.js | 18 ++++-- .../Set/BigInt/detached-buffer-realm.js | 3 +- .../internals/Set/BigInt/indexed-value.js | 8 +-- .../internals/Set/BigInt/key-is-minus-zero.js | 13 ++--- .../Set/BigInt/key-is-not-integer.js | 16 ++---- .../Set/BigInt/key-is-out-of-bounds.js | 13 +++-- .../BigInt/tonumber-value-detached-buffer.js | 21 +++---- .../Set/BigInt/tonumber-value-throws.js | 3 +- .../conversion-operation-consistent-nan.js | 19 +++++-- .../internals/Set/conversion-operation.js | 20 +++++-- .../internals/Set/detached-buffer-realm.js | 3 +- .../internals/Set/indexed-value.js | 21 +++++-- .../internals/Set/key-is-minus-zero.js | 12 ++-- .../internals/Set/key-is-not-integer.js | 14 ++--- .../internals/Set/key-is-out-of-bounds.js | 17 ++---- .../Set/tonumber-value-detached-buffer.js | 19 +++++-- .../internals/Set/tonumber-value-throws.js | 3 +- .../of/BigInt/argument-is-symbol-throws.js | 18 ++++-- .../of/BigInt/new-instance.js | 21 +++++-- .../of/argument-is-symbol-throws.js | 18 ++++-- .../of/nan-conversion.js | 17 ++++-- .../TypedArrayConstructors/of/new-instance.js | 21 +++++-- 66 files changed, 966 insertions(+), 476 deletions(-) diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js index e091e0f09c..85bb513be7 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric-throw.js @@ -5,33 +5,43 @@ esid: sec-%typedarray%.prototype.fill description: > Fills all the elements with non numeric values values. info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js index e7f9175eb3..2b73da24e8 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-non-numeric.js @@ -5,33 +5,42 @@ esid: sec-%typedarray%.prototype.fill description: > Fills all the elements with non numeric values values. info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) - - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js index dddad60fa1..50cb0d5501 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/fill-values-symbol-throws.js @@ -5,32 +5,43 @@ esid: sec-%typedarray%.prototype.fill description: > Throws a TypeError if value is a Symbol info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, Symbol, TypedArray] diff --git a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js index c30cbf0975..875600bd16 100644 --- a/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/BigInt/return-abrupt-from-set-value.js @@ -5,32 +5,43 @@ esid: sec-%typedarray%.prototype.fill description: > Returns abrupt from value set info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js index b2735c7703..be7ce96f09 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-non-numeric.js @@ -5,32 +5,43 @@ esid: sec-%typedarray%.prototype.fill description: > Fills all the elements with non numeric values values. info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [TypedArray] diff --git a/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js b/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js index be5ca9b5e8..d903770c11 100644 --- a/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js +++ b/test/built-ins/TypedArray/prototype/fill/fill-values-symbol-throws.js @@ -5,32 +5,43 @@ esid: sec-%typedarray%.prototype.fill description: > Throws a TypeError if value is a Symbol info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [Symbol, TypedArray] diff --git a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js index 5702d4e6b1..0b38f0dc84 100644 --- a/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js +++ b/test/built-ins/TypedArray/prototype/fill/return-abrupt-from-set-value.js @@ -5,32 +5,43 @@ esid: sec-%typedarray%.prototype.fill description: > Returns abrupt from value set info: | - 22.2.3.8 %TypedArray%.prototype.fill (value [ , start [ , end ] ] ) + %TypedArray%.prototype.fill ( value [ , start [ , end ] ] ) - %TypedArray%.prototype.fill is a distinct function that implements the same - algorithm as Array.prototype.fill as defined in 22.1.3.6 except that the this - object's [[ArrayLength]] internal slot is accessed in place of performing a - [[Get]] of "length". The implementation of the algorithm may be optimized with - the knowledge that the this value is an object that has a fixed length and - whose integer indexed properties are not sparse. However, such optimization - must not introduce any observable changes in the specified behaviour of the - algorithm. + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If O.[[ContentType]] is BigInt, set value to ? ToBigInt(value). + Otherwise, set value to ? ToNumber(value). + Let relativeStart be ? ToIntegerOrInfinity(start). + If relativeStart is -Infinity, let k be 0. + Else if relativeStart < 0, let k be max(len + relativeStart, 0). + Else, let k be min(relativeStart, len). + If end is undefined, let relativeEnd be len; else let relativeEnd be ? ToIntegerOrInfinity(end). + If relativeEnd is -Infinity, let final be 0. + Else if relativeEnd < 0, let final be max(len + relativeEnd, 0). + Else, let final be min(relativeEnd, len). + If IsDetachedBuffer(O.[[ViewedArrayBuffer]]) is true, throw a TypeError exception. + Repeat, while k < final, + Let Pk be ! ToString(F(k)). + Perform ! Set(O, Pk, value, true). + Set k to k + 1. + Return O. - ... + IntegerIndexedElementSet ( O, index, value ) - 22.1.3.6 Array.prototype.fill (value [ , start [ , end ] ] ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 7. Repeat, while k < final - a. Let Pk be ! ToString(k). - b. Perform ? Set(O, Pk, value, true). - ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [TypedArray] diff --git a/test/built-ins/TypedArray/prototype/includes/detached-buffer-tointeger.js b/test/built-ins/TypedArray/prototype/includes/detached-buffer-tointeger.js index 869df61e8d..9eebb34c2e 100644 --- a/test/built-ins/TypedArray/prototype/includes/detached-buffer-tointeger.js +++ b/test/built-ins/TypedArray/prototype/includes/detached-buffer-tointeger.js @@ -2,30 +2,36 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- esid: sec-%typedarray%.prototype.includes -description: Throws a TypeError if this has a detached buffer after index coercion +description: > + Does not throw a TypeError if this has a detached buffer after index coercion, + because ValidateTypedArray has already successfully completed. + info: | 22.2.3.14 %TypedArray%.prototype.includes ( searchElement [ , fromIndex ] ) - This function is not generic. ValidateTypedArray is applied to the this value - prior to evaluating the algorithm. If its result is an abrupt completion that - exception is thrown instead of evaluating the algorithm. + The interpretation and use of the arguments of %TypedArray%.prototype.includes are the same as for Array.prototype.includes as defined in 22.1.3.13. - 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O ) + When the includes method is called with one or two arguments, the following steps are taken: + Let O be the this value. + Perform ? ValidateTypedArray(O). + Let len be O.[[ArrayLength]]. + If len is 0, return false. + Let n be ? ToIntegerOrInfinity(fromIndex). ... - 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. - ... + includes: [testTypedArray.js, detachArrayBuffer.js] -features: [TypedArray] +features: [align-detached-buffer-semantics-with-web-reality, TypedArray] ---*/ testWithTypedArrayConstructors(function(TA) { - var sample = new TA(10); - function detachAndReturnIndex(){ + const sample = new TA(10); + let isDetached = false; + function valueOf(){ $DETACHBUFFER(sample.buffer); + isDetached = true; return 0; } - assert.throws(TypeError, function() { - sample.includes(0, {valueOf :detachAndReturnIndex}); - }); + assert.sameValue(sample.includes(0, {valueOf}), false); + assert.sameValue(isDetached, true); }); diff --git a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js index dba6bc011b..44fab4529e 100644 --- a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation-consistent-nan.js @@ -12,11 +12,20 @@ info: | d. Perform ? Set(A, Pk, mappedValue, true). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js index 29ee3f8ab7..a64aacdf9d 100644 --- a/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js +++ b/test/built-ins/TypedArray/prototype/map/return-new-typedarray-conversion-operation.js @@ -14,11 +14,20 @@ info: | d. Perform ? Set(A, Pk, mappedValue, true). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js index dd3bdcc44f..c9d163983e 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobigint64.js @@ -22,17 +22,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, "Unordered"). - // NOTE: type will be set to BigInt64 in this test - 16. Return true. + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). SetValueInBuffer ( arrayBuffer, byteIndex, type, value, isTypedArray, order [ , isLittleEndian ] ) ... diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js index ded74af07a..d8002e5a8e 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/bigint-tobiguint64.js @@ -22,17 +22,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, "Unordered"). - // NOTE: type will be set to BigUint64 in this test - 16. Return true. + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). SetValueInBuffer ( arrayBuffer, byteIndex, type, value, isTypedArray, order [ , isLittleEndian ] ) ... diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js index c277e50fdc..ea9b5bfe24 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/boolean-tobigint.js @@ -22,14 +22,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js index fdbbab93d4..378b4db1e7 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/null-tobigint.js @@ -22,14 +22,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js index 886c99f165..8961c0b58c 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/number-tobigint.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js index 0726d56e52..1b17771c4d 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-nan-tobigint.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js index 5798167dbb..3233817ff0 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/string-tobigint.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js index 2183b6ab1f..88771c4ac8 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/symbol-tobigint.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js index 116401a4ca..c2fa6f5dd9 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive-typeerror.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js index 7742ba6ac9..27f2e74625 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-to-primitive.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js index bbe3c2c5b5..64b75595df 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-tostring.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js index 3165cbd397..9eeec3ca6a 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof-typeerror.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js index b9f0d461a4..ca2b2acbe6 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/throws-setting-obj-valueof.js @@ -25,15 +25,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) diff --git a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js index 26f708df5a..ad4678c3a5 100644 --- a/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js +++ b/test/built-ins/TypedArrayConstructors/ctors-bigint/object-arg/undefined-tobigint.js @@ -22,14 +22,24 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) - ... - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", - let numValue be ? ToBigInt(value). - ... + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). ToBigInt ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js index d4a6235da9..d440071946 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation-consistent-nan.js @@ -17,11 +17,20 @@ info: | c. Perform ? Set(O, Pk, kValue, true). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation.js index 9590549110..9e01a57999 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/conversion-operation.js @@ -19,11 +19,20 @@ info: | c. Perform ? Set(O, Pk, kValue, true). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive-typeerror.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive-typeerror.js index 215bf75fc0..e0eaa1f057 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive-typeerror.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive-typeerror.js @@ -25,16 +25,26 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 3. Let numValue be ? ToNumber(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - 7.1.3 ToNumber ( argument ) + ToNumber ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive.js index 7a7170b6f1..2e347876c8 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-to-primitive.js @@ -25,16 +25,26 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 3. Let numValue be ? ToNumber(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - 7.1.3 ToNumber ( argument ) + ToNumber ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-tostring.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-tostring.js index 482e115957..43dec2072a 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-tostring.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-tostring.js @@ -25,16 +25,26 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 3. Let numValue be ? ToNumber(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - 7.1.3 ToNumber ( argument ) + ToNumber ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof-typeerror.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof-typeerror.js index 767dd21825..d7a838e769 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof-typeerror.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof-typeerror.js @@ -25,16 +25,26 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 3. Let numValue be ? ToNumber(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - 7.1.3 ToNumber ( argument ) + ToNumber ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof.js b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof.js index f9baf7758f..a23d1d6235 100644 --- a/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof.js +++ b/test/built-ins/TypedArrayConstructors/ctors/object-arg/throws-setting-obj-valueof.js @@ -25,16 +25,26 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 3. Let numValue be ? ToNumber(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - 7.1.3 ToNumber ( argument ) + ToNumber ( argument ) Object, Apply the following steps: diff --git a/test/built-ins/TypedArrayConstructors/from/BigInt/source-value-is-symbol-throws.js b/test/built-ins/TypedArrayConstructors/from/BigInt/source-value-is-symbol-throws.js index cebc1b1141..a81995b294 100644 --- a/test/built-ins/TypedArrayConstructors/from/BigInt/source-value-is-symbol-throws.js +++ b/test/built-ins/TypedArrayConstructors/from/BigInt/source-value-is-symbol-throws.js @@ -5,11 +5,23 @@ esid: sec-%typedarray%.from description: > Throws a TypeError if argument is a Symbol info: | - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). + + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, Symbol, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/from/nan-conversion.js b/test/built-ins/TypedArrayConstructors/from/nan-conversion.js index 6c01a614aa..68fcdb4917 100644 --- a/test/built-ins/TypedArrayConstructors/from/nan-conversion.js +++ b/test/built-ins/TypedArrayConstructors/from/nan-conversion.js @@ -5,12 +5,20 @@ esid: sec-%typedarray%.from description: > Test NaN conversions info: | - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 3. Let numValue be ? ToNumber(value). - ... + IntegerIndexedElementSet ( O, index, value ) + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) includes: [testTypedArray.js] diff --git a/test/built-ins/TypedArrayConstructors/from/source-value-is-symbol-throws.js b/test/built-ins/TypedArrayConstructors/from/source-value-is-symbol-throws.js index 58654b4694..75970650a4 100644 --- a/test/built-ins/TypedArrayConstructors/from/source-value-is-symbol-throws.js +++ b/test/built-ins/TypedArrayConstructors/from/source-value-is-symbol-throws.js @@ -5,11 +5,21 @@ esid: sec-%typedarray%.from description: > Throws a TypeError if argument is a Symbol info: | - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/desc-value-throws.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/desc-value-throws.js index d4dbc72679..aa9c1bbb92 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/desc-value-throws.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/desc-value-throws.js @@ -16,11 +16,23 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). + + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js index 893787aaed..c21fea4ba3 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer-realm.js @@ -17,11 +17,20 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). Let buffer be O.[[ViewedArrayBuffer]]. - If IsDetachedBuffer(buffer) is true, return false. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). includes: [testBigIntTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, cross-realm, Reflect, TypedArray] diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js index 570222d551..d591ea7250 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer.js @@ -16,12 +16,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). Let buffer be O.[[ViewedArrayBuffer]]. - If IsDetachedBuffer(buffer) is true, return false. - ... + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). + includes: [testBigIntTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/set-value.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/set-value.js index 1bcba5b21f..64a850bdd6 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/set-value.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/set-value.js @@ -16,11 +16,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - 16. Return true. includes: [testBigIntTypedArray.js] features: [BigInt, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js index 25a98e9bf7..4e74f0cfe9 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/tonumber-value-detached-buffer.js @@ -19,11 +19,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, numericIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - 16. Return true. includes: [testBigIntTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation.js index a496517eaf..0a3472e4ba 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/conversion-operation.js @@ -18,11 +18,20 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/desc-value-throws.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/desc-value-throws.js index 6572c1f946..ecfcee533d 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/desc-value-throws.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/desc-value-throws.js @@ -16,11 +16,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm.js index 4600e937e6..a5dd563ebc 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer-realm.js @@ -17,12 +17,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). Let buffer be O.[[ViewedArrayBuffer]]. - If IsDetachedBuffer(buffer) is true, return false. - ... + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). + includes: [testTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, cross-realm, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js index c32da9586f..f58dcdfe35 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer.js @@ -16,12 +16,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). Let buffer be O.[[ViewedArrayBuffer]]. - If IsDetachedBuffer(buffer) is true, return false. - ... + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). + includes: [testTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/set-value.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/set-value.js index ff71bee907..fe155ced1b 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/set-value.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/set-value.js @@ -16,11 +16,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, intIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - 16. Return true. includes: [testTypedArray.js] features: [Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js index 25ffb73c77..19d989d500 100644 --- a/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js +++ b/test/built-ins/TypedArrayConstructors/internals/DefineOwnProperty/tonumber-value-detached-buffer.js @@ -20,11 +20,21 @@ info: | 2. Return ? IntegerIndexedElementSet(O, numericIndex, value). ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - 16. Return true. includes: [testTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm.js index a95988e8d7..ecf27052bc 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/detached-buffer-realm.js @@ -12,7 +12,8 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/indexed-value.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/indexed-value.js index ee77663da3..0b1994182d 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/indexed-value.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/indexed-value.js @@ -11,14 +11,10 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - 16. Return true. includes: [testBigIntTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js index 32040d9f17..52bb09a3f7 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-minus-zero.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > - Returns false if index is -0 + Returns true, even if index is -0 info: | [[Set]] ( P, V, Receiver) @@ -11,19 +11,14 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - - IntegerIndexedElementSet ( O, index, value ) - - 5. If arrayTypeName is "BigUint64Array" or "BigInt64Array", let numValue be ? ToBigInt(value). - ... - 10. If index = -0, return false. includes: [testBigIntTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n]); - assert.sameValue(Reflect.set(sample, '-0', 1n), false, 'Reflect.set("new TA([42n])", "-0", 1n) must return false'); + assert.sameValue(Reflect.set(sample, '-0', 1n), true, 'Reflect.set("new TA([42n])", "-0", 1n) must return true'); assert.sameValue(sample.hasOwnProperty('-0'), false, 'sample.hasOwnProperty("-0") must return false'); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js index 80b4d042a0..50596494ed 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-not-integer.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > - Returns false if index is not integer + Returns true, even if index is not CanonicalNumericIndexString info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -11,25 +11,21 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 6. If IsInteger(index) is false, return false. - ... includes: [testBigIntTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n]); - assert.sameValue(Reflect.set(sample, '1.1', 1n), false, 'Reflect.set("new TA([42n])", "1.1", 1n) must return false'); + assert.sameValue(Reflect.set(sample, '1.1', 1n), true, 'Reflect.set("new TA([42n])", "1.1", 1n) must return true'); assert.sameValue( Reflect.set(sample, '0.0001', 1n), - false, - 'Reflect.set("new TA([42n])", "0.0001", 1n) must return false' + true, + 'Reflect.set("new TA([42n])", "0.0001", 1n) must return true' ); assert.sameValue(sample.hasOwnProperty('1.1'), false, 'sample.hasOwnProperty("1.1") must return false'); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js index 2f31fb83a9..0dc4499847 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/key-is-out-of-bounds.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > - Returns false if index is out of bounds + Returns true, even if index is out of bounds info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -11,10 +11,11 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + 9.4.5.11 IntegerIndexedElementSet ( O, index, value ) ... 8. Let length be the value of O's [[ArrayLength]] internal slot. @@ -25,9 +26,9 @@ features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, Ty ---*/ testWithBigIntTypedArrayConstructors(function(TA) { var sample = new TA([42n]); - assert.sameValue(Reflect.set(sample, '-1', 1n), false, 'Reflect.set("new TA([42n])", "-1", 1n) must return false'); - assert.sameValue(Reflect.set(sample, '1', 1n), false, 'Reflect.set("new TA([42n])", "1", 1n) must return false'); - assert.sameValue(Reflect.set(sample, '2', 1n), false, 'Reflect.set("new TA([42n])", "2", 1n) must return false'); + assert.sameValue(Reflect.set(sample, '-1', 1n), true, 'Reflect.set("new TA([42n])", "-1", 1n) must return false'); + assert.sameValue(Reflect.set(sample, '1', 1n), true, 'Reflect.set("new TA([42n])", "1", 1n) must return false'); + assert.sameValue(Reflect.set(sample, '2', 1n), true, 'Reflect.set("new TA([42n])", "2", 1n) must return false'); assert.sameValue(sample.hasOwnProperty('-1'), false, 'sample.hasOwnProperty("-1") must return false'); assert.sameValue(sample.hasOwnProperty('1'), false, 'sample.hasOwnProperty("1") must return false'); assert.sameValue(sample.hasOwnProperty('2'), false, 'sample.hasOwnProperty("2") must return false'); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js index 3e8c5268ee..a72877157f 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-detached-buffer.js @@ -5,7 +5,8 @@ esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > Setting a typed array element to a value that, when converted to the typed - array element type, detaches the typed array's underlying buffer, should return false. + array element type, detaches the typed array's underlying buffer, + will always return true. info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -13,31 +14,25 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - Assert: O is an Integer-Indexed exotic object. - Assert: Type(index) is Number. - If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). - Otherwise, let numValue be ? ToNumber(value). - Let buffer be O.[[ViewedArrayBuffer]]. - If IsDetachedBuffer(buffer) is true, return false. - includes: [testBigIntTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, BigInt, Reflect, TypedArray] ---*/ testWithBigIntTypedArrayConstructors(function(TA) { let ta = new TA(1); + let isDetached = false; let result = Reflect.set(ta, 0, { valueOf() { $DETACHBUFFER(ta.buffer); + isDetached = true; return 42n; } }); - assert.sameValue(result, false); + assert.sameValue(result, true); assert.sameValue(ta[0], undefined); + assert.sameValue(isDetached, true); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-throws.js b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-throws.js index f6bbcf6d94..5f4230839b 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-throws.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/BigInt/tonumber-value-throws.js @@ -11,7 +11,8 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js b/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js index 87814f9aa5..cfc365def7 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation-consistent-nan.js @@ -15,15 +15,24 @@ info: | 2. If Type(P) is String, then ... b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - #sec-integerindexedelementset IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). #sec-setvalueinbuffer SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation.js b/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation.js index e53c5fd1f7..abea3ce6ff 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/conversion-operation.js @@ -12,14 +12,24 @@ info: | 2. If Type(P) is String, then ... b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm.js b/test/built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm.js index e2cb371824..82732c41fa 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/detached-buffer-realm.js @@ -12,7 +12,8 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/indexed-value.js b/test/built-ins/TypedArrayConstructors/internals/Set/indexed-value.js index 65f93af058..205ddedbcf 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/indexed-value.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/indexed-value.js @@ -11,14 +11,25 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 15. Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue). - 16. Return true. includes: [testTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js index 31762ecc30..30c54b706f 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-minus-zero.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > - Returns false if index is -0 + Returns true, even if index is -0 info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -11,14 +11,10 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 7. If index = -0, return false. - ... includes: [testTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] ---*/ @@ -26,6 +22,6 @@ features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray testWithTypedArrayConstructors(function(TA) { var sample = new TA([42]); - assert.sameValue(Reflect.set(sample, "-0", 1), false, 'Reflect.set(sample, "-0", 1) must return false'); + assert.sameValue(Reflect.set(sample, "-0", 1), true, 'Reflect.set(sample, "-0", 1) must return true'); assert.sameValue(sample.hasOwnProperty("-0"), false, 'sample.hasOwnProperty("-0") must return false'); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js index a12cbdc432..c83325bb26 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-not-integer.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > - Returns false if index is not integer + Returns true, even if index is not CanonicalNumericIndexString info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -11,14 +11,10 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 6. If IsInteger(index) is false, return false. - ... includes: [testTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] ---*/ @@ -26,8 +22,8 @@ features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray testWithTypedArrayConstructors(function(TA) { var sample = new TA([42]); - assert.sameValue(Reflect.set(sample, "1.1", 1), false, 'Reflect.set(sample, "1.1", 1) must return false'); - assert.sameValue(Reflect.set(sample, "0.0001", 1), false, 'Reflect.set(sample, "0.0001", 1) must return false'); + assert.sameValue(Reflect.set(sample, "1.1", 1), true, 'Reflect.set(sample, "1.1", 1) must return true'); + assert.sameValue(Reflect.set(sample, "0.0001", 1), true, 'Reflect.set(sample, "0.0001", 1) must return true'); assert.sameValue(sample.hasOwnProperty("1.1"), false, 'sample.hasOwnProperty("1.1") must return false'); assert.sameValue( diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js index ce99ad1a26..9e0317dd6b 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/key-is-out-of-bounds.js @@ -3,7 +3,7 @@ /*--- esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > - Returns false if index is out of bounds + Returns true even if index is out of bounds info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -11,15 +11,10 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) - - ... - 8. Let length be the value of O's [[ArrayLength]] internal slot. - 9. If index < 0 or index ≥ length, return false. - ... includes: [testTypedArray.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] ---*/ @@ -27,9 +22,9 @@ features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray testWithTypedArrayConstructors(function(TA) { var sample = new TA([42]); - assert.sameValue(Reflect.set(sample, "-1", 1), false, 'Reflect.set(sample, "-1", 1) must return false'); - assert.sameValue(Reflect.set(sample, "1", 1), false, 'Reflect.set(sample, "1", 1) must return false'); - assert.sameValue(Reflect.set(sample, "2", 1), false, 'Reflect.set(sample, "2", 1) must return false'); + assert.sameValue(Reflect.set(sample, "-1", 1), true, 'Reflect.set(sample, "-1", 1) must return true'); + assert.sameValue(Reflect.set(sample, "1", 1), true, 'Reflect.set(sample, "1", 1) must return true'); + assert.sameValue(Reflect.set(sample, "2", 1), true, 'Reflect.set(sample, "2", 1) must return true'); assert.sameValue(sample.hasOwnProperty("-1"), false, 'sample.hasOwnProperty("-1") must return false'); assert.sameValue(sample.hasOwnProperty("1"), false, 'sample.hasOwnProperty("1") must return false'); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js b/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js index f734624f60..9836a2ab5c 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-detached-buffer.js @@ -5,7 +5,7 @@ esid: sec-integer-indexed-exotic-objects-set-p-v-receiver description: > Setting a typed array element to a value that, when converted to the typed - array element type, detaches the typed array's underlying buffer, should return false. + array element type, detaches the typed array's underlying buffer, will return true. info: | 9.4.5.5 [[Set]] ( P, V, Receiver) @@ -13,17 +13,24 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + 9.4.5.11 IntegerIndexedElementSet ( O, index, value ) Assert: O is an Integer-Indexed exotic object. - Assert: Type(index) is Number. If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). Otherwise, let numValue be ? ToNumber(value). Let buffer be O.[[ViewedArrayBuffer]]. - If IsDetachedBuffer(buffer) is true, return false. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). includes: [testTypedArray.js, detachArrayBuffer.js] features: [align-detached-buffer-semantics-with-web-reality, Reflect, TypedArray] @@ -38,6 +45,6 @@ testWithTypedArrayConstructors(function(TA) { } }); - assert.sameValue(result, false); + assert.sameValue(result, true); assert.sameValue(ta[0], undefined); }); diff --git a/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-throws.js b/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-throws.js index 09f43c02f6..f31ba31570 100644 --- a/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-throws.js +++ b/test/built-ins/TypedArrayConstructors/internals/Set/tonumber-value-throws.js @@ -11,7 +11,8 @@ info: | 2. If Type(P) is String, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... IntegerIndexedElementSet ( O, index, value ) diff --git a/test/built-ins/TypedArrayConstructors/of/BigInt/argument-is-symbol-throws.js b/test/built-ins/TypedArrayConstructors/of/BigInt/argument-is-symbol-throws.js index 70a7fb782a..3f99990191 100644 --- a/test/built-ins/TypedArrayConstructors/of/BigInt/argument-is-symbol-throws.js +++ b/test/built-ins/TypedArrayConstructors/of/BigInt/argument-is-symbol-throws.js @@ -5,11 +5,21 @@ esid: sec-%typedarray%.of description: > Throws a TypeError if argument is a Symbol info: | - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, Symbol, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/of/BigInt/new-instance.js b/test/built-ins/TypedArrayConstructors/of/BigInt/new-instance.js index 0e32755cf8..12b7b2ab75 100644 --- a/test/built-ins/TypedArrayConstructors/of/BigInt/new-instance.js +++ b/test/built-ins/TypedArrayConstructors/of/BigInt/new-instance.js @@ -11,14 +11,25 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testBigIntTypedArray.js] features: [BigInt, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/of/argument-is-symbol-throws.js b/test/built-ins/TypedArrayConstructors/of/argument-is-symbol-throws.js index 1138083ee3..07874ae471 100644 --- a/test/built-ins/TypedArrayConstructors/of/argument-is-symbol-throws.js +++ b/test/built-ins/TypedArrayConstructors/of/argument-is-symbol-throws.js @@ -5,11 +5,21 @@ esid: sec-%typedarray%.of description: > Throws a TypeError if argument is a Symbol info: | - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [Symbol, TypedArray] ---*/ diff --git a/test/built-ins/TypedArrayConstructors/of/nan-conversion.js b/test/built-ins/TypedArrayConstructors/of/nan-conversion.js index 4444f12860..dc12be8b70 100644 --- a/test/built-ins/TypedArrayConstructors/of/nan-conversion.js +++ b/test/built-ins/TypedArrayConstructors/of/nan-conversion.js @@ -5,11 +5,20 @@ esid: sec-%typedarray%.of description: > Test NaN conversions info: | - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) - ... - 3. Let numValue be ? ToNumber(value). - ... + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). 24.1.1.6 SetValueInBuffer ( arrayBuffer, byteIndex, type, value [ , isLittleEndian ] ) diff --git a/test/built-ins/TypedArrayConstructors/of/new-instance.js b/test/built-ins/TypedArrayConstructors/of/new-instance.js index e83ad648d9..9cbba9811f 100644 --- a/test/built-ins/TypedArrayConstructors/of/new-instance.js +++ b/test/built-ins/TypedArrayConstructors/of/new-instance.js @@ -11,14 +11,25 @@ info: | 2. If Type(P) is String and if SameValue(O, Receiver) is true, then a. Let numericIndex be ! CanonicalNumericIndexString(P). b. If numericIndex is not undefined, then - i. Return ? IntegerIndexedElementSet(O, numericIndex, V). + i. Perform ? IntegerIndexedElementSet(O, numericIndex, V). + ii. Return true. ... - 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) + IntegerIndexedElementSet ( O, index, value ) + + Assert: O is an Integer-Indexed exotic object. + If O.[[ContentType]] is BigInt, let numValue be ? ToBigInt(value). + Otherwise, let numValue be ? ToNumber(value). + Let buffer be O.[[ViewedArrayBuffer]]. + If IsDetachedBuffer(buffer) is false and ! IsValidIntegerIndex(O, index) is true, then + Let offset be O.[[ByteOffset]]. + Let arrayTypeName be the String value of O.[[TypedArrayName]]. + Let elementSize be the Element Size value specified in Table 62 for arrayTypeName. + Let indexedPosition be (ℝ(index) × elementSize) + offset. + Let elementType be the Element Type value in Table 62 for arrayTypeName. + Perform SetValueInBuffer(buffer, indexedPosition, elementType, numValue, true, Unordered). + Return NormalCompletion(undefined). - ... - 3. Let numValue be ? ToNumber(value). - ... includes: [testTypedArray.js] features: [TypedArray] ---*/