1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix: Float16Array support (#23512)

Ref #23490, #23277

* remove `--js-float16array` flag (This flag has already added to
deno_core)
* add some `Float16Array` support
This commit is contained in:
Kenta Moriuchi 2024-04-24 05:54:19 +09:00 committed by GitHub
parent ae62443ae0
commit aff7a64544
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 9 deletions

View file

@ -385,7 +385,7 @@ fn resolve_flags_and_init(
// Using same default as VSCode: // Using same default as VSCode:
// https://github.com/microsoft/vscode/blob/48d4ba271686e8072fc6674137415bc80d936bc7/extensions/typescript-language-features/src/configuration/configuration.ts#L213-L214 // https://github.com/microsoft/vscode/blob/48d4ba271686e8072fc6674137415bc80d936bc7/extensions/typescript-language-features/src/configuration/configuration.ts#L213-L214
DenoSubcommand::Lsp => vec!["--max-old-space-size=3072".to_string()], DenoSubcommand::Lsp => vec!["--max-old-space-size=3072".to_string()],
_ => vec!["--js-float16array".to_string()], _ => vec![],
}; };
init_v8_flags(&default_v8_flags, &flags.v8_flags, get_v8_flags_from_env()); init_v8_flags(&default_v8_flags, &flags.v8_flags, get_v8_flags_from_env());

View file

@ -58,6 +58,10 @@ export function isBigUint64Array(value: unknown): value is BigUint64Array {
return TypedArrayPrototypeGetSymbolToStringTag(value) === "BigUint64Array"; return TypedArrayPrototypeGetSymbolToStringTag(value) === "BigUint64Array";
} }
export function isFloat16Array(value: unknown): value is Float16Array {
return TypedArrayPrototypeGetSymbolToStringTag(value) === "Float16Array";
}
export function isFloat32Array(value: unknown): value is Float32Array { export function isFloat32Array(value: unknown): value is Float32Array {
return TypedArrayPrototypeGetSymbolToStringTag(value) === "Float32Array"; return TypedArrayPrototypeGetSymbolToStringTag(value) === "Float32Array";
} }

View file

@ -36,7 +36,6 @@ const {
Uint16Array, Uint16Array,
Uint32Array, Uint32Array,
BigUint64Array, BigUint64Array,
Float16Array,
Float32Array, Float32Array,
Float64Array, Float64Array,
} = primordials; } = primordials;
@ -59,7 +58,7 @@ function cloneArrayBuffer(
); );
} }
// TODO(petamoriken): Resizable ArrayBuffer support in the future // TODO(petamoriken): add Resizable ArrayBuffer support
/** Clone a value in a similar way to structured cloning. It is similar to a /** Clone a value in a similar way to structured cloning. It is similar to a
* StructureDeserialize(StructuredSerialize(...)). */ * StructureDeserialize(StructuredSerialize(...)). */
function structuredClone(value) { function structuredClone(value) {
@ -117,6 +116,7 @@ function structuredClone(value) {
Constructor = BigUint64Array; Constructor = BigUint64Array;
break; break;
case "Float16Array": case "Float16Array":
// TODO(petamoriken): add Float16Array to primordials
Constructor = Float16Array; Constructor = Float16Array;
break; break;
case "Float32Array": case "Float32Array":

View file

@ -1995,6 +1995,10 @@ function readableByteStreamControllerPullInto(
case "Uint32Array": case "Uint32Array":
ctor = Uint32Array; ctor = Uint32Array;
break; break;
case "Float16Array":
// TODO(petamoriken): add Float16Array to primordials
ctor = Float16Array;
break;
case "Float32Array": case "Float32Array":
ctor = Float32Array; ctor = Float32Array;
break; break;

View file

@ -525,6 +525,8 @@ ArrayPrototypeForEach(
Uint16Array, Uint16Array,
Uint32Array, Uint32Array,
Uint8ClampedArray, Uint8ClampedArray,
// TODO(petamoriken): add Float16Array converter
// Float16Array,
Float32Array, Float32Array,
Float64Array, Float64Array,
], ],

View file

@ -7158,12 +7158,8 @@
"response-from-stream.any.worker.html": true, "response-from-stream.any.worker.html": true,
"response-cancel-stream.any.html": true, "response-cancel-stream.any.html": true,
"response-cancel-stream.any.worker.html": true, "response-cancel-stream.any.worker.html": true,
"response-clone.any.html": [ "response-clone.any.html": true,
"Check response clone use structureClone for teed ReadableStreams (Float16Arraychunk)" "response-clone.any.worker.html": true,
],
"response-clone.any.worker.html": [
"Check response clone use structureClone for teed ReadableStreams (Float16Arraychunk)"
],
"response-consume-empty.any.html": [ "response-consume-empty.any.html": [
"Consume empty FormData response body as text" "Consume empty FormData response body as text"
], ],