| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1cfa31f commit 11144ab
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -343,6 +343,11 @@ export default [ | |||
| 343 | 343 | name: 'SubtleCrypto', | |
| 344 | 344 | message: "Use `const { SubtleCrypto } = require('internal/crypto/webcrypto');` instead of the global.", | |
| 345 | 345 | }, | |
| 346 | + // Float16Array is not available in primordials because it's only available with --js-float16array CLI flag. | ||
| 347 | + { | ||
| 348 | + name: 'Float16Array', | ||
| 349 | + message: 'Use `const { Float16Array } = globalThis;` instead of the global.', | ||
| 350 | + }, | ||
| 346 | 351 | ], | |
| 347 | 352 | 'no-restricted-modules': [ | |
| 348 | 353 | 'error', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,9 @@ const { | |||
| 31 | 31 | Uint32Array, | |
| 32 | 32 | Uint8Array, | |
| 33 | 33 | Uint8ClampedArray, | |
| 34 | + globalThis: { | ||
| 35 | + Float16Array, | ||
| 36 | + }, | ||
| 34 | 37 | } = primordials; | |
| 35 | 38 | ||
| 36 | 39 | const { Buffer } = require('buffer'); | |
@@ -63,6 +66,7 @@ const { | |||
| 63 | 66 | } = require('internal/heap_utils'); | |
| 64 | 67 | const promiseHooks = require('internal/promise_hooks'); | |
| 65 | 68 | const { getOptionValue } = require('internal/options'); | |
| 69 | + | ||
| 66 | 70 | /** | |
| 67 | 71 | * Generates a snapshot of the current V8 heap | |
| 68 | 72 | * and writes it to a JSON file. | |
@@ -289,6 +293,7 @@ function arrayBufferViewTypeToIndex(abView) { | |||
| 289 | 293 | // Index 10 is FastBuffer. | |
| 290 | 294 | if (type === '[object BigInt64Array]') return 11; | |
| 291 | 295 | if (type === '[object BigUint64Array]') return 12; | |
| 296 | + if (type === '[object Float16Array]') return 13; | ||
| 292 | 297 | return -1; | |
| 293 | 298 | } | |
| 294 | 299 | ||
@@ -306,6 +311,7 @@ function arrayBufferViewIndexToType(index) { | |||
| 306 | 311 | if (index === 10) return FastBuffer; | |
| 307 | 312 | if (index === 11) return BigInt64Array; | |
| 308 | 313 | if (index === 12) return BigUint64Array; | |
| 314 | + if (index === 13) return Float16Array; | ||
| 309 | 315 | return undefined; | |
| 310 | 316 | } | |
| 311 | 317 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,4 @@ | |||
| 1 | - // Flags: --expose-internals | ||
| 1 | + // Flags: --expose-internals --js-float16array | ||
| 2 | 2 | ||
| 3 | 3 | 'use strict'; | |
| 4 | 4 | ||
@@ -7,6 +7,9 @@ const { internalBinding } = require('internal/test/binding'); | |||
| 7 | 7 | const assert = require('assert'); | |
| 8 | 8 | const v8 = require('v8'); | |
| 9 | 9 | const os = require('os'); | |
| 10 | + // TODO(bartlomieju): once `Float16Array` is available in stable V8, | ||
| 11 | + // remove this line and `--js-float16array` flag up top | ||
| 12 | + const { Float16Array } = globalThis; | ||
| 10 | 13 | ||
| 11 | 14 | const circular = {}; | |
| 12 | 15 | circular.circular = circular; | |
@@ -26,6 +29,7 @@ const objects = [ | |||
| 26 | 29 | Buffer.from([1, 2, 3, 4]), | |
| 27 | 30 | new BigInt64Array([42n]), | |
| 28 | 31 | new BigUint64Array([42n]), | |
| 32 | + new Float16Array([1, 2, 3, 4]), | ||
| 29 | 33 | undefined, | |
| 30 | 34 | null, | |
| 31 | 35 | 42, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments