lib: use Float16Array from primordials

PR-URL: https://github.com/nodejs/node/pull/65702
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
Antoine du Hamel committed 2026-09-03 11:48:46 +02:00
1 parent 82c252172d
commit 4cd3d98510
5 files changed
+9 -14

No files matched your search

+1 -6
View File
@@ -412,12 +412,6 @@ export default [
name: 'SubtleCrypto',
message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.",
},
// Float16Array is not available in primordials because it can be
// disabled with --no-js-float16array CLI flag.
{
name: 'Float16Array',
message: 'Use `const { Float16Array } = globalThis;` instead of the global.',
},
// DisposableStack and AsyncDisposableStack are not available in primordials because they can be
// disabled with --no-js-explicit-resource-management CLI flag.
{
@@ -478,6 +472,7 @@ export default [
name: 'FinalizationRegistry',
into: 'Safe',
},
{ name: 'Float16Array' },
{ name: 'Float32Array' },
{ name: 'Float64Array' },
{ name: 'Function' },
+4
View File
@@ -54,6 +54,8 @@ const {
EvalErrorPrototype,
FinalizationRegistry,
FinalizationRegistryPrototype,
Float16Array,
Float16ArrayPrototype,
Float32Array,
Float32ArrayPrototype,
Float64Array,
@@ -196,6 +198,7 @@ module.exports = function() {
Uint16ArrayPrototype,
Int32ArrayPrototype,
Uint32ArrayPrototype,
Float16ArrayPrototype,
Float32ArrayPrototype,
Float64ArrayPrototype,
BigInt64ArrayPrototype,
@@ -296,6 +299,7 @@ module.exports = function() {
Uint16Array,
Int32Array,
Uint32Array,
Float16Array,
Float32Array,
Float64Array,
BigInt64Array,
+1
View File
@@ -196,6 +196,7 @@ function copyPrototype(src, dest, prefix) {
'Error',
'EvalError',
'FinalizationRegistry',
'Float16Array',
'Float32Array',
'Float64Array',
'Function',
+2 -5
View File
@@ -15,6 +15,7 @@ const {
Date,
DatePrototypeGetTime,
Error,
Float16Array,
Float32Array,
Float64Array,
Function,
@@ -50,7 +51,6 @@ const {
Uint8ClampedArray,
WeakMap,
WeakSet,
globalThis: { Float16Array },
} = primordials;
const { compare } = internalBinding('buffer');
@@ -70,6 +70,7 @@ const wellKnownConstructors = new SafeSet()
.add(DataView)
.add(Date)
.add(Error)
.add(Float16Array)
.add(Float32Array)
.add(Float64Array)
.add(Function)
@@ -91,10 +92,6 @@ const wellKnownConstructors = new SafeSet()
.add(WeakMap)
.add(WeakSet);
if (Float16Array) { // TODO(BridgeAR): Remove when Flag got removed from V8
wellKnownConstructors.add(Float16Array);
}
const types = require('internal/util/types');
const {
isAnyArrayBuffer,
+1 -3
View File
@@ -20,6 +20,7 @@ const {
BigUint64Array,
DataView,
Error,
Float16Array,
Float32Array,
Float64Array,
Int16Array,
@@ -32,9 +33,6 @@ const {
Uint32Array,
Uint8Array,
Uint8ClampedArray,
globalThis: {
Float16Array,
},
} = primordials;
const { Buffer } = require('buffer');