diff --git a/Libraries/LibJS/Forward.h b/Libraries/LibJS/Forward.h index 8e83869e40ca..dc9b755306f8 100644 --- a/Libraries/LibJS/Forward.h +++ b/Libraries/LibJS/Forward.h @@ -71,6 +71,7 @@ __JS_ENUMERATE(Int16Array, int16_array, Int16ArrayPrototype, Int16ArrayConstructor, i16) \ __JS_ENUMERATE(Int32Array, int32_array, Int32ArrayPrototype, Int32ArrayConstructor, i32) \ __JS_ENUMERATE(BigInt64Array, big_int64_array, BigInt64ArrayPrototype, BigInt64ArrayConstructor, i64) \ + __JS_ENUMERATE(Float16Array, float16_array, Float16ArrayPrototype, Float16ArrayConstructor, f16) \ __JS_ENUMERATE(Float32Array, float32_array, Float32ArrayPrototype, Float32ArrayConstructor, float) \ __JS_ENUMERATE(Float64Array, float64_array, Float64ArrayPrototype, Float64ArrayConstructor, double) diff --git a/Libraries/LibJS/Runtime/ArrayBuffer.h b/Libraries/LibJS/Runtime/ArrayBuffer.h index f2feae041251..057b0ce7024d 100644 --- a/Libraries/LibJS/Runtime/ArrayBuffer.h +++ b/Libraries/LibJS/Runtime/ArrayBuffer.h @@ -171,11 +171,12 @@ inline size_t array_buffer_byte_length(ArrayBuffer const& array_buffer, ArrayBuf } // 25.1.3.14 RawBytesToNumeric ( type, rawBytes, isLittleEndian ), https://tc39.es/ecma262/#sec-rawbytestonumeric +// 5 RawBytesToNumeric ( type, rawBytes, isLittleEndian ), https://tc39.es/proposal-float16array/#sec-rawbytestonumeric template static Value raw_bytes_to_numeric(VM& vm, Bytes raw_value, bool is_little_endian) { // 1. Let elementSize be the Element Size value specified in Table 70 for Element Type type. - // NOTE: Used in step 6, but not needed with our implementation of that step. + // NOTE: Used in step 7, but not needed with our implementation of that step. // 2. If isLittleEndian is false, reverse the order of the elements of rawBytes. if (!is_little_endian) { @@ -184,8 +185,23 @@ static Value raw_bytes_to_numeric(VM& vm, Bytes raw_value, bool is_little_endian swap(raw_value[i], raw_value[raw_value.size() - 1 - i]); } - // 3. If type is Float32, then using UnderlyingBufferDataType = Conditional, u8, T>; + + // 3. If type is Float16, then + if constexpr (IsSame) { + // a. Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2019 binary16 value. + f16 value; + raw_value.copy_to({ &value, sizeof(f16) }); + + // b. If value is an IEEE 754-2019 binary16 NaN value, return the NaN Number value. + if (isnan(static_cast(value))) + return js_nan(); + + // c. Return the Number value that corresponds to value. + return Value(value); + } + + // 4. If type is Float32, then if constexpr (IsSame) { // a. Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2019 binary32 value. float value; @@ -199,7 +215,7 @@ static Value raw_bytes_to_numeric(VM& vm, Bytes raw_value, bool is_little_endian return Value(value); } - // 4. If type is Float64, then + // 5. If type is Float64, then if constexpr (IsSame) { // a. Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2019 binary64 value. double value; @@ -217,16 +233,16 @@ static Value raw_bytes_to_numeric(VM& vm, Bytes raw_value, bool is_little_endian if constexpr (!IsIntegral) VERIFY_NOT_REACHED(); - // 5. If IsUnsignedElementType(type) is true, then + // 6. If IsUnsignedElementType(type) is true, then // a. Let intValue be the byte elements of rawBytes concatenated and interpreted as a bit string encoding of an unsigned little-endian binary number. - // 6. Else, + // 7. Else, // a. Let intValue be the byte elements of rawBytes concatenated and interpreted as a bit string encoding of a binary little-endian two's complement number of bit length elementSize × 8. // // NOTE: The signed/unsigned logic above is implemented in step 7 by the IsSigned<> check, and in step 8 by JS::Value constructor overloads. UnderlyingBufferDataType int_value = 0; raw_value.copy_to({ &int_value, sizeof(UnderlyingBufferDataType) }); - // 7. If IsBigIntElementType(type) is true, return the BigInt value that corresponds to intValue. + // 8. If IsBigIntElementType(type) is true, return the BigInt value that corresponds to intValue. if constexpr (sizeof(UnderlyingBufferDataType) == 8) { if constexpr (IsSigned) { static_assert(IsSame); @@ -236,7 +252,7 @@ static Value raw_bytes_to_numeric(VM& vm, Bytes raw_value, bool is_little_endian return BigInt::create(vm, Crypto::SignedBigInteger { Crypto::UnsignedBigInteger { int_value } }); } } - // 8. Otherwise, return the Number value that corresponds to intValue. + // 9. Otherwise, return the Number value that corresponds to intValue. else { return Value(int_value); } @@ -289,6 +305,7 @@ Value ArrayBuffer::get_value(size_t byte_index, [[maybe_unused]] bool is_typed_a } // 25.1.3.17 NumericToRawBytes ( type, value, isLittleEndian ), https://tc39.es/ecma262/#sec-numerictorawbytes +// 6 NumericToRawBytes ( type, value, isLittleEndian ), https://tc39.es/proposal-float16array/#sec-numerictorawbytes template static void numeric_to_raw_bytes(VM& vm, Value value, bool is_little_endian, Bytes raw_bytes) { @@ -302,6 +319,12 @@ static void numeric_to_raw_bytes(VM& vm, Value value, bool is_little_endian, Byt for (size_t i = 0; i < sizeof(UnderlyingBufferDataType) / 2; ++i) swap(raw_bytes[i], raw_bytes[sizeof(UnderlyingBufferDataType) - 1 - i]); }; + if constexpr (IsSame) { + auto raw_value = static_cast(MUST(value.to_double(vm))); + ReadonlyBytes { &raw_value, sizeof(f16) }.copy_to(raw_bytes); + flip_if_needed(); + return; + } if constexpr (IsSame) { float raw_value = MUST(value.to_double(vm)); ReadonlyBytes { &raw_value, sizeof(float) }.copy_to(raw_bytes); diff --git a/Libraries/LibJS/Runtime/CommonPropertyNames.h b/Libraries/LibJS/Runtime/CommonPropertyNames.h index 591da6f5cd18..e7c7872d53af 100644 --- a/Libraries/LibJS/Runtime/CommonPropertyNames.h +++ b/Libraries/LibJS/Runtime/CommonPropertyNames.h @@ -223,6 +223,7 @@ namespace JS { P(fromEpochSeconds) \ P(fromHex) \ P(fround) \ + P(f16round) \ P(gc) \ P(get) \ P(getBigInt64) \ @@ -232,6 +233,7 @@ namespace JS { P(getCollations) \ P(getDate) \ P(getDay) \ + P(getFloat16) \ P(getFloat32) \ P(getFloat64) \ P(getFullYear) \ @@ -464,6 +466,7 @@ namespace JS { P(setBigInt64) \ P(setBigUint64) \ P(setDate) \ + P(setFloat16) \ P(setFloat32) \ P(setFloat64) \ P(setFromBase64) \ diff --git a/Libraries/LibJS/Runtime/DataViewPrototype.cpp b/Libraries/LibJS/Runtime/DataViewPrototype.cpp index 5ef52e3df75e..f190b346d371 100644 --- a/Libraries/LibJS/Runtime/DataViewPrototype.cpp +++ b/Libraries/LibJS/Runtime/DataViewPrototype.cpp @@ -26,6 +26,7 @@ void DataViewPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.getBigInt64, get_big_int_64, 1, attr); define_native_function(realm, vm.names.getBigUint64, get_big_uint_64, 1, attr); + define_native_function(realm, vm.names.getFloat16, get_float_16, 1, attr); define_native_function(realm, vm.names.getFloat32, get_float_32, 1, attr); define_native_function(realm, vm.names.getFloat64, get_float_64, 1, attr); define_native_function(realm, vm.names.getInt8, get_int_8, 1, attr); @@ -36,6 +37,7 @@ void DataViewPrototype::initialize(Realm& realm) define_native_function(realm, vm.names.getUint32, get_uint_32, 1, attr); define_native_function(realm, vm.names.setBigInt64, set_big_int_64, 2, attr); define_native_function(realm, vm.names.setBigUint64, set_big_uint_64, 2, attr); + define_native_function(realm, vm.names.setFloat16, set_float_16, 2, attr); define_native_function(realm, vm.names.setFloat32, set_float_32, 2, attr); define_native_function(realm, vm.names.setFloat64, set_float_64, 2, attr); define_native_function(realm, vm.names.setInt8, set_int_8, 2, attr); @@ -236,6 +238,15 @@ JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_big_uint_64) return get_view_value(vm, vm.argument(0), vm.argument(1)); } +// 7.1 DataView.prototype.getFloat16 ( byteOffset [ , littleEndian ] ), https://tc39.es/proposal-float16array/#sec-dataview.prototype.getfloat16 +JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_float_16) +{ + // 1. Let v be the this value. + // 2. If littleEndian is not present, set littleEndian to false. + // 3. Return ? GetViewValue(v, byteOffset, littleEndian, Float16). + return get_view_value(vm, vm.argument(0), vm.argument(1)); +} + // 25.3.4.7 DataView.prototype.getFloat32 ( byteOffset [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.getfloat32 JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::get_float_32) { @@ -322,6 +333,15 @@ JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_big_uint_64) return set_view_value(vm, vm.argument(0), vm.argument(2), vm.argument(1)); } +// 7.2 DataView.prototype.setFloat16 ( byteOffset, value [ , littleEndian ] ), https://tc39.es/proposal-float16array/#sec-dataview.prototype.setfloat16 +JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_float_16) +{ + // 1. Let v be the this value. + // 2. If littleEndian is not present, set littleEndian to false. + // 3. Return ? SetViewValue(v, byteOffset, littleEndian, Float16, value). + return set_view_value(vm, vm.argument(0), vm.argument(2), vm.argument(1)); +} + // 25.3.4.17 DataView.prototype.setFloat32 ( byteOffset, value [ , littleEndian ] ), https://tc39.es/ecma262/#sec-dataview.prototype.setfloat32 JS_DEFINE_NATIVE_FUNCTION(DataViewPrototype::set_float_32) { diff --git a/Libraries/LibJS/Runtime/DataViewPrototype.h b/Libraries/LibJS/Runtime/DataViewPrototype.h index 3173ab7a808e..184a0717595e 100644 --- a/Libraries/LibJS/Runtime/DataViewPrototype.h +++ b/Libraries/LibJS/Runtime/DataViewPrototype.h @@ -24,6 +24,7 @@ class DataViewPrototype final : public PrototypeObject Value { return realm.intrinsics().error_constructor(); }); global.define_intrinsic_accessor(vm.names.EvalError, attr, [](auto& realm) -> Value { return realm.intrinsics().eval_error_constructor(); }); global.define_intrinsic_accessor(vm.names.FinalizationRegistry, attr, [](auto& realm) -> Value { return realm.intrinsics().finalization_registry_constructor(); }); + global.define_intrinsic_accessor(vm.names.Float16Array, attr, [](auto& realm) -> Value { return realm.intrinsics().float16_array_constructor(); }); global.define_intrinsic_accessor(vm.names.Float32Array, attr, [](auto& realm) -> Value { return realm.intrinsics().float32_array_constructor(); }); global.define_intrinsic_accessor(vm.names.Float64Array, attr, [](auto& realm) -> Value { return realm.intrinsics().float64_array_constructor(); }); global.define_intrinsic_accessor(vm.names.Function, attr, [](auto& realm) -> Value { return realm.intrinsics().function_constructor(); }); diff --git a/Libraries/LibJS/Runtime/MathObject.cpp b/Libraries/LibJS/Runtime/MathObject.cpp index 47705d303da3..e588c762b1bb 100644 --- a/Libraries/LibJS/Runtime/MathObject.cpp +++ b/Libraries/LibJS/Runtime/MathObject.cpp @@ -56,6 +56,7 @@ void MathObject::initialize(Realm& realm) define_native_function(realm, vm.names.cbrt, cbrt, 1, attr); define_native_function(realm, vm.names.atan2, atan2, 2, attr); define_native_function(realm, vm.names.fround, fround, 1, attr); + define_native_function(realm, vm.names.f16round, f16round, 1, attr); define_native_function(realm, vm.names.hypot, hypot, 2, attr); define_native_function(realm, vm.names.imul, imul, 2, attr); define_native_function(realm, vm.names.log, log, 1, attr, Bytecode::Builtin::MathLog); @@ -513,6 +514,26 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::fround) return Value((float)number.as_double()); } +// 3.1 Math.f16round ( x ), https://tc39.es/proposal-float16array/#sec-math.f16round +JS_DEFINE_NATIVE_FUNCTION(MathObject::f16round) +{ + // 1. Let n be ? ToNumber(x). + auto number = TRY(vm.argument(0).to_number(vm)); + + // 2. If n is NaN, return NaN. + if (number.is_nan()) + return js_nan(); + + // 3. If n is one of +0𝔽, -0𝔽, +∞𝔽, or -∞𝔽, return n. + if (number.as_double() == 0 || number.is_infinity()) + return number; + + // 4. Let n16 be the result of converting n to IEEE 754-2019 binary16 format using roundTiesToEven mode. + // 5. Let n64 be the result of converting n16 to IEEE 754-2019 binary64 format. + // 6. Return the ECMAScript Number value corresponding to n64. + return Value(static_cast(number.as_double())); +} + // 21.3.2.18 Math.hypot ( ...args ), https://tc39.es/ecma262/#sec-math.hypot JS_DEFINE_NATIVE_FUNCTION(MathObject::hypot) { diff --git a/Libraries/LibJS/Runtime/MathObject.h b/Libraries/LibJS/Runtime/MathObject.h index 57598d189c66..14dfb79ba6d8 100644 --- a/Libraries/LibJS/Runtime/MathObject.h +++ b/Libraries/LibJS/Runtime/MathObject.h @@ -57,6 +57,7 @@ class MathObject final : public Object { JS_DECLARE_NATIVE_FUNCTION(cbrt); JS_DECLARE_NATIVE_FUNCTION(atan2); JS_DECLARE_NATIVE_FUNCTION(fround); + JS_DECLARE_NATIVE_FUNCTION(f16round); JS_DECLARE_NATIVE_FUNCTION(hypot); JS_DECLARE_NATIVE_FUNCTION(imul); JS_DECLARE_NATIVE_FUNCTION(log); diff --git a/Libraries/LibJS/Runtime/Value.h b/Libraries/LibJS/Runtime/Value.h index 3d736a3ff2e3..11e0fa6ff12a 100644 --- a/Libraries/LibJS/Runtime/Value.h +++ b/Libraries/LibJS/Runtime/Value.h @@ -223,6 +223,11 @@ class Value { } } + explicit Value(f16 value) + : Value(static_cast(value)) + { + } + // NOTE: A couple of integral types are excluded here: // - i32 has its own dedicated Value constructor // - i64 cannot safely be cast to a double diff --git a/Libraries/LibJS/Tests/builtins/Math/Math.f16round.js b/Libraries/LibJS/Tests/builtins/Math/Math.f16round.js new file mode 100644 index 000000000000..1d83ef0d9ace --- /dev/null +++ b/Libraries/LibJS/Tests/builtins/Math/Math.f16round.js @@ -0,0 +1,8 @@ +test("basic functionality", () => { + expect(Math.f16round).toHaveLength(1); + + expect(Math.f16round(5.5)).toBe(5.5); + expect(Math.f16round(5.05)).toBe(5.05078125); + expect(Math.f16round(5)).toBe(5); + expect(Math.f16round(-5.05)).toBe(-5.05078125); +}); diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js index 19e19b388264..7293789d8e41 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.BYTES_PER_ELEMENT.js @@ -8,6 +8,7 @@ test("basic functionality", () => { expect(Int16Array.BYTES_PER_ELEMENT).toBe(2); expect(Int32Array.BYTES_PER_ELEMENT).toBe(4); expect(BigInt64Array.BYTES_PER_ELEMENT).toBe(8); + expect(Float16Array.BYTES_PER_ELEMENT).toBe(2); expect(Float32Array.BYTES_PER_ELEMENT).toBe(4); expect(Float64Array.BYTES_PER_ELEMENT).toBe(8); }); diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.from.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.from.js index 20bf2942120e..2f937953794d 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.from.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.from.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js index 454a9adc3156..8450fa74c3cf 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; @@ -185,8 +186,9 @@ test("typed array from TypedArray element cast", () => { [0x100, 0xff], [0x100, 0xff], [0x100, 0xff], + [0x100, 0xff], ]; - const u8Expected = [0xff, 0xff, 0xff, 0xff, -1, 0xff, 0xff, 0xff, 0xff]; + const u8Expected = [0xff, 0xff, 0xff, 0xff, -1, 0xff, 0xff, 0xff, 0xff, 0xff]; TYPED_ARRAYS.forEach((T, i) => { const newArrFromU32 = new T(u32Array); diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.of.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.of.js index 7246b1833ded..791fb2f21e55 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.of.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.of.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.@@iterator.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.@@iterator.js index 049733c57473..f1b6ff831a81 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.@@iterator.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.@@iterator.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.BYTES_PER_ELEMENT.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.BYTES_PER_ELEMENT.js index bc029b7e7a69..733be9318664 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.BYTES_PER_ELEMENT.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.BYTES_PER_ELEMENT.js @@ -8,6 +8,7 @@ const TYPED_ARRAYS = [ { array: Int16Array, expected: 2 }, { array: Int32Array, expected: 4 }, { array: BigInt64Array, expected: 8 }, + { array: Float16Array, expected: 2 }, { array: Float32Array, expected: 4 }, { array: Float64Array, expected: 8 }, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.at.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.at.js index fecc0991490b..ceb08e2287bd 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.at.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.at.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.buffer.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.buffer.js index 779932bc1879..8a8c51318d87 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.buffer.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.buffer.js @@ -8,6 +8,7 @@ const TYPED_ARRAYS = [ Int16Array, Int32Array, BigInt64Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteLength.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteLength.js index 0bbbbf85c587..c6b0566f33be 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteLength.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteLength.js @@ -8,6 +8,7 @@ const TYPED_ARRAYS = [ { array: Int16Array, expected: 6 }, { array: Int32Array, expected: 12 }, { array: BigInt64Array, expected: 24 }, + { array: Float16Array, expected: 6 }, { array: Float32Array, expected: 12 }, { array: Float64Array, expected: 24 }, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteOffset.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteOffset.js index 4ca9e0ca4906..3d7078296826 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteOffset.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.byteOffset.js @@ -8,6 +8,7 @@ const TYPED_ARRAYS = [ Int16Array, Int32Array, BigInt64Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.copyWithin.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.copyWithin.js index 9d9ab1e07893..7d2ad7e84747 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.copyWithin.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.copyWithin.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.entries.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.entries.js index b396e948f8fe..81dfa0871c0a 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.entries.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.entries.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js index 49e7f02cd7a2..ae7a6ef2b39e 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.every.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.fill.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.fill.js index af97b5daa3ba..64d0130a11db 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.fill.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.fill.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js index 01e9a2c629d7..bea0a5f62ceb 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.filter.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js index 139a7653f0eb..1270c9e34c9b 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.find.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js index 74ab4932efdd..15a3cebcfffb 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findIndex.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js index 6cc154187175..77f27a2dd64c 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLast.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js index 545dea582be1..70b2c84dc5e6 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.findLastIndex.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js index c860c92211fa..bce4b55b32fd 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.forEach.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.includes.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.includes.js index dc36fd834ca5..b2e2830fdfe0 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.includes.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.includes.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.indexOf.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.indexOf.js index d9cb8b67e33a..7bf85332384d 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.indexOf.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.indexOf.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.keys.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.keys.js index fc5169bccbb4..c1ff00e81ee5 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.keys.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.keys.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.lastIndexOf.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.lastIndexOf.js index eea71f314620..0682acb7154e 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.lastIndexOf.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.lastIndexOf.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js index 3868a74fca07..4ca664e8259f 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.length.js @@ -8,6 +8,7 @@ const TYPED_ARRAYS = [ Int16Array, Int32Array, BigInt64Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js index cd4bd2ae54b9..7f565cab0607 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.map.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduce.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduce.js index 66441d17f0d8..166e906ba1d3 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduce.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduce.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduceRight.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduceRight.js index f4d804b0d168..e8ff6eb7d6f8 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduceRight.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reduceRight.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reverse.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reverse.js index 5cc9963f7d5b..681104dffcc1 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reverse.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.reverse.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.set.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.set.js index bf2fc3e78930..7c29185665dc 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.set.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.set.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ { array: Int8Array, maxUnsignedInteger: 2 ** 7 - 1 }, { array: Int16Array, maxUnsignedInteger: 2 ** 15 - 1 }, { array: Int32Array, maxUnsignedInteger: 2 ** 31 - 1 }, + { array: Float16Array, maxUnsignedInteger: 2 ** 11 - 1 }, { array: Float32Array, maxUnsignedInteger: 2 ** 24 - 1 }, { array: Float64Array, maxUnsignedInteger: Number.MAX_SAFE_INTEGER }, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.slice.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.slice.js index dc37d980be3d..952a86866a64 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.slice.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.slice.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js index 756179b71d00..c5e232b22241 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.some.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.sort.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.sort.js index 9cb7e537c8f2..3c44ca379736 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.sort.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.sort.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.subarray.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.subarray.js index 875371986937..7d83f49377d6 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.subarray.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.subarray.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toLocaleString.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toLocaleString.js index 21c27ad03096..8a61e304a8bf 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toLocaleString.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toLocaleString.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toReversed.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toReversed.js index a160a1d8935f..1ec6f9303845 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toReversed.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toReversed.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toSorted.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toSorted.js index 69ca98b1b865..d2a4a2d3988f 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toSorted.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.toSorted.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.values.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.values.js index 18c702e4e228..88e5b29aaf9c 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.values.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.values.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ]; diff --git a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.with.js b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.with.js index f7c13e8e235f..51870749c10b 100644 --- a/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.with.js +++ b/Libraries/LibJS/Tests/builtins/TypedArray/TypedArray.prototype.with.js @@ -6,6 +6,7 @@ const TYPED_ARRAYS = [ Int8Array, Int16Array, Int32Array, + Float16Array, Float32Array, Float64Array, ];