Skip to content

Commit 4cd3d98

Browse files
committed
lib: use Float16Array from primordials
PR-URL: #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>
1 parent 82c2521 commit 4cd3d98

5 files changed

Lines changed: 9 additions & 14 deletions

File tree

lib/eslint.config_partial.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,6 @@ export default [
412412
name: 'SubtleCrypto',
413413
message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.",
414414
},
415-
// Float16Array is not available in primordials because it can be
416-
// disabled with --no-js-float16array CLI flag.
417-
{
418-
name: 'Float16Array',
419-
message: 'Use `const { Float16Array } = globalThis;` instead of the global.',
420-
},
421415
// DisposableStack and AsyncDisposableStack are not available in primordials because they can be
422416
// disabled with --no-js-explicit-resource-management CLI flag.
423417
{
@@ -478,6 +472,7 @@ export default [
478472
name: 'FinalizationRegistry',
479473
into: 'Safe',
480474
},
475+
{ name: 'Float16Array' },
481476
{ name: 'Float32Array' },
482477
{ name: 'Float64Array' },
483478
{ name: 'Function' },

lib/internal/freeze_intrinsics.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const {
5454
EvalErrorPrototype,
5555
FinalizationRegistry,
5656
FinalizationRegistryPrototype,
57+
Float16Array,
58+
Float16ArrayPrototype,
5759
Float32Array,
5860
Float32ArrayPrototype,
5961
Float64Array,
@@ -196,6 +198,7 @@ module.exports = function() {
196198
Uint16ArrayPrototype,
197199
Int32ArrayPrototype,
198200
Uint32ArrayPrototype,
201+
Float16ArrayPrototype,
199202
Float32ArrayPrototype,
200203
Float64ArrayPrototype,
201204
BigInt64ArrayPrototype,
@@ -296,6 +299,7 @@ module.exports = function() {
296299
Uint16Array,
297300
Int32Array,
298301
Uint32Array,
302+
Float16Array,
299303
Float32Array,
300304
Float64Array,
301305
BigInt64Array,

lib/internal/per_context/primordials.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ function copyPrototype(src, dest, prefix) {
196196
'Error',
197197
'EvalError',
198198
'FinalizationRegistry',
199+
'Float16Array',
199200
'Float32Array',
200201
'Float64Array',
201202
'Function',

lib/internal/util/comparisons.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const {
1515
Date,
1616
DatePrototypeGetTime,
1717
Error,
18+
Float16Array,
1819
Float32Array,
1920
Float64Array,
2021
Function,
@@ -50,7 +51,6 @@ const {
5051
Uint8ClampedArray,
5152
WeakMap,
5253
WeakSet,
53-
globalThis: { Float16Array },
5454
} = primordials;
5555

5656
const { compare } = internalBinding('buffer');
@@ -70,6 +70,7 @@ const wellKnownConstructors = new SafeSet()
7070
.add(DataView)
7171
.add(Date)
7272
.add(Error)
73+
.add(Float16Array)
7374
.add(Float32Array)
7475
.add(Float64Array)
7576
.add(Function)
@@ -91,10 +92,6 @@ const wellKnownConstructors = new SafeSet()
9192
.add(WeakMap)
9293
.add(WeakSet);
9394

94-
if (Float16Array) { // TODO(BridgeAR): Remove when Flag got removed from V8
95-
wellKnownConstructors.add(Float16Array);
96-
}
97-
9895
const types = require('internal/util/types');
9996
const {
10097
isAnyArrayBuffer,

lib/v8.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const {
2020
BigUint64Array,
2121
DataView,
2222
Error,
23+
Float16Array,
2324
Float32Array,
2425
Float64Array,
2526
Int16Array,
@@ -32,9 +33,6 @@ const {
3233
Uint32Array,
3334
Uint8Array,
3435
Uint8ClampedArray,
35-
globalThis: {
36-
Float16Array,
37-
},
3836
} = primordials;
3937

4038
const { Buffer } = require('buffer');

0 commit comments

Comments
 (0)