lib: handle Float16Array in node:v8 serdes · nodejs/node@889094f · GitHub
Skip to content

Commit 889094f

Browse files
bartlomiejuaduh95
authored andcommitted
lib: handle Float16Array in node:v8 serdes
PR-URL: #55996 Fixes: #55574 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
1 parent a6f0cfa commit 889094f

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

lib/eslint.config_partial.mjs

Lines changed: 5 additions & 0 deletions

lib/v8.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ const {
3131
Uint32Array,
3232
Uint8Array,
3333
Uint8ClampedArray,
34+
globalThis: {
35+
Float16Array,
36+
},
3437
} = primordials;
3538

3639
const { Buffer } = require('buffer');
@@ -63,6 +66,7 @@ const {
6366
} = require('internal/heap_utils');
6467
const promiseHooks = require('internal/promise_hooks');
6568
const { getOptionValue } = require('internal/options');
69+
6670
/**
6771
* Generates a snapshot of the current V8 heap
6872
* and writes it to a JSON file.
@@ -289,6 +293,7 @@ function arrayBufferViewTypeToIndex(abView) {
289293
// Index 10 is FastBuffer.
290294
if (type === '[object BigInt64Array]') return 11;
291295
if (type === '[object BigUint64Array]') return 12;
296+
if (type === '[object Float16Array]') return 13;
292297
return -1;
293298
}
294299

@@ -306,6 +311,7 @@ function arrayBufferViewIndexToType(index) {
306311
if (index === 10) return FastBuffer;
307312
if (index === 11) return BigInt64Array;
308313
if (index === 12) return BigUint64Array;
314+
if (index === 13) return Float16Array;
309315
return undefined;
310316
}
311317

test/parallel/test-v8-serdes.js

Lines changed: 5 additions & 1 deletion

0 commit comments

Comments
 (0)